/* Get Short Signals styles */

:root {
  color-scheme: dark; /* native number-input spinners match the dark theme */
  --bg: #0b0d11;
  --panel: #12151b;
  --panel-2: #171b22;
  --border: #222831;
  --border-strong: #343c48;
  --text: #e9ebee;
  --muted: #8d95a1;
  --green: #3fb950;
  --red: #f0554b;
  --accent: #6ea8fe;
  --warn: #dfb146;
  --radius: 12px;
  --radius-sm: 8px;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(110, 168, 254, 0.3); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px 40px; }

/* ---------- site header, hero and footer ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; width: 28px; height: 28px; border-radius: 7px; }
.brand-name { font-size: 1.02rem; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.site-nav { display: flex; gap: 20px; font-size: 0.88rem; }
.site-nav a { color: var(--muted); white-space: nowrap; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

.hero { padding: 34px 0 26px; }
h1 { margin: 0 0 8px; font-size: 1.85rem; font-weight: 680; line-height: 1.2; letter-spacing: -0.025em; }
.subtitle { max-width: 720px; margin: 0; color: var(--muted); font-size: 0.98rem; line-height: 1.55; }

.site-footer {
  margin-top: 48px;
  padding: 22px 0 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}
.site-footer p { max-width: 760px; margin: 0 0 6px; }

.error-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: rgba(248, 81, 73, 0.12);
  color: #ffc0bb;
  font-size: 0.9rem;
}

.hidden { display: none !important; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.controls { display: flex; gap: 8px; flex-wrap: wrap; }

/* Gainer/band threshold inputs; pushed to the toolbar's right edge on wide screens */
.thresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}
.thresh-label { color: var(--muted); font-size: 0.8rem; }
.thresh-input {
  width: 78px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.thresh-input:hover { border-color: var(--border-strong); }
.thresh-input:focus { outline: none; border-color: var(--accent); }

.filter-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
  font-size: 0.85rem;
  cursor: pointer;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-strong); }
.filter-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  font-weight: 600;
}

.source-status {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--muted);
}
.src { padding: 2px 9px; border: 1px solid var(--border); border-radius: 999px; }
.src-ok { color: var(--green); border-color: rgba(63, 185, 80, 0.45); }
.src-err { color: var(--red); border-color: rgba(248, 81, 73, 0.45); }
.src-unknown { color: var(--muted); }
/* Per-source age suffix ("· 20s") inside a status chip; inherits the chip's
   color so it turns amber together with the chip's stale-warn treatment. */
.src-age { opacity: 0.8; font-variant-numeric: tabular-nums; }
.as-of { margin-left: auto; }
/* Warm amber pill when the last payload's asOf is older than 120s — also
   applied to a source chip whose checkedAt age exceeds 90s (round 6). */
.stale-warn {
  color: var(--warn);
  background: rgba(227, 179, 65, 0.12);
  border: 1px solid rgba(227, 179, 65, 0.5);
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: top;
}
thead th {
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }

th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.symbol { font-weight: 700; font-size: 0.95rem; }
.name { display: block; color: var(--muted); font-size: 0.76rem; }

/* Round 5 movers inclusion: a coin admitted from outside the CoinGecko
   top-100 (outsideUniverse: true) wears this small chip in its symbol cell;
   regular coins never carry the key and get no badge. Same tiny uppercase
   family as .chip-ex/.check, amber like the other caution treatments. */
.badge-ext {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid rgba(227, 179, 65, 0.5);
  border-radius: 999px;
  background: rgba(227, 179, 65, 0.12);
  color: var(--warn);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: text-top;
}

.venues { display: flex; flex-direction: column; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  padding: 4px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.8rem;
}
.chip-ex {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chip-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.chip-pct { font-variant-numeric: tabular-nums; }
.chip-1h, .chip-7d { color: var(--muted); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

/* Suspect venue (round 7): the backend flagged this venue's price as deviating
   more than 15% from the median of the coin's other venues. The venue stays
   visible but is excluded from the coin's headline numbers server-side, so
   the chip reads as distrusted: amber outline in the .stale-warn family,
   amber exchange label, and a struck-through muted price. The tooltip (set by
   app.js) carries the exact deviation and the exclusion notice. */
.chip-suspect {
  border-color: rgba(227, 179, 65, 0.55);
  background: rgba(227, 179, 65, 0.08);
}
.chip-suspect .chip-ex { color: var(--warn); }
.chip-suspect .chip-price {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(227, 179, 65, 0.65);
}
/* Mute the suspect chip's colored percents too — (0,2,0) specificity beats
   .pos/.neg (0,1,0) regardless of source order. */
.chip-suspect .chip-pct { color: var(--muted); }

/* Round 10 venue deep-links: a chip backed by a validated https href renders
   as <a class="chip"> — base look identical to the span chip (the browser's
   link color and underline are reset; children keep their own colors), with a
   subtle hover affordance: a slight lift and an underlined exchange label.
   Suspect chips keep their amber treatment on the anchor untouched — these
   rules only affect color inheritance, transform and text-decoration. */
a.chip {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease;
}
a.chip:hover {
  transform: translateY(-1px);
}
a.chip:hover .chip-ex {
  text-decoration: underline;
}
a.chip:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

/* .pos/.neg come after the chip rules so they win for colored values */
.pos { color: var(--green); }
.neg { color: var(--red); }

.pct { font-weight: 600; font-variant-numeric: tabular-nums; }

.badge {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-rocket {
  color: var(--green);
  background: rgba(63, 185, 80, 0.14);
  border: 1px solid rgba(63, 185, 80, 0.5);
}
.badge-band {
  color: var(--accent);
  background: rgba(88, 166, 255, 0.12);
  border: 1px solid rgba(88, 166, 255, 0.5);
}

/* Watchlist star column + row toggle */
.star-col, td.cell-star { width: 36px; text-align: center; }
.star-btn {
  padding: 1px 7px;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  line-height: 1.2;
  cursor: pointer;
}
.star-btn:hover { color: var(--accent); }
.star-btn.on { color: var(--warn); }

/* "Alerts: off/on" toggle — deliberately NOT a .filter-btn, so the filter
   click handler never treats it as a coin filter. */
.alerts-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.alerts-btn:hover { color: var(--text); border-color: var(--border-strong); }
.alerts-btn.on {
  color: var(--warn);
  border-color: var(--warn);
  background: rgba(227, 179, 65, 0.12);
  font-weight: 600;
}

.muted { color: var(--muted); }

.empty { margin: 0; padding: 40px 0; text-align: center; color: var(--muted); font-size: 0.92rem; }

@media (max-width: 640px) {
  th, td { padding: 8px; font-size: 0.8rem; }
  .as-of { margin-left: 0; width: 100%; }
  .thresh { margin-left: 0; }
}

/* ===================== Short signals view ===================== */

.view-tabs { display: flex; gap: 22px; margin: 0 0 20px; border-bottom: 1px solid var(--border); }
.view-tab {
  margin-bottom: -1px;
  padding: 10px 2px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.view-tab:hover { color: var(--text); }
.view-tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab-count {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  text-align: center;
}

.sig-filter {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.sig-filter:hover { color: var(--text); border-color: var(--border-strong); }
.sig-filter.active { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600; }

.market-strip {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  font-size: 0.85rem;
}
.regime {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1 1 260px;
  min-width: 0;
  padding: 6px 12px;
  border-left: 3px solid var(--muted);
  border-radius: 4px;
}
.regime-title { font-weight: 700; }
.regime-note { color: var(--muted); font-size: 0.8rem; }
.regime-favourable { border-left-color: var(--green); }
.regime-caution { border-left-color: var(--warn); }
.regime-hostile { border-left-color: var(--red); }
.mstat { display: flex; flex-direction: column; justify-content: center; padding: 2px 10px; }
.mstat-label, .metric-label {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.mstat-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.market-strip .as-of { align-self: center; font-size: 0.75rem; }

.signals-list { display: flex; flex-direction: column; gap: 12px; }

.sig {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.sig-short { border-left-color: var(--red); }
.sig-exhausting { border-left-color: var(--warn); }
.sig-pumping { border-left-color: var(--green); }
.sig-avoid { border-left-color: var(--muted); }
.sig-late { border-left-color: var(--muted); opacity: 0.8; }

.sig-head {
  display: grid;
  grid-template-columns: minmax(110px, 170px) auto minmax(140px, 220px) 1fr;
  grid-template-areas:
    "id stage score spark"
    "metrics metrics metrics metrics"
    "checks checks checks checks";
  align-items: center;
  gap: 12px 16px;
  width: 100%;
  padding: 16px 18px;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sig-head:hover { background: rgba(255, 255, 255, 0.02); }
.sig-head:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius); }
.sig-id { grid-area: id; min-width: 0; }
.sig-symbol { display: block; font-size: 1.12rem; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
.sig-pair { color: var(--muted); font-size: 0.72rem; }

.stage {
  grid-area: stage;
  justify-self: start;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.stage-short { color: #fff; background: var(--red); border-color: var(--red); }
.stage-exhausting { color: var(--warn); background: rgba(227, 179, 65, 0.12); border-color: rgba(227, 179, 65, 0.5); }
.stage-pumping { color: var(--green); background: rgba(63, 185, 80, 0.12); border-color: rgba(63, 185, 80, 0.5); }
.stage-avoid { color: var(--muted); border-style: dashed; }
.stage-late { color: var(--muted); }

.score { grid-area: score; display: flex; align-items: center; gap: 8px; }
.score-num { width: 26px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.score-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.score-fill { height: 100%; border-radius: 3px; background: var(--muted); }
.score-fill.grade-a { background: var(--red); }
.score-fill.grade-b { background: var(--warn); }
.score-fill.grade-c { background: var(--accent); }
.score-grade { width: 14px; color: var(--muted); font-size: 0.8rem; font-weight: 700; }

.spark { grid-area: spark; justify-self: end; width: 140px; height: 38px; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-stop { stroke: var(--red); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }

.metrics { grid-area: metrics; display: flex; flex-wrap: wrap; gap: 8px 26px; }
.metric { display: flex; flex-direction: column; }
.metric-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.checks { grid-area: checks; display: flex; flex-wrap: wrap; gap: 6px; }
.check {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}
.check.ok { color: var(--green); border-color: rgba(63, 185, 80, 0.45); }

.sig-detail { padding: 6px 18px 18px; border-top: 1px solid var(--border); }
.plan { margin-top: 12px; }
.plan-grid { display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.plan-size { margin: 8px 0 0; color: var(--muted); font-size: 0.8rem; }
.why-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.why h4, .method-body h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.why ul { margin: 0; padding-left: 18px; font-size: 0.84rem; line-height: 1.5; }
.why-pro li::marker { color: var(--green); }
.why-con li::marker { color: var(--red); }
.sig-foot { margin: 12px 0 0; font-size: 0.76rem; }
.sig-link { color: var(--accent); }

.method { margin-top: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.method summary { padding: 14px 18px; color: var(--muted); font-size: 0.88rem; cursor: pointer; }
.method summary:hover { color: var(--text); }
.method-body { padding: 0 18px 18px; font-size: 0.86rem; line-height: 1.6; }
.method-body p { margin: 0 0 8px; }
.method-body h4 { margin-top: 14px; }
.method-line { font-variant-numeric: tabular-nums; }
.method-disclaimer { margin-top: 12px; color: var(--warn); }

@media (max-width: 760px) {
  .sig-head {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "id stage"
      "score spark"
      "metrics metrics"
      "checks checks";
  }
  .why-grid { grid-template-columns: 1fr; }
}

/* Venue of a signal + per-exchange status in the market strip */
.sig-venue { color: var(--accent); font-weight: 600; }
.sig-venue-bybit { color: var(--warn); }
.sig-venue-gate { color: var(--green); }
.venue-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-basis: 100%; font-size: 0.75rem; }

.metric-value.accent { color: var(--accent); }

/* ---------- static document pages (methodology) ---------- */
.doc-body { max-width: 780px; line-height: 1.65; }
.doc-body h2 { margin: 34px 0 10px; font-size: 1.2rem; letter-spacing: -0.01em; }
.doc-body h3 { margin: 20px 0 4px; font-size: 1rem; }
.doc-body p { margin: 0 0 12px; }
.doc-back { margin: 28px 0 0; font-size: 0.88rem; }
.doc-rules dt { margin-top: 12px; font-weight: 600; }
.doc-rules dd { margin: 2px 0 0; color: var(--text); }
.doc-list { margin: 0 0 12px; padding-left: 20px; }
.doc-list li { margin-bottom: 8px; }
.doc-table { width: 100%; margin: 0 0 14px; border-collapse: collapse; font-size: 0.88rem; }
.doc-table th, .doc-table td { padding: 8px 10px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.doc-table th { background: var(--panel); color: var(--muted); font-weight: 600; }
@media (max-width: 640px) {
  .doc-table { display: block; overflow-x: auto; }
}

@media (max-width: 640px) {
  .container { padding: 0 14px 32px; }
  .site-header { padding: 14px 0; }
  .site-nav { gap: 16px; }
  .site-nav a:first-child { display: none; } /* the brand already links home */
  .hero { padding: 24px 0 20px; }
  h1 { font-size: 1.5rem; }
  .subtitle { font-size: 0.92rem; }
  .sig-head { padding: 14px; }
  .sig-detail { padding: 6px 14px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* "What the numbers mean" inside an expanded signal card (touch-readable tooltips) */
.glossary { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; font-size: 0.82rem; }
.glossary summary { color: var(--muted); cursor: pointer; }
.glossary summary:hover { color: var(--text); }
.glossary-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0 0; line-height: 1.5; }
.glossary-list dt { color: var(--text); font-weight: 600; white-space: nowrap; }
.glossary-list dd { margin: 0; color: var(--muted); }
@media (max-width: 640px) {
  .glossary-list { grid-template-columns: 1fr; gap: 2px; }
  .glossary-list dd { margin-bottom: 8px; }
}
