:root {
  --bg: #0a0d12;
  --surface: #12171f;
  --border: #202834;
  --border-subtle: #171d26;
  --text-primary: #eef1f6;
  --text-secondary: #98a2b3;
  --text-tertiary: #7c8798;
  --gold: #d4af37;
  --buy: #34d399;
  --buy-bg: rgba(52, 211, 153, 0.12);
  --sell: #f87171;
  --sell-bg: rgba(248, 113, 113, 0.12);
  --amber: #f5b942;
  --amber-bg: rgba(245, 185, 66, 0.10);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  padding-bottom: 40px;
  -webkit-font-smoothing: antialiased;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.live-dot.live {
  background: var(--buy);
  animation: pulse 2s ease-out infinite;
}

.live-dot.offline {
  background: var(--sell);
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.1px;
}

#enable-btn {
  background: var(--gold);
  color: #171208;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

#enable-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

#enable-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-subtle);
}

.stats-bar .buy-count { color: var(--buy); }
.stats-bar .sell-count { color: var(--sell); }
.stats-bar .sep { color: var(--border); }

.status { padding: 0; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 72px 24px 40px;
  gap: 6px;
}

.empty-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-tertiary);
  margin-bottom: 10px;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0;
  max-width: 280px;
  line-height: 1.5;
}

#signal-list {
  list-style: none;
  padding: 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  border-left: 3px solid #556;
}

.signal-card.buy { border-left-color: var(--buy); }
.signal-card.sell { border-left-color: var(--sell); }

.signal-card.is-new {
  animation: newFlash 1.6s ease-out;
}

@keyframes newFlash {
  0%   { box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(212, 175, 55, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

.signal-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.symbol {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
}

.confidence {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.direction-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.direction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 9px;
  border-radius: 6px;
}

.direction.buy { color: var(--buy); background: var(--buy-bg); }
.direction.sell { color: var(--sell); background: var(--sell-bg); }

.time {
  font-size: 11px;
  color: var(--text-tertiary);
}

.ledger {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.ledger-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ledger-cell.full { grid-column: 1 / -1; }

.ledger-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.ledger-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

.note-chip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--amber);
  background: var(--amber-bg);
  border-radius: 6px;
  padding: 6px 9px;
  margin-bottom: 8px;
}

.signal-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--border-subtle);
}

@media (prefers-reduced-motion: reduce) {
  .live-dot.live { animation: none; }
  .signal-card.is-new { animation: none; }
}
