:root {
  --drawer-width: 640px;
  --tab-size: 44px;
  --card-bg: #12161d;
  --card-border: #1a1f29;
}

/* Gear tab (attached) */
.settings-tab {
  position: fixed;
  top: 5px;
  right: 0;
  width: var(--tab-size);
  height: var(--tab-size);
  background: #11141b;
  color: #cfd3da;
  border: 1px solid #232733;
  border-right: none;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  z-index: 1066;
  cursor: pointer;
  transition: right .25s ease, background .15s ease;
}
.settings-tab:hover { background: #161a22; }

/* Gear tab (attached) */
.btn-help {
  position: fixed;
  top: 55px;
  right: 0;
  width: var(--tab-size);
  height: var(--tab-size);
  background: #11141b;
  color: #cfd3da;
  border: 1px solid #232733;
  border-right: none;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  z-index: 1066;
  cursor: pointer;
  transition: right .25s ease, background .15s ease;
}
.btn-help:hover { background: #161a22; }


/* Drawer */
.drawer {
  position: fixed;
  top: 0;
  right: calc(-1 * var(--drawer-width));
  width: var(--drawer-width);
  height: 100vh;
  box-sizing: border-box;
  color: #e6e6e9;
  background: var(--drawer-bg, var(--app-bg));
  border-left: 1px solid #232733;
  display: flex;
  flex-direction: column;
  border-top-left-radius: 14px;
  transition: right .25s ease;
  z-index: 1065;
}
.drawer.open { right: 0; }
body.settings-open .settings-tab { right: var(--drawer-width); }
body.settings-open .btn-help { right: var(--drawer-width); }

.drawer-header {
  padding: .9rem 1rem;
  border-bottom: 1px solid #232733;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px 16px;
}

.drawer-section + .drawer-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.drawer-footer {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  background: var(--drawer-bg, #0f1218);
}

.drawer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #cfd6e4;
  text-decoration: none;
}
.drawer-brand:hover { color: #fff; }
.drawer-brand-img { width: 28px; height: 28px; object-fit: contain; }

/* Backdrop */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 1060;
}
.drawer-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* Buttons */
.btn-ghost {
  background: transparent;
  color: #cfd3da;
  border: 1px solid #2a2d36;
}
.btn-ghost:hover { background: #1f232d; }

/* Fullscreen icon button */
#btn-fullscreen svg { width: 18px; height: 18px; display: block; }

/* Tokens (news keywords) */
.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.token-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9999px;
  padding: 4px 8px;
  font-size: 12px;
}
.token-list button {
  border: 0;
  background: transparent;
  color: #999;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.token-list button:hover { color: #fff; }

/* Pair list (rotation) */
.pair-list { list-style: none; padding-left: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pair-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}
.pair-sym { font-weight: 600; letter-spacing: .3px; }
.pair-actions { display: flex; gap: 6px; }
.pair-actions .btn-icon {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,.12);
  background: transparent; color: #cfd6e4;
  border-radius: 6px; cursor: pointer;
}
.pair-actions .btn-icon:hover { background: rgba(255,255,255,.06); }

/* YT chips */
#yt-list { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding-left: 0; margin: 0; }
#yt-list .yt-chip {
  background: var(--card-border,#1a1f29);
  color:#e6e6e9; border-radius: 999px;
  padding:.25rem .6rem; display:inline-flex; gap:.5rem;
  align-items:center;
  border: 1px solid rgba(255,255,255,.1);
}
#yt-list .yt-chip button { all: unset; cursor:pointer; opacity:.6; }
#yt-list .yt-chip button:hover { opacity:1; }

/* Apply theme to panels */
.kpi-card, .panel, .news-card, .ticker, .marquee {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}

/* Small helpful cursors */
#kw-list li { cursor: pointer; }
