/* =========================================================================
   Poker Tournament Display — Main Screen
   Visual spec: see ../02_DESIGN_PRINCIPLES.md (v6)
   ========================================================================= */

/* -------------------------------------------------------------------------
   Design tokens (Tier B1). Two-tier system per the DTCG / design-system
   best practice: PRIMITIVES name a value (--zinc-400), SEMANTIC tokens name
   a purpose (--text-muted) and reference a primitive. Rules should use the
   SEMANTIC tokens, so a theme/rebrand (e.g. a light mode) is a one-line remap
   in this block — never a hunt through every rule. This :root lives in the
   shared stylesheet, so the tokens are available to every page's inline
   styles too; migrate those to var(...) incrementally (each is an exact-value
   swap). Values below are the app's existing de-facto palette (Tailwind
   zinc/blue/amber + custom navy surfaces) — unchanged, just named.
   ------------------------------------------------------------------------- */
:root {
  /* --- Primitives: raw palette, named by what they ARE --- */
  --navy-950: #0A1426;
  --navy-900: #152033;
  --navy-800: #1E2A44;
  --zinc-100: #F4F4F5;
  --zinc-300: #D4D4D8;
  --zinc-400: #A1A1AA;
  --zinc-500: #71717A;
  --zinc-600: #52525B;
  --amber-500: #F59E0B;
  --blue-400: #60A5FA;
  /* rgb triplets, for alpha compositing — rgba(<triplet-token>, alpha) */
  --navy-900-rgb: 21, 32, 51;
  --blue-400-rgb: 96, 165, 250;
  --white-rgb: 255, 255, 255;

  /* --- Semantic tokens: named by what they're FOR; reference these --- */
  --surface-page:   var(--navy-950);  /* outermost page background */
  --surface-base:   var(--navy-900);  /* panels, display, overlays */
  --surface-raised: var(--navy-800);  /* cards, stat boxes, kbd */
  --text-primary:   var(--zinc-100);  /* headings, values, white text */
  --text-secondary: var(--zinc-300);
  --text-muted:     var(--zinc-400);  /* labels, secondary copy */
  --text-subtle:    var(--zinc-500);
  --text-faint:     var(--zinc-600);  /* slashes, dividers */
  --color-warning:  var(--amber-500); /* clock amber, break headline */
  --color-accent:   var(--blue-400);  /* level-label highlight */
  --border-hairline: rgba(var(--white-rgb), 0.06);
  --border-soft:     rgba(var(--white-rgb), 0.08);
  --border-strong:   rgba(var(--white-rgb), 0.1);
}

/* ---------- Reset & page shell ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 40px;
  background: var(--surface-page);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  color: var(--text-primary);
}

.label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: none;
}

/* ---------- Display container (16:9) ---------- */
.display {
  background: var(--surface-base);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 16/9;
  width: 100%;
  max-width: 1280px;
  display: flex;
  flex-direction: column;
  color: var(--text-primary);
}

/* ---------- Header ---------- */
.header {
  padding: 24px 36px;
  border-bottom: 1px solid var(--border-hairline);
}

.tournament-name {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 26px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ---------- Hero (clock + blinds zone) ---------- */
.hero {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px 32px;
  gap: 18px;
  position: relative;
}

.next-break {
  position: absolute;
  top: 28px;
  right: 36px;
  text-align: right;
}

.next-break-label {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: none;
}

.next-break-value {
  font-size: 38px;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.level-label {
  display: inline-block;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  background: rgba(var(--blue-400-rgb), 0.12);
  border: 1px solid rgba(var(--blue-400-rgb), 0.30);
  border-radius: 8px;
  padding: 6px 22px;
  text-transform: none;
}

/* ---------- The clock (the hero) ---------- */
.clock {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 180px;
  font-weight: 800;
  line-height: 0.95;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  transition: color 600ms ease;
}

/* Spec #5: 60s remaining → amber */
.clock.amber {
  color: var(--color-warning);
}

/* Spec #5: 10s remaining → gentle 1Hz opacity pulse */
.clock.pulse {
  animation: clockPulse 1s ease-in-out infinite;
}

@keyframes clockPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.8; }
}

/* Spec #5/#9: level transition → 400ms cross-fade
   The blinds row + next-preview fade out on level rollover, JS swaps content,
   and they fade back in.  Clock itself stays in place — only its numerals reset. */
.fade-out {
  opacity: 0;
  transition: opacity 400ms ease;
}
.fade-in {
  opacity: 1;
  transition: opacity 400ms ease;
}

/* ---------- Blinds row ---------- */
.blinds-row {
  display: flex;
  align-items: baseline;
  gap: 56px;
  margin-top: 6px;
  transition: opacity 400ms ease;
}

.blinds-element, .ante-element {
  text-align: center;
}

.blinds-label, .ante-label {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.10em;
  color: var(--text-muted);
  margin-bottom: 14px;
  text-transform: none;
}

.blinds-value, .ante-value {
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.blinds-slash {
  color: var(--text-faint);
  margin: 0 12px;
}

/* When BB ante is inactive (early levels), hide the whole element cleanly */
.ante-element[hidden] { display: none; }

/* ---------- Next-level preview ---------- */
.next-preview {
  font-size: 20px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  transition: opacity 400ms ease;
}

.next-preview-dot {
  color: var(--text-faint);
  margin: 0 8px;
}

/* ---------- Stats row ---------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 24px;
  flex-shrink: 0;
}

.stat-box {
  background: var(--surface-raised);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 14px 20px;
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: none;
}

.stat-value {
  font-size: 26px;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-suffix {
  color: var(--text-primary);
  font-size: 16px;
  margin-left: 6px;
}

/* ---------- Payouts row ---------- */
.payouts-row {
  padding: 22px 36px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-shrink: 0;
}

.payouts-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-subtle);
  flex-shrink: 0;
  text-transform: none;
}

/* Auto-scrolling payouts marquee — TV-friendly, no interaction needed */
.payouts-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%);
}

.payouts-track {
  display: flex;
  gap: 36px;
  width: max-content;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  animation: payoutsScroll 90s linear infinite;
}

@keyframes payoutsScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.payouts-viewport:hover .payouts-track { animation-play-state: paused; }

.payout-entry {
  font-size: 22px;
  font-weight: 500;
  flex-shrink: 0;
  color: var(--text-muted);
}

.payout-position {
  color: var(--text-subtle);
  margin-right: 9px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.p1 { color: var(--text-primary); }
.p2 { color: var(--text-secondary); }
.p3, .p4, .p5 { color: var(--text-muted); }

/* ---------- Break state (spec #8) ---------- */
.break-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  background: var(--surface-base);
  z-index: 2;
}

.break-overlay[hidden] { display: none; }

.break-headline {
  font-size: 80px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-warning);
  text-transform: none;
  line-height: 1;
}

.break-resumes {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: none;
}

.break-clock {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 140px;
  font-weight: 800;
  line-height: 0.95;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

/* ---------- Dev HUD (?dev=1) ---------- */
.dev-hud {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: rgba(var(--navy-900-rgb), 0.92);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace;
  z-index: 10;
  min-width: 200px;
}

.dev-hud[hidden] { display: none; }

.dev-hud kbd {
  display: inline-block;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--text-primary);
  margin-right: 6px;
  min-width: 14px;
  text-align: center;
}

.dev-status {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-primary);
}
