/* Øktplan – stil.
   Layout: én kolonne (maks 560px), store titler, høyst ett nivå med bokser.
   Typografi: seks størrelser (--fs-1…--fs-6) + én visningsstørrelse for klokka. Ingen store bokstaver.
   Farger: pasteller markerer felt (øvelse/binge), sterke farger markerer bolk under trening,
   vestfargene er informasjon. */
:root {
  --bg: #ffffff;
  --group: #f2f2f7;
  --surface: #ffffff;
  --fill: #efeff4;
  --ink: #15171c;
  --muted: #6b707c;
  --line: #e2e3e9;
  --accent: #f08a2c;
  --accent-ink: #ffffff;

  --p-peach: #f8d4ab;
  --p-mint: #b9e6d1;
  --p-lav: #cdcbee;
  --p-pink: #f3c1cf;
  --p-sky: #ace0ec;
  --p-ink: #15171c;
  --p-line: rgba(21, 23, 28, .16);

  --run-opp: #c4402f;
  --run-okt: #1b7a49;
  --run-pause: #16768f;

  --vest-bla: #2170e0;
  --vest-rod: #dc3b3b;
  --vest-gul: #f2c21b;
  --vest-gronn: #22a35a;
  --vest-ingen: #ffffff;
  --vest-stroke: #15171c;
  --star: #f5a400;
  --grass: #3f9a4f;
  --grass-2: #39904a;
  --focus: #2170e0;

  --i-blue: #2f80ed; --i-purple: #8b5cf6; --i-green: #22a35a; --i-orange: #f08a2c;
  --i-pink: #ec4d7a; --i-gray: #8e8e93; --i-red: #e5484d; --i-teal: #14a3b8;

  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-1: 13px;   /* metadata, små merkelapper */
  --fs-2: 15px;   /* sekundærtekst */
  --fs-3: 17px;   /* brødtekst */
  --fs-4: 20px;   /* seksjonstitler, beskjeder */
  --fs-5: 24px;   /* kort- og sidetitler */
  --fs-6: 34px;   /* store titler */
  --fs-clock: 64px;

  --band: var(--bg);
  --shadow: 0 8px 30px rgba(20, 24, 40, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12; --group: #0e0f12; --surface: #1b1c21; --fill: #26272e; --ink: #f2f3f6; --muted: #9a9fab; --line: #2c2e36;
    --p-peach: #4a3522; --p-mint: #1d3e31; --p-lav: #2e2c4d; --p-pink: #4a2836; --p-sky: #183f4a; --p-ink: #f2f3f6; --p-line: rgba(242, 243, 246, .18);
    --vest-stroke: #f2f3f6; --focus: #6aa7ff; --shadow: 0 8px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f12; --group: #0e0f12; --surface: #1b1c21; --fill: #26272e; --ink: #f2f3f6; --muted: #9a9fab; --line: #2c2e36;
  --p-peach: #4a3522; --p-mint: #1d3e31; --p-lav: #2e2c4d; --p-pink: #4a2836; --p-sky: #183f4a; --p-ink: #f2f3f6; --p-line: rgba(242, 243, 246, .18);
  --vest-stroke: #f2f3f6; --focus: #6aa7ff; --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- grunnlag ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-ui); font-size: var(--fs-3); line-height: 1.45; font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.v-innstillinger { --bg: var(--group); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--band); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; font-weight: 800; letter-spacing: -.015em; }
p { margin: 0; }
.ph { width: 1em; height: 1em; fill: currentColor; flex: none; }
.emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; line-height: 1; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-2); }
.meta { font-size: var(--fs-1); color: var(--muted); font-weight: 600; }

.main {
  max-width: 560px; margin: 0 auto; outline: none;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px calc(110px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 24px;
}
.v-na .main { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); gap: 20px; }
.large { font-size: var(--fs-6); letter-spacing: -.025em; padding-top: 24px; }
.h2 { font-size: var(--fs-4); }
.lead { color: var(--muted); font-size: var(--fs-2); }
.prose { font-size: var(--fs-3); }
.sec { display: flex; flex-direction: column; gap: 10px; }
.bleed {
  margin-left: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  margin-right: calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.titlebar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- fanemeny ---------- */
.tabbar {
  position: fixed; z-index: 20;
  left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: 420px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid var(--line); border-radius: 36px; box-shadow: var(--shadow);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 58px; border-radius: 30px; text-decoration: none; color: var(--ink); font-size: var(--fs-1); font-weight: 600; }
.tabbar .ph { font-size: 26px; }
.tabbar a[aria-current="page"] { background: var(--fill); color: var(--accent); }
body.v-na .tabbar { display: none; }

/* ---------- knapper ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 28px; border-radius: 99px; border: 0;
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--fs-3);
}
.pill .ph { font-size: 20px; }
.pill-sm { min-height: 42px; padding: 0 16px; font-size: var(--fs-2); background: var(--fill); }
.circle { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface); color: var(--ink); box-shadow: 0 2px 10px rgba(0,0,0,.08); text-decoration: none; flex: none; }
.circle .ph { font-size: 22px; }
.circle:disabled { opacity: .35; }
.ghost { background: none; border: 0; font-weight: 600; font-size: var(--fs-2); min-height: 44px; color: inherit; opacity: .85; }
.chev { color: var(--muted); font-size: 18px; display: inline-flex; transition: transform .2s; }
.badge { font-size: var(--fs-1); font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); }

/* ---------- vester og lagbrikker ---------- */
.vest { width: 22px; height: 22px; flex: none; }
.vest path { stroke: var(--vest-stroke); stroke-width: 1.2; stroke-linejoin: round; }
.vest.v-bla path { fill: var(--vest-bla); stroke: var(--vest-bla); }
.vest.v-rod path { fill: var(--vest-rod); stroke: var(--vest-rod); }
.vest.v-gul path { fill: var(--vest-gul); stroke: #b88f00; }
.vest.v-gronn path { fill: var(--vest-gronn); stroke: var(--vest-gronn); }
.vest.v-ingen path { fill: var(--vest-ingen); }
.tok { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px 4px 6px; border-radius: 99px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-2); font-weight: 600; white-space: nowrap; color: var(--ink); }
.tok .vest.v-ingen path { stroke: var(--ink); }

/* ---------- økt-liste ---------- */
.cards { display: flex; flex-direction: column; gap: 12px; }
.ocard { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; border-radius: 26px; padding: 22px 18px 22px 22px; min-height: 116px; text-decoration: none; color: var(--p-ink); }
.ocard-t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ocard-t b, .now-l b { font-size: var(--fs-5); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.ocard-t > span { font-size: var(--fs-2); }
.ocard-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.ocard-tags:empty { display: none; }
.tagp { font-size: var(--fs-1); font-weight: 600; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.tag-now { background: var(--run-okt); color: #fff; }
.ocard-e { font-size: 52px; }
.ocard .chev { color: var(--p-ink); opacity: .5; }
.ocard-new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 96px; background: none; border: 2px dashed var(--line); color: var(--muted); width: 100%; font-size: var(--fs-2); }
.ocard-new .ph { font-size: 24px; color: var(--ink); }
.ocard-new b { color: var(--ink); font-size: var(--fs-3); }
.now-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; background: var(--run); color: #fff; border-radius: 26px; padding: 22px; min-height: 116px; }
.now-l { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-2); }
.now-l span { font-variant-numeric: tabular-nums; }
.now-r { width: 52px; height: 52px; border-radius: 50%; background: #fff; color: var(--run); display: grid; place-items: center; flex: none; }
.now-r .ph { font-size: 22px; }

/* ---------- økt-side ---------- */
.hero { color: var(--p-ink); padding-block: 14px 28px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; margin-top: -20px; }
.hero-top { align-self: stretch; display: flex; margin-bottom: -14px; }
.hero .big-emoji { font-size: 72px; margin-bottom: 4px; }
.hero h1 { font-size: var(--fs-5); }
.hero p { font-size: var(--fs-2); }
.hero .pill { margin-top: 12px; }
.c-peach { background: var(--p-peach); }
.c-mint { background: var(--p-mint); }
.c-lav { background: var(--p-lav); }
.c-pink { background: var(--p-pink); }
.c-sky { background: var(--p-sky); }

/* ---------- grupperte lister ---------- */
.grp { display: flex; flex-direction: column; gap: 8px; }
.grp-f { font-size: var(--fs-1); color: var(--muted); padding: 0 4px; }
.card { background: var(--group); border-radius: 20px; overflow: hidden; }
.v-innstillinger .card { background: var(--surface); }
.set { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 56px; position: relative; }
.set + .set::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line); }
.set.col { flex-direction: column; align-items: stretch; gap: 10px; }
.set-top { display: flex; align-items: center; gap: 12px; }
.ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.ico .ph { font-size: 18px; }
.set-l { flex: 1; min-width: 0; font-size: var(--fs-3); }
.set-s { display: block; font-size: var(--fs-1); color: var(--muted); }
.set-v { color: var(--muted); font-size: var(--fs-2); text-align: right; min-width: 0; }
button.set { width: 100%; border: 0; background: none; text-align: left; }
.danger { color: var(--i-red); }
.ok { color: var(--i-green); font-weight: 600; }
.no { color: var(--i-red); font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 2px; background: var(--surface); border-radius: 99px; padding: 3px; }
.v-innstillinger .stepper { background: var(--fill); }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--fill); font-size: var(--fs-4); line-height: 1; display: grid; place-items: center; }
.stepper output { min-width: 52px; text-align: center; font-weight: 600; font-size: var(--fs-3); font-variant-numeric: tabular-nums; }
.segctl { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; background: var(--fill); border-radius: 12px; padding: 3px; }
.segctl button { border: 0; background: none; border-radius: 9px; min-height: 36px; font-weight: 600; font-size: var(--fs-2); padding: 0 10px; }
.segctl button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.switch { appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 99px; background: var(--fill); position: relative; flex: none; margin: 0; cursor: pointer; transition: background .2s; box-shadow: inset 0 0 0 1px var(--line); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked { background: var(--i-green); box-shadow: none; }
.switch:checked::after { transform: translateX(20px); }
.vpick { display: flex; flex-wrap: wrap; gap: 6px; }
.vpick button { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 99px; padding: 7px 13px 7px 8px; background: var(--surface); font-weight: 600; font-size: var(--fs-2); opacity: .5; }
.vpick button[aria-pressed="true"] { opacity: 1; box-shadow: inset 0 0 0 2px var(--ink); }
.txt { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; font-size: var(--fs-3); }
.pick-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-e { width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--surface); font-size: var(--fs-5); display: grid; place-items: center; }
.pick-c { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); }
.pick-e[aria-pressed="true"], .pick-c[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); }
.list { margin: 0; padding-left: 1.25em; display: flex; flex-direction: column; gap: 6px; }

/* ---------- rader med miniatyr ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; align-items: center; padding-block: 8px; text-decoration: none; color: inherit; width: 100%; background: none; border: 0; text-align: left; }
.thumb { width: 60px; height: 60px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--grass); }
.thumb svg.diag { width: 100%; height: 100%; border-radius: 0; }
.row-t { font-size: var(--fs-3); font-weight: 600; min-width: 0; }
.row-s { display: block; font-size: var(--fs-1); font-weight: 400; color: var(--muted); }
.row-r { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-2); }
.stars-mini { display: inline-flex; align-items: center; gap: 3px; color: var(--ink); font-weight: 600; font-size: var(--fs-2); }
.stars-mini .ph { color: var(--star); }

/* ---------- RUTENETTET: hallen sett ovenfra ---------- */
.hall { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; }
.hcol { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; color: var(--p-ink); border: 0; padding: 0; text-align: center; min-width: 0; background: var(--p-mint); }
.hcol.ex { background: var(--p-peach); }
.hcol-h { font-size: var(--fs-1); font-weight: 800; padding: 8px 2px 2px; }
.hcell { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 10px; min-height: 84px; justify-content: center; }
.hcell + .hcell { border-top: 1px solid var(--p-line); }
.hcell .vest { width: 32px; height: 32px; }
.hcell b { font-size: var(--fs-1); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.hgo { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-1); font-weight: 600; opacity: .7; }
.hgo .ph { font-size: 13px; }
.hgo.wrap { opacity: 1; }
.hall.small { gap: 4px; }
.hall.small .hcol { border-radius: 11px; }
.hall.small .hcol-h { padding: 5px 1px 0; }
.hall.small .hcell { min-height: 56px; padding: 4px 1px 6px; }
.hall.small .hcell .vest { width: 22px; height: 22px; }
.hall-rule { font-size: var(--fs-1); color: var(--muted); }
.rounds { display: flex; flex-direction: column; gap: 14px; padding-top: 10px; }
.round { display: flex; flex-direction: column; gap: 6px; }
details.plain > summary { cursor: pointer; font-weight: 600; font-size: var(--fs-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.plain > summary::-webkit-details-marker { display: none; }
details.plain[open] > summary .chev { transform: rotate(90deg); }

/* ---------- under trening ---------- */
body.v-na { --band: var(--run); }
.runbar { background: var(--run); color: #fff; margin-top: -20px; padding-block: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.rb-x { width: 40px; height: 40px; background: color-mix(in srgb, #000 22%, var(--run)); color: #fff; box-shadow: none; margin-bottom: 8px; }
.rb-x .ph { font-size: 20px; }
.rb-title { font-size: var(--fs-5); }
.rb-next { font-size: var(--fs-2); opacity: .85; }
.rb-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.clock { font-size: var(--fs-clock); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; color: #fff; }
.clock.over { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { opacity: .35; } }
.rb-ctrls { display: flex; align-items: center; gap: 8px; }
.rb-ctrls .circle { width: 44px; height: 44px; background: color-mix(in srgb, #000 22%, var(--run)); color: #fff; box-shadow: none; }
.rb-ctrls .circle .ph { font-size: 20px; }
.rb-ctrls .play { width: 60px; height: 60px; background: #fff; color: var(--run); }
.rb-ctrls .play .ph { font-size: 26px; }
.rb-prog { height: 5px; border-radius: 99px; background: rgba(255,255,255,.28); overflow: hidden; display: block; margin-top: 12px; }
.rb-prog > i:not(.tick) { display: block; height: 100%; background: #fff; transition: width .25s linear; }
.rb-again { align-self: flex-start; background: none; border: 0; color: #fff; opacity: .85; font-size: var(--fs-2); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 6px 0 0; }

/* Faner (segmentert, som valgknappene) */
.sttabs { display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none; background: var(--fill); border-radius: 14px; padding: 3px; }
.sttabs::-webkit-scrollbar { display: none; }
.sttabs button { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 0; background: none; border-radius: 11px; min-height: 40px; padding: 0 12px; font-size: var(--fs-2); font-weight: 600; color: var(--ink); white-space: nowrap; }
.sttabs button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.sttabs .vest { width: 18px; height: 18px; }

/* Én stasjon: stor kolonne */
.stcol { border-radius: 22px; color: var(--p-ink); background: var(--p-mint); overflow: hidden; }
.stcol.ex { background: var(--p-peach); }
.stcol-h { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px 4px; }
.stcol-h b { font-size: var(--fs-5); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.meta-l { font-size: var(--fs-1); font-weight: 600; opacity: .7; }
.stteam { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: center; padding: 14px 18px; }
.stteam + .stteam { border-top: 1px solid var(--p-line); }
.stteam .vest { width: 52px; height: 52px; grid-row: span 2; }
.stteam b { font-size: var(--fs-4); font-weight: 800; }
.stteam b small { font-size: var(--fs-2); font-weight: 400; opacity: .7; margin-left: 4px; }
.stgo { display: flex; align-items: center; gap: 6px; font-size: var(--fs-3); font-weight: 600; }
.stgo .ph { font-size: 20px; }
.stgo.wrap { color: inherit; }
.stinfo { padding: 14px 18px; font-size: var(--fs-3); }
.stinfo + .stteam, .stteam + .stinfo { border-top: 1px solid var(--p-line); }
.comes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-2); color: var(--muted); }

/* Full øvelsesbeskrivelse */
.exfull { display: flex; flex-direction: column; gap: 14px; }
.exfull h2 { font-size: var(--fs-4); }
.exfull h3 { font-size: var(--fs-3); font-weight: 800; }
.diag { width: 100%; height: auto; display: block; border-radius: 16px; max-width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-1); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend svg { width: 24px; height: 8px; }
.legend line { stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.facts-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: var(--fs-2); }
.facts-list dt { color: var(--muted); }
.facts-list dd { margin: 0; font-weight: 600; min-width: 0; }

/* Sene ankomster */
.late { display: flex; align-items: center; gap: 12px; background: var(--group); border-radius: 20px; padding: 14px 16px; flex-wrap: wrap; }
.late-t { flex: 1 1 200px; font-size: var(--fs-2); min-width: 0; }
.late-t b:first-child { display: block; font-size: var(--fs-3); }
.late-t .tok { vertical-align: middle; margin: 2px 0; }
.late-a { display: flex; align-items: center; gap: 8px; }

/* Bytt-skjerm */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: var(--run, var(--run-okt)); color: #fff;
  display: flex; flex-direction: column; gap: 18px; overflow-y: auto; text-align: left;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  padding-top: calc(28px + env(safe-area-inset-top, 0px)); padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.overlay > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
.overlay h2 { font-size: var(--fs-clock); letter-spacing: -.04em; line-height: 1; }
.overlay .ov-sub { font-size: var(--fs-3); opacity: .9; margin-top: -10px; }
.ov-say { display: flex; flex-direction: column; gap: 14px; }
.ov-say .say { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ov-say .say-t { font-size: var(--fs-4); font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.ov-say .say-s { display: block; font-size: var(--fs-2); font-weight: 400; opacity: .85; flex-basis: 100%; padding-left: 4px; }
.ov-say .tok { font-size: var(--fs-3); padding: 6px 14px 6px 8px; box-shadow: none; }
.ov-say .tok .vest { width: 28px; height: 28px; }
.overlay .comes { color: rgba(255,255,255,.9); }
.overlay .comes .tok { box-shadow: none; }
.overlay .pill { width: 100%; background: #fff; color: var(--run, var(--run-okt)); margin-top: 4px; }
.overlay .big-emoji { font-size: 64px; }

/* Advarsel */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(10, 12, 20, .5); display: grid; place-items: center; padding: 24px; }
.modal-card { background: var(--bg); color: var(--ink); border-radius: 24px; padding: 22px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.modal-card h3 { font-size: var(--fs-4); }
.modal-card p { font-size: var(--fs-2); color: var(--muted); }
.modal-a { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.modal-a .pill { width: 100%; background: var(--fill); }
.modal-a .pill.dark { background: var(--ink); color: var(--bg); }
.modal-a .pill.danger { color: var(--i-red); background: var(--fill); }

/* ---------- øvelser ---------- */
.searchbox { display: flex; align-items: center; gap: 10px; background: var(--fill); border-radius: 99px; padding: 0 18px; min-height: 50px; }
.searchbox .ph { font-size: 20px; color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--fs-3); }
.searchbox:focus-within { box-shadow: 0 0 0 3px var(--focus); }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-top: -10px; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: none; border: 0; background: var(--fill); border-radius: 99px; padding: 8px 15px; font-weight: 600; font-size: var(--fs-2); display: inline-flex; gap: 6px; align-items: center; }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.inuse { font-size: var(--fs-1); font-weight: 600; color: var(--accent); }
.dhero { padding-block: 14px 20px; display: flex; flex-direction: column; gap: 14px; margin-top: -20px; color: var(--p-ink); }
.dhero.k-Oppvarming { background: var(--p-sky); }
.dhero.k-Teknikk { background: var(--p-lav); }
.dhero.k-Avslutning { background: var(--p-peach); }
.dhero.k-Smålagsspill { background: var(--p-mint); }
.dhead { text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.dhead h1 { font-size: var(--fs-5); }
.dhead p { font-size: var(--fs-2); }
.stars { display: flex; gap: 6px; }
.star { width: 50px; height: 50px; border: 0; background: var(--fill); border-radius: 14px; display: grid; place-items: center; }
.star .ph { font-size: 26px; color: var(--muted); opacity: .45; }
.star.on { background: color-mix(in srgb, var(--star) 18%, var(--surface)); }
.star.on .ph { color: var(--star); opacity: 1; }
.use { display: flex; flex-wrap: wrap; gap: 8px; }
.use button { border: 0; background: var(--fill); border-radius: 99px; padding: 9px 15px; font-weight: 600; font-size: var(--fs-2); display: inline-flex; align-items: center; gap: 6px; }
.use button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* Velg øvelse (ark nedenfra) */
.picker { position: fixed; inset: 0; z-index: 45; background: rgba(10, 12, 20, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-panel {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; border-radius: 26px 26px 0 0;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 10px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head b { font-size: var(--fs-4); font-weight: 800; }
.sheet-panel .row { grid-template-columns: 1fr auto; }
.row-btn { display: grid; grid-template-columns: 60px 1fr; gap: 14px; align-items: center; background: none; border: 0; padding: 0; text-align: left; color: inherit; min-width: 0; }
.check { color: var(--i-green); font-size: 22px; display: inline-flex; }
.circle.sm { width: 36px; height: 36px; box-shadow: none; background: var(--fill); }
.circle.sm .ph { font-size: 16px; }

/* ---------- tegning ---------- */
.d-grass { fill: var(--grass); }
.d-stripe { fill: var(--grass-2); }
.d-zone { fill: none; stroke: #ffffff; stroke-opacity: .75; stroke-width: .5; stroke-dasharray: 1.5 1.2; }
.d-cone { fill: #f08a2c; stroke: #ffffff; stroke-width: .3; }
.d-goal { fill: #ffffff; fill-opacity: .25; stroke: #ffffff; stroke-width: .7; }
.d-p { stroke: #ffffff; stroke-width: .6; }
.d-p-bla { fill: var(--vest-bla); }
.d-p-rod { fill: var(--vest-rod); }
.d-p-ingen { fill: #ffffff; stroke: #15171c; }
.d-p-keeper { fill: #8b5cf6; }
.d-ball { fill: #ffffff; stroke: #15171c; stroke-width: .35; }
.d-a { fill: none; stroke: #ffffff; stroke-width: .7; stroke-linecap: round; stroke-linejoin: round; }
.d-a-run { stroke-dasharray: 2 1.4; }
.d-a-drib { stroke-dasharray: .3 1.2; stroke-width: .9; }
.d-head { fill: #ffffff; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 99px; font-weight: 600; font-size: var(--fs-2);
  max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
body.v-na .toast { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

@media (prefers-reduced-motion: reduce) { .clock.over { animation: none; } .rb-prog i, .chev, .switch, .switch::after { transition: none; } }

/* Rader med knapp, legg til felt, vester på linje med tittel */
.set-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; color: inherit; min-height: 40px; }
.set-btn .set-s { margin-bottom: 1px; }
.add-row { gap: 8px; flex-wrap: wrap; }
.add-row .pill-sm { background: var(--surface); }
.vpick.indent { padding-left: 42px; }
.set .circle.sm { background: var(--surface); }
.runbar .clock { font-size: clamp(44px, 14vw, var(--fs-clock)); }
.rb-ctrls { gap: 6px; }
.rb-ctrls .circle { width: 40px; height: 40px; }
.rb-ctrls .play { width: 56px; height: 56px; }
.rb-main { min-width: 0; }
/* Antall spillere i vesten */
.vnum text { font: 800 9px var(--f-ui); fill: #ffffff; }
.vnum.v-ingen text, .vnum.v-gul text { fill: #15171c; }
/* Fjern-knapp i rødt */
.circle.sm.del { color: var(--i-red); }
/* Én kom: synlig knapp på grå bakgrunn */
.late .pill-sm { background: var(--ink); color: var(--bg); }

/* ===== Kampdag ===== */
:root { --lag-bla: #2170e0; --lag-rod: #dc3b3b; --lag-gul: #f2c21b; --lag-gronn: #22a35a; --lag-oransje: #f08a2c; --lag-lilla: #8b5cf6; --lag-rosa: #ec6fa6; --lag-svart: #2a2d34; --lag-hvit: #ffffff; }
.vest.v-oransje path { fill: var(--lag-oransje); stroke: var(--lag-oransje); }
.vest.v-lilla path { fill: var(--lag-lilla); stroke: var(--lag-lilla); }
.vest.v-rosa path { fill: var(--lag-rosa); stroke: var(--lag-rosa); }
.vest.v-svart path { fill: var(--lag-svart); stroke: #000; }
.vest.v-hvit path { fill: #ffffff; stroke: var(--vest-stroke); }
.newrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.newrow .ocard-new { min-height: 110px; padding: 14px; text-align: center; }
.kthumb { background: var(--fill); }
.kthumb .vest { width: 34px; height: 34px; }
/* lagfarge som svak bakgrunn */
.k-bla { --kc: var(--lag-bla); } .k-rod { --kc: var(--lag-rod); } .k-gul { --kc: var(--lag-gul); } .k-gronn { --kc: var(--lag-gronn); }
.k-oransje { --kc: var(--lag-oransje); } .k-lilla { --kc: var(--lag-lilla); } .k-rosa { --kc: var(--lag-rosa); } .k-svart { --kc: var(--lag-svart); } .k-hvit { --kc: #9aa0ab; }
.stcol.kc { background: color-mix(in srgb, var(--kc) 22%, var(--bg)); color: var(--ink); }
.pill-go { background: var(--run-okt); color: #fff; width: 100%; margin-top: -8px; }
.ktable-wrap { overflow-x: auto; margin-inline: -2px; }
.ktable { border-collapse: separate; border-spacing: 4px; font-size: var(--fs-1); min-width: 100%; }
.ktable thead th { font-weight: 600; color: var(--muted); text-align: left; padding: 0 4px 2px; white-space: nowrap; }
.ktable tbody th { font-weight: 800; font-size: var(--fs-2); text-align: left; padding-right: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: top; padding-top: 8px; }
.ktable td { vertical-align: top; min-width: 96px; }
.kcell { display: flex; flex-direction: column; border-radius: 10px; padding: 7px 9px; background: color-mix(in srgb, var(--kc) 24%, var(--bg)); border-left: 4px solid var(--kc); margin-bottom: 4px; }
.kcell b { font-size: var(--fs-2); }
.kcell small { font-size: var(--fs-1); color: var(--muted); }
.kcell.dim { opacity: .35; }
.krow { grid-template-columns: 60px 1fr auto; }
.ktime { font-size: var(--fs-4); font-weight: 800; font-variant-numeric: tabular-nums; }
.krow .chev { color: var(--run-okt); }
.bplan { border-collapse: collapse; font-size: var(--fs-1); min-width: 100%; }
.bplan th, .bplan td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.bplan thead th { color: var(--muted); font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.bplan tbody th { text-align: left; font-weight: 600; font-size: var(--fs-2); white-space: nowrap; }
.bplan td { text-align: center; }
.bplan .on { display: inline-block; width: 22px; height: 14px; border-radius: 4px; background: var(--kc); }
.k-hvit .on, .bplan .on.k-hvit { background: #c9ccd3; }
textarea.txt.area { min-height: 96px; padding: 10px 12px; line-height: 1.4; resize: vertical; font: inherit; font-size: var(--fs-3); }
.kedit { display: grid; grid-template-columns: 84px 1fr auto; gap: 6px; }
.kedit .txt.sm { min-height: 38px; padding: 0 8px; font-size: var(--fs-2); }
.kedit input[data-kk="bane"] { grid-column: 1; }
.kedit input[data-kk="mot"] { grid-column: 2; }
.kedit .del { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.kedit select[data-kk="lag"] { grid-column: 2; grid-row: 1; }
.add-wide { align-self: flex-start; }
.ov-say .say-n { flex-basis: 100%; font-size: var(--fs-5); font-weight: 600; line-height: 1.25; }
.stepper button:disabled { opacity: .35; }

/* Kamparkiv */
details.kdone > summary { list-style: none; cursor: pointer; }
details.kdone > summary::-webkit-details-marker { display: none; }
details.kdone[open] .chev { transform: rotate(90deg); }
details.kdone { border-bottom: 1px solid var(--line); }
.kres { display: flex; flex-direction: column; gap: 6px; padding: 0 0 12px 74px; font-size: var(--fs-2); }
.kres > span { display: flex; justify-content: space-between; gap: 10px; }
.kres .ghost { align-self: flex-start; padding: 0; min-height: 36px; color: var(--muted); }
details.setup > summary { font-size: var(--fs-4); font-weight: 800; padding-block: 4px; }
details.setup[open] > summary { margin-bottom: 16px; }
details.setup > .grp, details.setup > section { margin-bottom: 20px; }
.txt.dato { width: auto; min-height: 38px; }

/* Seksjonstittel med Rediger-knapp */
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.edit-btn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: var(--fs-2); padding: 4px 0; }
.grp > .sec-h { margin-bottom: 0; }
.sec > .card + .card, .sec > .card + .pill { margin-top: 2px; }
.add-wide { align-self: flex-start; background: var(--fill); }
.txt.inline { width: auto; max-width: 60%; min-height: 38px; text-align: right; background: var(--surface); }
.score { font-size: var(--fs-4); font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.row-r.go { color: var(--run-okt); font-size: 20px; }
/* Hakk på tidslinjen for bytter */
.rb-prog { position: relative; height: 8px; }
.rb-prog .fill { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .25s linear; position: relative; z-index: 1; }
.rb-prog .tick { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: rgba(0,0,0,.35); z-index: 2; }
.bplan th.cur, .bplan td.cur { background: color-mix(in srgb, var(--kc, var(--accent)) 14%, transparent); }
.bplan .on { background: var(--kc, var(--accent)); }
.bplan th, .bplan td { padding: 5px 1px; }
.bplan tbody th { padding-right: 8px; }
.bplan .on { width: 100%; max-width: 20px; min-width: 10px; height: 14px; }
.bplan thead th { font-size: 11px; }
.kedit { grid-template-columns: 104px 1fr auto; }
.bplan { table-layout: fixed; width: 100%; }
.bplan thead th:first-child { width: 86px; }
.bplan tbody th { overflow: hidden; text-overflow: ellipsis; }
.bplan thead th { overflow: visible; white-space: nowrap; text-align: left; }
.bplan .on { display: block; margin: 0 auto; width: 80%; }

/* Bytt-skjerm: kontrast, linjering og gruppering */
.overlay .pill { color: var(--ink); }
.overlay .pill .ph { color: var(--ink); }
.ov-say { gap: 22px; margin-top: 4px; }
.ov-say .say { gap: 6px 12px; }
.ov-say .say-s { padding-left: 0; margin-top: -2px; }
.ov-say .say-n { margin-top: -2px; }
.overlay .comes { margin-top: 6px; }
.overlay .ov-sub { margin-top: -6px; }
.overlay > .pill { margin-top: 12px; }

/* Underseksjoner */
.h3 { font-size: var(--fs-3); font-weight: 800; margin-top: 14px; }
.grp > .h3 { margin-bottom: 2px; }
.hall.warm .hcell { min-height: 76px; }
.hall.warm .hcell .vest { width: 36px; height: 36px; }

.score-big { display: inline-flex; align-items: center; gap: 14px; }
.score-big .emoji { font-size: 56px; }
.end-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 99px; min-height: 52px; background: var(--fill); color: var(--i-red); font-weight: 600; font-size: var(--fs-3); margin-top: 8px; }
.end-btn .ph { font-size: 18px; }
.grp > .card + .card { margin-top: 6px; }

/* Deling */
.now-card.live { width: 100%; border: 0; text-align: left; font: inherit; color: #fff; cursor: pointer; }
.now-r.join { width: auto; height: auto; padding: 10px 16px; border-radius: 99px; font-weight: 700; font-size: var(--fs-2); }
.follow { display: flex; flex-direction: column; gap: 12px; background: var(--group); border-radius: 20px; padding: 16px; }
.follow-t { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-2); }
.follow-t .ph { font-size: 22px; flex: none; margin-top: 1px; }
.follow .take { align-self: flex-start; background: var(--ink); color: var(--bg); }
.live-note { display: flex; gap: 6px; align-items: center; }
.live-note .ph { font-size: 16px; }
.modal-a .pill { font-size: var(--fs-2); }
