/* Market Bubbles — dark theme in the Banter/Crypto Bubbles visual language */
:root {
  --bg: #10131a;
  --bg-panel: #1a1f2b;
  --bg-input: #232a3a;
  --border: #2c3547;
  --text: #dfe6f2;
  --muted: #7d8aa5;
  --accent: #46d46a;
  --up: #3ddc74;
  --down: #ff4d4d;
  --toolbar-h: 52px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}

/* ---------- toolbar ---------- */
#toolbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  user-select: none;
  overflow-x: auto;
  scrollbar-width: none;
}
#toolbar::-webkit-scrollbar { display: none; }

.brand { display: flex; align-items: center; gap: 7px; font-size: 17px; white-space: nowrap; color: var(--accent); }
.brand span { color: var(--text); letter-spacing: .2px; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-icon { width: 24px; height: 24px; }

.tabs, .timeframes { display: flex; background: var(--bg-input); border-radius: 8px; padding: 3px; gap: 2px; }
.tabs button, .timeframes button {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; padding: 6px 13px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; transition: background .15s, color .15s;
}
.tabs button:hover, .timeframes button:hover { color: var(--text); }
.tabs button.active, .timeframes button.active { background: var(--accent); color: #08130b; }

#pageSelect {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 8px; font: inherit; cursor: pointer;
}

.search-wrap { position: relative; margin-left: auto; }
#searchInput {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 12px; width: 170px; font: inherit; outline: none;
}
#searchInput:focus { border-color: var(--accent); width: 220px; }
.search-results {
  position: absolute; top: 40px; right: 0; width: 280px; max-height: 340px; overflow-y: auto;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 40;
}
.search-results .row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer;
}
.search-results .row:hover { background: var(--bg-input); }
.search-results img { width: 22px; height: 22px; border-radius: 50%; }
.search-results .sym { font-weight: 700; }
.search-results .nm { color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar-right { display: flex; gap: 6px; }
.icon-btn {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); }
.icon-btn.active { color: #ffd75e; border-color: #ffd75e; }
#settingsBtn.active { color: var(--accent); border-color: var(--accent); }

/* ---------- stage ---------- */
#stage { position: relative; width: 100vw; height: calc(100vh - var(--toolbar-h)); }
#bubbleCanvas { position: absolute; inset: 0; display: block; cursor: default; }
.status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; pointer-events: none; text-align: center; padding: 0 30px;
}

/* ---------- panels ---------- */
.hidden { display: none !important; }
.panel {
  position: fixed; top: calc(var(--toolbar-h) + 10px); right: 12px; width: 250px; z-index: 50;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
.panel h3 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 15px; }
.field { display: block; margin: 12px 0 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.field select {
  display: block; width: 100%; margin-top: 5px;
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 8px; font: inherit;
}
.check { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; color: var(--text); font-size: 13.5px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.close-btn {
  background: transparent; border: 0; color: var(--muted); font-size: 15px; cursor: pointer;
  padding: 4px 6px; border-radius: 6px;
}
.close-btn:hover { color: var(--text); background: var(--bg-input); }

/* ---------- modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(5,8,14,.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  position: relative; width: min(560px, 94vw); max-height: 92vh; overflow-y: auto;
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; box-shadow: 0 25px 80px rgba(0,0,0,.6);
}
.modal .close-btn { position: absolute; top: 12px; right: 12px; }
.modal-head { display: flex; align-items: center; gap: 13px; margin-bottom: 8px; }
.modal-head img { border-radius: 50%; background: var(--bg-input); }
.modal-head h2 { font-size: 19px; }
.muted { color: var(--muted); font-size: 12.5px; }
.fav-btn {
  margin-left: auto; margin-right: 26px; background: transparent; border: 1px solid var(--border);
  color: var(--muted); font-size: 17px; width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
}
.fav-btn.active { color: #ffd75e; border-color: #ffd75e; }
.modal-price { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 12px; }
#mPrice { font-size: 26px; font-weight: 700; }
#mDayChange { font-size: 15px; font-weight: 700; }
.pos { color: var(--up); }
.neg { color: var(--down); }
#mSpark { width: 100%; height: 110px; border-radius: 8px; background: var(--bg-input); margin-bottom: 14px; }
.perf-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.perf-table th, .perf-table td { text-align: center; padding: 7px 4px; border: 1px solid var(--border); font-size: 13px; }
.perf-table th { color: var(--muted); font-weight: 600; background: var(--bg-input); }
.perf-table td { font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 16px; }
.stat-grid .stat { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.stat-grid .stat b { font-weight: 600; }
.stat-grid .stat span { color: var(--muted); }
.modal-links { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-links a {
  color: var(--accent); text-decoration: none; border: 1px solid var(--border);
  padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600;
}
.modal-links a:hover { border-color: var(--accent); }

@media (max-width: 760px) {
  .brand span { display: none; }
  #searchInput { width: 110px; }
  #searchInput:focus { width: 150px; }
  .timeframes button { padding: 6px 8px; font-size: 12.5px; }
}
