/* Football Touchdown: HUD over a full-screen WebGL canvas. Touch first (iPad Safari).
   All type >= 20px. Visual layers never take pointer events; only buttons do. */
:root {
  --msu: #18453b; --msu-2: #0f2e27; --msu-hi: #2f7d68; --white: #ffffff;
  --mich: #00274c; --maize: #ffcb05;
  --ink: #0d1a16; --panel: rgba(9, 22, 18, .86); --panel-solid: #0f241e; --line: rgba(255, 255, 255, .16);
  --good: #4ade80; --warn: #fbbf24; --bad: #f87171;
  --font: "Avenir Next Condensed", "Avenir Next", "Helvetica Neue", "Arial Narrow", Arial, system-ui, sans-serif;
}
html, body { margin: 0; height: 100%; background: #0b1d14; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; font-family: var(--font); color: var(--white); }
#game { position: absolute; inset: 0; display: block; width: 100vw; height: 100vh; height: 100dvh; touch-action: none; outline: none; }
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#hud * { box-sizing: border-box; }
#hud button, #start, #restart, #mute { pointer-events: auto; touch-action: manipulation; font-family: inherit; cursor: pointer; border: 0;
  -webkit-tap-highlight-color: transparent; min-width: 56px; min-height: 56px; color: inherit; }
#hud button:focus-visible, #start:focus-visible, #restart:focus-visible, #mute:focus-visible { outline: 4px solid var(--maize); outline-offset: 3px; }
#hud button:active { transform: translateY(2px) scale(.98); }
#finale-mount { position: absolute; inset: 0; z-index: 6; pointer-events: none; }

/* ---- Top bar: mute, scorebug, pause ---- */
.ft-top { position: absolute; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  top: max(10px, env(safe-area-inset-top)); display: grid; grid-template-columns: 76px 1fr 76px; align-items: start; gap: 10px; z-index: 3; }
.ft-iconbtn { width: 72px; height: 72px; border-radius: 22px; background: var(--panel); border: 2px solid var(--line) !important;
  display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.ft-iconbtn svg { width: 34px; height: 34px; fill: #fff; }
#mute[aria-pressed="true"] .snd-on, #mute[aria-pressed="false"] .snd-off { display: none; }
.ft-pause { display: flex !important; align-items: center; justify-content: center; }
.ft-pause i { display: inline-block; width: 11px; height: 30px; margin: 0 4px; border-radius: 4px; background: #fff; }
.ft-center { justify-self: center; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.ft-bug { display: flex; align-items: stretch; border-radius: 18px; overflow: hidden; box-shadow: 0 8px 22px rgba(0,0,0,.4);
  font-variant-numeric: tabular-nums; border: 2px solid rgba(255,255,255,.22); }
.ft-team { display: flex; align-items: center; gap: 10px; padding: 6px 14px; min-width: 128px; justify-content: space-between; }
.ft-team b { font-size: 22px; letter-spacing: .06em; font-weight: 800; }
.ft-team span { font-size: 38px; font-weight: 900; line-height: 1; }
.ft-team.msu { background: var(--msu); color: #fff; }
.ft-team.mich { background: var(--mich); color: var(--maize); flex-direction: row-reverse; }
.ft-team .ball { width: 20px; height: 13px; border-radius: 50%; background: #8a4b22; box-shadow: inset 0 0 0 2px #5b2d10; opacity: 0;
  position: relative; transition: opacity .25s; }
.ft-team .ball::after { content: ""; position: absolute; left: 5px; right: 5px; top: 5px; height: 2px; background: #fff; border-radius: 2px; }
.ft-team.has .ball { opacity: 1; }
.ft-clock { background: #0b0f0e; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 14px; min-width: 108px; }
.ft-clock b { font-size: 21px; font-weight: 800; color: #cfe3da; letter-spacing: .08em; }
.ft-clock span { font-size: 30px; font-weight: 900; line-height: 1.05; }
.ft-down { background: var(--panel); border-radius: 14px; padding: 6px 16px; font-size: 23px; font-weight: 800; letter-spacing: .02em;
  border: 2px solid var(--line); white-space: nowrap; box-shadow: 0 6px 16px rgba(0,0,0,.3); }
.ft-down em { font-style: normal; color: var(--maize); }
.ft-down:empty { display: none; }

/* ---- Prompt, banner ---- */
.ft-prompt { position: absolute; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px);
  background: var(--panel); border: 2px solid var(--line); border-radius: 20px; padding: 12px 26px; font-size: 28px; font-weight: 800;
  white-space: nowrap; opacity: 0; transition: opacity .25s, transform .25s; box-shadow: 0 8px 22px rgba(0,0,0,.35); z-index: 2; }
.ft-prompt.show { opacity: 1; transform: translate(-50%, 0); }
.ft-prompt.low { bottom: calc(28px + env(safe-area-inset-bottom)); }
.ft-banner { position: absolute; left: 50%; top: 32%; transform: translate(-50%, -50%) scale(.85); text-align: center; opacity: 0;
  transition: opacity .25s, transform .25s; z-index: 2; pointer-events: none; }
.ft-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ft-banner b { display: inline-block; font-size: clamp(40px, 8vw, 76px); font-weight: 900; letter-spacing: .02em; padding: 6px 30px;
  border-radius: 18px; background: var(--msu); color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); box-shadow: 0 10px 30px rgba(0,0,0,.35);
  white-space: nowrap; transform: skew(-6deg); }
.ft-banner.mich b { background: var(--mich); color: var(--maize); }
.ft-banner.plain b { background: rgba(10,20,16,.85); }
.ft-banner small { display: block; margin-top: 10px; font-size: 26px; font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,.8); }

/* ---- Receiver markers, catch ring, catch spot ---- */
.ft-layer { position: absolute; inset: 0; pointer-events: none; }
.ft-mark { position: absolute; width: 74px; height: 74px; margin: -37px 0 0 -37px; border-radius: 50%; display: grid; place-items: center;
  font-size: 34px; font-weight: 900; color: #08170f; background: var(--good); border: 4px solid #fff; box-shadow: 0 0 0 4px rgba(74,222,128,.35), 0 6px 18px rgba(0,0,0,.4);
  animation: ft-pulse 1.1s ease-in-out infinite; }
.ft-mark.covered { background: var(--warn); box-shadow: 0 0 0 4px rgba(251,191,36,.35), 0 6px 18px rgba(0,0,0,.4); }
.ft-mark small { position: absolute; top: 76px; font-size: 20px; color: #fff; background: rgba(0,0,0,.6); padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
@keyframes ft-pulse { 50% { transform: scale(1.08); } }
.ft-ring { position: absolute; border-radius: 50%; border: 8px solid rgba(255,255,255,.95); box-shadow: 0 0 0 3px rgba(0,0,0,.35), inset 0 0 0 3px rgba(0,0,0,.25);
  display: grid; place-items: center; transform: translate(-50%, -50%); }
.ft-ring b { font-size: 30px; font-weight: 900; text-shadow: 0 2px 6px rgba(0,0,0,.8); opacity: 0; }
.ft-ring.open { border-color: var(--good); box-shadow: 0 0 0 4px rgba(0,0,0,.3), 0 0 30px rgba(74,222,128,.8); }
.ft-ring.open b { opacity: 1; }
.ft-ring.covered:not(.open) { border-color: var(--warn); }
.ft-ring.tapped { border-color: #fff; background: rgba(74,222,128,.35); }
.ft-ring.locked { border-color: var(--bad); }

/* ---- Joystick ---- */
.ft-joy { position: absolute; width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%; border: 4px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.12); display: none; }
.ft-joy.show { display: block; }
.ft-knob { position: absolute; width: 74px; height: 74px; margin: -37px 0 0 -37px; border-radius: 50%; background: rgba(255,255,255,.92);
  box-shadow: 0 4px 14px rgba(0,0,0,.4); display: none; }
.ft-knob.show { display: block; }
.ft-ghost { position: absolute; left: max(40px, env(safe-area-inset-left)); bottom: calc(40px + env(safe-area-inset-bottom)); width: 150px; height: 150px;
  border-radius: 50%; border: 4px dashed rgba(255,255,255,.75); display: none; place-items: center; animation: ft-ghost 1.6s ease-in-out infinite; }
.ft-ghost.show { display: grid; }
.ft-ghost::after { content: ""; width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.75); animation: ft-ghost-knob 1.6s ease-in-out infinite; }
@keyframes ft-ghost { 50% { opacity: .55; } }
@keyframes ft-ghost-knob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-34px); } }

/* ---- Play picker and choice cards ---- */
.ft-picker { position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 14px;
  width: min(96vw, 760px); z-index: 3; }
.ft-picker[hidden], .ft-pat[hidden], .ft-meter[hidden], .ft-cut[hidden], .ft-skip[hidden] { display: none !important; }
.ft-play { flex: 1; min-height: 116px; border-radius: 24px; background: var(--panel-solid) !important; border: 3px solid rgba(255,255,255,.25) !important;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative; overflow: hidden;
  box-shadow: 0 8px 22px rgba(0,0,0,.4); padding: 8px 6px; }
.ft-play svg { width: 64px; height: 36px; stroke: #fff; fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.ft-play b { font-size: 27px; font-weight: 900; letter-spacing: .02em; }
.ft-play small { font-size: 20px; color: #bcd6cb; font-weight: 700; }
.ft-play.def { background: var(--msu) !important; border-color: var(--maize) !important; box-shadow: 0 0 0 4px rgba(255,203,5,.35), 0 8px 22px rgba(0,0,0,.4); }
.ft-play.def small { font-size: 0; }
.ft-play.def small::after { content: "Suggested"; font-size: 20px; color: var(--maize); font-weight: 800; }
.ft-play .bar { position: absolute; left: 0; bottom: 0; height: 8px; width: 0; background: var(--maize); }
.ft-play kbd { position: absolute; top: 8px; left: 12px; font: 800 20px var(--font); color: rgba(255,255,255,.5); }
.ft-pat { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4,12,9,.45); pointer-events: auto; z-index: 4; padding: 16px; }
.ft-pat .card { background: var(--panel-solid); border-radius: 30px; padding: 22px; width: min(94vw, 640px); text-align: center; border: 3px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.ft-pat h2 { margin: 0 0 4px; font-size: 44px; font-weight: 900; }
.ft-pat p { margin: 0 0 16px; font-size: 22px; color: #cfe3da; }
.ft-pat .row { display: flex; gap: 14px; }
.ft-choice { flex: 1; min-height: 168px; border-radius: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px; }
.ft-choice.kick { background: var(--msu) !important; border: 3px solid #fff !important; }
.ft-choice.two { background: #1f3a33 !important; border: 3px solid rgba(255,255,255,.35) !important; }
.ft-choice b { font-size: 36px; font-weight: 900; }
.ft-choice em { font-style: normal; font-size: 44px; font-weight: 900; color: var(--maize); line-height: 1; }
.ft-choice small { font-size: 21px; color: #e3efe9; font-weight: 700; }
.ft-pat .bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); margin-top: 14px; overflow: hidden; }
.ft-pat .bar i { display: block; height: 100%; width: 0; background: var(--maize); }

/* ---- Kick meter ---- */
.ft-meter { position: absolute; left: 50%; bottom: calc(40px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(92vw, 620px);
  background: var(--panel); border: 2px solid var(--line); border-radius: 26px; padding: 14px 22px 20px; text-align: center; z-index: 3;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.ft-meter b { display: block; font-size: 28px; font-weight: 900; }
.ft-meter small { display: block; font-size: 21px; color: #cfe3da; margin: 2px 0 12px; font-weight: 700; }
.ft-meter .track { position: relative; height: 54px; border-radius: 16px; background: linear-gradient(90deg, #7f1d1d, #b45309 30%, #b45309 70%, #7f1d1d); overflow: hidden; }
.ft-meter .green { position: absolute; top: 0; bottom: 0; background: #16a34a; box-shadow: inset 0 0 0 3px rgba(255,255,255,.55); }
.ft-meter .needle { position: absolute; top: -4px; bottom: -4px; width: 12px; margin-left: -6px; border-radius: 6px; background: #fff; box-shadow: 0 0 0 3px #000; }
.ft-meter.hit .needle { background: var(--maize); }

/* ---- Michigan's drive cutaway ---- */
.ft-cut { position: absolute; left: 50%; top: calc(150px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; flex-direction: column;
  align-items: center; gap: 10px; z-index: 2; }
.ft-cut .chip { background: var(--mich); color: var(--maize); border-radius: 16px; padding: 8px 22px; font-size: 26px; font-weight: 900; letter-spacing: .06em;
  text-transform: uppercase; border: 3px solid var(--maize); box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.ft-cut .cap { background: var(--panel); border-radius: 16px; padding: 8px 20px; font-size: 25px; font-weight: 800; border: 2px solid var(--line); white-space: nowrap; }
.ft-cut .cap:empty { display: none; }
/* Review fix: top right under Pause, away from the right thumb's resting spot. */
.ft-skip { position: absolute; right: max(12px, env(safe-area-inset-right)); top: calc(96px + env(safe-area-inset-top)); min-width: 150px !important; min-height: 72px !important;
  border-radius: 22px; background: var(--panel) !important; border: 2px solid var(--line) !important; font-size: 26px; font-weight: 900; z-index: 3; }

/* ---- Panels: title, pause, controls, halftime, loss ---- */
.ft-overlay { position: absolute; inset: 0; display: none; place-items: center; padding: 16px; pointer-events: auto; z-index: 5;
  background: radial-gradient(circle at 50% 40%, rgba(24,69,59,.55), rgba(4,12,9,.82)); }
.ft-overlay.show { display: grid; }
.ft-overlay.clear { background: rgba(4,12,9,.35); }
.ft-panel { background: var(--panel-solid); border-radius: 34px; padding: 28px 30px; width: min(94vw, 600px); text-align: center; border: 3px solid var(--line);
  box-shadow: 0 24px 70px rgba(0,0,0,.55); max-height: calc(100dvh - 32px); overflow: auto; }
.ft-panel h1 { margin: 0; font-size: clamp(48px, 9vw, 78px); line-height: .95; font-weight: 900; letter-spacing: .01em; text-transform: uppercase; }
.ft-panel h1 span { color: var(--maize); display: block; }
.ft-panel h2 { margin: 0 0 10px; font-size: 42px; font-weight: 900; }
.ft-panel p { margin: 8px 0; font-size: 22px; line-height: 1.35; color: #dbe9e2; }
.ft-panel .vs { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 6px; font-size: 26px; font-weight: 900; }
.ft-panel .vs .t { padding: 6px 16px; border-radius: 12px; }
.ft-panel .vs .t.msu { background: var(--msu); border: 2px solid #fff; }
.ft-panel .vs .t.mich { background: var(--mich); color: var(--maize); border: 2px solid var(--maize); }
.ft-panel ul { list-style: none; padding: 0; margin: 14px 0; text-align: left; display: grid; gap: 10px; }
.ft-panel li { font-size: 22px; line-height: 1.3; display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: baseline; }
.ft-panel li b { color: var(--maize); font-weight: 900; }
.ft-panel .keys { font-size: 20px; color: #9fbcb0; }
.ft-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
.ft-btn { min-height: 76px !important; padding: 0 34px; border-radius: 24px; font-size: 30px; font-weight: 900; background: var(--msu) !important;
  border: 3px solid #fff !important; box-shadow: 0 8px 0 var(--msu-2); }
.ft-btn.alt { background: #233d36 !important; border-color: rgba(255,255,255,.35) !important; box-shadow: 0 8px 0 #0b1a16; }
.ft-btn.wide { min-width: min(100%, 360px); }
.ft-seg { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.ft-seg button { min-height: 64px !important; padding: 0 20px; border-radius: 18px; font-size: 24px; font-weight: 900; background: #233d36 !important;
  border: 3px solid rgba(255,255,255,.25) !important; }
.ft-seg button[aria-pressed="true"] { background: var(--maize) !important; color: var(--ink) !important; border-color: #fff !important; }
.ft-label { font-size: 20px !important; letter-spacing: .1em; text-transform: uppercase; color: #9fbcb0 !important; margin-top: 18px !important; font-weight: 800; }
.ft-panel .ft-diff { font-size: 22px; margin-top: 4px; }
.ft-panel .ft-diff b { color: var(--maize); }
.ft-panel .ft-diff span { color: #9fbcb0; }
.ft-score { font-size: 36px; font-weight: 900; margin: 10px 0; font-variant-numeric: tabular-nums; }
.ft-score .m { color: #fff; } .ft-score .w { color: var(--maize); }

/* ---- Ripple on touch ---- */
.ft-ripple { position: absolute; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; border: 5px solid rgba(255,255,255,.9);
  box-shadow: 0 0 0 3px rgba(0,0,0,.25); pointer-events: none; animation: ft-ripple .45s ease-out forwards; }
@keyframes ft-ripple { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.15); opacity: 0; } }

.ft-hidden-ui .ft-top, .ft-hidden-ui .ft-prompt, .ft-hidden-ui .ft-picker, .ft-hidden-ui .ft-cut, .ft-hidden-ui .ft-skip, .ft-hidden-ui .ft-banner { display: none !important; }

@media (max-width: 720px) {
  .ft-top { grid-template-columns: 64px 1fr 64px; gap: 6px; }
  .ft-iconbtn { width: 64px; height: 64px; }
  .ft-team { min-width: 0; padding: 6px 10px; gap: 6px; }
  .ft-team b { font-size: 20px; } .ft-team span { font-size: 30px; }
  .ft-clock { min-width: 84px; padding: 4px 8px; } .ft-clock span { font-size: 24px; }
  .ft-down { font-size: 20px; }
  .ft-prompt { font-size: 23px; padding: 10px 18px; bottom: calc(140px + env(safe-area-inset-bottom)); }
  .ft-panel li { grid-template-columns: 1fr; gap: 2px; }
  .ft-cut { top: calc(140px + env(safe-area-inset-top)); }
  .ft-cut .cap { white-space: normal; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { .ft-mark, .ft-ghost, .ft-ghost::after { animation: none; } }
