/* Utseende: mörk botten, en limegrön accent och runda siffror (SF Rounded på Apple, systemets typsnitt annars).
   --accent är fyllnadsfärgen (knappar, staplar), --accent-fg är accenten som text/linje. */
:root {
  --bg: #0a0c0b;
  --card: #121615;
  --card-2: #1a1f1d;
  --line: #232927;
  --field: #333b38;
  --rule: #eef2ef;
  --text: #eef2ef;
  --muted: #8b9590;
  --accent: #c8f04a;
  --accent-ink: #0a0c0b;
  --accent-hover: #d8f97a;
  --accent-fg: #c8f04a;
  --accent-2: #b4e352; /* "bra"/inom riktvärdet */
  --accent-soft: rgba(200,240,74,.10);
  --header: #0a0c0b;
  --header-text: #eef2ef;
  --header-muted: #8b9590;
  --nav-bg: rgba(10,12,11,.86);
  --warn: #ffb547;
  --bad: #ff6b5e;
  --info: #6ec3ff;
  --c-main: #c8f04a;
  --c-ref: #ff8ad8;
  --tempo-back: #ffb547;
  --zebra: rgba(255,255,255,.02);
  --chart-1: #c8f04a;
  --chart-2: #6ec3ff;
  --chart-3: #ffb547;
  --chart-4: #c79bff;
  --chart-grid: #232927;
  --chart-phase: #4a5450;
  --card-edge: rgba(255,255,255,.045);
  --mark-arc: #c8f04a;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --serif: var(--display);
  --r-lg: 20px;
  --r-md: 13px;
  --r-sm: 9px;
  --nav-h: 64px;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}

/* Ljust läge: samma system på ljusgrått. Limen är fyllnad; som text används en mörkare oliv för kontrast. */
:root[data-theme="light"] {
  --bg: #f2f3f0;
  --card: #ffffff;
  --card-2: #eef0eb;
  --line: #e2e5df;
  --field: #cdd2ca;
  --rule: #0e1210;
  --text: #0e1210;
  --muted: #5b645f;
  --accent: #c8f04a;
  --accent-ink: #0e1210;
  --accent-hover: #b9e632;
  --accent-fg: #3c6a0c;
  --accent-2: #3c7a12;
  --accent-soft: rgba(110,160,20,.10);
  --header: #f2f3f0;
  --header-text: #0e1210;
  --header-muted: #5b645f;
  --nav-bg: rgba(255,255,255,.9);
  --warn: #a35400;
  --bad: #c4372b;
  --info: #1f6fb5;
  --c-main: #4d8a12;
  --c-ref: #b0307e;
  --tempo-back: #d99a1e;
  --zebra: rgba(0,0,0,.02);
  --chart-1: #4d8a12;
  --chart-2: #1f6fb5;
  --chart-3: #c26a12;
  --chart-4: #7b4fa8;
  --chart-grid: #e2e5df;
  --chart-phase: #a3aaa4;
  --card-edge: rgba(0,0,0,.06);
  --mark-arc: #7cae12; /* limen syns för dåligt mot ljus botten */
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
html[data-i18n-pending] body { visibility: hidden; }
[hidden] { display: none !important; }

/* ── Sidhuvud ─────────────────────────────────────────────── */
header {
  width: min(1200px, 100%); margin: 0 auto; padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
  padding-top: calc(18px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: inherit; text-decoration: none; }
.brand .mark { width: 30px; height: 30px; flex: none; display: block; }
.brand .mark path { stroke: var(--mark-arc); }
.brand:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 4px; border-radius: 8px; }
h1 { margin: 0; font: 600 19px/1.2 var(--display); letter-spacing: -.02em; white-space: nowrap; }
.wordmark span { font-weight: 800; }
h2 { margin: 0 0 12px; font: 650 17px/1.3 var(--display); letter-spacing: -.01em; }
.sub { margin: 4px 0 0; color: var(--muted); }
.header-tools { margin-left: auto; display: flex; gap: 8px; }
.theme-toggle, .lang-toggle {
  width: 38px; height: 38px; padding: 0; display: grid; place-items: center;
  background: var(--card); color: var(--muted); border: 1px solid var(--line); border-radius: 11px;
  font: 650 12px/1 var(--sans); letter-spacing: .04em;
}
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle:hover:not(:disabled), .lang-toggle:hover:not(:disabled) { color: var(--text); border-color: var(--field); }
.install-btn {
  height: 38px; padding: 0 14px; border-radius: 11px; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font: 650 13px/1 var(--sans);
}
.install-btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Flikar: segmenterad kontroll i sidhuvudet på stor skärm, flikrad i underkant på mobil. */
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-left: 12px; }
.tabs a {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 9px;
  color: var(--muted); text-decoration: none; font: 600 14px/1.2 var(--sans);
  transition: color .15s, background .15s;
}
.tabs a svg { width: 18px; height: 18px; flex: none; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--card-2); color: var(--text); }
.tabs a[aria-current="page"] svg { color: var(--accent-fg); }
.tabs a:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 1px; }

/* ── Dialoger och uppdateringsrad ───────────────────────── */
.install-help {
  width: min(420px, 100% - 32px); padding: 22px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.install-help[open] { animation: pop .22s var(--ease); }
.install-help::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.install-help h2 { margin-top: 0; font-size: 20px; }
.install-help ol { padding-left: 1.3em; line-height: 1.6; }
.install-help form { display: flex; justify-content: flex-end; margin-top: 16px; }
.install-help.feedback { width: min(480px, 100% - 32px); }
.install-help.feedback form { display: grid; gap: 14px; margin: 0; }
.feedback h2 { margin: 0; }
.feedback .note { margin: 0; }
.feedback textarea { width: 100%; resize: vertical; min-height: 120px; line-height: 1.45; }
.feedback .hp { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }
.feedback.install-help form.sent .field, .feedback form.sent #feedback-send { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.dialog-actions button { min-height: 44px; }
#feedback-status.ok { color: var(--accent-fg); }
#feedback-status.err { color: var(--warn); }
.update-bar {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font: 650 14px/1.3 var(--sans); box-shadow: 0 8px 28px rgba(0,0,0,.35);
}

/* ── Sidans spalt och kort ──────────────────────────────── */
main { max-width: 1200px; margin: 0 auto; padding: 8px 20px 64px; display: grid; gap: 16px; }
#results { display: grid; gap: 16px; scroll-margin-top: 8px; }
#results:not([hidden]) { animation: rise .35s var(--ease); }
main, #results, #shared { grid-template-columns: minmax(0, 1fr); }
main > *, #results > *, #shared > *, #shared-content > * { min-width: 0; }

.card {
  position: relative; background: var(--card); border-radius: var(--r-lg); padding: 20px; min-width: 0;
  box-shadow: inset 0 0 0 1px var(--card-edge);
}
.card > h2, .chart-head > h2 { font: 650 17px/1.3 var(--display); letter-spacing: -.01em; margin: 0 0 14px; }
.card > h2#shared-title { font-size: 24px; margin-bottom: 4px; }
.card:has(> details.info) > h2 { padding-right: 36px; }
.sub-h { margin-top: 20px !important; }
.card-lead { margin: -6px 0 16px; color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
/* På stor skärm följer videon med medan man läser flikarna bredvid. */
@media (min-width: 861px) { .viewer-card { position: sticky; top: 16px; } }
.side, .panel, .tabpanel { display: grid; gap: 16px; align-content: start; min-width: 0; }
.tabpanel:not([hidden]) { animation: fade .2s ease; }

/* ── Formulärelement och knappar ────────────────────────── */
select, input[type=number], input[type=text], input[type=email], textarea, button {
  font: inherit; color: var(--text); background: var(--card-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px;
}
input[type=text], input[type=email], textarea { background: var(--bg); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9590' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
select:hover, input[type=number]:hover, input[type=text]:hover, input[type=email]:hover, textarea:hover { border-color: var(--field); }
input[type=text]:focus, input[type=email]:focus, textarea:focus { border-color: var(--accent-fg); outline: none; }
select:focus-visible, input:focus-visible, button:focus-visible, a.button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-fg); outline-offset: 2px;
}
input[type=number] { width: 90px; font-variant-numeric: tabular-nums; }
button {
  cursor: pointer; font-weight: 550; user-select: none; -webkit-user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease);
}
button:hover:not(:disabled) { border-color: var(--field); }
button:active:not(:disabled), a.button:active, .tabs a:active, .drop:active { transform: scale(.97); }
button:disabled { opacity: .4; cursor: default; }
button.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
  font-weight: 700; padding: 0 28px; min-height: 50px; border-radius: var(--r-md); font-size: 16px;
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary:disabled { opacity: 1; background: var(--card-2); color: var(--muted); border-color: var(--line); }
button.wide { width: 100%; }
button.active { border-color: var(--text); background: var(--text); color: var(--bg); }
a.button {
  display: inline-flex; align-items: center; gap: 6px; color: var(--text); background: var(--card-2); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 14px; line-height: 1.3; font-weight: 550;
}
a.button:hover { border-color: var(--field); }
.linklike {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start;
  background: none; border: 0; padding: 6px 0; color: var(--accent-fg); font-size: 14px; font-weight: 600;
}
.linklike svg { width: 16px; height: 16px; flex: none; }
.linklike:hover:not(:disabled) { color: var(--text); }
.linklike.small { font-size: 13px; color: var(--muted); margin-top: 6px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.button-row button { flex: 1 1 140px; min-height: 44px; border-radius: var(--r-md); }
input[type=range] { width: 100%; accent-color: var(--accent); margin-top: 8px; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; color: var(--text); font-size: 14px; }
.check input, .toggles input { accent-color: var(--accent); width: 16px; height: 16px; }
.field { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 13px; color: var(--muted); }
.field input { flex: 1 1 100%; margin-top: 2px; }
#share-name { width: 100%; }

/* "Mer information": liten i-knapp uppe till höger i kortet; texten fälls ut under rubriken. */
details.info > summary {
  position: absolute; top: 14px; right: 14px; list-style: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
}
details.info > summary::-webkit-details-marker { display: none; }
details.info > summary svg { width: 19px; height: 19px; }
details.info > summary:hover, details.info[open] > summary { color: var(--text); background: var(--card-2); }
.info-body { margin: 0 0 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--card-2); color: var(--muted); font-size: 13px; }
.info-body p { margin: 0; }
.info-body p + p { margin-top: 8px; }
details.info[open] .info-body { animation: fade .2s ease; }

/* ── Första skärmen ─────────────────────────────────────── */
.setup { display: grid; gap: 16px; }
.hero { padding: 18px 4px 4px; max-width: 640px; }
.hero-title { margin: 0; font: 750 40px/1.05 var(--display); letter-spacing: -.035em; }
.hero-sub { margin: 10px 0 0; color: var(--muted); font-size: 16px; max-width: 52ch; }
.setup-card { padding: 22px; }
.uploads { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.upload { display: grid; gap: 8px; align-content: start; }
.drop {
  display: grid; justify-items: center; text-align: center; gap: 2px; padding: 30px 18px;
  border: 1.5px dashed var(--field); border-radius: var(--r-lg); cursor: pointer;
  background: var(--bg); transition: border-color .15s, background .15s, transform .12s var(--ease);
}
.drop .drop-icon {
  width: 48px; height: 48px; border-radius: 15px; margin-bottom: 10px;
  display: grid; place-items: center; background: var(--card-2); color: var(--accent-fg);
  transition: background .15s, color .15s;
}
.drop .drop-icon svg { width: 22px; height: 22px; }
.drop:focus-visible { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.drop:hover, .drop.over { border-color: var(--accent-fg); background: var(--accent-soft); }
.drop.has-file { border-style: solid; border-color: var(--accent-fg); background: var(--accent-soft); }
.drop.has-file .drop-icon { background: var(--accent); color: var(--accent-ink); }
.drop-title { font: 650 17px/1.3 var(--display); }
.drop-title em { color: var(--muted); font: 400 14px var(--sans); }
.drop-name { color: var(--muted); font-size: 13px; word-break: break-word; }
.trim { color: var(--muted); font-size: 13px; }
.trim input { width: 76px; max-width: 30%; padding: 5px 8px; margin: 0 2px; }

.actions { display: flex; align-items: flex-end; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.club-pick { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 180px; }
.club-pick select { font-size: 15px; font-weight: 600; color: var(--text); min-height: 50px; border-radius: var(--r-md); }
.analyze-bar { display: flex; align-items: center; gap: 12px 16px; flex: 1; flex-wrap: wrap; min-width: 200px; }
.analyze-bar button.primary { flex: 1 1 auto; }
.setup-links { display: flex; gap: 6px 20px; flex-wrap: wrap; margin-top: 12px; }

/* Analysen pågår: stor procentsiffra, tunn stapel och vad som görs just nu. */
.progress { margin-top: 18px; padding: 18px; border-radius: var(--r-lg); background: var(--bg); display: grid; gap: 10px; animation: fade .2s ease; }
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-pct { font: 750 44px/1 var(--display); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--card-2); border-radius: 3px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .2s linear; }
#progress-text { color: var(--muted); font-size: 14px; }
.cancel { padding: 8px 14px; font-size: 13px; border-radius: 999px; }
.error { color: var(--bad); margin: 12px 0 0; }
.detected { font-size: 13px; }

.advanced, .hint { margin-top: 16px; border-top: 1px solid var(--line); }
.hint { margin-top: 0; }
.advanced summary, .hint summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--text); padding: 14px 0;
}
.advanced summary::-webkit-details-marker, .hint summary::-webkit-details-marker, .drill summary::-webkit-details-marker { display: none; }
.advanced summary::after, .hint summary::after, .rl-settings summary::after, .drill summary::after {
  content: ""; width: 16px; height: 16px; flex: none; background: currentColor; opacity: .6; transition: transform .2s var(--ease);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
}
details[open] > summary::after { transform: rotate(180deg); }
.hint { color: var(--muted); font-size: 14px; }
.hint ul { margin: 0 0 12px; padding-left: 20px; }
.hint li { margin: 4px 0; }
.settings { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 14px; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); flex: 1 1 160px; min-width: 0; }
.settings select, .settings input[type=number] { width: 100%; max-width: 100%; }

.guide { margin-top: 4px; color: var(--muted); font-size: 14px; }
.guide-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.guide figure { margin: 0; background: var(--bg); border-radius: var(--r-md); padding: 12px; }
.guide svg { width: 100%; max-height: 240px; display: block; color: var(--text); }
.guide figcaption { margin-top: 8px; font-size: 13px; }
.guide ul { margin: 12px 0 0; padding-left: 20px; }

/* ── Resultat: domen ────────────────────────────────────── */
.verdict { padding: 22px; }
.verdict-main { display: flex; align-items: center; gap: 22px; padding-right: 30px; }
.verdict .info-body { margin: 16px 0 0; }
.verdict-text { min-width: 0; }
.verdict-band { font: 650 22px/1.25 var(--display); letter-spacing: -.02em; }
.verdict-band b { color: var(--accent-fg); font-weight: 750; }
.verdict-gain { margin-top: 6px; color: var(--muted); font-size: 14.5px; }
.verdict-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.v-stat { background: var(--card-2); border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; }
.v-n { font: 700 24px/1.1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v-l { color: var(--muted); font-size: 12.5px; }

/* ── Resultatflikar ─────────────────────────────────────── */
.seg-tabs { display: flex; gap: 2px; padding: 4px; background: var(--card); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--card-edge); }
.seg-tabs button {
  flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 10px;
  padding: 10px 6px; font: 650 14px/1.2 var(--sans); min-height: 42px;
}
.seg-tabs button:hover:not(:disabled) { color: var(--text); }
.seg-tabs button[aria-selected="true"] { background: var(--card-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent-fg); }

/* ── Videovisare ────────────────────────────────────────── */
.viewer { background: #000; overflow: hidden; display: flex; justify-content: center; border-radius: var(--r-md); }
.viewer canvas { max-width: 100%; max-height: 70vh; display: block; }
.stack { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
.viewer #draw { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; pointer-events: none; }
.viewer #draw.active { pointer-events: auto; touch-action: none; cursor: crosshair; }
#view.marking { cursor: crosshair; outline: 2px dashed var(--accent); outline-offset: -2px; }

.controls { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.controls .time { color: var(--muted); font: 500 13px var(--sans); font-variant-numeric: tabular-nums; margin-left: auto; }
.controls input[type=range] { flex: 1; width: auto; margin: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 40px; padding: 0 10px; border-radius: 11px; }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; display: block; }
#btn-play, #cmp-play { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
#btn-play:hover, #cmp-play:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.controls select { height: 40px; border-radius: 11px; }

.scrub-wrap { position: relative; margin-top: 10px; }
.scrub-wrap input[type=range] { margin: 0; display: block; height: 28px; }
/* Faslägen på reglaget: --f är 0–1; 8 px = halva reglagets knapp. */
.ticks { position: absolute; inset: 0; pointer-events: none; }
.ticks i { position: absolute; top: 50%; left: calc(8px + (100% - 16px) * var(--f)); width: 2px; height: 14px; transform: translate(-50%, -50%); background: var(--accent-fg); border-radius: 1px; opacity: .8; }

/* Fasknapparna som segmenterad kontroll. */
.phase-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.segmented { display: flex; flex-wrap: nowrap; gap: 2px; margin-top: 10px; padding: 3px; background: var(--card-2); border-radius: var(--r-md); }
.segmented button {
  flex: 1 1 0; min-width: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted);
  padding: 8px 4px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.segmented button:hover:not(:disabled) { color: var(--text); }
.segmented button.active { background: var(--card); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent-fg), 0 1px 2px rgba(0,0,0,.2); }

.toggles { display: flex; gap: 10px 16px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 14px; }
.toggles label { display: inline-flex; align-items: center; gap: 8px; }
/* Visartogglarna som chips: rutan döljs visuellt, hela etiketten är tryckytan. */
.chips { gap: 8px; }
.chips label {
  cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--muted); user-select: none; font-size: 13px; font-weight: 600;
  transition: background .15s, color .15s;
}
.chips label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--field); transition: background .15s; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.chips label:has(input:checked) { color: var(--text); border-color: transparent; background: var(--card-2); }
.chips label:has(input:checked)::before { background: var(--accent-fg); }
.chips label:has(input:focus-visible) { outline: 2px solid var(--accent-fg); outline-offset: 1px; }

.ball-mark button { margin-left: 6px; padding: 5px 12px; font-size: 13px; }
.draw-tools { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.draw-tools .muted { font-size: 13px; font-weight: 600; }
.tool-group { display: inline-flex; gap: 2px; padding: 3px; background: var(--card-2); border-radius: var(--r-md); }
.tool-group button { border: 0; background: transparent; color: var(--muted); padding: 5px 12px; font-size: 13px; font-weight: 600; border-radius: var(--r-sm); }
.tool-group button:hover:not(:disabled) { color: var(--text); }
.tool-group button.active { background: var(--accent); color: var(--accent-ink); }

/* ── Tempo och nivå ─────────────────────────────────────── */
.tempo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px 14px; background: var(--card-2); border-radius: var(--r-md); min-width: 0; }
.stat .v { font: 700 24px/1.1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat .r { color: var(--c-ref); font-size: 12px; }
.tempo-cmp { grid-column: 1 / -1; display: grid; gap: 8px; margin-top: 8px; }
.tc-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) 3.2em; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.tc-v { text-align: right; font: 650 13px var(--display); font-variant-numeric: tabular-nums; color: var(--text); }
.tc-row.bench .tempo-bar { opacity: .5; }
.tempo-bar { display: flex; gap: 2px; height: 8px; }
.tempo-bar > div { border-radius: 2px; }
.tempo-bar .b { background: var(--tempo-back); }
.tempo-bar .d { background: var(--bad); }

.level { display: flex; align-items: center; gap: 18px; }
.level .band { font: 600 17px/1.3 var(--display); }
.gauge { position: relative; width: 132px; flex: none; }
.gauge svg { display: block; width: 100%; }
.gauge path { fill: none; stroke-width: 10; stroke-linecap: round; }
.gauge .g-track { stroke: var(--card-2); }
.gauge .g-fill { stroke: var(--accent); }
.gauge .score { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-variant-numeric: tabular-nums; }
.gauge .score .n { font: 750 38px/1 var(--display); letter-spacing: -.04em; color: var(--text); }
.gauge .score .of { color: var(--muted); margin-left: 2px; font: 600 13px var(--display); }
.gain { margin: 12px 0 0; font-size: 14px; }

/* ── Tips och listor ────────────────────────────────────── */
.tips, .tour { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tips > li, .tour > li { position: relative; padding: 10px 0 10px 18px; font-size: 14px; color: var(--muted); }
.tips > li + li, .tour > li + li { border-top: 1px solid var(--line); }
.tips > li::before, .tour > li::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 2px; background: var(--info); }
.tips > li.good::before, .tour > li::before { background: var(--accent-2); }
.tips > li.warn::before, .tour > li.off::before { background: var(--warn); }
.tips > li > b, .tour > li > b { display: block; color: var(--text); font-weight: 650; font-size: 15px; margin-bottom: 1px; }

.drill { margin-top: 10px; background: var(--card-2); padding: 0 12px; border-radius: var(--r-sm); }
.drill summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; color: var(--accent-fg); font-weight: 600; font-size: 13px; }
.drill[open] { padding-bottom: 8px; }
.drill p { margin: 0 0 6px; color: var(--muted); }
.drill ol { margin: 4px 0; padding-left: 20px; }
.drill li { margin: 2px 0; }

.hist-list ul { list-style: none; margin: 8px 0 0; padding: 0; }
.hist-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding: 6px 0; font-size: 14px; }

/* ── Tabell ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 14px; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
td:first-child { color: var(--muted); }
thead th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
tbody tr:last-child td { border-bottom: 0; }
td .val { font: 650 14.5px var(--display); }
td .ref { color: var(--c-ref); font-size: 12px; margin-left: 6px; }
td .target, .stat .target { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.val.ok, .stat .v.ok { color: var(--accent-2); }
.val.off, .stat .v.off { color: var(--warn); }
.val.unsure { opacity: .6; font-style: italic; }
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.legend .ok, .legend .off { display: inline-flex; align-items: center; gap: 6px; }
.legend .ok::before, .legend .off::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.legend .ok::before { background: var(--accent-2); }
.legend .off::before { background: var(--warn); }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.muted { color: var(--muted); }

/* ── Diagram ────────────────────────────────────────────── */
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-head h2, .chart-head h3 { margin: 0; }
.chart-head h3 { font: 650 15px/1.3 var(--display); color: var(--text); }
.trend-opts { display: flex; gap: 8px; flex-wrap: wrap; }
#trend, #chart { width: 100%; display: block; }
#chart { cursor: crosshair; }

/* ── Jämförelse ─────────────────────────────────────────── */
.compare-views { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.compare-views figure { margin: 0; background: #000; overflow: hidden; display: flex; flex-direction: column; border-radius: var(--r-md); }
.compare-views canvas { display: block; max-width: 100%; max-height: 65vh; margin: 0 auto; }
.compare-views figcaption { margin-top: auto; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px; background: var(--card-2); }
.compare-views.overlay { grid-template-columns: 1fr; }
.compare-views.overlay figure:nth-child(2) { display: none; }

.hidden-media { position: fixed; left: -10000px; top: 0; width: 320px; height: 240px; overflow: hidden; }

/* ── Dela & AI ──────────────────────────────────────────── */
.share-card > h2 { margin-bottom: 8px; }
.share-card .note { margin-top: 12px; }
hr.split { border: 0; border-top: 1px solid var(--line); margin: 20px 0 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#ai-status.ok, #share-status.ok { color: var(--accent-fg); }
#ai-status.err, #share-status.err { color: var(--warn); }
#share-status input { width: 100%; margin-top: 6px; }

/* ── Delad länk ─────────────────────────────────────────── */
#shared, #shared-content { display: grid; gap: 16px; }
.shared-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; max-width: 960px; }
.shared-figures figure { margin: 0; background: #0a0c0b; border-radius: var(--r-md); overflow: hidden; }
.shared-figures canvas { width: 100%; display: block; }
.shared-figures figcaption { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px; background: var(--card-2); }

/* ── Rangeläge (/liverange/) ────────────────────────────── */
#rl-start { display: grid; gap: 16px; }
.rl-intro { margin: 0; }
.rl-stage { position: relative; background: #000; line-height: 0; border-radius: var(--r-md); overflow: hidden; }
.rl-stage video { width: 100%; max-height: 60vh; object-fit: contain; display: block; background: #000; }
.rl-tag {
  position: absolute; top: 10px; padding: 4px 10px; border-radius: 8px;
  background: rgba(0,0,0,.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #c8f04a; font: 650 12px/1.5 var(--sans); font-variant-numeric: tabular-nums;
}
.rl-tag:empty { display: none; }
.rl-fps { right: 10px; }
.rl-status { left: 10px; color: #fff; }
.rl-meter { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); overflow: hidden; }
.rl-meter i { display: block; height: 100%; width: 0; background: #c8f04a; transition: width .05s; }
.rl-warn { color: var(--warn); }
#rl-canvas { width: 100%; max-height: 60vh; object-fit: contain; display: block; background: #000; margin-bottom: 4px; border-radius: var(--r-md); }
.rl-speed { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.rl-thumbs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.rl-thumb { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: var(--r-md); line-height: 0; overflow: hidden; background: #000; }
.rl-thumb img { height: 96px; width: auto; display: block; }
.rl-thumb.active { border-color: var(--accent); }
.rl-settings summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.rl-settings summary::-webkit-details-marker { display: none; }
.rl-settings .settings { margin-top: 14px; }
.rl-settings .check { margin-bottom: 0; }

/* ── Banläget (/bana/) ──────────────────────────────────── */
#cs-pick { display: grid; gap: 16px; }
.cs-search { display: flex; gap: 10px; }
.cs-search input { flex: 1; min-width: 0; min-height: 44px; }
.cs-search button { flex: none; min-height: 44px; }
.cs-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 2px; }
.cs-list button {
  width: 100%; display: grid; gap: 2px; text-align: left; padding: 12px 14px; min-height: 56px;
  background: transparent; border: 0; border-radius: var(--r-md);
}
.cs-list button:hover:not(:disabled) { background: var(--card-2); }
.cs-item-name { font-weight: 600; }
.cs-item-meta { color: var(--muted); font-size: 13px; font-weight: 450; }
.cs-credit { margin: 0 4px; font-size: 13px; color: var(--muted); }
.cs-credit a { color: inherit; }
.cs-play { display: grid; gap: 12px; }
.cs-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cs-bar h2 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-back, .cs-holebar button, .cs-tools button { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; flex: none; }
.cs-back svg, .cs-holebar svg, .cs-tools svg { width: 20px; height: 20px; }
.cs-holebar { display: flex; gap: 8px; }
.cs-holebar select { flex: 1; min-width: 0; min-height: 44px; font-weight: 600; }
.cs-stage { position: relative; border-radius: var(--r-md); overflow: hidden; background: #000; }
.cs-map { height: min(72vh, 720px); }
.cs-dist {
  position: absolute; top: 12px; right: 12px; z-index: 2; display: grid; gap: 1px; min-width: 104px;
  padding: 10px 14px; border-radius: 16px; background: rgba(8,10,9,.72); color: #fff;
  border: 1px solid rgba(255,255,255,.08); box-shadow: 0 6px 24px rgba(0,0,0,.35);
  backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4); pointer-events: none;
}
.cs-dist div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cs-dist span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.55); }
.cs-dist b { font: 700 17px/1.25 var(--display); font-variant-numeric: tabular-nums; color: rgba(255,255,255,.85); }
.cs-dist .cs-mid { padding: 2px 0; }
.cs-dist .cs-mid b { font-size: 34px; line-height: 1.05; color: #c8f04a; letter-spacing: -.02em; }
.cs-holechip {
  position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px; border-radius: 999px; background: rgba(8,10,9,.72); color: #fff;
  border: 1px solid rgba(255,255,255,.08); box-shadow: 0 6px 24px rgba(0,0,0,.35);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); pointer-events: none;
}
.cs-holechip b {
  display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px;
  background: #c8f04a; color: #0a0c0b; font: 800 17px/1 var(--display);
}
.cs-holechip span { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.8); white-space: nowrap; }
.cs-tools { position: absolute; left: 12px; bottom: 32px; z-index: 2; display: grid; gap: 8px; }
.cs-tools button {
  background: rgba(8,10,9,.72); color: #fff; border: 1px solid rgba(255,255,255,.1); border-radius: 14px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.cs-tools button.on { color: var(--accent); }
.cs-tools button[hidden] { display: none; }
.cs-status { margin: 0; color: var(--muted); font-size: 14px; }
.cs-score { display: flex; align-items: stretch; gap: 8px; }
.cs-score[hidden] { display: none; }
.cs-score > button:not(.cs-total):not(#cs-plus) { width: 52px; height: 52px; padding: 0; display: grid; place-items: center; flex: none; }
.cs-score svg { width: 22px; height: 22px; }
#cs-plus {
  flex: 1.6; min-width: 0; height: 52px; padding: 0 14px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 16px; font-weight: 800;
  box-shadow: 0 4px 16px var(--accent-soft);
}
#cs-plus span { white-space: nowrap; }
.cs-strokes, .cs-total { display: grid; place-content: center; justify-items: center; gap: 2px; min-width: 0; }
.cs-strokes { width: 48px; flex: none; }
.cs-total { flex: 1; min-height: 52px; padding: 4px 10px; }
.cs-strokes span, .cs-total span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.cs-strokes b { font: 800 26px/1 var(--display); font-variant-numeric: tabular-nums; }
.cs-total b { font: 700 18px/1.1 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cs-strokes b.under, .cs-cardtab td.under { color: var(--info); }
.cs-strokes b.over, .cs-cardtab td.over { color: var(--warn); }
.cs-cardlg { max-height: calc(100dvh - 32px); }
.install-help.cs-cardlg form { display: grid; justify-content: stretch; gap: 14px; margin: 0; }
.cs-cardlg h2 { margin: 0; }
#cs-card-body { display: grid; gap: 14px; overflow-y: auto; max-height: calc(100dvh - 200px); }
.cs-cardtab { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cs-cardtab caption { text-align: left; font-weight: 700; padding-bottom: 6px; }
.cs-cardtab th { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px; }
.cs-cardtab td { text-align: center; padding: 7px 4px; border-top: 1px solid var(--line); }
.cs-cardtab tbody tr { cursor: pointer; }
.cs-cardtab tbody tr.now { background: var(--accent-soft); }
.cs-cardtab tbody td:last-child { font-weight: 700; }
.cs-cardtab tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.cs-pin { cursor: grab; touch-action: none; }
.cs-pin::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; } /* större yta att ta tag i med tummen */
.cs-pin:active { cursor: grabbing; }
.cs-pin-origin {
  width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid #0a0c0b;
  box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(0,0,0,.5);
}
.cs-pin-target {
  width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid #fff; background: rgba(255,255,255,.12);
  box-shadow: 0 0 0 1px rgba(0,0,0,.25), inset 0 0 0 1px rgba(0,0,0,.2), 0 2px 10px rgba(0,0,0,.35);
}
.cs-pin-target::after { content: ""; position: absolute; inset: 50% auto auto 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff; }
.cs-flag { width: 28px; height: 40px; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.cs-flag svg { display: block; width: 100%; height: 100%; }
.cs-label {
  display: flex; align-items: baseline; gap: 2px; padding: 4px 10px; border-radius: 999px;
  background: #fff; color: #0a0c0b; box-shadow: 0 2px 10px rgba(0,0,0,.35); white-space: nowrap; pointer-events: none;
}
.cs-label b { font: 800 16px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.cs-label span { font-size: 11px; font-weight: 700; color: #4b524e; }
.cs-arc-label {
  padding: 1px 6px; border-radius: 6px; background: rgba(8,10,9,.6); color: rgba(255,255,255,.85);
  font: 700 11px/1.3 var(--display); font-variant-numeric: tabular-nums; pointer-events: none;
}
.cs .maplibregl-ctrl-attrib { font-size: 10px; }
#rl-summary-body p { margin: 6px 0 0; }
#rl-stop { color: var(--bad); }

/* ── Rörelse ────────────────────────────────────────────── */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Mobil ──────────────────────────────────────────────── */
@media (max-width: 860px) {
  .grid, .uploads, .compare-views { grid-template-columns: 1fr; }
  header { padding: calc(14px + env(safe-area-inset-top)) 16px 10px; }
  main { padding: 4px 12px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); gap: 12px; }
  #results, .panel, .tabpanel, #shared, #shared-content, .setup, #rl-start { gap: 12px; }
  .card { padding: 18px 16px; }
  .guide-figs { grid-template-columns: 1fr; }
  .shared-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 10px 4px 2px; }
  .hero-title { font-size: 32px; }
  .hero-sub { font-size: 15px; }
  .verdict-main { gap: 16px; }
  .verdict-band { font-size: 19px; }
  .gauge { width: 112px; }
  .gauge .score .n { font-size: 32px; }
  /* Flikarna sticker kvar överst när man scrollar i resultatet. */
  .seg-tabs { position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 15; box-shadow: inset 0 0 0 1px var(--card-edge), 0 6px 20px rgba(0,0,0,.25); }

  /* Flikraden blir en appflikrad i underkant. */
  .tabs {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 0;
    background: var(--nav-bg); border: 0; border-top: 1px solid var(--line); border-radius: 0;
    backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  }
  .tabs a { flex: 1; flex-direction: column; gap: 3px; padding: 6px 4px; min-height: 52px; justify-content: center; font-size: 11px; border-radius: 10px; }
  .tabs a svg { width: 22px; height: 22px; }
  .tabs a[aria-current="page"] { background: transparent; color: var(--accent-fg); }
  .update-bar { bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }

  .actions { align-items: stretch; flex-direction: column; gap: 12px; }
  .club-pick { min-width: 0; }
  /* Analysera-knappen ligger kvar ovanför flikraden när en video är vald. */
  .setup.has-video .analyze-bar {
    position: sticky; z-index: 20; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); flex: none;
    margin: 0 -16px; padding: 10px 16px;
    background: var(--card); border-top: 1px solid var(--line);
  }
  .analyze-bar button.primary { flex: 1 1 100%; }
  .stat .v, .v-n { font-size: 21px; }
  /* Kartan fyller skärmen mellan sidhuvudet och flikraden. */
  .cs-play { margin: 0 -8px; padding: 8px 8px 10px; gap: 8px; }
  .cs-bar { gap: 8px; }
  .cs-bar h2 { font-size: 17px; }
  .cs-back, .cs-holebar button { width: 38px; height: 38px; }
  .cs-holebar { gap: 6px; }
  .cs-holebar select { min-height: 38px; font-size: 14px; }
  .cs-stage { margin: 0 -8px; border-radius: 0; }
  .cs-map { height: calc(100dvh - 226px - env(safe-area-inset-bottom)); min-height: 380px; }
  .cs-play:has(.cs-score:not([hidden])) .cs-map { height: calc(100dvh - 292px - env(safe-area-inset-bottom)); }
  .cs-status:empty { display: none; }
  /* Mindre överlägg så att kartan syns bättre. */
  .cs-dist { top: 8px; right: 8px; min-width: 86px; padding: 6px 10px; border-radius: 12px; }
  .cs-dist span { font-size: 9px; }
  .cs-dist b { font-size: 14px; }
  .cs-dist .cs-mid b { font-size: 26px; }
  .cs-holechip { top: 8px; left: 8px; padding: 4px 10px 4px 4px; gap: 7px; }
  .cs-holechip b { min-width: 28px; height: 28px; font-size: 14px; }
  .cs-holechip span { font-size: 11px; }
  .cs-tools { left: 8px; bottom: 26px; gap: 6px; }
  .cs-tools button { width: 36px; height: 36px; border-radius: 11px; }
  .cs-tools svg { width: 18px; height: 18px; }
  .cs-label { padding: 2px 8px; }
  .cs-label b { font-size: 14px; }
}
/* Smal skärm med installationsknapp: bara märket syns, namnet står kvar för skärmläsare. */
@media (max-width: 440px) {
  header:has(.install-btn:not([hidden])) h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 380px) {
  .stat, .v-stat { padding: 10px; }
  .stat .v, .v-n { font-size: 18px; }
  .gauge { width: 96px; }
}

/* Pekskärmar: minst 44 px tryckyta. */
@media (pointer: coarse) {
  .controls button, .controls select, .segmented button, .tool-group button, .chips label, .ball-mark button, .linklike, .cancel, .seg-tabs button { min-height: 44px; }
  .icon-btn { min-width: 44px; }
  .theme-toggle, .lang-toggle, .install-btn { height: 44px; min-width: 44px; }
  details.info > summary { width: 40px; height: 40px; top: 10px; right: 10px; }
  .scrub-wrap input[type=range], .controls input[type=range] { height: 44px; }
  .ticks i { height: 18px; }
}
