/* Kjørerapport – stil. Mobil først, maks 720 px, lys/mørk via prefers-color-scheme. */
@font-face {
  font-family: 'Overpass';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/overpass-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Overpass';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/overpass-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #e9ecea; --surface: #f7f8f6; --ink: #1f2428; --muted: #59626a; --line: #d2d7d3;
  --asphalt: #3b4146; --road-edge: #2a2f33; --lane: #f2be22;
  --brake: #c8412b; --accel: #1f5fa8; --turn: #c7741f; --good: #2f7d4f; --sign: #c8102e;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1f22; --surface: #23282c; --ink: #e7eae8; --muted: #a3abb1; --line: #363c41;
    --asphalt: #4a5157; --road-edge: #5b6369; --lane: #f2c230;
    --brake: #e3654e; --accel: #6a9fe0; --turn: #e89b4c; --good: #56b37c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1f22; --surface: #23282c; --ink: #e7eae8; --muted: #a3abb1; --line: #363c41;
  --asphalt: #4a5157; --road-edge: #5b6369; --lane: #f2c230;
  --brake: #e3654e; --accel: #6a9fe0; --turn: #e89b4c; --good: #56b37c;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }   /* også når siden dras forbi kanten */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Overpass', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.45;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app { max-width: 720px; margin: 0 auto; padding: 12px 16px 32px; }
.screen[hidden] { display: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }
.center { text-align: center; }
.top { display: flex; align-items: center; gap: 12px; min-height: 56px; margin-bottom: 8px; }
.top h1 { flex: 1; margin: 0; }
.brand { flex: 1; }

/* Knapper – alle berøringsflater er minst 48 px */
button { font: inherit; color: inherit; }
.btn {
  display: block; width: 100%; min-height: 56px; padding: 14px 20px; margin: 0 0 12px;
  border: 2px solid transparent; border-radius: var(--radius); font-weight: 700; font-size: 1.05rem;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.btn.big { min-height: 76px; font-size: 1.35rem; font-weight: 800; }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--brake); border-color: var(--brake); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(0.985); }
.link { background: none; border: 0; color: var(--accel); font-weight: 700; padding: 10px 6px; min-height: 48px; cursor: pointer; font-size: 1.05rem; }
.icon-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accel); outline-offset: 3px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card:empty { display: none; }
.notice { background: color-mix(in srgb, var(--turn) 14%, var(--surface)); border-left: 4px solid var(--turn); padding: 10px 12px; border-radius: 8px; }
.notice:empty { display: none; }
.reminder { font-size: 1.05rem; }

/* Hjem: liste og trend */
.drives { list-style: none; margin: 0; padding: 0; }
.drives li + li { border-top: 1px solid var(--line); }
.drive { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 4px; background: none; border: 0; text-align: left; cursor: pointer; }
.drive-main { flex: 1; display: flex; flex-direction: column; }
.score { font-weight: 800; font-size: 1.4rem; min-width: 48px; text-align: right; }
.score.good { color: var(--good); } .score.mid { color: var(--turn); } .score.bad { color: var(--brake); }
.empty { padding: 10px 0; }

/* Før kjøring */
.checks { list-style: none; margin: 0 0 12px; padding: 12px 16px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.checks li + li { border-top: 1px solid var(--line); }
.check-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; margin-top: 2px; border: 3px solid var(--line); position: relative; }
[data-state="ok"] .check-icon { background: var(--good); border-color: var(--good); }
[data-state="ok"] .check-icon::after { content: ''; position: absolute; left: 8px; top: 3px; width: 6px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
[data-state="fail"] .check-icon { background: var(--brake); border-color: var(--brake); }
[data-state="fail"] .check-icon::before, [data-state="fail"] .check-icon::after { content: ''; position: absolute; left: 10px; top: 4px; width: 3px; height: 15px; background: #fff; transform: rotate(45deg); }
[data-state="fail"] .check-icon::after { transform: rotate(-45deg); }
[data-state="wait"] .check-icon { border-style: dashed; }

/* Opptak – minimalt og høy kontrast */
.record { min-height: calc(100vh - 44px); min-height: calc(100dvh - 44px); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding-top: 24px; }
.rec-top { display: flex; align-items: center; gap: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--brake); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.rec-stats { text-align: center; }
.rec-elapsed { font-size: clamp(3.6rem, 22vw, 6.5rem); font-weight: 800; line-height: 1; margin: 20px 0 8px; font-variant-numeric: tabular-nums; }
.rec-dist { font-size: 2rem; font-weight: 700; margin-bottom: 6px; }
.rec-gps { font-size: 1.1rem; font-weight: 700; color: var(--muted); }
.rec-gps[data-state="ok"] { color: var(--good); } .rec-gps[data-state="fail"] { color: var(--brake); }
.stop {
  /* Stoppknappen (0.10.1): rund og rød med et hvitt stopp-symbol. En ring rundt fylles mens den holdes inne (1 s).
     touch-action: pan-y: siden kan rulles med en finger på knappen, og rulling avbryter holdet (pointercancel). */
  position: relative; width: 196px; height: 196px; border-radius: 50%; border: 0; padding: 0; background: none; color: #fff; margin: 20px 0 24px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.stop-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.stop-track { fill: none; stroke: color-mix(in srgb, var(--sign) 18%, transparent); stroke-width: 5; }
.stop-fill { fill: none; stroke: var(--sign); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.stop-face {
  position: absolute; inset: 12px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 35% 28%, color-mix(in srgb, var(--sign) 78%, #fff) 0%, var(--sign) 55%, color-mix(in srgb, var(--sign) 82%, #000) 100%);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--sign) 40%, transparent), inset 0 -4px 10px rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.18);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stop-ico { width: 30px; height: 30px; border-radius: 7px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: border-radius .2s var(--ease); }
.stop-label { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: .01em; }
.stop-hint { font-size: .85rem; font-weight: 700; opacity: .9; }
.stop.pressing .stop-face { transform: scale(.94); box-shadow: 0 4px 12px color-mix(in srgb, var(--sign) 35%, transparent), inset 0 -2px 8px rgba(0,0,0,.25); }
.stop.pressing .stop-ico { border-radius: 50%; }
.stop.done .stop-fill { stroke: var(--good); }
.stop:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }
@media (prefers-reduced-motion: reduce) { .stop-face, .stop-ico { transition: none; } }
.record.busy { opacity: 0.6; pointer-events: none; }

/* Rapport */
.report-head { margin-bottom: 10px; }
.hero { display: flex; gap: 18px; align-items: center; }
.hero .sign, .hero .score-ring { flex: none; width: 148px; height: 148px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25)); }
.hero-text { flex: 1; min-width: 0; }
.rating { font-size: 1.25rem; font-weight: 800; margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 0 0 10px; }
.stats dt { font-size: 0.85rem; color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.compare { color: var(--muted); font-size: 0.95rem; margin: 0; }
@media (max-width: 420px) {
  .hero { flex-direction: column; align-items: stretch; text-align: center; }
  .hero .sign, .hero .score-ring { margin: 0 auto; }
  .stats { text-align: left; }
}

.map, .chart { width: 100%; height: auto; display: block; }
.map { background: var(--bg); border-radius: 10px; }
.marker .halo { fill: none; stroke: var(--ink); stroke-width: 3; opacity: 0; }
.marker.active .halo { opacity: 1; }
.marker.active circle:not(.halo) { stroke-width: 4; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 0; padding: 0; font-size: 0.92rem; color: var(--muted); }
.legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend .dot.square { border-radius: 2px; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 7.2rem 1fr 2.4rem; align-items: center; gap: 10px; }
.bar { height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 7px; transition: width 0.6s ease; }
.bar-fill.good { background: var(--good); } .bar-fill.mid { background: var(--turn); } .bar-fill.bad { background: var(--brake); }
.bar-val { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }

.tips { display: grid; gap: 10px; }
.tip { padding: 10px 14px; border-left: 5px solid var(--line); background: var(--bg); border-radius: 8px; }
.tip p { margin: 0; }
.tip-brake { border-color: var(--brake); } .tip-accel { border-color: var(--accel); } .tip-turn { border-color: var(--turn); } .tip-smooth { border-color: var(--muted); } .tip-good { border-color: var(--good); }

.grid { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 14px; font-family: inherit; }
.axis-line { stroke: var(--muted); stroke-width: 1.5; }
.axis.big { font-size: 18px; }
.trend { max-height: 240px; }
.sep { margin: 0 0.4em; }

.events { list-style: none; margin: 0; padding: 0; }
.events li + li { border-top: 1px solid var(--line); }
.event { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 4px; background: none; border: 0; text-align: left; cursor: pointer; border-radius: 8px; }
.event.active { background: var(--bg); }
.event .num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; display: grid; place-items: center; }
.ev-text { flex: 1; display: flex; flex-direction: column; }
.ev-text .muted { font-size: 0.92rem; }
.ev-g { font-weight: 800; font-variant-numeric: tabular-nums; }

details summary { font-weight: 700; font-size: 1.15rem; cursor: pointer; min-height: 48px; display: flex; align-items: center; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '›'; display: inline-block; margin-right: 10px; transition: transform 0.2s; font-size: 1.4rem; }
details[open] > summary::before { transform: rotate(90deg); }
.method p { font-size: 0.97rem; }
.report-foot { color: var(--muted); font-size: 0.9rem; text-align: center; padding: 16px 8px 8px; }

/* Innstillinger */
.segment { display: flex; border: 2px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.segment label { flex: 1; position: relative; }
.segment input { position: absolute; opacity: 0; inset: 0; }
.segment span { display: grid; place-items: center; min-height: 52px; font-weight: 700; cursor: pointer; text-align: center; padding: 0 6px; }
.segment input:checked + span { background: var(--ink); color: var(--bg); }
.segment input:focus-visible + span { outline: 3px solid var(--accel); outline-offset: -3px; }
select { width: 100%; min-height: 52px; font: inherit; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); margin-bottom: 12px; }

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

/* ---- v0.2.0 ---- */
.btn.small-btn { display: inline-block; width: auto; min-height: 48px; padding: 10px 18px; margin: 0; font-size: 1rem; }
.report-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.report-title h1 { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 10px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.tile-val { font-size: 1.35rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-label { font-size: 0.82rem; color: var(--muted); }
.howto { margin: 0 0 10px; padding-left: 22px; }
.howto li { margin-bottom: 8px; }
.install-hint p { margin-bottom: 10px; }
.install-hint .btn { margin-bottom: 4px; }
.share-glyph { display: inline-block; font-size: 1.1em; }
.note-snippet { font-style: italic; }
.note-card textarea { width: 100%; font: inherit; font-size: 1rem; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; min-height: 60px; }
.note-card h2 { margin-bottom: 6px; }
.note-card p { margin: 6px 0 0; }
.delta { display: inline-block; margin-left: 6px; font-size: 0.8rem; font-weight: 700; }
.delta.up { color: var(--good); } .delta.down { color: var(--brake); } .delta.same { color: var(--muted); }
.bar-row { grid-template-columns: 7.2rem 1fr auto; }
.bar-val { min-width: 2.4rem; white-space: nowrap; }
.positives { margin: 0; padding-left: 20px; }
.positives li { margin-bottom: 6px; }
.marker { cursor: pointer; }
.marker:focus-visible { outline: none; }
.marker:focus-visible .halo { opacity: 1; }
.file-btn { position: relative; display: block; text-align: center; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--accel); outline-offset: 3px; }
.rec-saved { margin-top: 10px; }
.stats { grid-template-columns: 1fr 1fr; }
@media (min-width: 560px) { .stats { grid-template-columns: 1fr 1fr 1fr; } }

/* ---- v0.3.0 ---- */
.quicknav { position: sticky; top: env(safe-area-inset-top, 0); z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 10px; margin: 0 -16px 6px; padding-left: 16px; padding-right: 16px; background: var(--bg); scrollbar-width: none; }
.quicknav::-webkit-scrollbar { display: none; }
.quicknav a { flex: none; min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem; }
.btn.small-btn { min-height: 48px; padding: 10px 20px; font-size: 1.05rem; }
.mark-wrap { text-align: center; margin: 8px 0; }
.mark-wrap p { margin: 6px 0 0; }
.btn-mark { min-width: 200px; min-height: 64px; border-radius: 32px; border: 3px solid var(--ink); background: var(--surface); color: var(--ink); font-weight: 800; font-size: 1.4rem; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn-mark.flash { background: var(--ink); color: var(--bg); }
.marks { list-style: none; margin: 0; padding: 0; }
.marks li + li { border-top: 1px solid var(--line); }
.mark-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px; }
.mark-num { flex: none; width: 34px; height: 34px; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 800; border-radius: 6px; transform: rotate(45deg); margin: 4px 2px 0 2px; }
.mark-num { transform: none; border-radius: 8px; }
.mark-note { width: 100%; font: inherit; font-size: 1rem; padding: 8px 10px; margin-top: 6px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; min-height: 44px; }
.g-word { display: block; font-size: 0.78rem; font-weight: 700; text-align: right; }
.legend .dot.diamond { border-radius: 2px; transform: rotate(45deg) scale(0.85); }
.markpin { cursor: default; }

/* ---- v0.3.1 ---- */
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; min-height: 48px; cursor: pointer; }
.toggle + .toggle { border-top: 1px solid var(--line); }
.toggle input { width: 26px; height: 26px; flex: none; margin: 2px 0 0; accent-color: var(--good); }
.enrich-status { font-size: 0.92rem; color: var(--muted); margin: 0 0 10px; }
.enrich-status.error { color: var(--brake); }
.ev-place { display: block; color: var(--muted); font-size: 0.92rem; }
.limit-line { stroke: var(--sign); stroke-width: 2; stroke-dasharray: 6 4; fill: none; }
.over-area { fill: var(--sign); opacity: 0.28; }
.episodes { list-style: none; margin: 0; padding: 0; }
.episodes li { display: flex; gap: 12px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line); }
.episodes li:first-child { border-top: 0; }
.episodes .num { background: var(--sign); }
.limit-pill { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 4px solid var(--sign); color: #111; font-weight: 800; font-size: 0.9rem; flex: none; }

/* ---- v0.3.2 ---- */
.method h3 { font-size: 1rem; margin: 12px 0 6px; }
.diag { margin: 0; padding-left: 20px; font-size: 0.95rem; }
.diag li { margin-bottom: 4px; word-break: break-word; }

/* ---- v0.4.0 ---- */
.head-actions { display: flex; gap: 8px; flex: none; }
/* Ekte kart */
.lmap-wrap { position: relative; z-index: 0; }   /* egen stabel: kartets knapper og lag havner ikke over fanelinjen (0.11.4) */
.lmap { height: 380px; border-radius: 10px; overflow: hidden; background: var(--bg); z-index: 0; }
.lmap-toggle { position: absolute; right: 10px; bottom: 26px; z-index: 500; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.lmap-wrap.expanded { position: fixed; inset: 0; z-index: 2000; background: var(--bg); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.lmap-wrap.expanded .lmap { height: 100%; border-radius: 0; }
.lmap-wrap.expanded .lmap-toggle { bottom: calc(26px + env(safe-area-inset-bottom)); }
body.map-open { overflow: hidden; }
.route-edge { stroke: var(--road-edge); }
.route-asphalt { stroke: var(--asphalt); }
.route-lane { stroke: var(--lane); }
.route-over { stroke: var(--sign); opacity: 0.85; }
.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { font-size: 11px; }
.leaflet-bar a { width: 40px; height: 40px; line-height: 40px; font-size: 20px; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9); } }
.lm-start span, .lm-end span { display: block; width: 22px; height: 22px; font-size: 0; border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.lm-start span { background: var(--good); border-radius: 50%; }
.lm-end span { background: var(--road-edge); }
.lm-mark span { display: grid; place-items: center; width: 24px; height: 24px; margin: 2px; transform: rotate(45deg); background: var(--ink); border: 2px solid var(--surface); border-radius: 4px; }
.lm-mark span { font-weight: 800; color: var(--surface); font-size: 13px; }
.lm-ev-wrap { background: none; border: 0; }
.lm-ev { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 16px; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.45); cursor: pointer; }
.lm-brake { background: var(--brake); } .lm-accel { background: var(--accel); } .lm-turn { background: var(--turn); }
.lm-ev.active { outline: 4px solid var(--ink); outline-offset: 1px; }
.legend .dot.line { width: 18px; height: 5px; border-radius: 3px; }
/* Hendelsesdetalj */
.event { position: relative; }
.ev-chev { flex: none; font-size: 1.5rem; color: var(--muted); transition: transform .2s; margin-left: 4px; }
.event.open .ev-chev { transform: rotate(90deg); }
.ev-detail { padding: 6px 4px 14px 50px; }
.ev-detail p { margin-bottom: 8px; }
.ev-detail .btn { margin: 4px 0 0; }
.ev-stats { grid-template-columns: 1fr 1fr; margin: 8px 0; }
.ev-chart { margin: 4px 0 2px; }
.ev-now { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; }
.th-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 5 4; }
.ev-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0 0 8px; }
.ev-legend .dot { display: inline-block; margin-right: 6px; }
.ev-marks { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.ev-advice { border-left: 4px solid var(--good); padding-left: 10px; }
@media (max-width: 420px) { .ev-detail { padding-left: 4px; } }
/* Førere og mål */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; scrollbar-width: none; }
.chip { flex: none; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.driver-pick { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.driver-pick select { margin: 0; }
.driver-row { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 10px; }
.driver-row select { margin: 0; flex: 1; min-height: 48px; }
.driver-list { list-style: none; padding: 0; margin: 0 0 10px; }
.driver-list li { display: flex; justify-content: space-between; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); }
.danger-link { color: var(--brake); }
.add-row { display: flex; gap: 8px; }
.add-row input, .field input { flex: 1; min-height: 52px; font: inherit; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
.add-row .btn { width: auto; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; margin-bottom: 12px; }
.goal-list { list-style: none; margin: 0; padding: 0; }
.goal-list li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.goal-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; border: 2px solid var(--line); }
.goal-ok .goal-icon { background: var(--good); border-color: var(--good); color: #fff; }
.goal-line { stroke: var(--good); stroke-width: 2; stroke-dasharray: 6 5; }
.goal-text { fill: var(--good); font-weight: 700; }
.trend-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.trend-head h2 { margin: 0; }
.mini-seg { display: flex; border: 2px solid var(--line); border-radius: 22px; overflow: hidden; }
.mini-seg button { min-height: 40px; padding: 0 12px; border: 0; background: none; color: var(--ink); font-weight: 700; cursor: pointer; }
.mini-seg button.on { background: var(--ink); color: var(--bg); }
/* Avanserte terskler */
details.adv { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
details.adv summary { font-size: 1rem; }
.th-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px 10px; align-items: center; margin-bottom: 8px; }
.th-grid label { display: flex; flex-direction: column; gap: 2px; }
.th-grid input { width: 100%; min-height: 48px; font: inherit; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); }
/* Utskrift / PDF */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #111; --muted: #444; --line: #ccc; --asphalt: #3b4146; --road-edge: #2a2f33; --lane: #f2be22;
    --brake: #c8412b; --accel: #1f5fa8; --turn: #c7741f; --good: #2f7d4f; color-scheme: light; }
  body { padding: 0; background: #fff; }
  #app { max-width: none; padding: 0; }
  .screen:not(#report):not(#teacher), .t-controls, .t-done, .top, .quicknav, .head-actions, .lmap-toggle, .btn, .enrich-status button, .ev-chev, .leaflet-control-zoom, #btn-delete-drive, .ev-detail .btn { display: none !important; }
  .card { break-inside: avoid; border-color: #ccc; }
  .lmap { height: 420px; }
  textarea { border: 0 !important; resize: none; background: none !important; padding: 0 !important; }
  textarea:placeholder-shown { display: none; }
  .ev-detail[hidden] { display: none; }
  .leaflet-tile-pane { filter: none !important; }
  a { color: inherit; text-decoration: none; }
}

/* =========================================================
   v0.5.0 – designløft
   ========================================================= */
:root {
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .05), 0 4px 14px rgba(20, 24, 28, .06);
  --shadow-lg: 0 10px 30px rgba(20, 24, 28, .18);
  --appbar-h: 56px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 30px rgba(0,0,0,.5); } }
:root[data-theme="dark"] { --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 30px rgba(0,0,0,.5); }

body { padding-top: 0; }
#app { padding-top: 0; }
.card { border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); padding: 18px; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; margin: 0 0 6px; }
.mt { margin-top: 18px; }
.ico { flex: none; display: inline-block; vertical-align: middle; }

/* Skjermoverganger */
.screen.enter { animation: screen-in .28s var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* App-linje */
.appbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 6px;
  min-height: calc(var(--appbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 6px 0;
  margin: 0 -16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.appbar h1 { flex: 1; margin: 0; font-size: 1.12rem; font-weight: 800; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .brand { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 800; padding-left: 10px; }
.appbar .brand img { border-radius: 8px; }
.appbar-spacer, .appbar-actions { min-width: 48px; display: flex; justify-content: flex-end; }
.icon-btn { width: 48px; height: 48px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.icon-btn:active { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.top { display: none; }

/* Knapper */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 14px; transition: transform .12s var(--ease), background .2s; }
.btn.primary { box-shadow: var(--shadow); }
.btn.danger-fill { background: var(--brake); color: #fff; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn { margin-bottom: 12px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 10px 16px; margin-bottom: 12px; box-shadow: var(--shadow); font-weight: 700; }
.banner .btn { margin: 0; }

/* Startkort med vei-motiv */
.start-card {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(150deg, #2a2f33 0%, #3b4146 60%, #464d53 100%);
  color: #f2f4f3; border-radius: 22px; padding: 22px 20px 16px; margin-bottom: 14px; box-shadow: var(--shadow-lg);
}
.start-road { position: absolute; z-index: -1; right: -40px; top: -30px; width: 120px; height: 140%; transform: rotate(18deg);
  background: linear-gradient(90deg, transparent 0 8px, rgba(255,255,255,.08) 8px 112px, transparent 112px),
              repeating-linear-gradient(180deg, #f2be22 0 26px, transparent 26px 50px) center / 6px 100% no-repeat; opacity: .9; }
.start-hello { font-size: 1.65rem; font-weight: 800; margin: 0 0 4px; line-height: 1.15; max-width: 80%; }
.start-sub { margin: 0 0 18px; opacity: .82; max-width: 78%; }
.start-btn { background: #f2be22; color: #1f2428; min-height: 64px; font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; box-shadow: 0 6px 18px rgba(242,190,34,.35); }
.start-btn:active { transform: scale(.98); }
.start-demo { color: #f2f4f3; opacity: .85; display: block; margin: 0 auto; text-decoration: underline; text-underline-offset: 3px; }

/* Siste tur */
.last-card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; margin-bottom: 14px; }
.last-card:active { transform: scale(.99); }
.eyebrow { text-transform: uppercase; letter-spacing: .07em; font-size: .78rem; font-weight: 800; color: var(--muted); margin: 0; }
.last-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.last-body { display: flex; align-items: center; gap: 14px; }
.last-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.last-text strong { font-size: 1.15rem; }
.last-tip { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; background: var(--bg); border-radius: 12px; font-size: .95rem; }
.last-tip .ico { margin-top: 2px; color: var(--accel); }
.last-cta { display: flex; justify-content: flex-end; align-items: center; gap: 2px; margin-top: 10px; color: var(--accel); font-weight: 800; }
.badge { flex: none; }
.delta-pill { display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; font-size: .85rem; font-weight: 800; padding: 3px 10px; border-radius: 20px; background: var(--bg); color: var(--muted); margin: 4px 0 0; }
.delta-pill.up { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--good); }
.delta-pill.down { background: color-mix(in srgb, var(--brake) 14%, var(--surface)); color: var(--brake); }

/* Oppsummering 2×2 */
.tiles { grid-template-columns: 1fr 1fr; }
.tile { box-shadow: var(--shadow); border-radius: 16px; padding: 14px 12px; text-align: left; }
.tile-val { font-size: 1.5rem; }
.tile-label { font-size: .85rem; }

/* Kort-titler med ikon */
.card-title { display: flex; align-items: center; gap: 8px; }
.card-title .ico { color: var(--muted); }
.section-title { font-size: 1.12rem; margin: 18px 4px 8px; }

/* Turliste */
#drive-section .drives { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 12px; margin-bottom: 14px; }
.drives li + li { border-top: 0; }
.drives li:not(.group-head) + li:not(.group-head) { border-top: 1px solid var(--line); }
.group-head { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 14px 4px 4px; }
.drive { gap: 12px; padding: 10px 2px; min-height: 76px; }
.drive:active { background: var(--bg); }
.drive-main { gap: 2px; min-width: 0; }
.drive-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb { flex: none; width: 56px; height: 56px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.thumb-empty { display: grid; place-items: center; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag { font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--bg); color: var(--muted); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 10px; }
.empty-ico { color: var(--muted); }
.skeleton-row { height: 76px; margin: 6px 0; border-radius: 12px; background: linear-gradient(90deg, var(--bg) 25%, color-mix(in srgb, var(--line) 60%, var(--bg)) 50%, var(--bg) 75%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Mål med fremdrift */
.goal-list li { flex-direction: column; align-items: stretch; gap: 6px; }
.goal-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.goal-state { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: .9rem; color: var(--muted); white-space: nowrap; }
.goal-ok .goal-state { color: var(--good); }
.goal-bar { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; }
.goal-bar span { display: block; height: 100%; border-radius: 5px; background: var(--turn); transition: width .6s var(--ease); }
.goal-ok .goal-bar span { background: var(--good); }

/* Før kjøring – steg */
.flow { list-style: none; margin: 0 0 12px; padding: 0; }
.flow-step { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.flow-step:not(:last-child)::before { content: ''; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--line); }
.flow-num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--ink); color: var(--bg); position: relative; z-index: 1; }
.flow-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.flow-body h2 { margin-bottom: 4px; }
.flow-body .btn { margin: 10px 0 0; }
.flow-step[data-state="done"] .flow-num { background: var(--good); font-size: 0; }
.flow-step[data-state="done"] .flow-num::after { content: ''; width: 8px; height: 15px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -2px); }
.flow-step[data-state="todo"] .flow-body { opacity: .55; }
.flow-step[data-state="todo"] .flow-num { background: var(--line); color: var(--muted); }
.flow .checks { margin: 6px 0 0; padding: 0; border: 0; box-shadow: none; }
.driver-pick { font-weight: 700; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.start-bar { position: sticky; bottom: 0; z-index: 20; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.start-bar .btn { margin-bottom: 8px; }
.start-bar p { margin: 0; }
.check-icon { transition: background .25s, border-color .25s; }

/* Opptak */
.record { padding-top: calc(24px + env(safe-area-inset-top)); }
.rec-pills { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 4px 0 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; font-weight: 800; font-size: .95rem; background: var(--surface); border: 1px solid var(--line); }
.pill.ok, .rec-gps[data-state="ok"] { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.pill.warn { color: var(--turn); border-color: color-mix(in srgb, var(--turn) 40%, var(--line)); }
.rec-gps[data-state="fail"] { color: var(--brake); }
.btn-mark { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

/* Brytere (iOS-stil) */
.toggle-list { margin: 8px 0 0; }
.toggle { justify-content: space-between; align-items: center; padding: 12px 0; }
.toggle + .toggle { border-top: 1px solid var(--line); }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 52px; height: 32px; border-radius: 16px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0 0 0 12px; }
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
input.switch:checked { background: var(--good); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:focus-visible { outline: 3px solid var(--accel); outline-offset: 2px; }

/* Innstillinger – grupper */
.group-title { display: flex; align-items: center; gap: 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 22px 6px 8px; }
.group-title:first-of-type { margin-top: 8px; }
.goal-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.goal-fields .field { font-size: .92rem; }
.about { margin-top: 18px; }
a.btn { text-decoration: none; }
.feedback-btn { width: 100%; margin-top: 12px; }
.about-actions { display: grid; gap: 10px; margin-top: 12px; }
.about-actions .btn { margin: 0; }
.report-foot a { color: inherit; }

/* Rapport */
.report-head { margin: 0 4px 10px; }
.hero { display: grid; grid-template-columns: auto 1fr; gap: 14px 16px; align-items: center; }
.hero .sign, .hero .score-ring { width: 124px; height: 124px; }
.hero .rating { font-size: 1.25rem; margin: 0; }
.hero-warn { display: flex; gap: 6px; align-items: flex-start; color: var(--turn); font-weight: 700; font-size: .9rem; margin: 8px 0 0; }
.stat-chips { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; }
.stat-chips div { background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.stat-chips dt { font-size: .78rem; color: var(--muted); }
.stat-chips dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .hero { grid-template-columns: 1fr; text-align: center; } .hero .sign, .hero .score-ring { margin: 0 auto; } .hero-text { display: flex; flex-direction: column; align-items: center; } .delta-pill { align-self: center; } .stat-chips { text-align: left; grid-template-columns: repeat(2, 1fr); } }
.summary-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.summary-list li { display: flex; gap: 10px; align-items: flex-start; }
.summary-list .ico { margin-top: 1px; padding: 3px; border-radius: 50%; box-sizing: content-box; }
.sum-good .ico { color: #fff; background: var(--good); }
.sum-work .ico { color: #fff; background: var(--turn); }
.sum-brake .ico { background: var(--brake); } .sum-accel .ico { background: var(--accel); } .sum-turn .ico { background: var(--turn); } .sum-smooth .ico { background: var(--muted); } .sum-limits .ico { background: var(--sign); }
.sum-note .ico { color: var(--bg); background: var(--ink); }
.quicknav { top: calc(var(--appbar-h) + env(safe-area-inset-top)); z-index: 40; margin: 0 -16px 10px; padding: 8px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.quicknav a { transition: background .2s, color .2s; }
.quicknav a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.quicknav .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; font-size: .75rem; margin-left: 6px; background: var(--bg); color: var(--ink); padding: 0 5px; }
.quicknav a.on .count { background: var(--bg); color: var(--ink); }
#quality-section summary { justify-content: space-between; gap: 10px; }
#quality-section summary::before { display: none; }
details > summary .card-title { margin: 0; font-size: 1.12rem; }
.pill.ok { color: var(--good); } 
.quality-list { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 8px; }
.quality-list li { display: flex; gap: 8px; align-items: flex-start; }
.quality-list .q-2 .ico { color: var(--brake); } .quality-list .q-1 .ico { color: var(--turn); } .quality-list .q-0 .ico { color: var(--good); }
.bar-fill { transition: width .8s var(--ease); }
.leaflet-container { border-radius: 12px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 3000; transform: translate(-50%, 16px); opacity: 0; visibility: hidden; display: flex; align-items: center; gap: 10px; width: max-content; max-width: min(calc(100vw - 32px), 520px); box-sizing: border-box; padding: 12px 18px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow-lg); transition: transform .3s var(--ease), opacity .25s, visibility 0s linear .3s; pointer-events: none; }
/* Skjult = usynlig, ikke bare skjøvet ned (før 0.11.3 kunne en høy melding bli stående halvveis over fanelinjen) */
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; cursor: pointer; transition: transform .3s var(--ease), opacity .2s, visibility 0s; }
.toast-ok .ico { color: #56b37c; } .toast-error .ico { color: #e3654e; }

/* Dialog */
dialog.sheet { border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--ink); width: min(92vw, 440px); box-shadow: var(--shadow-lg); }
dialog.sheet::backdrop { background: rgba(10, 12, 14, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: sheet-in .22s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.sheet-body { padding: 22px 20px 16px; }
.sheet-body h2 { font-size: 1.25rem; }
.sheet-input { width: 100%; min-height: 52px; font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); margin: 6px 0 4px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { margin: 0; }
.sheet-actions .btn:only-child { grid-column: 1 / -1; }

/* Steg-liste på hjem */
.steps-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 12px; }
.steps-list li { display: flex; gap: 12px; align-items: flex-start; }
.step-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--bg); font-weight: 800; }

@media (prefers-reduced-motion: reduce) { .screen.enter, dialog.sheet[open] { animation: none; } .skeleton-row { animation: none; } }
@media print { .appbar, .start-bar, .toast { display: none !important; } .quicknav { display: none !important; } #quality-section details { display: block; } }
/* Ingen sidelengs overløp: hindrer at mobilnettleseren zoomer ut siden */
#app { overflow-x: clip; }
.goal-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.field input, .add-row input { width: 100%; min-width: 0; }
@media (max-width: 360px) { .goal-fields { grid-template-columns: 1fr; } }
.start-card { contain: paint; }

/* ---- v0.6.0 ---- */
/* Ledsagerens hurtigknapper */
.mark-wrap { width: 100%; }
.mark-help { font-weight: 800; text-align: center; margin: 0 0 8px; color: var(--muted); font-size: .95rem; }
.mark-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mark-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 74px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 800; font-size: .95rem; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .1s, background .2s; }
.mark-btn:active { transform: scale(.96); }
.mark-btn[data-cat="felt"] { grid-column: span 2; flex-direction: row; min-height: 56px; border-style: dashed; }
.mark-btn[data-cat="grense"] { flex-direction: row; min-height: 56px; border-style: dashed; font-size: .85rem; gap: 6px; }
.undo-mark { display: flex; align-items: center; gap: 8px; margin: 10px auto 0; }
.lane-truth { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; }
.mark-btn.flash { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mark-n { position: absolute; top: 6px; right: 8px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: .75rem; display: grid; place-items: center; padding: 0 5px; }
.mark-n:empty { display: none; }
.mark-btn.flash .mark-n { background: var(--bg); color: var(--ink); }
.record .stop { width: 188px; height: 188px; margin: 16px 0 20px; }
.record .rec-elapsed { margin: 10px 0 4px; }

/* Øvingsmål */
.focus-title { font-weight: 700; margin: 14px 0 8px; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin-bottom: 0; }
.chips.wrap .chip { min-height: 40px; padding: 0 12px; font-size: .92rem; }
.focus-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.focus-list li { display: flex; align-items: flex-start; gap: 10px; }
.focus-list li > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.f-ico { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); }
.f-ok .f-ico { background: var(--good); color: #fff; }
.f-no .f-ico { background: var(--turn); color: #fff; }
.f-state { font-weight: 800; font-size: .85rem; white-space: nowrap; }
.f-ok .f-state { color: var(--good); } .f-no .f-state { color: var(--turn); }

/* Veier og manøvrer */
.road-mix { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg); margin: 4px 0 6px; }
.road-mix span { display: block; height: 100%; }
.legend .mix-dot { border-radius: 3px; }
.man-list { list-style: none; margin: 10px 0 0; padding: 0; }
.man-list li + li { border-top: 1px solid var(--line); }
.man-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 2px; background: none; border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
.man-item .ev-text { flex: 1; }
.man-item > .ico:last-child { color: var(--muted); }
.man-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); }
.man-ico.ok { color: var(--good); } .man-ico.no { color: var(--turn); }
.sit-high { color: #fff; background: var(--brake); } .sit-medium { color: var(--turn); } .sit-low { color: var(--muted); } .sit-ok { color: var(--good); }
.sit-text { display: block; margin-top: 2px; }
.src-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.src-chip { font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.man-verdict { font-size: .9rem; font-weight: 700; }
.man-verdict.ok { color: var(--good); } .man-verdict.no { color: var(--turn); }
details.gw { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
details.gw summary { font-size: 1rem; min-height: 48px; }
.gw-list { list-style: none; margin: 0; padding: 0; }
.man-item.small { min-height: 44px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.mark-cat { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border-radius: 10px; background: var(--bg); font-size: .85rem; margin-right: 4px; }
.map-highlight { stroke: var(--ink); }

/* Kjørelogg */
.log-card-btn { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; margin-bottom: 14px; }
.log-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.log-row > span { display: flex; flex-direction: column; }
.log-row strong { font-size: 1.15rem; }
.week-bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 150px; margin: 6px 0; }
.wk { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.wk-bar { width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: var(--accel); min-height: 2px; }
.wk-val { font-size: .75rem; font-weight: 800; color: var(--muted); }
.wk-lbl { font-size: .68rem; color: var(--muted); white-space: nowrap; display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.wk-lbl strong { color: var(--ink); font-size: .9rem; }
.spots-cta { width: 100%; }   /* ukenummeret, datoen under (0.12.1) */
.log-list { padding: 4px 12px; }
.pad { margin: 0 4px 10px; }
#log .btn { margin-top: 4px; }

/* ---- v0.7.0 ---- */
.start-suggest { margin: -8px 0 16px; font-weight: 700; color: #f2be22; font-size: .95rem; max-width: 80%; }
.banner > span:first-child { display: flex; align-items: center; gap: 8px; }
.banner-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mini-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; font: inherit; color: inherit; cursor: pointer; margin: 0; padding: 14px; }
.mini-card strong { font-size: 1.5rem; margin-top: 6px; }
.mini-card .card-title { font-size: .95rem; font-weight: 800; }
.focus-suggest { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--bg); }
.sug-title { display: flex; align-items: center; gap: 6px; font-weight: 800; margin: 0 0 6px; }
.sug-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.sug-list li { display: flex; flex-direction: column; }
.focus-suggest .btn { margin: 0; }
/* Samme rute */
.route-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.route-table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 700; padding: 4px 6px; }
.route-table td { padding: 10px 6px; border-top: 1px solid var(--line); }
.route-table tr[data-id]:not(.cur) { cursor: pointer; }
.route-table tr.cur td { background: var(--bg); }
.route-verdict { font-weight: 800; margin: 10px 0 0; }
.route-verdict.up { color: var(--good); } .route-verdict.down { color: var(--turn); }
/* Avspilling */
.replay-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 4px; }
.replay-bar .btn { margin: 0; }
.seg-mini { display: flex; border: 2px solid var(--line); border-radius: 20px; overflow: hidden; }
.seg-mini button { min-height: 40px; min-width: 52px; border: 0; background: none; color: var(--ink); font-weight: 800; cursor: pointer; }
.seg-mini button.on { background: var(--ink); color: var(--bg); }
.replay-hud { position: absolute; right: 10px; top: 10px; z-index: 500; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: calc(100% - 70px); }
.replay-hud span { background: var(--ink); color: var(--bg); padding: 4px 10px; border-radius: 14px; font-weight: 800; font-size: .9rem; font-variant-numeric: tabular-nums; }
.replay-hud span:empty { display: none; }
.replay-dot span { display: block; width: 22px; height: 22px; border-radius: 50%; background: #f2be22; border: 3px solid #1f2428; box-shadow: 0 0 0 4px rgba(242,190,34,.35); }
.lm-ev.active { animation: pulse .6s var(--ease) 2; }
@keyframes pulse { 50% { transform: scale(1.35); } }
/* Faresteder */
.spots-route { stroke: var(--asphalt); opacity: .55; }
.spot-circle { stroke: #fff; fill-opacity: .55; }
.spot-circle.spot-brake { fill: var(--brake); } .spot-circle.spot-accel { fill: var(--accel); } .spot-circle.spot-turn { fill: var(--turn); } .spot-circle.spot-mark { fill: var(--ink); }
.spot-n { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; }
.spot-n.spot-brake { background: var(--brake); } .spot-n.spot-accel { background: var(--accel); } .spot-n.spot-turn { background: var(--turn); } .spot-n.spot-mark { background: var(--ink); color: var(--bg); }
.spot-list { padding: 4px 12px; }
#spots-map { height: 360px; }
/* Opplæring */
.plan-head .goal-bar span { background: var(--good); }
.plan-prog { font-size: 1.1rem; margin: 2px 0 8px; }
.plan-prog strong { font-size: 1.6rem; }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li + li { border-top: 1px solid var(--line); }
.plan-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.plan-item input { flex: none; width: 26px; height: 26px; margin: 1px 0 0; accent-color: var(--good); }
.plan-item > span { display: flex; flex-direction: column; gap: 2px; }
.plan-ev { font-size: .85rem; color: var(--muted); }
.plan-ev.good { color: var(--good); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .lm-ev.active { animation: none; } }
.banner { flex-wrap: wrap; }
.banner > span:first-child { flex: 1 1 180px; min-width: 0; }
.banner-actions { margin-left: auto; }

/* ---------- Kamera-testversjonen ---------- */
.beta-tag { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 10px; background: var(--accel); color: #fff; vertical-align: 2px; margin-left: 6px; }
.cam-card { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.cam-card > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.cam-card-ico { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--accel) 15%, var(--surface)); color: var(--accel); }
.cam-view { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.cam-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam-label { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0; padding: 8px 18px; border-radius: 22px; font-weight: 800; font-size: 1.15rem; color: #fff; background: rgba(0,0,0,.6); white-space: nowrap; }
.cam-label[data-cls="left"], .cam-label[data-cls="right"], .cam-label[data-cls="rear"] { background: var(--good); }
.cam-label[data-cls="shoulderL"], .cam-label[data-cls="shoulderR"] { background: var(--accel); }
.cam-label[data-cls="none"] { background: var(--brake); }
/* Kalibrering over hele skjermen: stor tekst som kan leses fra førersetet, og opplest instruksjon */
.calib-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; background: #1b1f22; color: #fff; }
.calib-overlay[hidden] { display: none; }
.calib-progress { color: #f2c230; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .95rem; margin: 0; }
.calib-step { font-size: 2rem; font-weight: 800; line-height: 1.15; margin: 0; max-width: 14em; }
.calib-count { font-size: 4rem; font-weight: 800; margin: 8px 0; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.calib-face { margin: 0 0 16px; color: #a3abb1; }
.calib-face[data-ok="0"] { color: #f2c230; font-weight: 700; }
.calib-overlay .btn { background: transparent; color: #fff; border-color: #5b6369; }
.pre-calib { margin-top: 8px; }
.cam-card.warn { border-color: var(--turn); }
.cam-card.warn .cam-card-ico { background: color-mix(in srgb, var(--turn) 18%, var(--surface)); color: var(--turn); }
.cam-calib-status { display: flex; gap: 8px; align-items: flex-start; }
.cam-log { list-style: none; margin: 0; padding: 0; }
.cam-log li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.center { text-align: center; }
.pre-video { flex: none; margin-left: auto; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; transform: scaleX(-1); background: #000; }
#check-camera > span:nth-child(2) { flex: 1; }
.rec-video { position: fixed; right: 12px; top: calc(env(safe-area-inset-top) + 64px); width: 72px; height: 72px; border-radius: 50%; object-fit: cover; transform: scaleX(-1); border: 3px solid var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.3); z-index: 5; }
#rec-cam[data-state="ok"] { color: var(--good); }
#rec-cam[data-state="wait"] { color: var(--turn); }
.cam-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.cam-stats > div { display: flex; flex-direction: column; gap: 2px; }
.cam-stats strong { font-size: 1.5rem; }
.cam-timeline { width: 100%; height: 72px; display: block; margin-top: 6px; }
.gl-axis { stroke: var(--line); stroke-width: 1; }
.gl-left, .gl-dot.gl-left { fill: var(--good); background: var(--good); }
.gl-right, .gl-dot.gl-right { fill: var(--turn); background: var(--turn); }
.gl-rear, .gl-dot.gl-rear { fill: var(--muted); background: var(--muted); }
.gl-shoulderL, .gl-shoulderR, .gl-dot.gl-shoulderL { fill: var(--accel); background: var(--accel); }
.gl-gap, .gl-dot.gl-gap { fill: color-mix(in srgb, var(--brake) 18%, transparent); background: color-mix(in srgb, var(--brake) 30%, transparent); }
.gl-lane.ok { fill: var(--good); }
.gl-lane.no { fill: var(--brake); }
.cam-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 14px; font-size: .88rem; font-weight: 700; border: 1px solid var(--line); }
.cam-chip.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.cam-chip.no { color: var(--brake); border-color: color-mix(in srgb, var(--brake) 40%, var(--line)); }
.cam-lanes { list-style: none; margin: 0; padding: 0; }
.cam-lanes li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }

.cam-chip.unk { color: var(--muted); border-color: var(--line); }
.gl-lane.unk { fill: var(--muted); }

.along-list { padding-left: 18px; margin: 6px 0; }
.along-list li { margin-bottom: 4px; }

/* Aktiv fartsgrense under opptak (v0.9.4): skiltet ser ut som et ekte fartsgrenseskilt i begge temaer */
.rec-limit { margin: 6px 0 2px; }
.rec-limit-row { display: flex; align-items: center; justify-content: center; gap: 22px; }
.limit-sign { width: 84px; height: 84px; border-radius: 50%; border: 9px solid #d4001a; background: #fff; color: #111;
  display: grid; place-items: center; font-weight: 800; font-size: 2.1rem; font-variant-numeric: tabular-nums; box-sizing: border-box; }
.limit-sign.none { border-color: #9a9a9a; color: #777; }
.rec-speed-box { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.rec-speed { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
#rec-limit-note { margin-top: 4px; }

/* Fotoboks og strekningsmåling under opptak (v0.9.7) */
.rec-atk { display: inline-block; margin: 6px auto 0; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: .95rem;
  background: #ffcc00; color: #111; }
.rec-atk[data-kind="ferdig"] { background: var(--surface); color: var(--ink); border: 2px solid var(--line); }

/* Stort varsel for fotoboks og strekningsmåling (k0.7.1): de siste 300 m, forsvinner av seg selv etter passering */
.atk-pop { position: fixed; left: 16px; right: 16px; top: max(16px, env(safe-area-inset-top)); z-index: 1000; text-align: center;
  background: #ffcc00; color: #111; border-radius: 24px; padding: 18px 16px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.45);
  border: 4px solid #111; animation: atk-in .25s ease-out; }
.atk-pop[hidden] { display: none; }
.atk-pop-title { font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.atk-pop-main { font-size: clamp(3rem, 16vw, 4.6rem); font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; margin: 4px 0; }
.atk-pop-sub { font-size: 1.15rem; font-weight: 700; }
.atk-pop[data-kind="ferdig"] { background: #fff; border-color: #ffcc00; }
@keyframes atk-in { from { transform: translateY(-20px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .atk-pop { animation: none; } }

/* Opprydding (v0.9.12): poengring, neste øvingstur og «Flere detaljer» */
.hero .score-ring { filter: none; }
.practice-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: p; }
.practice-list li { display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; row-gap: 2px; counter-increment: p; }
.practice-list li::before { content: counter(p); grid-row: span 3; width: 32px; height: 32px; border-radius: 50%; background: var(--lane); color: #1f2428; font-weight: 800; display: grid; place-items: center; }
.practice-list li > * { grid-column: 2; }
.more-details { margin: 14px 0; }
.more-details > summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; cursor: pointer; }
.more-details > summary::-webkit-details-marker { display: none; }
.more-details > summary .muted { flex-basis: 100%; text-align: center; font-weight: 400; }
.more-details[open] > summary { margin-bottom: 14px; }
.settings-adv { margin: 22px 0 8px; }
.settings-adv > summary { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; cursor: pointer; }
.settings-adv > summary::-webkit-details-marker { display: none; }
.settings-adv > summary .muted { flex-basis: 100%; text-align: center; font-weight: 400; }

/* Til trafikklæreren (v0.9.13) */
.t-cta { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; font: inherit; color: inherit; cursor: pointer; margin: 0; padding: 14px; }
.t-controls .segment { margin: 10px 0; }
.t-controls .field { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.t-controls textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.t-tiles { margin: 8px 0 0; }
.t-good { display: flex; gap: 8px; align-items: flex-start; color: var(--good); margin-top: 12px; }
.t-man { margin-top: 12px; }
.t-cats { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.t-cats li { display: grid; grid-template-columns: 110px 1fr 32px; align-items: center; gap: 8px; }
.t-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.t-bar span { display: block; height: 100%; background: var(--accel); }
.t-notes { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.t-stage { font-size: .9rem; margin: 12px 0 4px; }
.t-plan { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.t-plan li { display: flex; gap: 8px; align-items: flex-start; }
.t-plan li.done { color: var(--good); }
.t-plan li.done span { color: var(--ink); }
.t-dot { flex: none; width: 10px; height: 10px; margin: 5px 3px; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box; }
.t-q { white-space: pre-wrap; }
.t-done { margin: 6px 0 20px; }

/* ---------- Intro ved første start (v0.9.18) ---------- */
.intro { position: fixed; inset: 0; z-index: 60; background: var(--bg); color: var(--ink); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.intro[hidden] { display: none; }
body.intro-open { overflow: hidden; }
body.intro-open .tabbar { display: none; }
.intro-skip { align-self: flex-end; margin: 4px 12px 0; padding: 0 8px; font-weight: 700; }
.intro-pages { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.intro-pages::-webkit-scrollbar { display: none; }
.intro-page { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; overflow-y: auto; padding: 8px 24px 16px; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; box-sizing: border-box; }
/* Sentrert når det er plass, ellers fra toppen (auto-marger skyver aldri innholdet ut av syne) */
.intro-page > :first-child { margin-top: auto; } .intro-page > :last-child { margin-bottom: auto; }
.intro-page h2 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -.01em; margin: 24px 0 10px; outline: none; }
.intro-page p { font-size: 1.0625rem; line-height: 1.5; margin: 0 0 12px; }
.intro-hero { position: relative; overflow: hidden; isolation: isolate; border-radius: 24px; width: 100%; aspect-ratio: 16 / 10; max-height: min(32vh, 260px); flex-shrink: 0;
  background: radial-gradient(120% 90% at 0% 0%, #343c42 0%, #20262a 55%, #171b1e 100%); display: grid; place-items: center; box-shadow: var(--shadow-lg); }
.intro-hero .start-road { right: 12%; height: 180%; top: -40%; }
.intro-ico { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); box-shadow: 0 8px 24px rgba(245, 197, 24, .35); }
.intro-ico svg { width: 52px; height: 52px; stroke-width: 2.2; }
.intro-foot { padding: 8px 24px 16px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; max-width: 560px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.intro-dots { display: flex; justify-content: center; gap: 4px; margin-bottom: 4px; }
.intro-dots button { width: 28px; height: 28px; border: 0; padding: 0; background: none; display: grid; place-items: center; cursor: pointer; }
.intro-dots button::after { content: ""; width: 8px; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 25%, transparent); transition: width .2s var(--ease, ease), background .2s; }
.intro-dots button.on::after { width: 22px; background: var(--ink); }
.intro-next { min-height: 56px; font-size: 1.125rem; margin: 0; }
.intro-demo { justify-content: center; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .intro-dots button::after { transition: none; } }
@media (max-height: 760px) { .intro-hero { max-height: 20vh; } .intro-page h2 { margin-top: 16px; font-size: 1.5rem; } .intro-ico { width: 72px; height: 72px; } .intro-ico svg { width: 40px; height: 40px; } }

/* Utviklerdelen: 7 trykk på versjonsnummeret. Uten touch-action tolker iOS raske trykk som dobbelttrykk-zoom og
   sender bare det første som click. */
#version { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* ---------- Veikamera samtidig med førerkameraet (iPhone-appen, 0.10.0) ---------- */
.pre-video.road, .rec-video.road, .cam-full video.road, .cam-road video { transform: none; }
.rec-video.rec-road { top: calc(env(safe-area-inset-top) + 144px); }
/* iPhone sender ikke trykk på video-elementer: trykket tas av flaten rundt (kamerasiden) eller over (opptaket) */
.rec-video, .cam-view video, .cam-road video { pointer-events: none; }
.cam-view, .cam-road video, .cam-road { cursor: pointer; }
.rec-video-hit { position: fixed; right: 12px; top: calc(env(safe-area-inset-top) + 64px); width: 72px; height: 72px; border-radius: 50%; border: 0; padding: 0; background: transparent; z-index: 6; cursor: pointer; }
.rec-video-hit.rec-road { top: calc(env(safe-area-inset-top) + 144px); }
.rec-video-hit[hidden] { display: none; }
.cam-road { margin-top: 12px; display: flex; gap: 12px; align-items: center; }
.cam-road video { flex: none; width: 96px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 12px; background: #000; }
.cam-road p { margin: 0; }
.road-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.road-stats div { background: var(--bg); border-radius: 12px; padding: 10px; text-align: center; }
.road-stats strong { display: block; font-size: 1.3rem; }
/* Fartsgrensen fra et skilt veikameraet leste (k0.7.6), når den er en annen enn i NVDB */
.limit-sign.cam { box-shadow: 0 0 0 4px #2196f3; }
/* Fullskjerm kamera med det modellene ser (k0.7.2) */
.cam-full { position: fixed; inset: 0; z-index: 900; background: #000; }
.cam-full[hidden] { display: none; }
.cam-full video, .cam-full canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam-full video { transform: scaleX(-1); }
.cam-full canvas { pointer-events: none; }
.cam-full-info { position: absolute; left: 12px; right: 64px; top: max(12px, env(safe-area-inset-top)); color: #fff; font: 700 .95rem/1.35 system-ui, sans-serif;
  text-shadow: 0 1px 3px #000, 0 0 8px rgba(0,0,0,.8); pointer-events: none; }
.cam-full-info .muted { font-weight: 500; opacity: .85; }
.cam-full-close { position: absolute; right: 12px; top: max(12px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.3rem; cursor: pointer; }
.cam-full-switch { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); min-height: 44px; padding: 0 18px;
  border-radius: 22px; border: 0; background: rgba(0,0,0,.65); color: #fff; font: 700 1rem system-ui, sans-serif; cursor: pointer; }
.cam-full-switch[hidden] { display: none; }

/* ---------- Kartet i rapporten (0.10.1) ---------- */
.lmap-toggle { position: absolute; right: 10px; bottom: 26px; z-index: 500; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 0; border-radius: 20px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink); font: inherit; font-weight: 800; font-size: .92rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.22); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); cursor: pointer; }
.lmap-top { display: none; }
.lmap-wrap.expanded .lmap-toggle { display: none; }
.lmap-wrap.expanded .lmap-top { display: flex; position: absolute; z-index: 600; left: 0; right: 0; top: 0; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 12px) 10px calc(env(safe-area-inset-left) + 12px); background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent), color-mix(in srgb, var(--bg) 0%, transparent)); }
.lmap-title { flex: 1; text-align: center; font-weight: 800; font-size: 1rem; color: var(--muted); }
.lmap-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 800; font-size: .92rem; box-shadow: 0 2px 10px rgba(0,0,0,.2); cursor: pointer; }
.lmap-close { background: var(--ink); color: var(--bg); }
.lmap-wrap.expanded .leaflet-top { top: calc(env(safe-area-inset-top) + 64px); }
.lmap-wrap.expanded .replay-hud { top: calc(env(safe-area-inset-top) + 70px); }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.leaflet-popup-content { margin: 10px 14px; font: 500 .95rem/1.4 inherit; }
@media (max-width: 560px) { .lmap { height: 320px; } }
@media print { .lmap-toggle, .lmap-top { display: none !important; } }

/* ---------- Guider (0.10.1) ---------- */
.guide-card { position: relative; border: 2px solid color-mix(in srgb, var(--primary) 55%, transparent); transition: opacity .2s var(--ease), transform .2s var(--ease); }
.guide-card.closing { opacity: 0; transform: translateY(-6px) scale(.98); }
.guide-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.guide-head h2 { margin: 2px 0 0; }
.guide-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.guide-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 22%, var(--surface)); color: var(--ink); }
.guide-close { flex: none; width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; border-radius: 22px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.guide-close:active { background: var(--bg); }
.guide-more { display: inline-block; margin-top: 2px; font-weight: 800; }
.guides-lead { margin: 4px 4px 14px; }
.guide-item summary { display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; min-height: 44px; }
.guide-item summary::-webkit-details-marker { display: none; }
.guide-item summary > svg:last-child { flex: none; color: var(--muted); transition: transform .2s var(--ease); }
.guide-item[open] summary > svg:last-child { transform: rotate(90deg); }
.guide-item[open] summary { margin-bottom: 12px; }
#guides > .btn { width: 100%; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .guide-card, .guide-item summary > svg:last-child { transition: none; } }
.guide-lead { margin: 0 0 8px; }
.guide-steps summary { list-style: none; display: inline-flex; align-items: center; min-height: 44px; font-weight: 800; color: var(--accel); cursor: pointer; }
.guide-steps summary::-webkit-details-marker { display: none; }
.guide-steps .when-open, .guide-steps[open] .when-closed { display: none; }
.guide-steps[open] .when-open { display: inline; }
.guide-steps[open] summary { margin-bottom: 6px; }
.guide-more { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; font-weight: 700; font-size: .92rem; color: var(--muted); text-decoration: none; }
/* Meldinger over fanelinjen, ikke oppå den (0.10.1) */
body.has-tabbar .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }

/* Stoppknappen alltid synlig nederst under opptak (0.10.1) */
.stop-dock { position: sticky; bottom: 0; z-index: 30; width: calc(100% + 32px); margin: 8px -16px 0; display: flex; justify-content: center;
  padding: 26px 0 calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent) 0, var(--bg) 24px); }
.record .stop-dock .stop { width: 156px; height: 156px; margin: 0; }
.record .stop-dock .stop-label { font-size: 1.7rem; }
.record .stop-dock .stop-ico { width: 24px; height: 24px; border-radius: 6px; }
@media (min-height: 900px) { .record .stop-dock .stop { width: 184px; height: 184px; } .record .stop-dock .stop-label { font-size: 2rem; } }
.guide-item summary::before, .guide-steps summary::before { display: none; }

/* ---------- Kjørerapport Pluss (0.11.0) ---------- */
.plus-hero { text-align: center; padding: 18px 8px 6px; }
.plus-hero h2 { font-size: 1.6rem; line-height: 1.15; margin: 12px 0 8px; }
.plus-hero p { margin: 0 auto 8px; max-width: 34ch; color: var(--muted); }
.plus-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; background: var(--primary); color: var(--on-primary, #111); font-weight: 800; letter-spacing: .02em; }
.plus-list { display: grid; gap: 14px; }
.plus-item { display: flex; gap: 12px; align-items: flex-start; border-radius: 14px; padding: 4px; transition: background .2s; }
.plus-item > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.plus-item.focus { background: color-mix(in srgb, var(--primary) 16%, transparent); padding: 10px; margin: -6px; }
.plus-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 22%, var(--surface)); color: var(--ink); }
.plus-ok { flex: none; color: var(--good); align-self: center; }
.plus-buy { width: 100%; min-height: 58px; font-size: 1.15rem; margin-top: 4px; }
.plus-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.plus-free { margin: 14px 4px 24px; text-align: center; }
#pluss > .btn, #plus-root > .btn { width: 100%; }
.plus-row { display: flex; align-items: center; gap: 12px; }
.plus-row > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.plus-locked { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 18px; }
.plus-locked h2 { margin: 4px 0 0; }
.plus-locked .btn { width: 100%; }
/* Låste ting: en liten lås ved fanene og turene som krever Pluss */
.tabbar a.locked > span:first-child { position: relative; }
.tabbar a.locked > span:first-child::after { content: ''; position: absolute; right: -7px; top: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3'%3E%3Crect x='6' y='11' width='12' height='9' rx='1.5'/%3E%3Cpath d='M9 11V8a3 3 0 0 1 6 0v3'/%3E%3C/svg%3E") center / 9px no-repeat; }
.drive.locked { opacity: .55; }
.drive.locked .drive-main strong::after { content: ' · Pluss'; font-weight: 700; font-size: .8rem; color: var(--muted); }

/* Klar for oppkjøring? (0.11.2) */
.ready-cta { width: 100%; }
.ready-cta .card-title { display: flex; align-items: center; gap: 6px; width: 100%; }
.lock-tag { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; font-weight: 800; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.ready-cta .goal-bar { width: 100%; margin-top: 6px; }
.ready-mini strong { font-size: 1.15rem; }
.lv-klar .goal-bar span { background: var(--good); }
.ready-head h2 { margin: 2px 0 6px; }
.ready-head.lv-klar h2 { color: var(--good); }
.ready-head .goal-bar { margin: 8px 0 10px; }
.rd-list, .rd-next { list-style: none; margin: 0; padding: 0; }
.rd-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.rd-item:first-child { border-top: 0; padding-top: 2px; }
.rd-item > span:last-child { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.rd-ok, .rd-no, .rd-na { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.rd-ok { background: var(--good); color: #fff; }
.rd-no { border: 2px solid var(--turn); }
.rd-na { border: 2px dashed var(--line); color: var(--muted); font-weight: 800; }
.goal-bar.thin { height: 6px; margin-top: 6px; }
.rd-next li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; }
.rd-next li svg { flex: none; color: var(--turn); margin-top: 2px; }
.ready-note { margin: 16px 4px; }

/* Sjekk før kjøring (0.11.5): dagens mål i en lukket boks, så man kommer raskt i gang */
.focus-box { margin-top: 14px; border-radius: 14px; background: var(--bg); }
.focus-box > summary { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 14px; min-height: 44px; cursor: pointer; }
.focus-box > summary::-webkit-details-marker { display: none; }
.focus-box > summary::before { content: none; display: none; }
.focus-box > summary { font-size: 1rem; font-weight: 400; }
.focus-box .focus-title { font-weight: 700; }
.focus-box .focus-title { margin: 0; grid-column: 1; }
.focus-box .focus-summary { grid-column: 1; color: var(--muted); font-size: .92rem; }
.focus-box .focus-edit { grid-column: 2; grid-row: 1 / span 2; color: var(--accel); font-weight: 700; }
.focus-box[open] .focus-edit { visibility: hidden; }
.focus-box > :not(summary) { margin-left: 14px; margin-right: 14px; }
.focus-box > :last-child { margin-bottom: 14px; }

/* Datofelt (0.11.6): iPhone gir datofeltet sin egen bredde, så det stakk ut av kortet, og et tomt felt var blankt */
input[type="date"] { box-sizing: border-box; display: block; width: 100%; max-width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.date-wrap { position: relative; display: block; margin-top: 6px; }
.date-ph { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 400; pointer-events: none; }
.date-wrap.has-value .date-ph { display: none; }
/* Startkortet uten holder-linjen (0.11.6): forslaget fikk negativ avstand og la seg nesten oppå hilsenen */
.start-sub[hidden] + .start-suggest { margin-top: 14px; }
.start-sub[hidden] + .start-suggest[hidden] + .start-btn { margin-top: 18px; }
/* «Se hvor ›» midt i en setning */
.link.sum-goto { display: inline; min-height: 0; padding: 0 0 0 4px; font-size: inherit; }

/* 0.12.0: «Kjørerapport» og innstillingene står øverst på alle faner. Sidens tittel og knapper ligger på siden. */
.appbar .btn-back + .brand { padding-left: 0; }
.page-head { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; }
.page-title { flex: 1; margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.page-actions { display: flex; gap: 2px; margin-right: -8px; }
.page-actions:empty { display: none; }
@media print { .page-actions { display: none !important; } }
/* Opptaket (0.12.0): fartsgrensen er det store, kilometerne en liten linje under */
.record .rec-stats { padding-top: 8px; }
.record .limit-sign { width: 112px; height: 112px; border-width: 12px; font-size: 2.9rem; }
.record .rec-speed { font-size: 3rem; }
.record .rec-dist { font-size: 1rem; font-weight: 700; color: var(--muted); margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
#rec-limit-note:empty { display: none; }
/* «Hva må du øve mer på?» (0.12.0) */
.ready-next { display: block; font-weight: 800; font-size: 1.05rem; margin: 2px 0 6px; }
.rd-next li > span { display: flex; flex-direction: column; gap: 2px; }
/* Fartsvarsel (0.12.0): rød kant rundt skjermen, sterkere jo mer over grensen (--speed-warn 0–1, se speedwarn.js) */
.record::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 40; opacity: 0; transition: opacity .35s;
  box-shadow: inset 0 0 calc(18px + 46px * var(--speed-warn, 0)) calc(4px + 14px * var(--speed-warn, 0)) rgba(230, 0, 30, .85); }
.record.speeding::after { opacity: calc(.45 + .55 * var(--speed-warn, 0)); }
.record.speeding .limit-sign { animation: limit-pulse 1s ease-in-out infinite; }
@keyframes limit-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.record.speeding .rec-speed { color: #e6001e; }
@media (prefers-reduced-motion: reduce) { .record.speeding .limit-sign { animation: none; } }
/* Føre før turen (0.12.0) */
.surface-pick { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.sp-label { font-weight: 700; }
.surface-seg.need { outline: 2px dashed var(--turn); outline-offset: 3px; border-radius: 14px; }
#surface-note:empty { display: none; }
/* Kalibreringen passer ikke lenger (0.12.0): et punkt å gjøre før turen */
.checks li.todo { background: color-mix(in srgb, var(--turn) 12%, transparent); border-radius: 12px; padding: 8px; margin: 0 -8px; }
.checks li.todo .pre-calib { margin-top: 8px; }
/* Kjøreutvikling (0.12.0): grafen på Hjem kan trykkes, og åpnes i full skjerm med zoom og perioder */
.trend-open { display: block; width: 100%; border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: zoom-in; text-align: left; -webkit-tap-highlight-color: transparent; }
.trend-zoom { display: flex; align-items: center; gap: 6px; justify-content: center; color: var(--link); font-size: .85rem; font-weight: 700; margin-top: 4px; }
.dev-full { position: fixed; inset: 0; z-index: 120; background: var(--bg); color: var(--ink); overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 16px); display: flex; flex-direction: column; gap: 12px; }
.dev-head { display: flex; align-items: center; justify-content: space-between; }
.dev-head h2 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.dev-mode { align-self: flex-start; }
.dev-periods { margin: 0; }
.dev-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.dev-stats > span { display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; padding: 10px 4px; }
.dev-stats strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.dev-stats strong.up { color: var(--good); } .dev-stats strong.down { color: var(--brake); }
.dev-chart { background: var(--surface); border-radius: 18px; padding: 8px 4px; touch-action: none; user-select: none; -webkit-user-select: none; }
.dev-svg { width: 100%; height: auto; display: block; }
.dev-svg .axis { font-size: 11px; }
.dev-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; }
.dev-pick > span { display: flex; flex-direction: column; }
.dev-help { margin: 0; }
/* Fremgang (0.12.0): nivå, ukesringer, uker på rad, rekorder og merker */
.game-card { display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.game-top { display: flex; align-items: center; gap: 16px; }
.game-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.game-text strong { font-size: 1.2rem; }
.goal-bar.xp > span { background: var(--lv1); }
.game-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; }
.ring-lbl { display: inline-flex; align-items: center; gap: 5px; }
.ring-lbl .dot, .ring-list .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.streak, .badge-count { display: inline-flex; align-items: center; gap: 5px; }
.streak .ico { color: var(--lv2); } .badge-count .ico { color: var(--lv1); }
.rings .ring-fill { transition: stroke-dasharray .9s var(--ease); }
.level-hero { display: flex; align-items: center; gap: 16px; }
.level-hero > span:last-child { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.level-hero h2 { margin: 0; }
.level-num { flex: none; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; font-weight: 800; background: var(--lv1); color: #1b1f22; }
.rings-big { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ring-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 180px; }
.ring-list li { display: flex; gap: 8px; align-items: flex-start; }
.ring-list li .dot { margin-top: 6px; }
.ring-list li > span:last-child { display: flex; flex-direction: column; }
.streak.big { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; }
.streak.big > span { display: flex; flex-direction: column; }
.record-list { list-style: none; margin: 0; padding: 0; }
.record-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.record-list li:first-child { border-top: 0; }
.record-list li > span { display: flex; flex-direction: column; }
.record-list li.tap { cursor: pointer; }
.record-list strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.badge-grid { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.merke { background: var(--surface); border-radius: 16px; padding: 14px 12px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.badge-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--lv1) 30%, transparent); color: var(--ink); margin-bottom: 4px; flex: none; }
.merke.locked { opacity: .55; }
.merke.locked .badge-ico { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.badge-at { margin-top: 2px; }
.unlock-card { border: 2px solid var(--lv1); animation: unlock-in .6s var(--ease) both; }
.unlock-card .eyebrow { display: flex; align-items: center; gap: 6px; }
.unlock-level { font-size: 1.1rem; margin: 4px 0 8px; }
.unlock-badges { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 10px; }
.unlock-badges li { display: flex; align-items: center; gap: 12px; }
.unlock-badges li > span:last-child { display: flex; flex-direction: column; }
.unlock-badges .badge-ico { width: 44px; height: 44px; margin: 0; animation: badge-pop .7s .2s var(--ease) both; }
.unlock-rec { display: flex; align-items: center; gap: 6px; font-weight: 700; }
@keyframes unlock-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes badge-pop { 0% { transform: scale(.3); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 130; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: confetti-fall 2.2s cubic-bezier(.2,.6,.4,1) forwards; }
@keyframes confetti-fall { to { transform: translate(var(--dx), 105vh) rotate(calc(var(--r) + 540deg)); opacity: .9; } }
/* Lekser og skole (0.12.0) */
.school-card h2 { margin: 2px 0 4px; }
.school-card .eyebrow, .sync-line { display: flex; align-items: center; gap: 6px; }
.sync-line { color: var(--good); font-weight: 700; font-size: .92rem; margin: 6px 0 0; }
.homework-card { border-left: 4px solid var(--lv2); }
.students-card .student-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.student { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.student.on { border-color: var(--link); }
.student > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.student-ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--lv1); color: #1b1f22; flex: none; }
.add-student { display: grid; gap: 8px; margin: 6px 0 8px; }
.add-student input { margin: 0; }
.chip.add { display: inline-flex; align-items: center; gap: 4px; border-style: dashed; }
.mode-list { display: grid; gap: 6px; }
.mode-opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px; -webkit-tap-highlight-color: transparent; }
.mode-opt input { margin-top: 4px; width: 20px; height: 20px; accent-color: var(--link); }
.mode-opt > span { display: flex; flex-direction: column; }
.view-mode { border: 2px dashed var(--turn); }
.cam-card { display: flex; align-items: center; gap: 12px; width: 100%; }
.cam-card .cam-chev { margin-left: auto; color: var(--muted); }
/* Ingen zoom av siden (0.12.2): dobbelttrykk og knip zoomet appen ved et uhell. Kart og kjøreutviklingen zoomer selv. */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.dev-zoom { display: flex; gap: 8px; justify-content: center; }
.dev-zoom .btn { min-width: 56px; font-size: 1.2rem; }
/* Grafen tegnes på nytt mens fingrene beveger seg: berøringen må høre til rammen rundt, ellers kommer ikke «slipp» fram */
.dev-chart .dev-svg { pointer-events: none; }
/* 0.12.3: småting */
.stat-chips dd { white-space: nowrap; }
.ring-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ring-stats > span { display: flex; flex-direction: column; align-items: flex-start; }
.ring-stats strong { display: flex; align-items: center; gap: 6px; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.ring-stats .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ring-stats > span { position: relative; padding-left: 16px; }
.ring-stats > span > .dot { position: absolute; left: 0; top: 8px; }
.how-calc summary { font-weight: 700; cursor: pointer; }
.how-calc p { margin: 8px 0 0; }
