/* World Cup 2026 sweepstake — mobile-first, legible on a phone. */
:root {
  --bg: #0f1724;
  --bg2: #14203a;
  --panel: #182441;
  --panel2: #1f2d52;
  --line: #2a3a63;
  --ink: #eaf0ff;
  --muted: #9fb0d6;
  --accent: #00c2a8;     /* pitch teal */
  --accent2: #ffd23f;    /* trophy gold */
  --green: #2ecc71;
  --amber: #f1a73a;
  --red: #ff5d6c;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2c52 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(15,23,36,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 12px; }
.ball { font-size: 30px; }
h1 { font-size: 19px; margin: 0; letter-spacing: .2px; }
#subtitle { margin: 0; font-size: 12.5px; color: var(--muted); }
.admin-toggle { background: var(--panel2); color: var(--ink); border: 1px solid var(--line); padding: 8px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.admin-toggle:hover { border-color: var(--accent); }
.mode-badge { display: none; background: var(--accent2); color: #2a2300; font-size: 12px; font-weight: 600; text-align: center; padding: 5px 10px; }

/* Tabs */
.tabs { display: flex; gap: 6px; padding-bottom: 10px; overflow-x: auto; }
.tab { background: transparent; border: none; color: var(--muted); padding: 8px 14px; border-radius: 999px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--accent); color: #00231e; font-weight: 600; }
.tab:hover:not(.active) { color: var(--ink); }

main { padding-top: 16px; padding-bottom: 40px; min-height: 60vh; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.muted { color: var(--muted); }

/* Round tabs (knockout) */
.round-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 12px; }
.round-tab { background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: 7px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.round-tab.active { background: var(--accent2); color: #2a2300; border-color: var(--accent2); font-weight: 600; }

/* Grids */
.grid { display: grid; gap: 12px; }
.ko-grid { grid-template-columns: 1fr; }
.group-grid { grid-template-columns: 1fr; }
.lb-grid { grid-template-columns: 1fr; }
.draw-grid { grid-template-columns: 1fr; }
@media (min-width: 620px) {
  .ko-grid { grid-template-columns: 1fr 1fr; }
  .group-grid { grid-template-columns: 1fr 1fr; }
  .lb-grid { grid-template-columns: 1fr 1fr; }
  .draw-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 920px) {
  .ko-grid { grid-template-columns: 1fr 1fr 1fr; }
  .group-grid { grid-template-columns: 1fr 1fr 1fr; }
  .lb-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }

/* Team chips */
.team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team .flag { font-size: 19px; line-height: 1; }
.team .tname { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team.placeholder { color: var(--muted); font-style: italic; font-size: 13px; }
.team.win .tname { font-weight: 700; }
.team.dim { opacity: .5; }
.owner { font-size: 11px; padding: 1px 7px; border-radius: 999px; color: #fff; font-weight: 600; white-space: nowrap; flex: none; }

/* Knockout cards */
.ko-card { display: flex; flex-direction: column; gap: 8px; }
.ko-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.ko-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; background: var(--bg2); border-radius: 9px; }
.ko-row .score { font-weight: 700; font-size: 16px; min-width: 18px; text-align: center; }
.pens { color: var(--accent2); font-weight: 600; }
.pwin { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1.5; background: var(--accent); color: #00231e; border-radius: 5px; padding: 0 5px; margin-left: 5px; white-space: nowrap; vertical-align: middle; }
.fxl-t.win .fxl-nm { font-weight: 700; }
.fxl-t.dim { opacity: .5; }

/* Grid / Wallchart toggle */
.ko-toggle-row { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.view-label { color: var(--muted); font-size: 13px; }
.ko-toggle { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg { background: transparent; border: none; color: var(--muted); padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.seg.on { background: var(--accent); color: #00231e; font-weight: 700; }

/* Bracket tree */
.bracket-wrap { }
.bracket-tree { position: relative; display: flex; gap: 34px; overflow-x: auto; padding: 4px 4px 16px; -webkit-overflow-scrolling: touch; }
.bk-lines { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 0; }
.bk-lines path { fill: none; stroke: var(--line); stroke-width: 2; }
.bk-round { display: flex; flex-direction: column; min-width: 188px; z-index: 1; }
.bk-round-title { text-align: center; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.bk-round-body { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 10px; }
.bk-match { position: relative; z-index: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.bk-team { display: flex; align-items: center; gap: 6px; padding: 6px 8px; font-size: 12.5px; }
.bk-team + .bk-team { border-top: 1px solid var(--line); }
.bk-team .flag { font-size: 15px; line-height: 1; }
.bk-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-name.ph { color: var(--muted); font-style: italic; }
.bk-owner { font-size: 9.5px; padding: 1px 6px; border-radius: 999px; color: #fff; font-weight: 600; white-space: nowrap; flex: none; }
.bk-score { font-weight: 700; min-width: 14px; text-align: center; white-space: nowrap; }
.bk-pen { color: var(--accent); font-weight: 700; font-size: 10px; margin-left: 2px; }
.bk-team.win { background: rgba(0,194,168,.13); }
.bk-team.win .bk-name { font-weight: 700; }
.bk-team.dim { opacity: .5; }
.bk-third { margin-top: 14px; max-width: 220px; }

/* Groups */
.group-card h3 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.live { font-size: 10px; background: var(--red); color: #fff; padding: 1px 6px; border-radius: 999px; }
.standings { width: 100%; border-collapse: collapse; font-size: 13px; }
.standings th { color: var(--muted); font-weight: 500; font-size: 11px; text-align: center; padding: 2px; }
.standings td { padding: 4px 2px; text-align: center; border-top: 1px solid var(--line); }
.standings td.tcell { text-align: left; width: 100%; }
.standings td.pos { color: var(--muted); }
.standings td.pts { font-weight: 700; }
.standings tr.q1 td.pos { color: var(--green); font-weight: 700; }
.standings tr.q1 { background: rgba(46,204,113,.08); }
.standings tr.q3 td.pos { color: var(--amber); font-weight: 700; }
.standings tr.q3 { background: rgba(241,167,58,.07); }
.fixtures { margin-top: 8px; }
.fixtures summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.fx { padding: 6px 0; }
.fx + .fx { border-top: 1px solid var(--line); }
.fxdt { color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.fxm { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.fxt { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxt.r { text-align: right; }
.fxs { color: var(--accent2); font-weight: 600; min-width: 30px; text-align: center; }

/* Fixtures list (full schedule) */
.fxl-day { margin-bottom: 14px; }
.fxl-day h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent2); margin: 0 0 6px; }
.fxl-row { padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; margin-bottom: 6px; }
.fxl-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.fxl-time { color: var(--muted); font-size: 11.5px; }
.fxl-tag { font-size: 10px; color: var(--muted); background: var(--bg2); padding: 1px 7px; border-radius: 999px; }
.fxl-match { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.fxl-side { flex: 1; min-width: 0; }
.fxl-side.r { text-align: right; }
.fxl-mid { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none; }
.fxl-sc { color: var(--accent2); font-weight: 700; min-width: 26px; text-align: center; }
.pwin-ghost { visibility: hidden; }
.fxl-t { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; vertical-align: bottom; }
.fxl-t .flag { font-size: 15px; line-height: 1; }
.fxl-nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fxl-tbd { color: var(--muted); font-style: italic; font-size: 12px; }

/* Leaderboard — prize hero banner */
.prize-hero { text-align: center; margin: 2px 0 18px; padding: 20px 16px; border: 1px solid rgba(255,210,63,.35); border-radius: 16px; background: linear-gradient(180deg, rgba(255,210,63,.12), rgba(255,210,63,.03)); }
.prize-label { font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--accent2); font-weight: 700; }
.prize-amt { font-size: 54px; line-height: 1.02; font-weight: 800; color: var(--accent2); margin: 4px 0 2px; letter-spacing: -1.5px; text-shadow: 0 2px 18px rgba(255,210,63,.25); }
.prize-split { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.prize-split span { display: inline-flex; align-items: center; gap: 5px; }
.prize-split b { color: var(--accent2); font-weight: 700; }

/* Leaderboard — winner banner (the finale) */
.winner-banner { text-align: center; padding: 22px 18px 24px; margin: 2px 0 16px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,210,63,.22), rgba(255,210,63,.04) 62%);
  border: 1px solid rgba(255,210,63,.5); animation: winnerGlow 2.6s ease-in-out infinite; }
@keyframes winnerGlow { 0%, 100% { box-shadow: 0 0 26px rgba(255,210,63,.12); } 50% { box-shadow: 0 0 48px rgba(255,210,63,.32); } }
.winner-confetti { font-size: 22px; letter-spacing: 4px; }
.winner-eyebrow { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent2); font-weight: 800; margin-top: 6px; }
.winner-name { font-size: 44px; line-height: 1.04; font-weight: 900; color: #fff; margin: 4px 0 6px; letter-spacing: -1px; text-shadow: 0 2px 24px rgba(255,210,63,.45); }
.winner-name::after { content: ""; display: block; width: 64px; height: 4px; margin: 9px auto 0; border-radius: 4px; background: var(--win, var(--accent2)); }
.winner-sub { font-size: 15px; color: var(--muted); }
.winner-sub b { color: var(--accent2); font-weight: 800; }
@media (prefers-reduced-motion: reduce) { .winner-banner { animation: none; } }

/* Leaderboard — prize podium */
.podium { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
@media (min-width: 560px) { .podium { grid-template-columns: repeat(3, 1fr); } }
.pod { text-align: center; }
.pod.p1 { border-color: var(--accent2); box-shadow: 0 0 0 1px var(--accent2), var(--shadow); }
.pod-top { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.pod-owner { font-size: 15px; font-weight: 700; margin-top: 4px; }   /* player — the focus, on top */
.pod-team { font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 3px; }
.pod-team .flag { font-size: 17px; }
.pod-prize { font-size: 20px; font-weight: 800; color: var(--accent2); margin-bottom: 6px; }

/* Leaderboard */
.lb-card { display: flex; flex-direction: column; gap: 8px; }
.lb-furthest { font-size: 12px; color: var(--accent2); font-weight: 600; white-space: nowrap; }
.lb-top { display: flex; align-items: center; gap: 9px; }
.rank { font-size: 13px; color: var(--muted); width: 18px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.lb-name { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-pts { font-size: 20px; font-weight: 800; color: var(--accent2); }
.lb-pts small { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.lb-sub { font-size: 12.5px; color: var(--muted); }
.lb-sub.win { color: var(--ink); font-weight: 600; }
.lb-sub.out { color: #818daf; }
.lb-flags { display: flex; flex-wrap: wrap; gap: 5px; }
/* Promoted top-3 rows at season end — gold / silver / bronze */
.rank.medal { font-size: 19px; width: 22px; text-align: center; }
.lb-prize { font-size: 15px; font-weight: 800; color: var(--accent2); white-space: nowrap; }
.lb-card.m1 { border-color: #ffd23f; box-shadow: 0 0 0 1px #ffd23f, var(--shadow); }
.lb-card.m2 { border-color: #c4ccda; box-shadow: 0 0 0 1px #c4ccda, var(--shadow); }
.lb-card.m3 { border-color: #cd8b50; box-shadow: 0 0 0 1px #cd8b50, var(--shadow); }
.lf { font-size: 13px; background: var(--bg2); padding: 2px 7px; border-radius: 7px; }
.lf.out { opacity: .35; text-decoration: line-through; }

/* Panels / admin */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 6px; font-size: 16px; }
.people { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.prow { display: flex; align-items: center; gap: 8px; }
.prow .pname { flex: 1; min-width: 0; }
.prow .pcount { width: 64px; }
.ptag { font-size: 12px; color: var(--muted); }
input, select, textarea { background: var(--bg2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.prow-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 6px 0; cursor: pointer; }
.chk input { width: auto; }
.hint.note { margin-top: 0; }
.hint.bad { color: var(--red); }
.draw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.draw-msg { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: rgba(255,93,108,.12); border: 1px solid var(--red); font-size: 13px; }

/* Organiser lock screen */
.lock { display: flex; justify-content: center; padding-top: 24px; }
.lock-card { max-width: 380px; width: 100%; text-align: center; }
.lock-card h3 { margin: 0 0 6px; }
.lock-card #lock-pw { width: 100%; margin: 6px 0 4px; text-align: center; font-size: 16px; }
.lock-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.lock-err { color: var(--red); font-size: 13px; margin-top: 6px; }
.alloc { font-size: 13px; color: var(--muted); }
.alloc .good { color: var(--green); font-weight: 600; }
.alloc .bad { color: var(--red); font-weight: 600; }

.btn { background: var(--panel2); border: 1px solid var(--line); color: var(--ink); padding: 9px 15px; border-radius: 10px; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #00231e; border-color: var(--accent); font-weight: 700; }
.btn.primary[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.danger, .mini.danger { color: var(--red); }
.mini { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; cursor: pointer; }

.draw-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.draw-flags .lf { transition: opacity .25s; }

/* Results rows */
.org-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 4px 10px; }
.org-group summary { cursor: pointer; padding: 6px 0; font-weight: 600; }
.res-row { display: flex; align-items: center; gap: 6px; padding: 5px 0; font-size: 13px; }
.res-row .rt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-row .rt.r { text-align: right; }
.res-row .sc { width: 48px; text-align: center; padding: 6px; }
.res-row .dash { color: var(--muted); }
.third-sel { flex: 1; max-width: 240px; }
.pen { max-width: 130px; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; width: 100%; max-width: 640px; }
.modal-box textarea { width: 100%; height: 260px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; white-space: pre; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.site-footer { padding: 20px max(14px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); color: var(--muted); font-size: 12px; text-align: center; }
code { background: var(--bg2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
