/* ═══════════════════════════════════════════════════════════════════════════
   PREDICTER · DESIGN SYSTEM  (css/system.css)
   Tokens · type scale · primitives · components.  Layout lives in app.css.

   Identity: dark ARENA night, GOLD verdict + MINT signal battle, VIOLET Clerk
   voice, RED roast. Receipts-obsessed. Nothing Diablo — Predicter's own chrome.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── SURFACES ─────────────────────────────────────────────────────────── */
  --bg0: #07060a;            /* arena floor            */
  --bg1: #0c0a12;            /* rails / nav            */
  --panel: rgba(18, 16, 26, .88);
  --panel2: #181522;         /* raised card            */
  --panel3: #1f1b2c;         /* highest / hover        */
  --line: rgba(255, 210, 120, .12);
  --line-hi: rgba(255, 210, 120, .28);

  /* ── BATTLE PALETTE ───────────────────────────────────────────────────── */
  --gold: #f0c060;           /* verdict / victory      */
  --gold-hi: #ffdf9a;
  --gold-dim: #a07830;
  --mint: #5dffb1;           /* sealed / live signal   */
  --mint-dim: rgba(93, 255, 177, .14);
  --red: #ff5c7a;            /* roast / miss           */
  --red-dim: rgba(255, 92, 122, .12);
  --violet: #b794ff;         /* The Clerk's voice      */
  --violet-dim: rgba(183, 148, 255, .1);

  --text: #f4efe6;           /* receipt paper          */
  --mute: #9a9184;
  --mute2: #6a635a;

  /* accent flips mint when the arena is live (body[data-state="live"]) */
  --accent: var(--gold);
  --accent-soft: rgba(240, 192, 96, .45);

  /* ── TYPE ─────────────────────────────────────────────────────────────── */
  --font-display: "Syne", system-ui, sans-serif;         /* headers, numbers  */
  --font-ui: "Barlow Condensed", system-ui, sans-serif;  /* condensed board   */
  --font-mono: "IBM Plex Mono", ui-monospace, monospace; /* receipts, stamps  */

  /* FULLSCREEN-FIRST TYPE FLOOR — nothing renders below --fs-2xs */
  --fs-2xs: clamp(13px, 1vw, 15px);
  --fs-xs:  clamp(14px, 1.1vw, 16px);
  --fs-sm:  clamp(15px, 1.2vw, 18px);
  --fs-base: clamp(16.5px, 1.35vw, 20px);
  --fs-md:  clamp(18px, 1.6vw, 23px);
  --fs-lg:  clamp(22px, 2.1vw, 30px);
  --fs-xl:  clamp(28px, 2.8vw, 40px);
  --fs-2xl: clamp(36px, 4vw, 56px);
  --fs-display: clamp(42px, 6.5vw, 88px);
  --fs-mega: clamp(72px, 13vw, 200px);   /* Theatre score reveal finish-move */

  /* ── SPACING (8pt base, tightened for app density) ───────────────────── */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;

  /* ── SHAPE / MOTION / ELEVATION ──────────────────────────────────────── */
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --elev-1: 0 10px 28px rgba(0, 0, 0, .35);
  --elev-2: 0 28px 70px rgba(0, 0, 0, .45);
  --elev-3: 0 40px 100px rgba(0, 0, 0, .55);
  --glow-gold: 0 0 20px rgba(240, 192, 96, .35);
  --glow-mint: 0 0 20px rgba(93, 255, 177, .35);

  /* ── SHELL METRICS (also consumed by app.css) ───────────────────────── */
  --head-h: 56px;
  --nav-w: 196px;
  --rail-w: min(300px, 26vw);
  --bottomnav-h: 60px;       /* mobile bottom-nav — see ARCHITECTURE.md */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; height: 100%; }
body {
  background:
    radial-gradient(120% 90% at 8% -12%, rgba(240, 192, 96, .09), transparent 48%),
    radial-gradient(90% 70% at 100% 100%, rgba(93, 255, 177, .04), transparent 50%),
    linear-gradient(180deg, #0e0c14 0%, var(--bg0) 55%, #050408 100%);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
/* soft edge vignette — arena cue, not a film overlay */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 30;
  background: radial-gradient(120% 120% at 50% 45%, transparent 62%, rgba(0, 0, 0, .45) 100%);
  opacity: .75;
}
body[data-state="live"] { --accent: var(--mint); --accent-soft: rgba(93, 255, 177, .45); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); text-decoration: none; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ── TYPE PRIMITIVES ─────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-2xs);
  letter-spacing: .16em; text-transform: uppercase; color: var(--gold-dim);
}
.mono { font-family: var(--font-mono); }
.num  { font-family: var(--font-display); font-weight: 800; letter-spacing: -.01em; }

/* ── BRAND MARK ──────────────────────────────────────────────────────────── */
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800;
  font-size: var(--fs-md); letter-spacing: .1em;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #ff9f43);
  color: #1a1004; display: grid; place-items: center;
  font-size: 14px; font-weight: 800; box-shadow: var(--glow-gold);
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 11px;
  padding: 12px 18px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; font-size: var(--fs-sm);
  transition: transform .15s var(--ease), box-shadow .15s, border-color .15s, color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #ff9f43); color: #1a1004;
  box-shadow: 0 10px 28px rgba(240, 192, 96, .25);
}
.btn-mint { background: var(--mint-dim); border-color: rgba(93, 255, 177, .35); color: var(--mint); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--line-hi); color: var(--gold); }
.btn-danger { background: var(--red-dim); border-color: rgba(255, 92, 122, .4); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: var(--fs-2xs); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ── PILLS / BADGES / STAMPS ─────────────────────────────────────────────── */
.tag-pill {
  font-family: var(--font-mono); font-size: var(--fs-2xs);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--mint); border: 1px solid rgba(93, 255, 177, .3);
  background: var(--mint-dim); padding: 5px 10px; border-radius: var(--radius-pill);
}
.tag-pill.warn { color: var(--gold); border-color: var(--line-hi); background: rgba(240, 192, 96, .08); }

.badge {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; padding: 3px 7px; border-radius: var(--radius-pill); border: 1px solid;
}
.badge.open { color: var(--gold); border-color: rgba(240, 192, 96, .35); }
.badge.hit  { color: var(--mint); border-color: rgba(93, 255, 177, .4); }
.badge.miss { color: var(--red);  border-color: rgba(255, 92, 122, .4); }

/* SEAL STAMP — the signature receipt motif (clerk's rubber stamp) */
.stamp {
  font-family: var(--font-display); font-weight: 800; letter-spacing: .12em;
  color: var(--mint); border: 3px solid var(--mint);
  padding: 6px 10px; border-radius: 6px; background: rgba(7, 6, 10, .55);
  text-transform: uppercase;
}
.stamp.miss { color: var(--red); border-color: var(--red); }
.stamp.pending { color: var(--gold); border-color: var(--gold); }

/* ── PANELS ──────────────────────────────────────────────────────────────── */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; backdrop-filter: blur(8px);
}
.panel:last-child { margin-bottom: 0; }
.panel-h {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px;
}
.panel-h h2 {
  margin: 0; font-family: var(--font-display); font-size: var(--fs-md);
  letter-spacing: .06em; font-weight: 800; display: flex; align-items: center; gap: 10px;
}
.panel-h h2::before {  /* gold accent bar — section discipline */
  content: ""; width: 3px; height: 1em; border-radius: 2px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-dim));
  box-shadow: var(--glow-gold);
}
.panel-h .sub {
  font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--mute);
  letter-spacing: .1em; text-transform: uppercase;
}

/* ── FORM PRIMITIVES ─────────────────────────────────────────────────────── */
.form { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.form label {
  display: grid; gap: 5px; font-size: var(--fs-2xs); letter-spacing: .14em;
  text-transform: uppercase; color: var(--mute);
}
.form input, .form select, .form textarea {
  background: #0a0910; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-family: var(--font-mono); font-size: var(--fs-sm);
}
.form textarea { min-height: 80px; resize: vertical; font-family: var(--font-ui); letter-spacing: .02em; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--gold); }

/* ── CLERK VOICE BOX ─────────────────────────────────────────────────────── */
.clerk-box {
  font-family: var(--font-mono); font-size: var(--fs-2xs); line-height: 1.45;
  color: #ddd0ff; background: var(--violet-dim);
  border: 1px solid rgba(183, 148, 255, .28); border-radius: 10px; padding: 12px;
  min-height: 72px;
}
.clerk-box .who {
  color: var(--violet); letter-spacing: .12em; text-transform: uppercase;
  margin-bottom: 6px; font-size: 10px;
}

/* ── EMPTY STATE (teaches in the Clerk's voice, never a gray box) ──────────── */
.empty {
  text-align: center; padding: var(--s7) var(--s5);
  border: 1px dashed var(--line-hi); border-radius: var(--radius);
  background: rgba(183, 148, 255, .04);
}
.empty .mark2 { font-size: var(--fs-2xl); line-height: 1; }
.empty h3 {
  font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg);
  margin: var(--s3) 0 var(--s2); color: var(--text);
}
.empty p {
  font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--violet);
  max-width: 42ch; margin: 0 auto var(--s4); line-height: 1.5;
}

/* ── TOAST ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(22px + var(--safe-bottom)); left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #1a1220; border: 1px solid rgba(240, 192, 96, .4); color: var(--gold);
  padding: 12px 18px; border-radius: 12px; font-family: var(--font-mono);
  font-size: var(--fs-2xs); opacity: 0; pointer-events: none; transition: .25s;
  z-index: 60; max-width: 92vw; text-align: center; box-shadow: var(--elev-2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
