/* SNHP Evolution Arena — page chrome. The world is all canvas; the HUD is DOM
   over the letterboxed canvas. Kin to the PAR dark+violet brand. */
:root {
  --bg: #07060d;
  --ink: #e8e8e3;
  --ink-dim: #9a95b0;
  --violet: #a78bfa;
  --violet-bright: #bba6ff;
  --violet-deep: #16102c;
  --gold: #ffe08a;
  --panel: rgba(11, 10, 20, 0.55);
  --line: rgba(167, 139, 250, 0.14);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: var(--bg); overflow: hidden; }
body { font-family: var(--mono); color: var(--ink); -webkit-font-smoothing: none; }

#stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 100% at 50% 40%, #0f0c1a 0%, #07060d 75%);
}
#view, #scanlines {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  image-rendering: pixelated; image-rendering: crisp-edges;
}
#scanlines { pointer-events: none; opacity: 0.12; mix-blend-mode: multiply; }
#vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(130% 120% at 50% 45%, transparent 55%, rgba(0,0,0,0.55) 100%);
}

#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-panel {
  position: absolute; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; backdrop-filter: blur(6px);
  font-size: 12px; line-height: 1.5; pointer-events: auto;
  color: var(--ink-dim); opacity: 0.86; transition: opacity 0.3s;
}
.hud-panel:hover { opacity: 1; }
#era-banner {
  top: 16px; left: 16px; display: flex; gap: 9px; align-items: center;
  font-size: 13px; letter-spacing: 0.02em;
}
#era-glyph { font-size: 15px; filter: drop-shadow(0 0 6px currentColor); }
#era-name { font-weight: 600; color: var(--violet-bright); }
#gen-counter { color: var(--ink-dim); text-transform: uppercase; font-size: 11px; }

#leaderboard { top: 16px; right: 16px; width: 214px; }
#leaderboard .lb-title, #census .cs-title, #science .sci-title {
  text-transform: uppercase; font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-dim); margin-bottom: 6px;
}
.lb-row { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.lb-swatch { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.lb-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-energy { color: var(--gold); font-variant-numeric: tabular-nums; }

#census { bottom: 16px; left: 16px; width: 230px; }
.cs-bar { height: 8px; border-radius: 3px; margin: 3px 0; transition: width 0.6s ease; }
.cs-stat { display: flex; justify-content: space-between; color: var(--ink-dim); font-size: 11px; }
.cs-stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cs-soften {
  margin-top: 6px; font-size: 10px; letter-spacing: 0.04em; color: #f0c674;
  background: rgba(240,198,116,0.10); border: 1px solid rgba(240,198,116,0.35);
  border-radius: 5px; padding: 4px 6px; animation: softpulse 1.6s ease-in-out infinite;
}
@keyframes softpulse { 0%,100% { opacity: 0.65; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cs-soften { animation: none; } }

#science { bottom: 16px; right: 16px; width: 214px; }
#sci-chart { width: 100%; height: 60px; display: block; margin-top: 4px; }

#ticker {
  position: absolute; bottom: 0; left: 0; right: 0; height: 26px;
  background: linear-gradient(180deg, transparent, rgba(7,6,13,0.85));
  overflow: hidden; pointer-events: none; display: flex; align-items: center;
}
#ticker-inner {
  white-space: nowrap; font-size: 11px; color: var(--ink-dim);
  will-change: transform; padding-left: 100%;
  animation: ticker 46s linear infinite;
}
#ticker-inner b { color: var(--violet-bright); }
@keyframes ticker { to { transform: translateX(-100%); } }

#conn-chip {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-dim); background: var(--panel); border: 1px solid var(--line);
  padding: 3px 10px; border-radius: 20px; pointer-events: none; opacity: 0;
  transition: opacity 0.4s;
}
#conn-chip.show { opacity: 1; }
#conn-chip.demo { color: var(--gold); border-color: rgba(255,224,138,0.4); }

#sound-btn, #help-btn {
  position: absolute; bottom: 34px; width: 30px; height: 30px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-dim); font-size: 14px; cursor: pointer; pointer-events: auto;
}
#sound-btn { right: 54px; }
#help-btn { right: 16px; }
#sound-btn:hover, #help-btn:hover { color: var(--violet-bright); }
#sound-btn.on { color: var(--gold); border-color: rgba(255,224,138,0.4); }

.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(7,6,13,0.82); backdrop-filter: blur(3px); pointer-events: auto; z-index: 30;
}
.overlay.hidden { display: none; }

/* Bloom of the Generation — the full-screen payoff, stained-glass style */
#bloom-overlay {
  position: absolute; inset: 0; z-index: 16; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(120% 100% at 50% 42%, rgba(22,16,44,0.5), rgba(7,6,13,0.92));
  opacity: 0; transition: opacity 0.6s ease;
}
#bloom-overlay.show { opacity: 1; }
#bloom-overlay.hidden { display: none; }
#bloom-canvas { image-rendering: pixelated; filter: drop-shadow(0 0 40px rgba(167,139,250,0.35)); }
#bloom-caption { text-align: center; margin-top: 10px; }
#bloom-title {
  font-size: 12px; letter-spacing: 0.36em; color: var(--ink-dim); text-transform: uppercase;
}
#bloom-house { font-size: 30px; font-weight: 600; color: var(--violet-bright); margin: 6px 0 4px; letter-spacing: 0.02em; }
#bloom-meta { font-size: 12px; color: var(--ink-dim); letter-spacing: 0.05em; }
#bloom-meta b { color: var(--gold); }

#era-poll { font-size: 13px; margin-left: 2px; filter: drop-shadow(0 0 5px rgba(167,139,250,0.5)); }
.onboard-card {
  max-width: 440px; padding: 30px 34px; background: var(--violet-deep);
  border: 1px solid var(--line); border-radius: 14px; text-align: left;
}
.onboard-card h1 {
  font-size: 22px; color: var(--violet-bright); margin-bottom: 16px;
  letter-spacing: 0.01em; font-weight: 600;
}
.onboard-card ol { margin: 0 0 16px 18px; }
.onboard-card li { margin: 9px 0; font-size: 13px; line-height: 1.6; }
.onboard-card b { color: var(--ink); }
.onboard-card .fine { font-size: 11px; color: var(--ink-dim); line-height: 1.6; margin-bottom: 18px; }
.onboard-card button {
  background: var(--violet); color: #17102c; border: none; border-radius: 8px;
  padding: 10px 20px; font-family: var(--mono); font-weight: 600; font-size: 13px; cursor: pointer;
}
.onboard-card button:hover { background: var(--violet-bright); }

.pick-title {
  font-size: 10px; letter-spacing: 0.12em; color: var(--ink-dim);
  margin: 4px 0 8px; text-transform: uppercase;
}
#house-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 16px; }
.house-card {
  background: rgba(7,6,13,0.6); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 5px 6px; text-align: center; cursor: pointer; transition: border-color .15s, transform .1s;
}
.house-card:hover { border-color: var(--violet); transform: translateY(-2px); }
.house-card canvas { image-rendering: pixelated; width: 36px; height: 52px; }
.house-card .hc-name { font-size: 11px; color: var(--ink); font-weight: 600; margin-top: 2px; }
.house-card .hc-line { font-size: 8.5px; color: var(--ink-dim); line-height: 1.35; margin-top: 3px; min-height: 22px; }

#forge-dials { margin: 4px 0 12px; }
#forge-dials label {
  display: block; font-size: 10.5px; color: var(--ink-dim); text-transform: uppercase;
  letter-spacing: 0.08em; margin: 7px 0;
}
#forge-dials input[type="range"] {
  width: 100%; accent-color: var(--violet); height: 3px; margin-top: 3px;
}
#forge-dials .dial-hint {
  display: block; font-size: 9px; color: var(--muted, #7c7790);
  text-transform: none; letter-spacing: 0; margin-top: 1px;
}
.forge-row { display: flex; gap: 10px; align-items: center; }
.forge-row button.ghost {
  background: transparent; color: var(--ink-dim); border: 1px solid var(--line);
}
#forge-send:disabled { opacity: 0.45; cursor: default; }

#myhouse { top: 64px; left: 16px; min-width: 172px; }
#myhouse .mh-bar {
  height: 6px; border-radius: 3px; background: #2a2438; margin: 4px 0 2px; overflow: hidden;
}
#myhouse .mh-bar i { display: block; height: 100%; background: var(--gold); transition: width 0.5s; }
#myhouse button.reforge {
  margin-top: 7px; width: 100%; background: var(--violet-deep); color: var(--violet-bright);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px; font-family: var(--mono);
  font-size: 11px; cursor: pointer;
}
#myhouse .mh-title { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
#myhouse .mh-name { font-size: 13px; font-weight: 600; margin: 2px 0 4px; }
#myhouse .mh-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-dim); }
#myhouse .mh-row b { color: var(--gold); font-variant-numeric: tabular-nums; }
#myhouse.hidden { display: none; }
.strat-row { display: flex; align-items: center; gap: 6px; margin: 2px 0; font-size: 10.5px; }
.strat-chip { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.strat-name { flex: 1; color: var(--ink-dim); }
.strat-e { color: var(--ink); font-variant-numeric: tabular-nums; }
.strat-up { color: #7fc48f; } .strat-dn { color: #e8734a; }

/* onboarding stake line — the CMO's one-sentence hook, led with the stake */
.onboard-card .onboard-stake {
  font-size: 12.5px; line-height: 1.6; color: var(--ink);
  border-left: 2px solid var(--violet); padding-left: 11px; margin-bottom: 15px;
}
.onboard-card .onboard-stake b { color: var(--violet-bright); }
.onboard-card .fine a { color: var(--violet); text-decoration: none; border-bottom: 1px dotted var(--line); white-space: nowrap; }
.onboard-card .fine a:hover { color: var(--violet-bright); }

/* Honest Page trigger — sits left of sound/help in the button row */
#honest-btn {
  position: absolute; bottom: 34px; right: 92px; width: 30px; height: 30px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-dim); font-size: 11px; cursor: pointer; pointer-events: auto;
}
#honest-btn:hover { color: var(--gold); border-color: rgba(255,224,138,0.4); }

/* THE HONEST PAGE — the skeptic's destination; honesty as the brand */
.honest-card {
  position: relative; width: min(680px, 92vw); max-height: 90vh; overflow-y: auto;
  padding: 30px 34px 26px; background: var(--violet-deep);
  border: 1px solid var(--line); border-radius: 14px; text-align: left;
}
.honest-card .hx {
  position: absolute; top: 14px; right: 14px; width: 28px; height: 28px;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-dim); cursor: pointer; font-family: var(--mono); padding: 0;
}
.honest-card .hx:hover { color: var(--ink); }
.honest-eyebrow { font-size: 10px; letter-spacing: 0.28em; color: var(--gold); text-transform: uppercase; }
.honest-card h1 { font-size: 24px; color: var(--ink); margin: 8px 0 6px; font-weight: 600; line-height: 1.2; text-wrap: balance; }
.honest-sub { font-size: 12.5px; color: var(--ink-dim); line-height: 1.6; margin-bottom: 18px; max-width: 58ch; }
.honest-live { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.hl-cell {
  flex: 1 1 auto; min-width: 88px; background: rgba(7,6,13,0.5); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.hl-v { font-size: 18px; color: var(--violet-bright); font-variant-numeric: tabular-nums; font-weight: 600; }
.hl-k { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
.honest-sec { margin-bottom: 18px; }
.honest-sec h2 { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--violet-bright); margin-bottom: 8px; }
.honest-sec > p { font-size: 13px; color: var(--ink-dim); line-height: 1.6; }
.honest-sec ul { margin: 8px 0 8px 18px; }
.honest-sec li { font-size: 12.5px; color: var(--ink-dim); line-height: 1.6; margin: 4px 0; }
.honest-card b { color: var(--ink); }
.honest-punch { color: var(--ink) !important; border-left: 2px solid var(--gold); padding-left: 11px; margin-top: 8px; }
.honest-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.honest-col { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.honest-col h3 { font-size: 12px; letter-spacing: 0.04em; margin-bottom: 8px; }
.honest-col.real { background: rgba(127,196,143,0.06); border-color: rgba(127,196,143,0.28); }
.honest-col.real h3 { color: #7fc48f; }
.honest-col.hype { background: rgba(232,115,74,0.06); border-color: rgba(232,115,74,0.28); }
.honest-col.hype h3 { color: #e8734a; }
.honest-col ul { margin: 0 0 0 16px; }
.honest-col li { font-size: 11.5px; color: var(--ink-dim); line-height: 1.55; margin: 6px 0; }
.honest-repro { font-size: 10.5px; color: var(--ink-dim); letter-spacing: 0.02em; }
.honest-repro code { color: var(--gold); }

/* the shareable saga card — the distribution engine (player is the hero) */
.saga-card {
  width: min(760px, 94vw); text-align: center;
  background: var(--violet-deep); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px;
}
#saga-canvas { width: 100%; height: auto; display: block; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.saga-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.saga-actions button {
  background: var(--violet); color: #17102c; border: none; border-radius: 8px;
  padding: 9px 18px; font-family: var(--mono); font-weight: 600; font-size: 13px; cursor: pointer;
}
.saga-actions button:hover { background: var(--violet-bright); }
.saga-actions button.ghost { background: transparent; color: var(--ink-dim); border: 1px solid var(--line); }
.saga-actions button.ghost:hover { color: var(--ink); }
.saga-hint { margin-top: 10px; font-size: 11px; color: var(--ink-dim); letter-spacing: .02em; }
/* the in-HUD trigger in the champion box */
.saga-btn {
  margin-top: 7px; width: 100%; background: var(--gold); color: #17102c; border: none;
  border-radius: 6px; padding: 6px; font-family: var(--mono); font-weight: 600; font-size: 11px;
  cursor: pointer;
}
.saga-btn:hover { filter: brightness(1.08); }

/* clip mode: pure canvas, no DOM chrome (clips crop to canvas) */
body.clip #hud, body.clip #vignette { display: none; }

@media (prefers-reduced-motion: reduce) {
  #ticker-inner { animation: none; }
}
@media (max-width: 640px) {
  #leaderboard, #science { width: 150px; font-size: 10px; }
  #census { width: 160px; }
  .honest-cols { grid-template-columns: 1fr; }
  .honest-card { padding: 24px 20px; }
  .honest-card h1 { font-size: 20px; }
}
