/* Stage, chrome and shared controls. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(120% 80% at 50% -10%, #16205a 0%, var(--stage) 45%, var(--stage-deep) 100%);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Static CRT texture. No flicker — motion here is nausea, not atmosphere —
   and the alpha stays low enough to leave text contrast intact. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.16) 0px,
    rgba(0, 0, 0, 0.16) 1px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 3px
  );
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 59;
  background: radial-gradient(120% 90% at 50% 45%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 100%);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: var(--gap) var(--gap) var(--gap-xl);
}

/* --- Header ------------------------------------------------------------ */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
  padding-bottom: var(--gap-sm);
  border-bottom: 1px solid var(--stage-edge);
}

.wordmark {
  font-family: var(--font-display);
  font-size: clamp(17px, 4.4vw, 26px);
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--gold);
  text-shadow: var(--glow-gold);
  text-decoration: none;
}

.masthead-meta {
  display: flex;
  align-items: center;
  gap: var(--gap);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.masthead-meta a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--stage-line);
}

.masthead-meta a:hover {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* --- Controls ---------------------------------------------------------- */

.term-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--stage-line);
  border-radius: var(--radius);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 5px 9px;
  cursor: pointer;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.term-btn:hover {
  border-color: var(--green);
  background: rgba(74, 255, 160, 0.08);
}

.term-btn--gold {
  color: var(--gold);
}

.term-btn--gold:hover {
  border-color: var(--gold);
  background: rgba(255, 181, 46, 0.1);
}

.term-btn[aria-pressed='false'] {
  color: var(--ink-faint);
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

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

@media (max-width: 560px) {
  .masthead { flex-wrap: wrap; gap: 4px var(--gap-sm); }
  .masthead-meta { gap: 10px; font-size: 11px; letter-spacing: 0.08em; }
  .shell { padding-bottom: var(--gap-lg); }
}

.fixture-flag {
  display: inline-block;
  margin-left: var(--gap-sm);
  padding: 1px 6px;
  border: 1px solid var(--gold-deep);
  border-radius: var(--radius);
  color: var(--gold-deep);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  vertical-align: middle;
}

.site-foot {
  margin-top: var(--gap-xl);
  padding-top: var(--gap);
  border-top: 1px solid var(--stage-edge);
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.06em;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  justify-content: space-between;
}

.site-foot a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px dotted var(--stage-line);
}

/* The mode tint. Classic keeps the scoreboard gold it always had; Personality
   gets terminal green, and that is the entire visual difference between the
   two boards — the label carries the rest. */
.game-id--personality { color: var(--green); }
