/* ============================================================
   YURAGI STADIUM — cinematic athletics broadcast
   Direction: live sports broadcast for an investor wow moment.
   ============================================================ */
:root {
  --void: #07090d;
  --ink: #0c1018;
  --panel: rgba(8, 11, 16, 0.82);
  --panel-hard: rgba(8, 11, 16, 0.94);
  --line: rgba(245, 238, 220, 0.14);
  --line-hot: rgba(245, 238, 220, 0.34);
  --paper: #f4efe4;
  --mute: #9aa3b0;
  --gold: #e2b84a;
  --clay: #c24b32;
  --live: #ff3a3a;
  --ok: #6dc98a;
  --disp: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sport: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --kanji: 'Shippori Mincho', serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-slam: cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--void); }
body {
  font-family: var(--mono);
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { text-decoration: none; }
::selection { background: rgba(226, 184, 74, 0.35); }

.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;
}

#stadium {
  position: fixed; inset: 0;
  display: block; width: 100%; height: 100%;
}

/* ---- letterbox ---- */
#letterbox {
  position: fixed; inset: 0; z-index: 8; pointer-events: none;
}
#letterbox i {
  position: absolute; left: 0; right: 0; height: 0;
  background: #000;
  transition: height 0.55s var(--ease-out);
}
#letterbox i:first-child { top: 0; }
#letterbox i:last-child { bottom: 0; }
#letterbox.on i { height: min(9vh, 72px); }

/* ---- gate ---- */
#gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 28px;
}
.gateBg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 55% at 50% 35%, rgba(194, 75, 50, 0.35), transparent 65%),
    radial-gradient(ellipse 50% 40% at 70% 80%, rgba(226, 184, 74, 0.12), transparent 60%),
    linear-gradient(180deg, #141a24 0%, #07090d 100%);
}
.gateBg::after {
  content: '';
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.45; pointer-events: none;
}
.gateInner {
  position: relative;
  width: min(560px, 94vw);
  text-align: center;
  animation: gateRise 0.9s var(--ease-out) both;
}
@keyframes gateRise {
  from { opacity: 0; transform: translateY(28px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
#gate.hide .gateInner {
  animation: gateDrop 0.4s ease forwards;
}
#gate.hide .gateBg {
  animation: gateFade 0.45s ease forwards;
}
@keyframes gateDrop {
  to { opacity: 0; transform: translateY(-20px) scale(1.02); }
}
@keyframes gateFade { to { opacity: 0; } }

.gateEyebrow {
  font-size: 11px; letter-spacing: 0.28em; color: var(--gold);
  margin-bottom: 18px;
}
.gateKanji {
  font-family: var(--kanji);
  font-size: clamp(56px, 12vw, 88px);
  line-height: 1; color: var(--gold); margin-bottom: 8px;
}
.gateKanji span {
  margin-left: 12px; font-size: 0.42em; color: var(--paper);
  letter-spacing: 0.12em; vertical-align: middle;
}
#gateTitle {
  font-family: var(--disp);
  font-size: clamp(34px, 7vw, 52px);
  font-weight: 400; line-height: 1.05;
  margin: 10px 0 14px;
}
#gateSub {
  font-size: 13px; line-height: 1.6; color: var(--mute);
  margin-bottom: 22px;
}
.gateProof {
  list-style: none;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 26px; text-align: left;
}
.gateProof li {
  padding: 12px 12px 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  display: flex; flex-direction: column; gap: 4px;
}
.gateProof b {
  font-family: var(--sport); font-size: 18px; letter-spacing: 0.06em;
  font-weight: 400; color: var(--paper);
}
.gateProof span { font-size: 10px; line-height: 1.4; color: var(--mute); }
#gateSkip {
  display: inline-block;
  padding: 16px 36px;
  font-family: var(--sport);
  font-size: 22px; letter-spacing: 0.14em;
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--paper);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
#gateSkip:hover, #gateSkip:focus-visible {
  background: transparent; color: var(--paper);
  transform: translateY(-1px);
}
#gateSkip:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.gateHint {
  margin-top: 14px; font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--mute);
}

/* ---- broadcast shell ---- */
#broadcast {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
}
#broadcast > * { pointer-events: auto; }
#broadcast[hidden] { display: none !important; }

#topBar {
  position: absolute; top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(260px, 440px) minmax(160px, 1fr);
  gap: 14px; align-items: start;
  padding: 14px 16px 40px;
  background: linear-gradient(180deg, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.25) 70%, transparent 100%);
}

#brand { display: flex; gap: 10px; align-items: center; }
.brandMark {
  font-family: var(--kanji); font-size: 36px; color: var(--gold); line-height: 1;
}
#brand strong {
  display: block; font-family: var(--sport); font-size: 22px;
  letter-spacing: 0.08em; font-weight: 400; line-height: 1;
}
#brand em {
  display: block; font-style: normal; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute);
  margin-top: 3px;
}

#eventBoard {
  text-align: center;
  padding: 12px 16px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--clay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: boardIn 0.5s var(--ease-out) both;
}
@keyframes boardIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: none; }
}
.ebTop {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 0.14em; color: var(--gold);
  margin-bottom: 4px;
}
#etClock { color: var(--mute); }
#etName {
  font-family: var(--sport); font-size: clamp(32px, 5vw, 48px);
  letter-spacing: 0.04em; line-height: 0.95; font-weight: 400;
}
#etBlurb {
  font-family: var(--disp); font-style: italic; font-size: 14px;
  color: var(--mute); margin: 6px 0 10px; line-height: 1.35;
}
#etReads { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.readTag {
  font-size: 10px; letter-spacing: 0.04em;
  padding: 4px 8px; border: 1px solid var(--line-hot);
  background: rgba(245, 238, 220, 0.05);
}

#statusCol {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
}
.liveBadge, .meetBadge, .hudBtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 12px; font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; border: 1px solid var(--line);
  background: var(--panel);
}
.liveBadge { color: var(--live); border-color: rgba(255, 58, 58, 0.45); }
.liveDot {
  width: 7px; height: 7px; background: var(--live);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }
.meetBadge { color: var(--mute); }
.meetBadge b { color: var(--paper); font-weight: 600; margin-left: 4px; }
.hudBtn {
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.hudBtn:hover, .hudBtn:focus-visible {
  border-color: var(--gold); color: var(--gold);
  background: rgba(226, 184, 74, 0.08);
}
.hudBtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mono { font-family: var(--mono); }

/* schedule */
#schedule {
  position: absolute; top: 118px; left: 50%; transform: translateX(-50%);
  width: min(560px, 92vw); z-index: 12;
}
#schedList {
  list-style: none; display: flex; gap: 4px;
}
#schedList li {
  flex: 1; text-align: center; padding: 7px 4px 8px;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mute); background: rgba(0,0,0,0.45);
  border: 1px solid transparent; border-bottom: 2px solid transparent;
}
#schedList li.done { color: rgba(245, 238, 220, 0.45); border-bottom-color: rgba(245,238,220,0.2); }
#schedList li.active {
  color: var(--paper); border-bottom-color: var(--clay);
  background: rgba(194, 75, 50, 0.18);
}
#schedList li .n {
  display: block; font-family: var(--sport); font-size: 16px;
  letter-spacing: 0.04em; line-height: 1; margin-bottom: 2px;
}

/* lane board */
#laneBoard {
  position: absolute; top: 118px; left: 14px;
  width: min(300px, 40vw);
  max-height: calc(100vh - 210px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  scrollbar-width: thin; scrollbar-color: rgba(245,238,220,0.2) transparent;
}
.panelHead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; font-size: 10px; letter-spacing: 0.16em;
  color: var(--mute); border-bottom: 1px solid var(--line);
}
.panelSub { color: var(--gold); }
#lbList { list-style: none; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
#lbList li {
  display: grid; grid-template-columns: 14px 26px 48px 1fr auto;
  gap: 8px; align-items: center; padding: 8px;
  background: rgba(245, 238, 220, 0.03);
  border-left: 3px solid hsl(var(--hue, 20), 70%, 52%);
  transition: background 0.25s ease, transform 0.25s var(--ease-out);
}
#lbList li.lead {
  background: rgba(226, 184, 74, 0.12);
  transform: translateX(2px);
}
#lbList .rank {
  font-family: var(--sport); font-size: 20px; color: var(--mute); text-align: center;
}
#lbList li.lead .rank { color: var(--gold); }
#lbList .laneNo {
  font-size: 10px; letter-spacing: 0.06em; color: var(--mute); text-align: center;
}
#lbList .face {
  width: 48px; height: 48px; object-fit: contain;
  border: 2px solid rgba(245, 238, 220, 0.22);
  background: rgba(20, 28, 40, 0.85);
  image-rendering: auto;
}
#lbList li.lead .face { border-color: var(--gold); }
#lbList .meta { min-width: 0; }
#lbList .name {
  display: block; font-family: var(--sport); font-size: 20px;
  letter-spacing: 0.04em; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#lbList .bar {
  margin-top: 5px; height: 3px; background: rgba(245,238,220,0.1); overflow: hidden;
}
#lbList .bar > i {
  display: block; height: 100%; width: 0%;
  background: hsl(var(--hue, 20), 70%, 55%);
  transition: width 0.35s var(--ease-out);
}
#lbList .metric {
  font-size: 11px; color: var(--paper); white-space: nowrap;
}

/* explain */
#explainPanel {
  position: absolute; top: 118px; right: 14px;
  width: min(340px, 42vw);
  padding: 0 0 14px;
  background: var(--panel-hard); border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  animation: boardIn 0.35s var(--ease-out) both;
}
#explainPanel[hidden] { display: none !important; }
#explainPanel .panelHead { padding: 12px 14px; }
.iconBtn {
  width: 32px; height: 32px; font-size: 22px; line-height: 1;
  color: var(--mute); border: 1px solid var(--line);
}
.iconBtn:hover, .iconBtn:focus-visible { color: var(--paper); border-color: var(--gold); }
.iconBtn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#explainBody {
  padding: 4px 16px 12px; font-family: var(--disp); font-style: italic;
  font-size: 17px; line-height: 1.35; color: var(--paper);
}
#explainReads { padding: 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.explainFoot {
  margin: 14px 16px 0; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 11px; line-height: 1.5; color: var(--mute);
}

/* toasts */
#toasts {
  position: absolute; top: 170px; right: 14px;
  width: min(320px, 44vw);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 20; pointer-events: none;
}
.toast {
  padding: 12px 14px;
  background: var(--panel-hard); border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  animation: toastIn 0.45s var(--ease-slam) both;
}
.toast.out { animation: toastOut 0.3s ease forwards; }
.toast.lead { border-left-color: var(--live); }
.toast.finish { border-left-color: var(--gold); background: rgba(226, 184, 74, 0.12); }
.toast.event { border-left-color: var(--clay); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(24px); }
}
.toast .kicker {
  display: block; font-size: 10px; letter-spacing: 0.18em;
  color: var(--gold); margin-bottom: 3px;
}
.toast.lead .kicker { color: var(--live); }
.toast .title {
  font-family: var(--sport); font-size: 26px; letter-spacing: 0.04em; line-height: 1;
}
.toast .body { margin-top: 4px; font-size: 11px; color: var(--mute); line-height: 1.4; }

/* score strip */
#scoreStrip {
  position: absolute; left: 14px; right: 14px; bottom: 12px;
  background: var(--panel-hard); border: 1px solid var(--line);
  border-left: 4px solid var(--gold); overflow: hidden;
}
#ttRows {
  padding: 12px 16px 8px; font-size: 13px; line-height: 1.45; color: var(--mute);
}
#ttRows .winner {
  color: var(--gold); font-family: var(--sport); font-size: 20px;
  letter-spacing: 0.05em; margin-right: 8px;
}
#proofTicker {
  display: flex; gap: 14px; padding: 7px 16px;
  border-top: 1px solid var(--line);
  font-size: 10px; letter-spacing: 0.14em; color: var(--mute);
  white-space: nowrap; overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
#proofTicker span:first-child { color: var(--gold); }

#reducedNote {
  position: fixed; bottom: 16px; left: 16px; z-index: 12;
  max-width: 40ch; padding: 8px 12px; font-size: 11px; color: var(--mute);
  background: var(--panel); border: 1px solid var(--line);
}

@media (max-width: 980px) {
  #topBar { grid-template-columns: 1fr; gap: 10px; }
  #statusCol { justify-content: flex-start; }
  #schedule { top: auto; bottom: 78px; }
  #laneBoard {
    top: auto; bottom: 118px; left: 10px; right: 10px;
    width: auto; max-height: 34vh;
  }
  #lbList { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  #explainPanel { top: auto; bottom: 118px; right: 10px; left: 10px; width: auto; }
  #toasts { top: 200px; right: 10px; }
  .gateProof { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #laneBoard, #schedule { display: none; }
  #toasts { width: calc(100vw - 24px); left: 12px; right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .liveDot { animation: none !important; }
  #letterbox i { transition: none !important; }
}
