/* Penalty Kick: a floodlit cup final on penalties. Self-contained. */

@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@1,700;1,800&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap");

:root{
  --ink: #f3f1ec;
  --dim: rgba(243, 241, 236, 0.66);
  --faint: rgba(243, 241, 236, 0.4);
  --bg: #06080b;
  --red: #e0343a;
  --red-deep: #9c1a22;
  --lime: #c6f03c;
  --line: rgba(255, 255, 255, 0.14);
  --font-display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* shared toy chrome (assets/toy-chrome.css) */
  --tc-accent: #e0343a;
  --tc-on: #ffffff;
  --tc-display: var(--font-display);
  --tc-ground: #07090d;
}

*, *::before, *::after{ box-sizing: border-box; }
html, body{
  height: 100%; margin: 0; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
canvas{
  display: block; width: 100%; height: 100%; touch-action: none;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}

/* ---------- scoreboard ---------- */
.hud{
  position: fixed; z-index: 5; pointer-events: none;
  top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
  font-family: var(--font-mono);
  padding: 8px 14px 7px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(7, 9, 13, 0.7);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  min-width: 232px; max-width: calc(100vw - 150px);
}
.hud[hidden]{ display: none; }
.sb{ display: flex; flex-direction: column; gap: 5px; }
.sb__row{ display: flex; align-items: center; gap: 10px; }
.sb__team{
  flex: 0 0 92px; font-family: var(--font-display); font-style: italic; font-weight: 800;
  font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.sb__row--you .sb__team{ color: #ff6a6f; }
.sb__row--opp .sb__team{ color: #9ec6f0; }
.sb__dots{ flex: 1; display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.sb__dots i{
  display: block; flex: 0 0 auto; width: 13px; height: 13px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.34); background: transparent;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.sb__dots i.is-next{ border-color: rgba(255, 255, 255, 0.85); box-shadow: 0 0 8px rgba(255, 255, 255, 0.35); }
.sb__dots i.g{ background: #f4f1ea; border-color: #f4f1ea; box-shadow: 0 0 9px rgba(255, 255, 255, 0.45); }
.sb__dots i.m{ background: transparent; border-color: #e0343a; position: relative; }
.sb__dots i.m::before, .sb__dots i.m::after{
  content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 1.8px; background: #e0343a;
  transform: translate(-50%, -50%) rotate(45deg); border-radius: 1px;
}
.sb__dots i.m::after{ transform: translate(-50%, -50%) rotate(-45deg); }
.sb__dots i.sd{ width: 10px; height: 10px; }
.sb__n{ flex: 0 0 18px; text-align: right; font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; }
.hud__meta{
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 8.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint);
  border-top: 1px solid var(--line); padding-top: 5px;
}

/* ---------- call-outs ---------- */
.stage{
  position: fixed; left: 0; right: 0; z-index: 4; pointer-events: none; text-align: center;
  top: 37%; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.role{
  font-family: var(--font-display); font-style: italic; font-weight: 800; text-transform: uppercase;
  font-size: clamp(22px, 6.2vw, 34px); letter-spacing: 0.08em; color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9), 0 0 2px rgba(224, 52, 58, 0.9);
  opacity: 0; transform: translateY(8px);
}
.role.is-on{ animation: roleIn 1500ms ease-out both; }
@keyframes roleIn{ 0%{ opacity: 0; transform: translateY(10px) scale(0.96); } 14%{ opacity: 1; transform: none; } 78%{ opacity: 1; } 100%{ opacity: 0; transform: translateY(-4px); } }
.call{
  font-family: var(--font-display); font-style: italic; font-weight: 800; text-transform: uppercase;
  font-size: clamp(54px, 18vw, 104px); line-height: 0.95; letter-spacing: 0.02em; color: #fff;
  -webkit-text-stroke: 2px var(--red);
  paint-order: stroke fill;
  text-shadow: 0 6px 34px rgba(0, 0, 0, 0.85);
  opacity: 0;
}
.call.is-on{ animation: callIn 1900ms cubic-bezier(.2,.9,.2,1) both; }
.call.is-miss{ -webkit-text-stroke-color: #7e8793; }
@keyframes callIn{ 0%{ opacity: 0; transform: scale(1.5) skewX(-6deg); } 12%{ opacity: 1; transform: scale(1) skewX(-6deg); } 80%{ opacity: 1; } 100%{ opacity: 0; transform: scale(1.04) skewX(-6deg); } }
.why{
  max-width: min(86vw, 420px); font: 500 14px/1.4 "Geist", system-ui, sans-serif; color: rgba(255, 255, 255, 0.92);
  padding: 7px 14px; border-radius: 10px; background: rgba(5, 7, 10, 0.62);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; text-wrap: balance;
}
.why.is-on{ animation: whyIn 2300ms ease-out both; }
@keyframes whyIn{ 0%{ opacity: 0; transform: translateY(6px); } 10%{ opacity: 1; transform: none; } 88%{ opacity: 1; } 100%{ opacity: 0; } }

.hintline{
  position: fixed; z-index: 4; pointer-events: none; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); text-align: center;
  top: 66%;
  font: 600 18px/1.3 "Geist", system-ui, sans-serif; letter-spacing: 0; color: #fff;
  padding: 9px 18px; border-radius: 14px; background: rgba(5, 7, 10, 0.7);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); text-wrap: balance;
  transition: opacity 180ms ease;
}
.is-save .hintline{ top: 83%; }
.is-save .timer{ top: 74%; }
.hintline:empty{ opacity: 0; padding: 0; }

/* the run-up as a countdown while you keep goal */
.timer{
  position: fixed; z-index: 4; pointer-events: none; left: 50%; transform: translateX(-50%);
  top: 58%; width: min(62vw, 300px); display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.timer[hidden]{ display: none; }
.timer__txt{ font: 800 italic 22px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.75); text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9); }
.timer__bar{ display: block; width: 100%; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.22); }
.timer__bar i{ display: block; height: 100%; width: 100%; transform-origin: left center; transform: scaleX(0); background: rgba(255, 255, 255, 0.85); }
.timer.is-go .timer__txt{ color: var(--lime); }
.timer.is-go .timer__bar i{ background: var(--lime); box-shadow: 0 0 12px var(--lime); }

@media (min-aspect-ratio: 23/20){
  .hintline, .is-save .hintline{ top: auto; bottom: 8%; }
  .timer, .is-save .timer{ top: auto; bottom: 15%; }
}

/* ---------- buttons ---------- */
.sound-btn{
  position: fixed; z-index: 6;
  top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(7, 9, 13, 0.7); color: var(--ink);
  font-size: 15px; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform 140ms ease, border-color 140ms ease, opacity 140ms ease;
}
.sound-btn:hover{ transform: translateY(-1px); border-color: var(--red); }
.sound-btn[aria-pressed="false"]{ opacity: 0.45; }
.sound-btn:focus-visible{ outline: none; box-shadow: 0 0 0 3px rgba(224, 52, 58, 0.55); }

.overlay{
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 22px; overflow-y: auto;
  background: radial-gradient(90% 70% at 50% 42%, rgba(4, 6, 9, 0.35), rgba(2, 3, 5, 0.82));
  transition: opacity 240ms ease;
}
.overlay[hidden]{ display: none; }
.overlay.is-out{ opacity: 0; pointer-events: none; }
.panel{ max-width: 440px; text-align: center; margin: auto; }
.panel__title{ font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0.01em; }
html.tc .panel__title{
  font-size: clamp(40px, 12vw, 54px); line-height: 0.98; letter-spacing: 0.005em; color: #fff;
  -webkit-text-stroke: 1.6px var(--red); paint-order: stroke fill;
}
html.tc .overlay .panel__eyebrow{ letter-spacing: 0.18em; }
.alt-btn{
  appearance: none; display: block; margin: 10px auto 0; padding: 8px 18px; border-radius: 999px;
  background: transparent; color: var(--tc-text, #ddd); border: 1px solid rgba(255, 255, 255, 0.22);
  font: 500 13px/1.2 "Geist", system-ui, sans-serif; cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}
.alt-btn:hover{ border-color: var(--red); color: #fff; }
.alt-btn:focus-visible{ outline: none; box-shadow: 0 0 0 3px rgba(224, 52, 58, 0.55); }
.alt-btn[hidden]{ display: none; }
.tag-row{ display: flex; justify-content: center; gap: 6px; margin: 0 0 12px; flex-wrap: wrap; }
.tag-row span{
  font: 500 10.5px/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 9px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.18); color: var(--tc-faint, #aaa);
}
.tag-row span.on{ color: #fff; border-color: var(--red); background: rgba(224, 52, 58, 0.22); }
@media (hover: none), (pointer: coarse){ .panel__keys{ display: none; } }

/* ---------- frame corners ---------- */
.frame{ position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner{
  position: fixed; font-family: var(--font-mono); font-size: 0.6rem;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint);
}
.frame__corner--tl{ top: max(14px, env(safe-area-inset-top)); left: max(14px, env(safe-area-inset-left)); }
.frame__corner--tr{ top: max(14px, env(safe-area-inset-top)); right: max(58px, calc(env(safe-area-inset-right) + 58px)); }
.frame__corner--bl{ bottom: max(14px, env(safe-area-inset-bottom)); left: max(14px, env(safe-area-inset-left)); pointer-events: auto; }
.frame__corner--bl a{ color: var(--faint); text-decoration: none; }
.frame__corner--bl a:hover{ color: #fff; }

@media (max-width: 620px){
  .frame__corner--tr{ display: none; }
  .hud{ min-width: 214px; padding: 7px 11px 6px; }
  .sb__team{ flex-basis: 78px; font-size: 14px; }
  .sb__dots i{ width: 12px; height: 12px; }
  .sb__dots{ gap: 5px; }
}
/* the corner labels sit under the scoreboard on a narrow screen */
@media (max-width: 460px){
  .frame__corner--tl{ top: calc(max(12px, env(safe-area-inset-top)) + 4px); }
  .hud{ left: auto; right: auto; transform: none; margin-left: 50px; margin-right: 56px; top: max(12px, env(safe-area-inset-top)); left: 0; max-width: none; width: calc(100vw - 106px); min-width: 0; }
  .frame__corner--tl{ display: none; }
}
@media (max-height: 460px){
  .hud{ top: max(6px, env(safe-area-inset-top)); padding: 5px 10px 4px; gap: 3px; min-width: 200px; }
  .sb{ gap: 3px; }
  .hud__meta{ display: none; }
  .stage{ top: 18%; }
  .call{ font-size: clamp(40px, 11vw, 64px); }
  .hintline{ top: auto; bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px)); font-size: 15px; padding: 6px 14px; }
  .timer, .is-save .timer{ top: auto; bottom: max(68px, calc(env(safe-area-inset-bottom) + 58px)); }
  .is-save .hintline{ top: auto; bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px)); }
}
@media (prefers-reduced-motion: reduce){
  .sound-btn, .overlay, .alt-btn, .sb__dots i{ transition: none; }
  .role.is-on, .call.is-on, .why.is-on{ animation-duration: 1ms; animation-fill-mode: forwards; }
  .role.is-on, .call.is-on, .why.is-on{ opacity: 1; animation: none; }
}

/* the tip-jar and fullscreen badges stack under the sound button */
.opt-tipjar.opt-tipjar{ top: calc(max(12px, env(safe-area-inset-top)) + 48px); bottom: auto; transform: none; }
.opt-fs.opt-fs{ top: calc(max(12px, env(safe-area-inset-top)) + 100px); bottom: auto; transform: none; }
.opt-tipjar.opt-tipjar.tj-nudge{ animation: none; }

/* short landscape: a two-column card */
@media (orientation: landscape) and (max-height: 500px){
  html.tc .panel__title{ font-size: 34px; }
  html.tc .overlay .panel{ display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; text-align: left; align-items: center; width: min(100%, 700px); max-width: 700px; }
  html.tc .overlay .panel > .panel__eyebrow, html.tc .overlay .panel > .panel__title{ grid-column: 1; }
  html.tc .overlay .panel > .panel__text{ grid-column: 1; margin-bottom: 0; }
  html.tc .overlay .panel > .tag-row{ grid-column: 2; grid-row: 1; margin: 0 0 6px; justify-content: flex-start; }
  html.tc .overlay .panel > .play-btn{ grid-column: 2; grid-row: 2; margin: 0; max-width: none; }
  html.tc .overlay .panel > .alt-btn{ grid-column: 2; grid-row: 3; margin: 8px 0 0; justify-self: start; }
  html.tc .overlay .panel > .panel__keys{ grid-column: 2; grid-row: 4; margin: 8px 0 0; }
}
