/* Playoff / Reel — design tokens + utility classes.
   Keeps backwards-compat selectors (.btn, input[type=text], .badge,
   .clip-broken) so existing JS DOM continues to render. */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Medium.ttf') format('truetype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

:root {
  /* Core palette */
  --ink:        #0A0B10;
  --ink-2:      #12131A;
  --ink-3:      #1A1C26;
  --ink-4:      #242735;
  --line:       #222532;
  --line-soft:  #181A23;

  --paper:      #F4F1E8;
  --chalk:      #E8E4D5;
  --fog:        #9BA0AE;
  --smoke:      #636877;

  /* Accents */
  --pink:       #FF3D6B;
  --pink-deep:  #E62E58;
  --pink-ink:   rgba(255, 61, 107, 0.10);

  --yellow:     #FFE14A;
  --yellow-hot: #FFD400;
  --yellow-ink: rgba(255, 225, 74, 0.10);

  --reel:       #FFB23D;
  --reel-ink:   rgba(255, 178, 61, 0.12);

  --ok:    #4ADE80;
  --warn:  #FF8A3D;
  --stop:  #FF3D6B;

  /* Type stacks */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body:    'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-serif:   'Instrument Serif', ui-serif, Georgia, serif;

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px; --s-10: 72px;

  /* Radius */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-2xl: 28px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-pop: 0 20px 60px rgba(255, 61, 107, 0.25);

  /* ---- backwards-compat aliases (existing CSS in HTML files uses these) ---- */
  --bg:        var(--ink);
  --bg-2:      var(--ink-2);
  --fg:        var(--paper);
  --muted:     var(--smoke);
  --accent:    var(--pink);
  --accent-2:  var(--reel);
  --good:      var(--ok);
  --border:    var(--line);
  --radius:    var(--r-lg);
  --radius-sm: var(--r-md);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'ss01', 'ss02';
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 0;
}
a { color: var(--paper); text-decoration: none; }

.small { font-size: 0.85rem; color: var(--fog); }

/* ---------- utilities ---------- */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-serif); }
.display { font-family: var(--font-display); letter-spacing: -0.025em; }

.kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--smoke);
}

.hero-type {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.92;
  text-wrap: balance;
}

/* Chip — pill with tone modifiers */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fog);
  background: var(--ink-2);
  font-weight: 500;
}
.chip--pink   { border-color: rgba(255,61,107,0.4); color: var(--pink);   background: var(--pink-ink); }
.chip--yellow { border-color: rgba(255,225,74,0.4); color: var(--yellow); background: var(--yellow-ink); }
.chip--reel   { border-color: rgba(255,178,61,0.4); color: var(--reel);   background: var(--reel-ink); }
.chip--paper  { border-color: rgba(244,241,232,0.2); color: var(--paper); background: rgba(244,241,232,0.06); }

/* Film grain overlay — element must be position:relative */
.grain { position: relative; }
.grain::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.05;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 56px;
  padding: 0 28px;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}
.btn:hover { background: var(--ink-3); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--pink);
  color: var(--ink);
  border-color: var(--pink);
  font-weight: 700;
}
.btn.primary:hover { background: var(--pink-deep); }
.btn.hero {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
  font-weight: 700;
}
.btn.solid {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
  font-weight: 700;
}
.btn.ghost { background: transparent; }
.btn.disabled, .btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- inputs ---------- */
input[type="text"] {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  font-size: 1rem;
  background: var(--ink-2);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  transition: border-color 120ms ease;
}
input[type="text"]::placeholder { color: var(--smoke); }
input[type="text"]:focus {
  outline: none;
  border-color: var(--pink);
  background: var(--ink-3);
}

/* ---------- badge (legacy compat — still used by submitted-bar) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fog);
  background: var(--ink-2);
  border: 1px solid var(--line);
}
.badge.good   { background: rgba(74,222,128,0.10); color: var(--ok);     border-color: rgba(74,222,128,0.4); }
.badge.warn   { background: var(--yellow-ink);     color: var(--yellow); border-color: rgba(255,225,74,0.4); }
.badge.accent { background: var(--reel-ink);       color: var(--reel);   border-color: rgba(255,178,61,0.4); }

/* ---------- accessibility ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- broken-clip fallback ---------- */
.clip-broken {
  width: 100%;
  height: 100%;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: repeating-linear-gradient(
    45deg,
    var(--ink-2),
    var(--ink-2) 10px,
    var(--ink) 10px,
    var(--ink) 20px
  );
  color: var(--fog);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  padding: 1rem;
}
.clip-broken .icon { font-size: 2rem; }

/* ---------- avatar (named circle) ---------- */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--ink-3);
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.avatar.locked::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--pink) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'><rect x='2.5' y='4.5' width='5' height='4' rx='0.5' fill='%230A0B10'/><path d='M3.5 4.5 L 3.5 3.2 A 1.5 1.5 0 0 1 6.5 3.2 L 6.5 4.5' stroke='%230A0B10' stroke-width='0.8' fill='none'/></svg>") center / 60% no-repeat;
  border: 2px solid var(--ink);
}
.avatar.disconnected { opacity: 0.35; }

/* ---------- Playoff lockup (used in top bars) ---------- */
.playoff-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.playoff-lockup__mark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.playoff-lockup__word {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 14px;
  color: var(--paper);
}
.reel-wordmark {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--reel);
  letter-spacing: -0.02em;
  line-height: 0.9;
  display: inline-flex;
  align-items: baseline;
  gap: 0.08em;
}
.reel-wordmark::after {
  content: "";
  display: inline-block;
  width: 0.13em;
  height: 0.13em;
  border-radius: 999px;
  background: var(--reel);
  align-self: flex-end;
  margin-bottom: 0.08em;
}
