/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d1a;
  --surface: #13132a;
  --surface2: #1a1a35;
  --border: #2a2a50;
  --gold: #e8b400;
  --gold-dim: rgba(232,180,0,0.15);
  --green: #00c896;
  --red: #e84040;
  --text: #e8e8f0;
  --muted: #6666aa;
  --mono: 'Share Tech Mono', monospace;
  --display: 'Oswald', sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo { display: flex; align-items: center; gap: 8px; flex: 1; }
.logo-icon { font-size: 22px; }
.logo-text { font-size: 20px; font-weight: 700; letter-spacing: 2px; color: var(--text); }
.logo-accent { color: var(--gold); }

.status-row { display: flex; align-items: center; gap: 6px; }
.status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted);
  transition: background 0.3s;
}
.status-dot.live { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 1.5s infinite; }
.status-label { font-size: 11px; letter-spacing: 2px; color: var(--muted); }
.status-dot.live + .status-label { color: var(--green); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px; opacity: 0.7;
  transition: opacity 0.2s;
}
.icon-btn:hover { opacity: 1; }

/* ── Settings panel ───────────────────────────────────────────────────────── */
.settings-panel {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease;
}
.settings-panel.open { max-height: 400px; }
.settings-inner { padding: 16px 20px; }
.settings-title { font-size: 13px; letter-spacing: 2px; color: var(--gold); margin-bottom: 12px; }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings-grid label { display: flex; flex-direction: column; gap: 5px; }
.settings-grid label span { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.settings-grid .full-width { grid-column: 1 / -1; }

.text-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 4px;
  resize: vertical;
}
.text-input:focus { outline: none; border-color: var(--gold); }

.settings-note {
  font-size: 11px; color: var(--muted); line-height: 1.6;
  font-family: var(--mono);
}
.settings-note code { color: var(--gold); background: var(--gold-dim); padding: 1px 4px; border-radius: 3px; }

/* ── Sections ─────────────────────────────────────────────────────────────── */
.section { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.section-title { font-size: 11px; letter-spacing: 2px; color: var(--muted); margin-bottom: 12px; }

/* ── Announcer rail ───────────────────────────────────────────────────────── */
.announcer-rail {
  display: flex; gap: 10px;
  overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.announcer-card {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  min-width: 80px;
}
.announcer-card:hover { border-color: var(--muted); }
.announcer-card.active { border-color: var(--gold); background: var(--gold-dim); }
.announcer-emoji { font-size: 22px; }
.announcer-name { font-size: 10px; letter-spacing: 1px; color: var(--muted); text-align: center; }
.announcer-card.active .announcer-name { color: var(--gold); }

.custom-hint { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 8px; }

/* ── Mode tabs ────────────────────────────────────────────────────────────── */
.mode-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.mode-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-tab:hover { border-color: var(--muted); color: var(--text); }
.mode-tab.active { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }

/* ── Asset input ──────────────────────────────────────────────────────────── */
.input-row { display: flex; gap: 8px; }

.asset-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  transition: border-color 0.2s;
}
.asset-input:focus { outline: none; border-color: var(--gold); }
.asset-input::placeholder { color: var(--muted); }

.btn {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(0.97); }
.btn-go { background: var(--gold); color: #000; }
.btn-go:not(:disabled):hover { opacity: 0.85; }
.btn-stop { background: var(--red); color: #fff; }
.btn-stop:not(:disabled):hover { opacity: 0.85; }

.error-msg {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--red);
}

/* ── Price display ────────────────────────────────────────────────────────── */
.price-section { background: var(--surface); }

.price-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ticker-label { font-size: 28px; font-weight: 700; letter-spacing: 3px; }
.chain-badge { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.change-badge { margin-left: auto; font-size: 14px; font-weight: 600; font-family: var(--mono); }
.change-badge.up { color: var(--green); }
.change-badge.down { color: var(--red); }
.change-badge.flat { color: var(--muted); }

.current-price {
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.stats-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-card {
  flex: 1; min-width: 80px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
}
.stat-label { display: block; font-size: 9px; letter-spacing: 2px; color: var(--muted); margin-bottom: 3px; }
.stat-value { font-family: var(--mono); font-size: 13px; color: var(--text); }

/* ── Chart ────────────────────────────────────────────────────────────────── */
.chart-section { padding: 12px 20px; height: 200px; }
.chart-section canvas { width: 100% !important; height: 100% !important; }

/* ── Commentary ───────────────────────────────────────────────────────────── */
.commentary-section { background: var(--surface); }

.commentary-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.commentary-speaker {
  font-size: 11px; letter-spacing: 2px; color: var(--gold);
  text-transform: uppercase;
}
.commentary-controls { display: flex; align-items: center; gap: 10px; }

.waveform {
  display: flex; align-items: center; gap: 3px; height: 20px;
}
.waveform span {
  display: block; width: 3px;
  background: var(--muted);
  border-radius: 2px;
  height: 4px;
  transition: height 0.1s;
}
.waveform.active span {
  background: var(--gold);
  animation: wave 0.8s ease-in-out infinite;
}
.waveform.active span:nth-child(1) { animation-delay: 0s; }
.waveform.active span:nth-child(2) { animation-delay: 0.1s; }
.waveform.active span:nth-child(3) { animation-delay: 0.2s; }
.waveform.active span:nth-child(4) { animation-delay: 0.3s; }
.waveform.active span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { height: 4px; }
  50% { height: 18px; }
}

.commentary-text {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

/* ── Play-by-play log ─────────────────────────────────────────────────────── */
.log-section { border-bottom: none; }

.play-log {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.log-entry {
  display: grid;
  grid-template-columns: 60px 60px 90px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 10px;
  background: var(--surface);
  border-left: 2px solid var(--border);
  border-radius: 0 4px 4px 0;
  font-family: var(--mono);
  font-size: 11px;
}
.log-time { color: var(--muted); }
.log-ticker { color: var(--gold); font-weight: bold; }
.log-price { }
.log-price.up { color: var(--green); }
.log-price.down { color: var(--red); }
.log-price.flat { color: var(--muted); }
.log-text { color: #aaa; line-height: 1.5; }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Checkbox ─────────────────────────────────────────────────────────────── */
input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer; }
