/* The public site (index.php), in the style of the election-night show.
   Phone first: one column and a bottom tab bar; from 860px it becomes tables and a top menu. */
:root { --navy: #08103c; --navy2: #121c58; --panel: #17226b; --line: #2b3890; --yel: #fff200; --red: #e60012; --ink: #fff; --dim: #aab3e6;
  --up: #37e07a; --down: #ff6b78; --bro: #ff7a1a; --liv: #29b6f6; --tabs: 68px;
  --heavy: "Arial Black", "Segoe UI Black", Impact, "Helvetica Neue", Arial, sans-serif; --text: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--navy) linear-gradient(180deg, #0b1550, var(--navy) 420px) no-repeat; color: var(--ink); font: 16px/1.4 var(--text);
  padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom) + 16px); -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 12px; }

/* ---- header: the show's badge ---- */
header.top { position: sticky; top: 0; z-index: 20; background: rgba(8, 16, 60, .94); backdrop-filter: blur(8px); border-bottom: 3px solid var(--yel); }
header.top .wrap { display: flex; align-items: center; gap: 10px; height: 60px; }
.badge { display: flex; align-items: stretch; text-decoration: none; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.badge b { background: var(--red); color: #fff; font: 900 22px/1 var(--heavy); padding: 9px 8px; border: 2px solid #fff; }
.badge span { background: var(--yel); color: #111; font: 900 17px/1 var(--heavy); padding: 6px 10px 5px; display: grid; }
.badge small { color: var(--red); font: 900 9px/1 var(--heavy); letter-spacing: .22em; font-style: italic; }
nav.menu { display: none; margin-left: auto; gap: 4px; }
nav.menu a { text-decoration: none; font: 900 13px var(--heavy); text-transform: uppercase; letter-spacing: .04em; padding: 9px 12px; border-radius: 4px; }
nav.menu a:hover, nav.menu a.on { background: var(--panel); color: var(--yel); }
nav.menu a.cta, .cta { background: var(--red); color: #fff; }

/* ---- ticker ---- */
.ticker { display: flex; background: #0d1650; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.ticker b { background: var(--red); padding: 7px 10px; font: 900 13px var(--heavy); white-space: nowrap; }
.ticker span { padding: 7px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- sections ---- */
section { padding: 22px 0 6px; }
h2 { margin: 0 0 12px; display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
h2 .k { background: var(--red); font: 900 italic 13px var(--heavy); padding: 4px 10px; letter-spacing: .12em; transform: skewX(-8deg); }
h2 .t { font: 900 italic clamp(26px, 7vw, 40px)/1 var(--heavy); text-transform: uppercase; text-shadow: 3px 3px 0 #000; letter-spacing: .01em; }
h2 .n { color: var(--dim); font-size: 13px; font-weight: 600; margin-left: auto; }
.lower { display: inline-block; background: var(--yel); color: #111; font: 900 italic 18px var(--heavy); padding: 6px 14px; transform: skewX(-6deg); box-shadow: 4px 4px 0 rgba(0, 0, 0, .4); }
.lower em { color: var(--red); font-style: inherit; }

.hero { display: grid; gap: 14px; padding-top: 18px; }
.hero p { margin: 0; color: var(--dim); max-width: 60ch; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border: 0; border-radius: 6px; cursor: pointer;
  font: 900 italic 18px var(--heavy); text-transform: uppercase; text-decoration: none; background: var(--yel); color: #111; box-shadow: 0 4px 0 #a39a00; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a39a00; }
.btn.red { background: var(--red); color: #fff; box-shadow: 0 4px 0 #86000b; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); font-size: 14px; min-height: 44px; }

/* ---- games: cards on a phone, the full table on a wide screen ---- */
.games { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.game { background: var(--panel); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.game .meta { display: flex; gap: 8px; align-items: center; padding: 6px 10px; background: var(--navy2); font-size: 12.5px; color: var(--dim); font-weight: 600; }
.game .meta b { color: var(--ink); }
.game .meta .elo { margin-left: auto; background: var(--yel); color: #111; font: 900 12px var(--heavy); padding: 2px 7px; border-radius: 3px; }
.game .sides { display: grid; grid-template-columns: 1fr 1fr; }
.side { padding: 8px 10px 10px; border-top: 4px solid var(--bro); min-width: 0; }
.side + .side { border-top-color: var(--liv); border-left: 1px solid var(--line); }
.side .tm { display: flex; justify-content: space-between; align-items: baseline; font: 900 12px var(--heavy); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.side .tm i { font: 900 italic 30px/1 var(--heavy); color: var(--ink); }
.side.win .tm i { color: var(--yel); }
.side.win .tm span::after { content: " ●"; color: var(--yel); }
.pl { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-weight: 700; font-size: 14.5px; }
.pl small { font: 900 10px var(--heavy); color: var(--dim); width: 12px; }
.pl span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl b { font: 900 15px var(--heavy); color: var(--yel); }
.tablewrap.always { display: block; margin-top: 12px; }
.stat th { cursor: pointer; white-space: normal; user-select: none; vertical-align: bottom; line-height: 1.15; min-width: 62px; } .stat th, .stat td { padding-left: 8px; padding-right: 8px; }
.stat td:first-child { max-width: 118px; overflow: hidden; text-overflow: ellipsis; } .stat th.on { color: var(--yel); }
.stat td:first-child, .stat th:first-child { position: sticky; left: 0; background: var(--panel); text-align: left; font-weight: 800; }
.stat td { white-space: nowrap; }
.tablewrap { display: none; overflow-x: auto; border-radius: 8px; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th { font: 900 11.5px var(--heavy); text-transform: uppercase; letter-spacing: .08em; color: var(--dim); background: var(--navy2); padding: 8px 10px; text-align: left; white-space: nowrap; }
td { padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
tbody tr { background: var(--panel); }
tbody tr:nth-child(even) { background: #1a2675; }
th.bro, td.bro { box-shadow: inset 3px 0 0 var(--bro); } th.liv, td.liv { box-shadow: inset 3px 0 0 var(--liv); }
td.g { font: 900 15px var(--heavy); color: var(--yel); text-align: right; padding-left: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Elo board: the show's leaderboard ---- */
.board { display: grid; gap: 4px; }
.row, .rowhead { display: grid; grid-template-columns: 34px 38px minmax(0, 1fr) 62px; grid-template-areas: "rk face name elo" "rk face sub sub"; column-gap: 8px; align-items: center; }
.row { background: linear-gradient(90deg, var(--panel), #1e2b82); border-left: 5px solid var(--c, var(--line)); padding: 6px 10px 6px 0; border-radius: 0 6px 6px 0; }
.row.first { background: linear-gradient(90deg, var(--red), #b0000e); }
.row .rk { grid-area: rk; background: #fff; color: #111; font: 900 16px var(--heavy); text-align: center; align-self: stretch; display: grid; place-items: center; margin: -6px 0; }
.row .face { grid-area: face; width: 38px; height: 38px; border-radius: 50%; background: #ffd42a center/cover; border: 2px solid var(--c, #fff); }
.row .name { grid-area: name; font: 800 16.5px var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .elo { grid-area: elo; font: 900 19px var(--heavy); color: var(--yel); text-align: right; font-variant-numeric: tabular-nums; }
.row .sub { grid-area: sub; display: flex; gap: 12px; font-size: 12.5px; color: var(--dim); font-weight: 600; flex-wrap: wrap; }
.row .sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
.row .cell { display: none; }
.up { color: var(--up) !important; } .down { color: var(--down) !important; }
.rowhead { display: none; }
.sortbar { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 2px; }
.chip { flex: none; border: 0; background: var(--panel); border-radius: 99px; padding: 8px 14px; min-height: 40px; font-weight: 700; font-size: 13.5px; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); }
.chip.on { background: var(--yel); color: #111; box-shadow: none; }
.chip i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; }

/* ---- teams ---- */
.search { width: 100%; min-height: 46px; border-radius: 6px; border: 2px solid var(--line); background: var(--navy2); padding: 0 12px; margin-bottom: 10px; }
.team { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr) 58px; gap: 8px; align-items: center; background: var(--panel); padding: 8px 10px 8px 0; border-radius: 0 6px 6px 0; font-weight: 700; }
.team .rk { background: #fff; color: #111; font: 900 14px var(--heavy); text-align: center; align-self: stretch; display: grid; place-items: center; margin: -8px 0; }
.team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team small { display: block; font: 900 9.5px var(--heavy); color: var(--dim); letter-spacing: .1em; }
.team b { font: 900 17px var(--heavy); color: var(--yel); text-align: right; }

/* ---- insert game ---- */
.form { display: grid; gap: 12px; max-width: 720px; }
.score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; text-align: center; background: var(--yel); color: #111; border-radius: 8px; padding: 8px; font: 900 italic 13px var(--heavy); letter-spacing: .08em; position: sticky; top: 66px; z-index: 5; box-shadow: 0 4px 0 rgba(0, 0, 0, .35); }
.score b { font-size: 34px; padding: 0 14px; letter-spacing: 0; }
.pitch { display: grid; gap: 10px; grid-template-columns: 1fr; }
.half { background: #1b7a3a linear-gradient(90deg, rgba(255, 255, 255, .06) 50%, transparent 0) 0 0/64px 100%; border-radius: 10px; padding: 10px; border-top: 6px solid var(--bro); display: grid; gap: 10px; }
.half.liv { border-top-color: var(--liv); }
.half h3 { margin: 0; font: 900 italic 18px var(--heavy); text-transform: uppercase; text-shadow: 2px 2px 0 rgba(0, 0, 0, .5); }
.pos { background: rgba(8, 16, 60, .88); border-radius: 8px; padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.pos label { font: 900 11px var(--heavy); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); display: grid; gap: 4px; min-width: 0; }
select, input[type=datetime-local], input[type=text] { width: 100%; min-height: 48px; border-radius: 6px; border: 2px solid var(--line); background: var(--navy2); padding: 0 10px; font-size: 16px; font-weight: 700; }
select:focus, input:focus, button:focus-visible, a:focus-visible { outline: 3px solid var(--yel); outline-offset: 2px; }
.step { display: grid; grid-template-columns: 48px 44px 48px; align-items: center; text-align: center; }
.step button { height: 48px; border: 0; border-radius: 6px; background: var(--line); font: 900 24px var(--heavy); cursor: pointer; }
.step button:active { background: var(--yel); color: #111; }
.step output { font: 900 26px var(--heavy); color: var(--yel); }
.field { display: grid; gap: 4px; font: 900 11px var(--heavy); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.two { display: grid; gap: 12px; grid-template-columns: 1fr; }
.msg { border-radius: 6px; padding: 10px 12px; font-weight: 700; display: none; }
.msg.err { display: block; background: #5a0a12; border: 2px solid var(--red); } .msg.ok { display: block; background: #0d4a26; border: 2px solid var(--up); }

/* ---- statistics ---- */
.chartbox { background: var(--panel); border-radius: 8px; border: 1px solid var(--line); padding: 8px; }
canvas { display: block; width: 100%; height: min(62vh, 460px); touch-action: pan-y; }
.ranges { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.players { display: flex; flex-wrap: wrap; gap: 6px; }

footer { margin-top: 28px; padding: 22px 0; border-top: 3px solid var(--yel); background: #060c30; color: var(--dim); font-size: 14px; }
footer q { display: block; color: var(--ink); font: 900 italic 17px var(--heavy); margin-bottom: 10px; quotes: none; }
footer nav { display: flex; gap: 14px; flex-wrap: wrap; }
details.about { margin-top: 16px; background: var(--navy2); border-radius: 8px; padding: 10px 14px; color: var(--ink); }
details.about summary { cursor: pointer; font-weight: 800; } details.about li { margin: 4px 0; }

/* ---- bottom tab bar (phone and tablet) ---- */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabs) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: rgba(6, 12, 48, .97); border-top: 3px solid var(--yel); }
nav.tabs a { display: grid; place-content: center; justify-items: center; gap: 2px; text-decoration: none; font: 900 10.5px var(--heavy); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
nav.tabs a span { font: 900 19px/1 var(--heavy); color: var(--ink); }
nav.tabs a.on, nav.tabs a.on span { color: var(--yel); }
nav.tabs a.add { margin: -18px 6px 8px; border-radius: 14px; background: var(--red); color: #fff; border: 3px solid #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
nav.tabs a.add span { font-size: 26px; color: #fff; }

.view { display: none; } .view.on { display: block; }

@media (min-width: 600px) { .pitch, .two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 860px) {
  body { padding-bottom: 0; } nav.tabs { display: none; } nav.menu { display: flex; }
  .badge b { font-size: 26px; } .badge span { font-size: 21px; }
  .games { display: none; } .tablewrap { display: block; }
  .rowhead { display: grid; font: 900 11.5px var(--heavy); text-transform: uppercase; letter-spacing: .08em; color: var(--dim); padding: 0 10px 4px 0; }
  .rowhead button { all: unset; cursor: pointer; text-align: right; } .rowhead button.on { color: var(--yel); }
  .row, .rowhead { grid-template-columns: 44px 40px minmax(0, 1fr) repeat(5, 110px); grid-template-areas: none; }
  .row > *, .rowhead > * { grid-area: auto !important; } .row .sub { display: none; } .row .cell { display: block; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
  .sortbar { display: none; }
  .teams { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; } .teams .team { margin: 0; }
}
.teams { display: grid; gap: 4px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---- ratings hidden until the julefrokost, messages, faces without a photo ---- */
.locked { background: var(--panel); border: 2px dashed var(--line); border-radius: 8px; padding: 22px 16px; text-align: center; color: var(--dim); font-weight: 600; }
.locked b { display: block; color: var(--yel); font: 900 italic 20px var(--heavy); text-transform: uppercase; margin-bottom: 6px; }
.flash { margin-top: 14px; border-radius: 6px; padding: 10px 12px; font-weight: 700; }
.flash.ok { background: #0d4a26; border: 2px solid var(--up); } .flash.err { background: #5a0a12; border: 2px solid var(--red); }
.row .face { display: grid; place-items: center; background: var(--c, #ffd42a); color: #111; font: 900 13px var(--heavy); overflow: hidden; }
.row .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
nav.tabs a.off span, nav.menu a.off { opacity: .45; }

.sortbar { scrollbar-width: none; } .sortbar::-webkit-scrollbar { display: none; }
