/* ======================================================================================================
   Football (js/football.js): the match screen and its Play-tab card. Laid out from the reference in newgp/:
   score and radar top left, pause top right, the stick bottom left, PASS / SHOOT / THROUGH / SPRINT bottom right.
   ====================================================================================================== */
#football { position: fixed; inset: 0; z-index: 5; background: #0b1530; overflow: hidden; touch-action: none;
  user-select: none; -webkit-user-select: none; font-family: 'Nunito', system-ui, sans-serif; color: #fff;
  --pad: max(10px, env(safe-area-inset-left)); --padr: max(10px, env(safe-area-inset-right)); --padb: max(12px, env(safe-area-inset-bottom)); --padt: max(10px, env(safe-area-inset-top)); }
#football[hidden] { display: none; }
#fb-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fb-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fb-touch { position: absolute; inset: 0; }

/* top left: flag, code and goals either side of the clock; the radar under it */
.fb-top { position: absolute; left: var(--pad); top: var(--padt); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.fb-score { display: flex; align-items: stretch; height: 30px; border-radius: 8px; overflow: hidden; background: #0d1a3ce6; box-shadow: 0 3px 10px #0007; font-weight: 900; font-size: 14px; }
.fb-score .fb-t { display: flex; align-items: center; padding: 0 9px; letter-spacing: .5px; box-shadow: inset 0 -3px 0 var(--k); }
.fb-score b { display: grid; place-items: center; min-width: 26px; background: #ffffff1a; font-size: 16px; }
.fb-score i { display: grid; place-items: center; padding: 0 9px; font-style: normal; font-variant-numeric: tabular-nums; color: #0d1a3c; background: #f4f7ff; }
.fb-map { width: 158px; height: 102px; border-radius: 6px; border: 1.5px solid #ffffffb3; box-shadow: 0 3px 10px #0006; }

/* top centre: stamina, draining red while sprinting */
.fb-stamina { position: absolute; left: 50%; top: var(--padt); transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 5px 10px;
  border-radius: 8px; background: #0d1a3cd9; box-shadow: 0 3px 10px #0006; font-size: 11px; font-weight: 900; letter-spacing: .4px; pointer-events: none; --s: 1; }
.fb-stamina i { position: relative; width: 120px; height: 9px; border-radius: 5px; background: #ffffff26; overflow: hidden; }
.fb-stamina i::after { content: ''; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--s)); background: linear-gradient(90deg, #ffcf3f, #3fd63a); }
.fb-stamina.drain i::after { background: linear-gradient(90deg, #ff6a3d, #ffcf3f); }
.fb-stamina.low span { color: #ff8a5c; }
.fb-stamina.drain span::after { content: ' ▼'; color: #ff5a4a; }

/* top right: camera and pause */
.fb-icon { position: absolute; top: var(--padt); right: var(--padr); width: 40px; height: 40px; padding: 0; border-radius: 10px; border: 1.5px solid #ffffff66;
  background: #0d1a3cd9; display: grid; place-items: center; cursor: pointer; box-shadow: 0 3px 10px #0006; }
.fb-icon.cam { right: calc(var(--padr) + 48px); }
.fb-icon svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.fb-icon:active { transform: scale(.94); }

/* the stick: it appears under the thumb (a faint one waits bottom left). The thumb out past its ring sprints: the ring
   lights orange and SPRINT shows over it, until the thumb comes back inside */
.fb-stick { position: absolute; left: calc(var(--pad) + 78px); top: calc(100% - var(--padb) - 84px); width: 128px; height: 128px; margin: -64px 0 0 -64px; border-radius: 50%;
  background: radial-gradient(circle, #ffffff1f 0 40%, #0d1a3c66 41% 100%); border: 2px solid #ffffff55; pointer-events: none; opacity: .55; transition: opacity .15s; }
.fb-stick.live { opacity: 1; }
.fb-stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffffff, #c9d3e6 60%, #8a97b3); box-shadow: 0 4px 10px #0008; }
.fb-stick::before, .fb-stick::after { content: ''; position: absolute; left: 50%; top: 9px; margin-left: -6px; border: 6px solid transparent; border-bottom-color: #ffffffa0; border-top: 0; }
.fb-stick::after { top: auto; bottom: 9px; border-bottom: 0; border-top: 6px solid #ffffffa0; }
.fb-stick { transition: opacity .15s, border-color .12s, box-shadow .12s; }
.fb-stick b { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) scale(.8); padding: 3px 10px; border-radius: 999px;
  background: #ff7a1a; font: 900 11px 'Nunito', system-ui, sans-serif; letter-spacing: .8px; color: #fff; opacity: 0; transition: opacity .12s, transform .12s; white-space: nowrap; }
.fb-stick.sprint { border-color: #ff9a3d; box-shadow: 0 0 0 4px #ff7a1a66, 0 0 18px #ff7a1a88; }
.fb-stick.sprint b { opacity: 1; transform: translateX(-50%) scale(1); }
.fb-stick.sprint i { background: radial-gradient(circle at 40% 35%, #fff4e0, #ffb15c 60%, #e0731a); }

/* the buttons, bottom right: SHOOT the big one in the corner, PASS left of it, THROUGH above it (sprint is on the stick) */
.fb-btns { position: absolute; right: var(--padr); bottom: var(--padb); width: 196px; height: 186px; }
.fb-b[hidden] { display: none; }
.fb-b { position: absolute; display: grid; place-items: center; border-radius: 50%; border: 2.5px solid #ffffffcc; padding: 0; cursor: pointer; color: #fff;
  font: 900 12px 'Nunito', system-ui, sans-serif; letter-spacing: .5px; text-shadow: 0 1px 2px #0008; touch-action: none;
  box-shadow: 0 4px 0 var(--d), 0 8px 16px #0007, inset 0 2px 0 #ffffff55; transition: transform .08s, filter .15s, opacity .15s; }
.fb-b.down { transform: translateY(3px) scale(.95); box-shadow: 0 1px 0 var(--d), 0 4px 10px #0007, inset 0 2px 0 #ffffff55; filter: brightness(1.12); }
.fb-b.shoot { right: 0; bottom: 4px; width: 100px; height: 100px; font-size: 15px; background: radial-gradient(circle at 50% 30%, #ff8a3d, #d9480f 70%); --d: #7a2304; }
.fb-b.pass { right: 112px; bottom: 4px; width: 78px; height: 78px; font-size: 13px; background: radial-gradient(circle at 50% 30%, #4fb2ff, #1468c9 70%); --d: #083a77; }
.fb-b.through { right: 14px; bottom: 116px; width: 70px; height: 70px; background: radial-gradient(circle at 50% 30%, #4ad86a, #158a3a 70%); --d: #0a4a1f; }
.fb-b.shoot[hidden] + .fb-b.pass { right: 0; width: 100px; height: 100px; font-size: 15px; }   /* passing practice: PASS takes the big spot */
.fb-b.cooldown { filter: grayscale(.85) brightness(.75); }
.fb-b.cooldown::after { content: 'COOLDOWN'; position: absolute; top: 100%; margin-top: 3px; font-size: 9px; letter-spacing: .6px; color: #ffd28a; }

/* practice: the drill's name and its tallies in place of the score */
.fb-score .fb-mode { font-size: 12px; letter-spacing: .6px; }
.fb-score .fb-tally { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 44px; padding: 0 7px; background: #ffffff12;
  border-left: 1px solid #ffffff1f; font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums; }
.fb-score .fb-tally small { font-size: 8px; letter-spacing: .5px; color: #a3b6df; margin-bottom: 2px; }
.fb-score:has(.fb-tally) { height: 34px; }

/* the big words: GOAL!, SAVE!, KICK OFF, CORNER... */
.fb-banner { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; white-space: nowrap;
  font: italic 900 clamp(26px, 7vw, 54px)/1 'Nunito', system-ui, sans-serif; letter-spacing: 1px; color: #fff;
  -webkit-text-stroke: 1.5px #0d1a3c; text-shadow: 0 4px 0 #0d1a3c, 0 8px 24px #000a; }
.fb-banner.show { animation: fb-banner 1.6s cubic-bezier(.2, .8, .2, 1) forwards; }
.fb-banner.goal { font-size: clamp(48px, 15vw, 110px); color: #ffe14a; }
.fb-banner.goal.show { animation-duration: 3s; }
.fb-banner.bad { color: #ff6b6b; }
.fb-banner.good { color: #5cff8f; }
.fb-banner.skill, .fb-banner.cam { font-size: clamp(16px, 4vw, 26px); top: 62%; color: #9fe8ff; }
.fb-banner.foul { color: #ffd23f; }
.fb-banner.post { color: #ffffff; }
@keyframes fb-banner {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  22% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.96); }
}
.fb-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.fb-flash.show { animation: fb-flash .9s ease-out; }
.fb-flash.goal { background: radial-gradient(circle, #ffe14a55, #ffe14a00 70%); }
.fb-flash.bad { background: radial-gradient(circle, #ff3b3b44, #ff3b3b00 70%); }
@keyframes fb-flash { 0% { opacity: 1; } 100% { opacity: 0; } }

.fb-hint { position: absolute; left: 50%; bottom: calc(var(--padb) + 4px); transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; background: #0d1a3ccc;
  font-size: 12px; font-weight: 800; pointer-events: none; white-space: nowrap; }
.fb-hint:empty { display: none; }

#football .overlay { position: absolute; z-index: 6; }
#football .overlay h2 { font-size: 26px; }
.fb-final { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 12px; font-weight: 900; font-size: 18px; }
.fb-final b { font-size: 38px; padding: 0 12px; border-radius: 10px; background: #ffffff14; }
.fb-stats { width: 100%; border-collapse: collapse; font-size: 13px; }
.fb-stats td, .fb-stats th { padding: 5px 4px; border-top: 1px solid #ffffff14; }
.fb-stats td:first-child { text-align: left; } .fb-stats td:last-child { text-align: right; }
.fb-stats th { color: var(--muted, #a3b6df); font-weight: 800; text-align: center; }
.fb-reward { margin: 12px 0 0; font-weight: 900; font-size: 18px; color: #ffcd56; }
.fb-keys { font-size: 13px; line-height: 1.6; color: #d6e2ff; }

/* small landscape phones: everything a touch smaller */
@media (max-height: 430px) {
  .fb-map { width: 120px; height: 78px; }
  .fb-btns { transform: scale(.86); transform-origin: right bottom; }
  .fb-stick { transform: scale(.9); }
}
/* portrait: the radar is smaller and the stamina sits under the score */
@media (max-aspect-ratio: 1/1) {
  .fb-map { width: 120px; height: 78px; }
  .fb-stamina { top: calc(var(--padt) + 52px); left: auto; right: var(--padr); transform: none; }
  .fb-stamina i { width: 80px; }
}

/* ---------- the Play tab's football card ---------- */
.mcard.fbcard { flex-direction: column; align-items: stretch; gap: 12px; border-color: #1f8a43;
  background: repeating-linear-gradient(90deg, #ffffff07 0 26px, #0000 26px 52px), linear-gradient(120deg, #135f2c, #12324f); }
.fbc-top { display: flex; align-items: center; gap: 12px; }
.fbc-ball { font-size: 38px; font-style: normal; filter: drop-shadow(0 3px 4px #0007); }
.fbc-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fbc-levels .btn { flex-direction: column; gap: 0; min-height: 50px; }
.fbc-label { margin: 2px 0 -4px; font-size: 11px; font-weight: 900; letter-spacing: .6px; color: #bfe8cc; text-transform: uppercase; }
.fbc-practice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fbc-practice .btn { justify-content: flex-start; gap: 10px; min-height: 54px; text-align: left; background: #ffffff10; }
.fbc-practice .btn i { font-style: normal; font-size: 22px; }
.fbc-practice .btn span { display: flex; flex-direction: column; }
.fbc-practice .btn small { font-weight: 700; color: var(--muted); }

/* short landscape screens: the full-time card fits without scrolling */
@media (max-height: 500px) {
  #football .overlay { padding: 8px; }
  #football .overlay .card { padding: 12px 18px; width: min(460px, 100%); }
  #football .overlay h2 { font-size: 20px; margin-bottom: 2px; }
  .fb-final { margin: 2px 0 6px; } .fb-final b { font-size: 28px; }
  .fb-stats { font-size: 12px; } .fb-stats td, .fb-stats th { padding: 2px 4px; }
  .fb-reward { margin-top: 6px; font-size: 16px; }
  #football .overlay .acts { margin-top: 10px; }
  #football .overlay .btn.big { min-height: 42px; padding: 8px 20px; }
}
