/* Layout: bordtennisbordet som toppfelt, faner under, innhold i én kolonne (tre med horisontal rulling). */
:root {
  --bg: #eaeff5;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --ink: #0e1a2b;
  --muted: #5a6a80;
  --line: #d4dce8;
  --table: #1a4c8b;
  --table-deep: #143c6f;
  --on-table: #ffffff;
  --ball: #ef6a1c;
  --ball-soft: #fde6d6;
  --win: #1b8657;
  --win-soft: #dcf1e6;
  --warn: #a86a10;
  --warn-soft: #fbefd6;
  --danger: #c0392b;
  --path: #ef6a1c;
  --shadow: 0 1px 2px rgba(14, 26, 43, .06), 0 6px 18px rgba(14, 26, 43, .07);
  --f-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', system-ui, sans-serif;
  --f-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a111c;
    --surface: #121c2b;
    --surface-2: #0f1826;
    --ink: #e6edf7;
    --muted: #93a3b8;
    --line: #26344b;
    --table: #1b4c8e;
    --table-deep: #123766;
    --on-table: #ffffff;
    --ball: #ff8a3d;
    --ball-soft: #3b2415;
    --win: #45c98f;
    --win-soft: #11301f;
    --warn: #e5ad52;
    --warn-soft: #33260f;
    --danger: #ff7b6b;
    --path: #ff8a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--f-body);
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.05; }

/* ---------- Toppfelt: bordet ---------- */
.hero {
  background: var(--table);
  color: var(--on-table);
  position: relative;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}
.hero::before {
  /* hvit kantlinje og midtlinje som på et bordtennisbord */
  content: "";
  position: absolute;
  inset: 10px;
  border: 3px solid rgba(255, 255, 255, .85);
  border-radius: 2px;
  background: linear-gradient(90deg, transparent calc(50% - 1px), rgba(255, 255, 255, .55) calc(50% - 1px), rgba(255, 255, 255, .55) calc(50% + 1px), transparent calc(50% + 1px));
  pointer-events: none;
}
.hero-inner {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding-block: 28px 26px;
  padding-left: max(30px, env(safe-area-inset-left, 0px));
  padding-right: max(30px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 18px;
}
.hero-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; }
.brand { display: flex; gap: 14px; align-items: center; min-width: 0; }
.brand h1 {
  font-size: clamp(30px, 5vw, 50px);
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: .01em;
}
.hero-sub { margin: 4px 0 0; opacity: .85; font-weight: 500; }
.ball {
  flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ffd0ad 0 12%, var(--ball) 45%, #c24c0c 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hbtn {
  border: 1.5px solid rgba(255, 255, 255, .6);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 600;
}
.hbtn:hover { background: rgba(255, 255, 255, .2); }
.hbtn.on { background: #fff; color: var(--table-deep); border-color: #fff; }
.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .2);
}
.live i { width: 9px; height: 9px; border-radius: 50%; background: #c8d3e3; }
.live[data-state="live"] i { background: #4ee39a; box-shadow: 0 0 0 0 rgba(78, 227, 154, .7); animation: pulse 2s infinite; }
.live[data-state="offline"] i { background: #ff7b6b; }
.live[data-state="local"] i { background: #ffc46b; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(78, 227, 154, 0); } 100% { box-shadow: 0 0 0 0 rgba(78, 227, 154, 0); } }

.hero-bottom { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.countdown { font-family: var(--f-display); font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; letter-spacing: .01em; }
.countdown b { color: #ffd2b3; font-weight: 800; }
.progress { display: flex; align-items: center; gap: 12px; min-width: min(320px, 100%); }
.progress-bar { flex: 1; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--ball); border-radius: inherit; transition: width .6s ease; }
.progress-text { font-weight: 600; font-size: 14px; white-space: nowrap; }

/* ---------- Faner ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface);
}
.tabs {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.tabs-inner {
  max-width: 1240px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.tabs a {
  flex: none;
  padding: 14px 14px 12px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--f-display);
  font-size: 19px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  border-bottom: 3px solid transparent;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ball); }

.wrap {
  max-width: 1240px; margin: 0 auto;
  padding-block: 24px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 22px;
}
#view { display: grid; gap: 28px; min-width: 0; }

/* ---------- Felles ---------- */
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 12px; }
.sec-head h2 { font-size: 30px; font-weight: 800; text-transform: uppercase; }
.sec-head .meta { color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px; padding: 9px 16px; font-weight: 700; border: 1.5px solid transparent;
  text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn.primary { background: var(--table); color: #fff; }
.btn.primary:hover { background: var(--table-deep); }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.small { padding: 6px 11px; font-size: 14px; }
.btn.danger-ghost { background: transparent; color: var(--danger); border-color: transparent; padding-inline: 4px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap;
}
.pill.ready { background: var(--ball-soft); color: var(--ball); }
.pill.done { background: var(--win-soft); color: var(--win); }
.pill.waiting { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.late { background: var(--warn-soft); color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px;
  padding: 5px 13px; font-weight: 600; font-size: 14px; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.notice {
  background: var(--warn-soft); color: var(--warn); border-radius: var(--r);
  padding: 12px 16px; font-weight: 600;
}
.empty { color: var(--muted); padding: 18px; border: 1.5px dashed var(--line); border-radius: var(--r); text-align: center; }

/* ---------- Mester ---------- */
.champ {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--ball), #f59a3e);
  color: #fff; border-radius: 14px; padding: 22px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px;
}
.champ .trophy { width: 54px; height: 54px; flex: none; }
.champ h2 { font-size: clamp(30px, 5vw, 48px); font-weight: 800; font-style: italic; text-transform: uppercase; }
.champ p { margin: 2px 0 0; font-weight: 600; opacity: .95; }

/* ---------- Neste opp ---------- */
.feature {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px 26px;
  padding: 20px 24px; border: 1px solid var(--line);
}
.feature .when { font-family: var(--f-display); text-align: center; min-width: 92px; }
.feature .when b { display: block; font-size: 44px; font-weight: 800; line-height: 1; }
.feature .when span { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.feature .vs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-family: var(--f-display); font-size: clamp(26px, 4vw, 40px); font-weight: 800; min-width: 0; }
.feature .vs i { font-style: normal; color: var(--ball); font-size: .6em; }
.feature .sub { color: var(--muted); font-weight: 500; margin-top: 2px; }
@media (max-width: 640px) {
  .feature { grid-template-columns: 1fr; padding: 18px; }
  .feature .when { text-align: left; }
}

.follow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  background: var(--surface); border: 1.5px solid var(--ball); border-radius: var(--r); padding: 12px 16px;
}
.follow b { font-family: var(--f-display); font-size: 20px; }

/* ---------- Kampkort i lister ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.mc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; display: grid; gap: 8px; min-width: 0;
}
.mc.done { background: var(--surface-2); }
.mc.focus { border-color: var(--path); box-shadow: 0 0 0 2px var(--path) inset; }
.mc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mc-label { font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mc-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.mc-name { font-weight: 600; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.mc-name.ph { color: var(--muted); font-weight: 500; font-style: italic; font-size: 15px; }
.mc-name.win { font-weight: 800; }
.mc-name.win::after { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ball); margin-left: 8px; vertical-align: 2px; }
.mc-name.lose { color: var(--muted); }
.mc-score { font-family: var(--f-display); font-size: 22px; font-weight: 800; min-width: 1.2em; text-align: right; }
.mc-sets { display: flex; flex-wrap: wrap; gap: 5px; }
.mc-sets span { font-size: 13px; font-weight: 600; background: var(--bg); border-radius: 5px; padding: 1px 7px; color: var(--muted); }
.mc-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mc-warn { font-size: 13px; color: var(--warn); font-weight: 600; }
.byes { color: var(--muted); font-size: 15px; margin-top: 10px; }

/* ---------- Tidslinje for sluttspilldagen ---------- */
.timeline { display: grid; gap: 0; }
.slot { display: grid; grid-template-columns: 82px 1fr; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.slot:first-child { border-top: 0; }
.slot-time { font-family: var(--f-display); font-size: 28px; font-weight: 800; line-height: 1; padding-top: 12px; }
.slot-time small { display: block; font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-top: 4px; }
.slot.past .slot-time { color: var(--muted); }
.now-line { display: flex; align-items: center; gap: 10px; color: var(--ball); font-weight: 800; font-family: var(--f-display); font-size: 17px; letter-spacing: .06em; text-transform: uppercase; padding: 6px 0; }
.now-line::after { content: ""; flex: 1; height: 2px; background: var(--ball); }
@media (max-width: 520px) {
  .slot { grid-template-columns: 1fr; gap: 6px; }
  .slot-time { padding-top: 0; }
}

/* ---------- Turneringstre ---------- */
.tree-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tree-tools label { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.tree-tools select { padding: 7px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 14px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 22px; height: 3px; border-radius: 2px; display: inline-block; }
.journey { background: var(--surface); border: 1.5px solid var(--path); border-radius: var(--r); padding: 12px 16px; display: grid; gap: 8px; }
.journey ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.journey li { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; background: var(--surface-2); border-radius: 6px; padding: 4px 9px; }
.journey li.w { background: var(--win-soft); color: var(--win); }
.journey li.l { background: var(--warn-soft); color: var(--warn); }
.journey li.n { background: var(--ball-soft); color: var(--ball); }
.journey .arrow { color: var(--muted); background: none; padding: 0; }

.tree-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 22px; }
.tree { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 212px; gap: 44px; width: max-content; }
.tree svg.links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.col { display: grid; grid-template-rows: auto 1fr; gap: 12px; }
.col-head { text-align: left; }
.col-head h3 { font-size: 20px; font-weight: 800; text-transform: uppercase; }
.col-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.col-body { display: flex; flex-direction: column; justify-content: space-around; height: var(--tree-h); position: relative; z-index: 1; }
.bm {
  display: grid; text-align: left; width: 100%;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 8px;
  padding: 0; overflow: hidden;
  transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.bm:hover { border-color: var(--muted); }
.bm-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; padding: 0 9px; height: 25px; font-size: 14.5px; font-weight: 600; }
.bm-row + .bm-row { border-top: 1px solid var(--line); }
.bm-row .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-row .n.ph { color: var(--muted); font-weight: 500; font-style: italic; font-size: 13px; }
.bm-row .s { font-family: var(--f-display); font-weight: 800; font-size: 16px; }
.bm-row.win { background: var(--win-soft); }
.bm-row.win .n { font-weight: 800; }
.bm-row.lose .n, .bm-row.lose .s { color: var(--muted); }
.bm-meta { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 9px; height: 14px; line-height: 14px; background: var(--surface-2); display: flex; justify-content: space-between; }
.bm.ready { border-color: var(--ball); }
.bm.bye { opacity: .6; border-style: dashed; }
.tree.has-focus .bm { opacity: .35; }
.tree.has-focus .bm.on-path { opacity: 1; border-color: var(--path); box-shadow: 0 0 0 2px var(--path); }
.bm-row.me { box-shadow: inset 4px 0 0 var(--path); }
.trophy-card {
  height: 120px; border-radius: 12px; display: grid; place-items: center; text-align: center; padding: 10px;
  border: 2px dashed var(--line); color: var(--muted); font-weight: 600;
}
.trophy-card.won { border: 0; background: linear-gradient(140deg, var(--ball), #f6a24c); color: #fff; }
.trophy-card svg { width: 40px; height: 40px; }
.trophy-card b { display: block; font-family: var(--f-display); font-size: 24px; font-weight: 800; color: inherit; }

/* ---------- Spillere ---------- */
.p-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.p-tools input { flex: 1; min-width: 200px; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); }
.plist { display: grid; gap: 8px; }
.prow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.prow summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; }
.prow summary::-webkit-details-marker { display: none; }
.prow .pname { font-family: var(--f-display); font-size: 21px; font-weight: 700; }
.prow .pstat { color: var(--muted); font-size: 14px; }
.prow.out .pname { color: var(--muted); }
.prow .pbody { padding: 0 14px 14px; display: grid; gap: 10px; }
.star { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--line); padding: 2px; }
.star[aria-pressed="true"] { color: var(--ball); }
.rec { font-family: var(--f-display); font-size: 18px; font-weight: 700; white-space: nowrap; }

/* ---------- Statistikk ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi b { display: block; font-family: var(--f-display); font-size: 40px; font-weight: 800; line-height: 1; }
.kpi span { color: var(--muted); font-weight: 600; font-size: 14px; }
.highs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.high { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; }
.high h3 { font-size: 15px; font-family: var(--f-body); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.high .big { font-family: var(--f-display); font-size: 24px; font-weight: 800; }
.high .small { color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.pos { color: var(--win); font-weight: 700; }
td.neg { color: var(--danger); font-weight: 700; }
.bar { display: inline-block; height: 8px; border-radius: 4px; background: var(--ball); vertical-align: middle; }

/* ---------- Dialoger ---------- */
.dlg {
  border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  max-height: calc(100vh - 24px);
}
.dlg.wide { width: min(760px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(8, 16, 30, .55); backdrop-filter: blur(2px); }
.dlg form { padding: 20px 22px; display: grid; gap: 14px; }
.dlg-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.dlg-head h2 { font-size: 28px; font-weight: 800; }
.x { background: none; border: 0; font-size: 30px; line-height: 1; color: var(--muted); padding: 0 4px; }
.dlg-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.sp { flex: 1; }
.mode-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; justify-self: start; flex-wrap: wrap; }
.mode-switch button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--muted); }
.mode-switch button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.board { display: grid; gap: 6px; }
.board-row { display: grid; grid-template-columns: 1fr 64px 64px; gap: 8px; align-items: center; }
.board-row.head { font-weight: 800; font-family: var(--f-display); font-size: 19px; }
.board-row.head span { text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row.head span:first-child { text-align: left; }
.board-row .lbl { color: var(--muted); font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.board-row .lbl em { font-style: normal; font-size: 12px; font-weight: 700; }
.board-row .lbl em.ok { color: var(--win); }
.board-row .lbl em.bad { color: var(--danger); }
.board-row input {
  width: 100%; text-align: center; padding: 8px 4px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--surface-2); font-family: var(--f-display); font-size: 24px; font-weight: 800;
}
.board-row input:disabled { opacity: .35; }
.board-row input.won { border-color: var(--win); background: var(--win-soft); }
.board-row .pick { height: 44px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 13px; color: var(--muted); }
.board-row .pick[aria-pressed="true"] { border-color: var(--win); background: var(--win-soft); color: var(--win); }
.board-row .pick:disabled { opacity: .35; }
.board-total { display: grid; grid-template-columns: 1fr 64px 64px; gap: 8px; border-top: 2px solid var(--ink); padding-top: 8px; font-family: var(--f-display); font-weight: 800; }
.board-total span { text-align: center; font-size: 30px; line-height: 1; }
.board-total span:first-child { text-align: left; font-size: 16px; color: var(--muted); align-self: center; text-transform: uppercase; letter-spacing: .06em; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
.warn { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-weight: 600; }
.wo summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
.wo-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.field { display: grid; gap: 5px; font-weight: 600; font-size: 14px; }
.field input, .field select { padding: 9px 11px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 500; font-size: 16px; }
.check { display: flex; gap: 9px; align-items: center; font-weight: 600; font-size: 14px; padding-bottom: 10px; }
.check input { width: 18px; height: 18px; accent-color: var(--ball); }
.set-h { font-size: 18px; font-weight: 800; text-transform: uppercase; margin-top: 4px; }
.slots-ed summary { cursor: pointer; font-weight: 700; }
.slots-ed[open] summary { margin-bottom: 10px; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 8px; margin-top: 10px; }
.slot-pair { display: grid; grid-template-columns: 32px 1fr 1fr 90px; gap: 6px; align-items: center; }
.slot-pair b { color: var(--muted); font-size: 13px; }
.slot-pair input { width: 100%; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; min-width: 0; }
.times { display: grid; gap: 8px; margin-top: 14px; }
.times .trow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.times .trow b { width: 100%; font-size: 13px; color: var(--muted); }
.times input { width: 74px; padding: 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-size: 14px; text-align: center; }
.data-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); border-radius: 10px; padding: 10px 12px 10px 16px;
  display: flex; gap: 14px; align-items: center; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  max-width: calc(100vw - 32px); font-weight: 600;
}
.toast button { background: transparent; color: var(--ball); border: 0; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Storskjerm ---------- */
.tv {
  position: fixed; inset: 0; z-index: 50; background: var(--table-deep); color: #fff;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(32px, env(safe-area-inset-right, 0px)) 24px max(32px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-rows: auto auto 1fr; gap: 18px; overflow: auto;
}
.tv-ctrl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tv-ctrl .hbtn { min-width: 44px; }
.tv-int { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; opacity: .9; }
.tv-int select { background: rgba(255, 255, 255, .12); color: #fff; border: 1.5px solid rgba(255, 255, 255, .5); border-radius: 999px; padding: 6px 10px; font-weight: 600; }
.tv-int select option { color: #0e1a2b; }
.tv-nav { display: grid; gap: 10px; }
.tv-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-dot {
  border: 0; border-radius: 999px; padding: 6px 14px; background: rgba(255, 255, 255, .1); color: #fff;
  font-family: var(--f-display); font-weight: 700; font-size: clamp(15px, 1.4vw, 20px); letter-spacing: .04em; text-transform: uppercase; opacity: .7;
}
.tv-dot[aria-selected="true"] { background: #fff; color: var(--table-deep); opacity: 1; }
.tv-prog { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.tv-prog span { display: block; height: 100%; width: 0; background: var(--ball); transition: width .2s linear; }
.tv-body.tree-slide { grid-template-columns: 1fr; gap: 14px; }
.tv-slide-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; }
.tv-slide-head .tv-h { font-size: clamp(36px, 5vw, 72px); font-weight: 800; font-style: italic; text-transform: uppercase; opacity: 1; margin: 0; letter-spacing: 0; }
.tv-count { font-size: clamp(16px, 1.6vw, 24px); font-weight: 600; opacity: .7; }
.tv-next { font-size: clamp(16px, 1.6vw, 24px); font-weight: 700; background: var(--ball); border-radius: 999px; padding: 4px 16px; }
.tv-next small { opacity: .8; font-weight: 600; }
.tv-tree { width: 100%; grid-auto-columns: minmax(0, 1fr); gap: clamp(24px, 4vw, 72px); }
.tv-tree .col-head h3 { color: #fff; font-size: clamp(18px, 1.8vw, 28px); }
.tv-tree .col-head p { color: rgba(255, 255, 255, .65); font-size: clamp(13px, 1.1vw, 16px); }
.tv-tree .bm { border-radius: 10px; color: var(--ink); cursor: default; }
.tv-tree .bm-row { height: auto; padding: clamp(4px, .6vw, 10px) clamp(8px, 1vw, 16px); font-size: clamp(16px, 1.7vw, 30px); }
.tv-tree .bm-row .s { font-size: clamp(18px, 2vw, 34px); }
.tv-tree .bm-row .n.ph { font-size: clamp(13px, 1.2vw, 20px); }
.tv-tree .bm-meta { height: auto; line-height: 1.6; font-size: clamp(11px, 1vw, 15px); padding: 0 clamp(8px, 1vw, 16px); }
.tv-tree .trophy-card { height: auto; min-height: 140px; border-color: rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .7); }
.tv-tree .trophy-card.won { color: #fff; }
.tv-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.tv-title { display: flex; gap: 14px; align-items: center; font-family: var(--f-display); font-size: clamp(28px, 4vw, 52px); font-weight: 800; font-style: italic; text-transform: uppercase; }
.tv-clock { font-family: var(--f-display); font-size: clamp(36px, 6vw, 80px); font-weight: 800; }
.tv-body { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-content: start; }
.tv h2 { font-size: clamp(20px, 2.2vw, 30px); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .75; margin-bottom: 12px; }
.tv-m { background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 16px 22px; display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; align-items: center; margin-bottom: 12px; }
.tv-m .t { font-family: var(--f-display); font-size: clamp(32px, 4vw, 60px); font-weight: 800; line-height: 1; }
.tv-m .p { font-family: var(--f-display); font-size: clamp(26px, 3.4vw, 50px); font-weight: 700; line-height: 1.1; }
.tv-m .p i { font-style: normal; color: var(--ball); font-size: .6em; padding: 0 .3em; }
.tv-m .r { grid-column: 2; opacity: .75; font-weight: 600; font-size: clamp(14px, 1.4vw, 20px); text-transform: uppercase; letter-spacing: .06em; }
.tv-m.first { background: var(--ball); }
.tv-m.first .p i { color: #fff; opacity: .75; }
.tv-m.wait { background: rgba(255, 255, 255, .05); }
.tv-m.wait .p { opacity: .75; }
.tv-wide { grid-column: 1 / -1; }
.tv .hbtn { font-size: clamp(14px, 1.1vw, 20px); padding: .45em 1em; }
.tv-int { font-size: clamp(13px, 1vw, 18px); }
.tv-int select { font-size: clamp(13px, 1vw, 18px); }
.tv-res { display: grid; gap: 10px; }
.tv-res div { background: rgba(255, 255, 255, .06); border-radius: 10px; padding: 12px 16px; font-size: clamp(18px, 1.8vw, 26px); font-weight: 600; }
.tv-res b { font-family: var(--f-display); font-weight: 800; }
.tv-res small { display: block; opacity: .65; font-size: .65em; text-transform: uppercase; letter-spacing: .08em; }
.tv-champ { grid-column: 1 / -1; text-align: center; padding: 40px 0; }
.tv-champ b { display: block; font-family: var(--f-display); font-size: clamp(60px, 10vw, 150px); font-weight: 800; font-style: italic; text-transform: uppercase; color: var(--ball); line-height: 1; }
@media (max-width: 800px) { .tv-body { grid-template-columns: 1fr; } }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
