/* 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 14px; }

/* 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); }
.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; }

/* Grid / Bracket toggle */
.ko-toggle { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 12px; }
.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; }
.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 { display: flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 0; }
.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; }

/* 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-team { font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pod-team .flag { font-size: 18px; }
.pod-owner { font-size: 13px; font-weight: 700; margin-top: 4px; }
.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-flags { display: flex; flex-wrap: wrap; gap: 5px; }
.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; }
.pool-title { width: 100%; font-size: 15px; }
.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; }
.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 14px 40px; color: var(--muted); font-size: 12px; text-align: center; }
code { background: var(--bg2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
