/* Comeback Kings (football) */
:root { --page-tint: var(--grass-dark); }
#app { max-width: 980px; margin: 0 auto; padding: 14px 14px 40px; }

/* ---------- Menu ---------- */
.hero { text-align: center; padding: 18px 8px 8px; position: relative; }
.hero h1 {
  font-family: var(--display); font-size: clamp(2.6rem, 9vw, 4.6rem);
  text-transform: uppercase; letter-spacing: 2px; margin: 6px 0;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .35);
}
.hero h1 span { color: var(--gold); }
.hero-sub { color: var(--muted); max-width: 520px; margin: 0 auto 6px; line-height: 1.45; }
.hero-date { font-weight: 700; letter-spacing: 1px; text-transform: uppercase; font-size: .85rem; color: var(--gold); }
.hero-board {
  display: inline-flex; flex-direction: column; align-items: center;
  background: #111; border: 3px solid #333; border-radius: 8px; padding: 4px 14px 2px;
  box-shadow: 0 0 0 2px #000, var(--shadow);
  animation: board-up 1.4s ease-in-out infinite alternate;
}
.hero-board-label { font-size: .6rem; letter-spacing: 2px; text-transform: uppercase; color: #aaa; }
.hero-board-num { font-family: 'Courier New', monospace; font-weight: 700; font-size: 2rem; color: #ff3b3b; text-shadow: 0 0 10px #ff3b3b; }
@keyframes board-up { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-6px) rotate(2deg); } }

.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.mode-card {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  border-radius: var(--radius); border: 2px solid rgba(255, 255, 255, .1);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .04) 0 26px, transparent 26px 52px),
    linear-gradient(160deg, #2f7d2a, #1f5a1c);
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
  position: relative; overflow: hidden;
}
.mode-card::after {
  content: ''; position: absolute; right: -40px; top: 50%; width: 110px; height: 110px;
  border: 3px solid rgba(255, 255, 255, .15); border-radius: 50%; transform: translateY(-50%);
}
@media (hover: hover) and (pointer: fine) { .mode-card:hover { transform: translateY(-3px); border-color: var(--gold); } }
.mode-card.cup { background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .04) 0 26px, transparent 26px 52px), linear-gradient(160deg, #6b4d10, #3d2a05); }
.mode-card.practice { background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .04) 0 26px, transparent 26px 52px), linear-gradient(160deg, #24496f, #142c47); }
.mode-card.played { opacity: .85; }
.mode-tag { font-size: .7rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.mode-title { font-family: var(--display); font-size: 1.7rem; letter-spacing: 1px; text-transform: uppercase; }
.mode-teaser { color: #dce6f2; font-size: .92rem; line-height: 1.4; min-height: 2.8em; }
.mode-status { margin-top: auto; font-weight: 700; color: var(--gold); }

.league-strip {
  font: inherit; color: inherit; cursor: pointer; width: 100%; margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--panel); border: 2px solid rgba(255, 255, 255, .1);
}
@media (hover: hover) and (pointer: fine) { .league-strip:hover { border-color: var(--gold); } }
.league-strip span:first-child { font-weight: 700; }
.league-strip span:nth-child(2) { color: var(--muted); flex: 1; text-align: right; }

/* ---------- Scoreboard ---------- */
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: stretch;
  background: linear-gradient(180deg, #1d1d2b, #0e0e18); border-radius: 10px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, .12);
  font-weight: 800; letter-spacing: 1px;
}
.sb-team { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 1.15rem; }
.sb-team.opp { justify-content: flex-end; }
.sb-badge { width: 26px; height: 26px; border-radius: 6px 6px 50% 50%; border: 2px solid #fff; flex: none; }
.sb-score {
  background: var(--chalk); color: #111; padding: 6px 16px; font-size: 1.6rem;
  display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums;
}
.sb-score span { transition: transform .3s; display: inline-block; }
.sb-dash { opacity: .4; }
.sb-clock {
  background: var(--gold); color: #111; padding: 8px 12px; display: flex; align-items: center;
  font-variant-numeric: tabular-nums; font-size: 1.05rem;
}
.sb-clock.late { background: var(--bad); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { filter: brightness(1.3); } }

.match-info {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 2px; color: var(--muted); font-size: .9rem;
}
.attack-track { display: flex; gap: 8px; }
.attack-chip { display: inline-flex; gap: 3px; padding: 4px 6px; border-radius: 6px; background: rgba(0, 0, 0, .3); border: 1px solid transparent; }
.attack-chip.active { border-color: var(--gold); }
.attack-chip i { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .18); display: block; }
.attack-chip i.ok { background: var(--good); }
.attack-chip i.goal { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.attack-chip i.bad { background: var(--bad); }
.attack-chip i.now { background: #fff; animation: pulse 1s infinite; }

/* ---------- Pitch ---------- */
.pitch-wrap, .goal-wrap {
  position: relative; border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow); border: 4px solid #1b4d18; background: #2f7d2a;
}
#pitch, #goal-view { display: block; width: 100%; height: auto; }
.player, .ball { transition: transform .7s cubic-bezier(.4, .1, .3, 1); }
.ball.kick { transition-duration: .6s; }
.ball.shot { transition: transform .45s cubic-bezier(.2, .7, .3, 1); }
svg.instant .player, svg.instant .ball { transition: none !important; }
.player-inner, .ball-inner { transform-box: fill-box; transform-origin: center bottom; }
.ball .ball-inner { transform-origin: center; }
.ball.kick .ball-inner, .ball.shot .ball-inner { animation: spin .5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player.celebrate .player-inner { animation: jump .45s ease-in-out infinite alternate; }
@keyframes jump { to { transform: translateY(-8px); } }
.player.sad .player-inner { animation: slump .6s forwards; }
@keyframes slump { to { transform: rotate(-12deg) translateY(2px); opacity: .85; } }
.player.keeper.dive .player-inner { animation: dive-down .4s forwards; }
@keyframes dive-down { to { transform: rotate(-75deg); } }
#target-goal.ripple, #goal-view.ripple #goal-frame { animation: net 0.5s ease-in-out 2; transform-box: fill-box; transform-origin: center; }
@keyframes net { 25% { transform: scale(1.06, .94); } 75% { transform: scale(.96, 1.04); } }

/* penalty keeper dives */
#pen-keeper.dive-left .player-inner { animation: dive-l .4s forwards; }
#pen-keeper.dive-right .player-inner { animation: dive-r .4s forwards; }
#pen-keeper.dive-centre .player-inner { animation: jump .25s ease-out 1 forwards; }
@keyframes dive-l { to { transform: rotate(-75deg); } }
@keyframes dive-r { to { transform: rotate(75deg); } }

.pitch-banner {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(5, 15, 30, .55); text-align: center; padding: 10px; pointer-events: none;
}
.pitch-banner.pop > * { animation: pop .35s ease-out both; }
.pitch-banner.pop > *:nth-child(2) { animation-delay: .1s; }
.pitch-banner.pop > *:nth-child(3) { animation-delay: .2s; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bn-big {
  font-family: var(--display); font-size: clamp(3rem, 12vw, 6rem); color: #ff3b3b; letter-spacing: 3px;
  text-shadow: 0 0 18px rgba(255, 59, 59, .7); line-height: 1;
}
.bn-big.sm { font-size: clamp(2rem, 7vw, 3.4rem); color: var(--chalk); text-shadow: 0 3px 0 rgba(0, 0, 0, .4); }
.bn-big.good { color: var(--gold); }
.bn-big.bad { color: #ff7a7a; }
.bn-small { font-weight: 700; font-size: clamp(.9rem, 2.6vw, 1.15rem); margin: 6px 0; }

/* ---------- Questions ---------- */
.question-panel {
  margin-top: 12px; background: var(--panel); border-radius: var(--radius); padding: 16px;
  border: 1px solid rgba(255, 255, 255, .1); box-shadow: var(--shadow);
  transition: opacity .3s, filter .3s;
}
.question-panel.dim { opacity: .35; filter: grayscale(.6); pointer-events: none; }
.q-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.q-stage { color: var(--gold); }
.q-cat { color: var(--muted); }
.timer { height: 6px; background: rgba(255, 255, 255, .12); border-radius: 3px; overflow: hidden; margin: 10px 0 4px; }
.timer-fill { height: 100%; width: 100%; background: var(--good); }
.timer-fill.warn { background: var(--bad); }
.q-text { font-size: clamp(1.05rem, 2.8vw, 1.3rem); font-weight: 700; line-height: 1.35; margin: 10px 0 14px; min-height: 2.7em; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .answers { grid-template-columns: 1fr; } }
.answer {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--panel-2); border: 2px solid rgba(255, 255, 255, .12);
  transition: transform .1s, border-color .15s, background .2s;
}
/* .fresh = new question just drawn: no hover glow until the mouse actually moves,
   so the button under a resting cursor doesn't look pre-selected */
@media (hover: hover) and (pointer: fine) { .answers:not(.fresh) .answer:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); } }
.answer:disabled { cursor: default; }
.answer-key {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .12); font-size: .8rem; font-weight: 800;
}
.answer.correct { background: #166534; border-color: var(--good); animation: pop .3s; }
.answer.wrong { background: #7f1d1d; border-color: var(--bad); animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
#overlay-goal { background: radial-gradient(circle, rgba(255, 210, 63, .35), rgba(5, 15, 30, .75) 70%); }
.goal-text {
  font-family: var(--display); font-size: clamp(5rem, 22vw, 12rem); color: var(--gold); letter-spacing: 6px;
  text-shadow: 0 6px 0 #a07800, 0 0 40px rgba(255, 210, 63, .8);
  animation: goal-zoom .6s cubic-bezier(.2, 1.6, .4, 1) both, goal-wobble 1s .6s ease-in-out infinite;
}
.goal-sub { font-size: clamp(1.1rem, 4vw, 1.8rem); font-weight: 800; animation: pop .4s .4s both; }
@keyframes goal-zoom { from { transform: scale(.2) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes goal-wobble { 50% { transform: scale(1.06) rotate(2deg); } }

#overlay-miss { background: rgba(60, 5, 5, .55); }
.miss-card {
  background: var(--panel); border-radius: var(--radius); padding: 20px 28px; text-align: center;
  box-shadow: var(--shadow); border: 2px solid var(--bad); animation: pop .35s both; max-width: 90vw;
}
.sad-player { width: 110px; height: 146px; }
.sad-head { transform-box: fill-box; transform-origin: center bottom; animation: head-shake .5s ease-in-out infinite alternate; }
@keyframes head-shake { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.tear { animation: tear 1s ease-in infinite; }
@keyframes tear { from { transform: translateY(0); opacity: 1; } to { transform: translateY(14px); opacity: 0; } }
.miss-title { font-family: var(--display); font-size: 2rem; letter-spacing: 1px; text-transform: uppercase; color: #ff7a7a; }
.miss-sub { color: #dce6f2; margin-top: 6px; line-height: 1.4; }
.miss-ans { color: var(--gold); font-weight: 700; }

/* ---------- Penalties ---------- */
.pens-head { text-align: center; margin-bottom: 12px; }
.pens-head h2 { font-family: var(--display); text-transform: uppercase; letter-spacing: 2px; color: var(--gold); margin: 4px 0 10px; font-size: 2rem; }
.pens-tally { display: inline-flex; flex-direction: column; gap: 6px; background: rgba(0, 0, 0, .3); padding: 10px 16px; border-radius: 10px; }
.pens-row { display: flex; align-items: center; gap: 12px; }
.pens-name { width: 44px; font-weight: 800; text-align: left; }
.pens-total { width: 24px; font-weight: 800; font-size: 1.2rem; color: var(--gold); }
.pens-dots { display: flex; gap: 6px; }
.pens-dots i {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35);
  display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: .75rem;
}
.pens-dots i.ok { background: var(--good); border-color: var(--good); color: #fff; }
.pens-dots i.bad { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ---------- Result ---------- */
.result-card {
  margin: 20px auto; max-width: 560px; text-align: center; padding: 28px 22px;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 2px solid rgba(255, 255, 255, .12);
}
.result-card.res-W { border-color: var(--gold); background: linear-gradient(180deg, #2b4a1a, var(--panel) 60%); }
.result-card.res-L { border-color: rgba(239, 68, 68, .6); }
.result-icon { font-size: 4.5rem; animation: goal-zoom .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.res-W .result-icon { animation: goal-zoom .6s cubic-bezier(.2, 1.6, .4, 1) both, trophy 1.4s .6s ease-in-out infinite; }
@keyframes trophy { 50% { transform: translateY(-8px) rotate(-6deg); filter: drop-shadow(0 0 16px var(--gold)); } }
.result-title { font-family: var(--display); font-size: clamp(2rem, 7vw, 3rem); text-transform: uppercase; letter-spacing: 1px; margin: 8px 0; }
.res-W .result-title { color: var(--gold); }
.result-score { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.result-score span { font-size: 1.1rem; color: var(--muted); vertical-align: middle; }
.result-sub { color: #dce6f2; }
.result-grid { font-size: 1.5rem; line-height: 1.3; margin: 14px 0; font-family: inherit; white-space: pre-wrap; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.result-next { color: var(--muted); font-size: .9rem; margin-top: 16px; }

/* ---------- League ---------- */
.league-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.league-head h2 { font-family: var(--display); text-transform: uppercase; letter-spacing: 1px; margin: 0; color: var(--gold); font-size: 1.8rem; }
.league-setup {
  background: var(--panel); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px;
  max-width: 560px; border: 1px solid rgba(255, 255, 255, .1);
}
.league-setup p { margin: 0; line-height: 1.5; color: #dce6f2; }
.league-setup label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.league-setup input:not([type=radio]) {
  font: inherit; padding: 10px 12px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .15);
  background: var(--night); color: var(--chalk);
}
.league-setup input:focus { outline: none; border-color: var(--gold); }
.league-setup fieldset { border: 1px solid rgba(255, 255, 255, .15); border-radius: 8px; padding: 10px 14px; }
.league-setup legend { font-weight: 700; padding: 0 6px; }
.league-setup label.radio { flex-direction: row; align-items: center; font-weight: 400; gap: 8px; padding: 4px 0; }
.league-setup .btn { align-self: flex-start; }

.league-meta { color: var(--muted); margin-bottom: 10px; }
.league-banner { background: linear-gradient(90deg, #6b4d10, #a07800); padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; font-size: 1.1rem; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.league-table { width: 100%; border-collapse: collapse; background: var(--panel); font-variant-numeric: tabular-nums; }
.league-table th, .league-table td { padding: 10px 8px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, .06); white-space: nowrap; }
.league-table th { background: #0e2238; font-size: .75rem; letter-spacing: 1px; color: var(--muted); }
.league-table .l { text-align: left; }
.league-table tr.top td:first-child { color: var(--gold); font-weight: 800; }
.league-table tr.you { background: rgba(255, 210, 63, .12); }
.league-table tr.you td { font-weight: 700; }
.league-table em { color: var(--gold); font-style: normal; font-size: .8rem; }
.league-table tbody tr:nth-child(4) td { border-bottom: 2px solid rgba(34, 197, 94, .5); }
.league-table tbody tr:nth-last-child(2) td { border-bottom: 2px solid rgba(239, 68, 68, .45); }
.form-col i { display: inline-block; width: 18px; height: 18px; line-height: 18px; border-radius: 4px; font-size: .65rem; font-style: normal; margin: 0 1px; font-weight: 800; }
.f-W { background: var(--good); } .f-D { background: #94a3b8; color: #111; } .f-L { background: var(--bad); } .f-n { background: #334155; }
@media (max-width: 560px) { .form-col { display: none; } .sb-team { font-size: .95rem; padding: 6px 8px; } .sb-score { font-size: 1.3rem; padding: 6px 10px; } }
.league-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

/* ---------- Replay / reset (in How to play) ---------- */
.help-tools { margin-top: 18px; border-top: 1px solid rgba(255, 255, 255, .12); padding-top: 12px; }
.help-tools summary { cursor: pointer; color: var(--muted); font-weight: 700; font-size: .9rem; }
.help-tools-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Weekly theme ---------- */
.theme-banner {
  display: flex; align-items: center; gap: 14px; margin: 14px auto 0; max-width: 720px;
  padding: 12px 18px; border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 210, 63, .18), rgba(255, 210, 63, .04));
  border: 1px solid rgba(255, 210, 63, .45);
}
.theme-emoji { font-size: 2.2rem; }
.theme-banner > div { display: flex; flex-direction: column; gap: 2px; }
.theme-label { font-size: .7rem; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.theme-title { font-size: 1.15rem; }
.theme-blurb { color: #dce6f2; font-size: .9rem; line-height: 1.4; }

/* ---------- Attack progress (keeper → goal) ---------- */
.steps { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.step {
  padding: 5px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  background: rgba(255, 255, 255, .08); color: var(--muted); border: 1px solid rgba(255, 255, 255, .12);
  transition: background .3s, color .3s;
}
.step.done { background: rgba(34, 197, 94, .25); color: #bbf7d0; border-color: var(--good); }
.step.done.goal { background: var(--gold); color: #111; border-color: var(--gold); }
.step.now { background: var(--chalk); color: #111; animation: pulse 1s infinite; }
.step.lost { background: rgba(239, 68, 68, .25); color: #fecaca; border-color: var(--bad); }
.step-arrow { color: var(--muted); font-weight: 800; }
@media (max-width: 560px) { .step { padding: 4px 7px; font-size: .66rem; } }

/* pass trail + player on the ball */
.trail { stroke: #ffd23f; stroke-width: 4; stroke-dasharray: 10 8; fill: none; opacity: .9; animation: trail-in .7s ease-out both; }
.trail.lost { stroke: #ef4444; }
.trail.shot { stroke: #fff; stroke-width: 5; }
@keyframes trail-in { from { opacity: 0; } to { opacity: .9; } }
.player .ring { opacity: 0; }
.player.on-ball .ring { opacity: 1; animation: ring 1s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes ring { to { transform: scale(1.25); } }

/* ---------- Topic picker ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.topic-btn, .club-btn {
  font: inherit; color: inherit; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; padding: 12px;
  border-radius: 10px; background: var(--panel-2); border: 2px solid rgba(255, 255, 255, .12);
}
@media (hover: hover) and (pointer: fine) { .topic-btn:hover, .club-btn:hover { border-color: var(--gold); } }
.topic-btn span { font-size: 1.5rem; }
.topic-btn em { font-style: normal; color: var(--muted); font-size: .8rem; }
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; max-height: 260px; overflow-y: auto; }
.club-btn { flex-direction: row; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; }
.club-btn .sb-badge { width: 20px; height: 20px; }
