/* Lucas el-bog. Designsprog: teknisk datablad møder gruppetavle.
   Farver låner fra faget: signalgul (advarselsmærker og måleinstrumenter),
   lederfarverne brun/blå/gul-grøn, og tavlens hvide eller grafitgrå front. */

/* Brødtekst: IBM Plex Sans. Den har et almindeligt nul uden skråstreg, så 0 aldrig kan forveksles med Ø. */
@font-face { font-family: 'Plex Sans'; src: url('../fonts/plexsans-400.woff2') format('woff2'); font-weight: 100 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Plex Sans'; src: url('../fonts/plexsans-400-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Barlow C'; src: url('../fonts/barlow-600-v2.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow C'; src: url('../fonts/barlow-700-v2.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/plexmono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --bg: #ebe9e3;
  --bg-grain: rgba(0, 0, 0, 0.025);
  --surface: #f7f6f2;
  --surface-2: #ffffff;
  --sunken: #e2dfd7;
  --ink: #16181b;
  --ink-2: #4b5059;
  --ink-3: #7d828a;
  --line: #d3d0c6;
  --line-strong: #b9b5aa;

  --accent: #ffc400;
  --accent-ink: #1b1600;
  --accent-soft: #fff1bf;

  --fase: #8a5a33;
  --nul: #1e5bc6;
  --pe-g: #2e8b3e;
  --pe-y: #f2c200;
  --sort: #222;
  --graa: #8b8f94;

  --ok: #23823a;
  --ok-soft: #dcf0df;
  --warn: #b86e00;
  --danger: #c8321e;
  --danger-soft: #fbe3de;
  --info: #1e5bc6;
  --info-soft: #e1eafb;

  --rail: linear-gradient(180deg, #c9ccd1 0%, #eef0f2 22%, #a9adb3 50%, #eef0f2 78%, #b8bbc0 100%);
  --breaker: #fbfbf9;
  --breaker-edge: #cfcdc5;
  --breaker-shadow: 0 1px 0 #fff inset, 0 6px 14px rgba(30, 30, 20, 0.12), 0 1px 2px rgba(0, 0, 0, 0.18);

  --font-body: 'Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Barlow C', 'Arial Narrow', sans-serif;
  --font-mono: 'Plex Mono', ui-monospace, 'SFMono-Regular', monospace;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --nav-h: 64px;
  --gutter: 16px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(40, 35, 20, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='lys']) {
    --bg: #111316;
    --bg-grain: rgba(255, 255, 255, 0.018);
    --surface: #191c20;
    --surface-2: #20242a;
    --sunken: #0c0e10;
    --ink: #eceae4;
    --ink-2: #b0b4bb;
    --ink-3: #7c828b;
    --line: #2c3036;
    --line-strong: #3d424a;
    --accent-soft: #3a2f00;
    --ok-soft: #12301a;
    --danger-soft: #3a1510;
    --info-soft: #132545;
    --fase: #b37a4b;
    --nul: #4c86ea;
    --rail: linear-gradient(180deg, #2b2e33 0%, #4a4e55 22%, #25282c 50%, #4a4e55 78%, #2b2e33 100%);
    --breaker: #2a2e34;
    --breaker-edge: #3a3f46;
    --breaker-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 6px 14px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme='mork'] {
  --bg: #111316;
  --bg-grain: rgba(255, 255, 255, 0.018);
  --surface: #191c20;
  --surface-2: #20242a;
  --sunken: #0c0e10;
  --ink: #eceae4;
  --ink-2: #b0b4bb;
  --ink-3: #7c828b;
  --line: #2c3036;
  --line-strong: #3d424a;
  --accent-soft: #3a2f00;
  --ok-soft: #12301a;
  --danger-soft: #3a1510;
  --info-soft: #132545;
  --fase: #b37a4b;
  --nul: #4c86ea;
  --rail: linear-gradient(180deg, #2b2e33 0%, #4a4e55 22%, #25282c 50%, #4a4e55 78%, #2b2e33 100%);
  --breaker: #2a2e34;
  --breaker-edge: #3a3f46;
  --breaker-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 6px 14px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-grain) 1px, transparent 1px);
  background-size: 6px 6px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Ramme ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  margin: 0 calc(var(--gutter) * -1);
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  min-height: 52px;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--ink); text-decoration: none; }
.icon-btn:active { background: var(--sunken); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.on svg { fill: var(--accent); stroke: var(--accent-ink); }

.sync { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.sync::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.sync.pending::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.sync.offline::before { background: var(--ink-3); box-shadow: none; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0 2px; text-decoration: none; color: var(--ink-3);
  font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 10px;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current='page'] { color: var(--ink); }
.nav a[aria-current='page'] .nav-ico { background: var(--accent); color: var(--accent-ink); }
.nav-ico { display: grid; place-items: center; width: 48px; height: 28px; border-radius: 14px; transition: background 0.2s; }

.banner { margin: 12px 0; padding: 12px 14px; border-radius: var(--r-m); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); font-size: 15px; display: flex; gap: 10px; align-items: center; }
.banner a { font-weight: 700; }

/* ---------- Typografi ---------- */
.eyebrow { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.eyebrow b { color: var(--ink); }
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: 0.01em; }
h1 { font-size: clamp(32px, 9vw, 46px); margin: 6px 0 10px; text-transform: uppercase; overflow-wrap: anywhere; }
/* Kun titler med et ord, der ikke kan stå på én linje, orddeles. Ellers brydes de mellem ordene. */
h1.langt-ord { -webkit-hyphens: auto; hyphens: auto; }
.page-h { font-size: clamp(34px, 10vw, 52px); margin: 18px 0 4px; text-transform: uppercase; }
.lead { color: var(--ink-2); margin: 0 0 18px; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-3); }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 10px; }
.section-h h2 { font-size: 22px; margin: 0; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- Kort og knapper ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-card); padding: 16px; }
.card + .card { margin-top: 12px; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:active { transform: scale(0.995); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--bg);
  font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: transform 0.08s, background 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn.yellow { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 12px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.chip.fase-gf { border-color: var(--fase); color: var(--fase); }
.chip.fase-hf { border-color: var(--nul); color: var(--nul); }
.chip.fase-svend { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.filter { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter); scrollbar-width: none; }
.filter::-webkit-scrollbar { display: none; }
.filter button { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-strong); background: var(--surface); font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; color: var(--ink-2); }
.filter button[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Tavlen (forsiden) ---------- */
.hello { margin: 14px 0 16px; }
.hello h1 { margin: 2px 0 0; }
.install-btn { margin-top: 10px; }
.install-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; font-size: 16px; line-height: 1.4; }
.inline-ico { width: 18px; height: 18px; vertical-align: -3px; }

.meter {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: end;
  background: #15171a; color: #e9e7df; border-radius: var(--r-l); padding: 16px 16px 14px;
  border: 1px solid #000; box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 10px 30px rgba(0,0,0,0.18);
  position: relative; overflow: hidden;
}
.meter::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px); pointer-events: none; }
.meter-label { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: #9aa0a8; }
.meter-value { font-family: var(--font-mono); font-size: 46px; line-height: 1; color: var(--accent); text-shadow: 0 0 18px rgba(255, 196, 0, 0.35); letter-spacing: -0.02em; }
.meter-value small { font-size: 20px; color: #c9a100; margin-left: 2px; }
.meter-side { text-align: right; font-family: var(--font-mono); font-size: 13px; color: #c3c7cd; line-height: 1.5; }
.meter-side b { color: #fff; font-weight: 500; }
.meter-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: #2a2d32; overflow: hidden; margin-top: 10px; }
.meter-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.6s cubic-bezier(.2,.8,.2,1); }

.next-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; margin-top: 12px; text-decoration: none; }
.next-card .t { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.1; text-transform: uppercase; }
.next-card .arrow { grid-row: 1 / span 3; grid-column: 2; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }

.cabinet {
  margin-top: 22px; border-radius: 18px; padding: 14px 12px 16px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  position: relative;
}
.cabinet-head { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 10px; }
.cabinet-head .eyebrow { font-size: 12px; }
.screw { width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #a9adb3 60%, #7d828a); box-shadow: 0 1px 1px rgba(0,0,0,0.3); position: relative; }
.screw::after { content: ''; position: absolute; left: 2px; right: 2px; top: 4.5px; height: 1px; background: #5b6067; transform: rotate(35deg); }
.row { position: relative; padding: 10px 0 8px; }
.row + .row { margin-top: 6px; }
.row::before { content: ''; position: absolute; left: -2px; right: -2px; top: 50%; height: 26px; transform: translateY(-50%); background: var(--rail); border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.modules { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 560px) { .modules { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.breaker {
  position: relative; display: flex; flex-direction: column; align-items: stretch;
  background: var(--breaker); border: 1px solid var(--breaker-edge); border-radius: 6px;
  box-shadow: var(--breaker-shadow); padding: 6px 5px 6px; min-height: 152px;
  text-decoration: none; color: var(--ink); cursor: pointer;
  transition: transform 0.12s;
}
.breaker:active { transform: translateY(1px); }
.breaker .rating { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); text-align: center; letter-spacing: 0.04em; }
.breaker .slot { margin: 6px auto 4px; width: 30px; height: 54px; border-radius: 5px; background: #1b1d20; position: relative; box-shadow: inset 0 2px 4px rgba(0,0,0,0.6); }
.breaker .lever {
  position: absolute; left: 3px; right: 3px; height: 26px; border-radius: 4px;
  background: linear-gradient(180deg, #ffffff, #d9d9d4); box-shadow: 0 1px 2px rgba(0,0,0,0.5);
  top: 25px; transition: top 0.35s cubic-bezier(.3,1.6,.5,1);
  display: grid; place-items: center; font-family: var(--font-mono); font-size: 11px; color: #555;
}
.breaker.on .lever { top: 3px; background: linear-gradient(180deg, #fff6cc, var(--accent)); color: var(--accent-ink); }
.breaker .flag { width: 14px; height: 6px; margin: 0 auto; border-radius: 1px; background: #3aa457; }
.breaker.on .flag { background: #d6362a; }
.breaker .label {
  margin-top: auto; border-top: 1px dashed var(--line-strong); padding-top: 5px;
  font-family: var(--font-display); font-weight: 600; font-size: 12.5px; line-height: 1.05; letter-spacing: 0.03em;
  text-transform: uppercase; text-align: center; min-height: 2.2em; hyphens: auto; overflow-wrap: anywhere;
}
.breaker .gr { display: block; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); letter-spacing: 0; margin-bottom: 2px; }
.breaker .fill { height: 3px; border-radius: 2px; background: var(--sunken); margin-top: 5px; overflow: hidden; }
.breaker .fill span { display: block; height: 100%; background: var(--accent); }

.breaker.main { min-height: 152px; }
.breaker.main .slot { width: 46px; }
.breaker.main .lever { background: linear-gradient(180deg, #ff6b5b, #c8321e); color: #fff; }
.breaker.main.on .lever { background: linear-gradient(180deg, #ff6b5b, #c8321e); color: #fff; }
.breaker.rcd .test {
  margin: 6px auto 0; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 40% 35%, #ffd84d, var(--accent) 60%, #c79800);
  font-family: var(--font-mono); font-weight: 500; font-size: 13px; color: var(--accent-ink);
  box-shadow: 0 2px 0 #9a7600, 0 3px 6px rgba(0,0,0,0.25);
}
.breaker.rcd .test:active { transform: translateY(2px); box-shadow: 0 0 0 #9a7600; }
.breaker.wide { grid-column: span 2; }

.tavle-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); margin: 10px 4px 0; }
.tavle-legend span { display: inline-flex; gap: 6px; align-items: center; }
.tavle-legend i { width: 10px; height: 5px; border-radius: 1px; display: inline-block; }

/* ---------- Bogen ---------- */
.search {
  position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 10;
  margin: 8px calc(var(--gutter) * -1) 6px; padding: 6px var(--gutter) 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.search label { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line-strong); }
.search label:focus-within { border-color: var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; font-size: 17px; }
.search svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }

.chapter { margin-top: 10px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.chapter > summary { list-style: none; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 14px; cursor: pointer; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter-no { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--sunken); font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); position: relative; overflow: hidden; }
.chapter-no.done { background: var(--accent); color: var(--accent-ink); }
.chapter-name { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.02em; }
.chapter-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.chapter .caret { transition: transform 0.2s; color: var(--ink-3); }
.chapter[open] .caret { transform: rotate(90deg); }
.entries { list-style: none; margin: 0; padding: 0 0 6px; border-top: 1px solid var(--line); }
.entry-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.entries li:last-child .entry-row { border-bottom: 0; }
.entry-row:active { background: var(--sunken); }
.entry-row .t { font-weight: 700; line-height: 1.25; }
.entry-row .k { font-size: 14.5px; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.entry-row .snip { font-size: 14px; color: var(--ink-3); margin-top: 4px; }
.entry-row .snip mark { background: var(--accent-soft); color: var(--ink); padding: 0 2px; border-radius: 3px; }
.entry-row.missing { opacity: 0.55; }

.status { width: 18px; height: 18px; border-radius: 50%; margin-top: 3px; border: 2px solid var(--line-strong); position: relative; }
.status.s1 { border-color: var(--accent); background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.status.s2 { border-color: var(--ok); background: var(--ok); }
.status.s2::after { content: ''; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; }

/* ---------- Opslag ---------- */
.entry-head { margin: 10px 0 18px; }
.entry-head h1 { margin: 6px 0 12px; }
.entry-head .kort { font-size: 19px; line-height: 1.45; color: var(--ink-2); margin: 0 0 14px; }

.prose { font-size: 17.5px; line-height: 1.65; }
.prose h2 { font-size: 24px; text-transform: uppercase; letter-spacing: 0.03em; margin: 34px 0 10px; padding-top: 14px; border-top: 2px solid var(--ink); overflow-wrap: anywhere; }
/* h2 er en almindelig blok (ikke flex), så et link i overskriften brydes som tekst. 0.15em løfter firkanten til midten af versalerne. */
.prose h2::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 10px; vertical-align: 0.15em; background: var(--accent); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 20px; margin: 24px 0 6px; text-transform: uppercase; letter-spacing: 0.02em; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose ol { counter-reset: trin; list-style: none; padding-left: 0; }
.prose ol > li { counter-increment: trin; position: relative; padding-left: 42px; margin: 10px 0; min-height: 30px; }
.prose ol > li::before { content: counter(trin); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--bg); font-family: var(--font-mono); font-size: 14px; display: grid; place-items: center; }
.prose strong { font-weight: 700; }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.prose a.xref { color: var(--ink); text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 3px no-repeat; padding-bottom: 1px; font-weight: 700; }
.prose a:not(.xref) { color: var(--nul); }
.prose hr { border: 0; height: 2px; background: var(--line); margin: 24px 0; }
#s-kort-fortalt + p, #s-kort-fortalt ~ p:first-of-type { font-size: 18.5px; }
.prose > h2#s-kort-fortalt { border-top: 0; padding-top: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.4; }
.prose th, .prose td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 14px; background: var(--sunken); white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }

.callout { margin: 0 0 18px; border-radius: var(--r-m); padding: 12px 14px 2px; background: var(--surface-2); border: 1px solid var(--line); position: relative; }
.callout-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.callout p { margin-bottom: 10px; }
.callout-fare { border: 0; background: var(--danger-soft); padding-top: 20px; }
.callout-fare::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 8px; border-radius: var(--r-m) var(--r-m) 0 0; background: repeating-linear-gradient(-45deg, #111 0 9px, var(--accent) 9px 18px); }
.callout-fare .callout-title { color: var(--danger); }
.callout-husk { border-left: 5px solid var(--nul); background: var(--info-soft); border-color: transparent; border-left-color: var(--nul); }
.callout-husk .callout-title { color: var(--nul); }
.callout-svend { border-left: 5px solid var(--fase); border-left-color: var(--fase); }
.callout-svend .callout-title { color: var(--fase); }
.callout-regel { border-left: 5px solid var(--ink); border-left-color: var(--ink); background: var(--sunken); }
.callout-regel .callout-title::before { content: '§'; font-family: var(--font-mono); }
.callout-tip { border-left: 5px solid; border-image: repeating-linear-gradient(180deg, var(--pe-g) 0 10px, var(--pe-y) 10px 20px) 5; }
.callout-tip .callout-title { color: var(--ok); }

.practice-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin: 24px 0; padding: 14px; border-radius: var(--r-l); background: var(--ink); color: var(--bg); text-decoration: none; }
.practice-card .ico { width: 44px; height: 44px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.practice-card .t { font-family: var(--font-display); font-weight: 700; font-size: 20px; text-transform: uppercase; line-height: 1.05; }
.practice-card .s { font-size: 14px; opacity: 0.75; }

.panel { margin-top: 28px; border-top: 2px solid var(--ink); padding-top: 14px; }
.panel h3 { font-size: 20px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }

.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.levels button { min-height: 64px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); padding: 6px 4px; cursor: pointer; font-size: 13.5px; line-height: 1.2; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.levels button b { font-family: var(--font-display); font-size: 16px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink); }
.levels button[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.levels button[aria-pressed='true'] b { color: var(--accent); }

textarea.note { width: 100%; min-height: 110px; resize: vertical; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface-2); padding: 12px; font-size: 16px; line-height: 1.5; }
textarea.note:focus { outline: 0; border-color: var(--ink); }
.saved { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); min-height: 18px; }

.sources { font-size: 14.5px; }
.sources summary { cursor: pointer; font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.sources ol { padding-left: 1.2em; }
.sources li { margin: 6px 0; overflow-wrap: anywhere; }
.disclaimer { font-size: 13.5px; color: var(--ink-3); margin-top: 10px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 24px; }
.pager a { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; font-size: 14px; line-height: 1.25; }
.pager a .d { display: block; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.pager a.next { text-align: right; grid-column: 2; }

/* ---------- Quiz ---------- */
.quiz-progress { display: flex; gap: 4px; margin: 6px 0 18px; }
.quiz-progress i { flex: 1; height: 6px; border-radius: 3px; background: var(--sunken); }
.quiz-progress i.r { background: var(--ok); }
.quiz-progress i.w { background: var(--danger); }
.quiz-progress i.c { background: var(--ink); }
.q-text { font-size: 22px; line-height: 1.3; font-weight: 700; margin: 0 0 18px; }
.options { display: grid; gap: 8px; }
.option { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: center; text-align: left; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 17px; line-height: 1.35; }
.option .key { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--sunken); font-family: var(--font-mono); font-size: 14px; }
.option.right { border-color: var(--ok); background: var(--ok-soft); }
.option.right .key { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.option.wrong .key { background: var(--danger); color: #fff; }
.option[disabled] { cursor: default; }
.explain { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 16px; }
.explain b { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; }
.quiz-foot { position: sticky; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); margin-top: 18px; }
.result { text-align: center; padding: 20px 0; }
.result .big { font-family: var(--font-mono); font-size: 64px; color: var(--ink); line-height: 1; }
.result .big small { font-size: 26px; color: var(--ink-3); }

/* ---------- Mål ---------- */
.goal-group { margin-top: 18px; }
.goal-group > summary { list-style: none; cursor: pointer; }
.goal-group > summary::-webkit-details-marker { display: none; }
.gg-head { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: end; padding: 14px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); }
.gg-head .n { font-family: var(--font-display); font-weight: 700; font-size: 22px; text-transform: uppercase; }
.gg-head .p { font-family: var(--font-mono); font-size: 20px; }
.gg-head .bar { grid-column: 1 / -1; height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.gg-head .bar span { display: block; height: 100%; background: var(--accent); }
.gg-intro { font-size: 15px; color: var(--ink-2); margin: 10px 4px 4px; }
.goal { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.goal-id { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); padding-top: 3px; min-width: 46px; }
.goal-text { font-size: 16px; line-height: 1.4; }
.goal-links { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; }
.goal-links a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-size: 13.5px; line-height: 1.2; }
.goal-links a .status { width: 12px; height: 12px; margin: 0; border-width: 1.5px; }
.goal-links a .status.s2::after { left: 2.5px; top: 0; width: 3px; height: 6px; border-width: 0 1.5px 1.5px 0; }
.check { grid-column: 2; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; color: var(--ink-2); user-select: none; }
.check input { appearance: none; -webkit-appearance: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--line-strong); background: var(--surface-2); display: grid; place-items: center; margin: 0; cursor: pointer; }
.check input:checked { background: var(--ok); border-color: var(--ok); }
.check input:checked::after { content: ''; width: 6px; height: 12px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }

/* ---------- Mig / logbog ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); }
.stat .v { font-family: var(--font-mono); font-size: 30px; line-height: 1.1; }
.stat .l { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 10px; }
.form-row label { font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.input { height: 48px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface-2); padding: 0 12px; font-size: 16px; width: 100%; }
.input:focus { outline: 0; border-color: var(--ink); }
/* iOS Safari giver datofeltet en indbygget mindstebredde og centreret tekst, så det stak ud over kortet. */
input.input[type='date'] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; line-height: 45px; text-align: left; }
input.input[type='date']::-webkit-date-and-time-value { text-align: left; }
.log-month { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin: 18px 0 6px; font-size: 14px; }
.log-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.log-date { text-align: center; font-family: var(--font-mono); line-height: 1.1; padding-top: 2px; }
.log-date b { display: block; font-size: 22px; font-weight: 500; }
.log-date span { font-size: 11px; color: var(--ink-3); text-transform: uppercase; }
.log-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 15; max-height: 260px; overflow: auto; background: var(--surface-2); border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: var(--shadow-card); }
.picker-list button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; cursor: pointer; font-size: 15px; border-bottom: 1px solid var(--line); }
.picker-list button:active { background: var(--sunken); }
/* Trykflade 32x32. De negative marginer æder chippens gap og højre padding, så chippen ser ud som før. */
.tag-x { display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; margin: -3px -11px -3px -8px; padding: 0; border: 0; background: transparent; cursor: pointer; color: var(--ink-3); font-size: 15px; line-height: 1; }
.seg { display: inline-grid; grid-auto-flow: column; border: 1.5px solid var(--line-strong); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 10px 14px; cursor: pointer; font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--bg); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 12px 0; border-bottom: 1px solid var(--line); }

/* ---------- Øv ---------- */
.ex-grid { display: grid; gap: 12px; }
.ex-card { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; padding: 14px; text-decoration: none; }
.ex-card .art { width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; background: #16181b; color: var(--accent); }
.ex-card .art svg { width: 38px; height: 38px; }
.ex-card .t { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.05; text-transform: uppercase; }
.ex-card .s { font-size: 14.5px; color: var(--ink-2); line-height: 1.35; margin-top: 2px; }
.ex-card .dots { display: flex; gap: 4px; margin-top: 6px; }
.ex-card .dots i { width: 18px; height: 5px; border-radius: 2px; background: var(--sunken); }
.ex-card .dots i.on { background: var(--ok); }

/* ---------- Min bog ---------- */
/* Faste farver og ikke tokens: kortet skal være mørkt i begge temaer, ellers lander den gule titel på lys baggrund. */
.book-cover { margin: 18px 0 24px; padding: 28px 20px; border-radius: var(--r-l); background: #16181b; color: #eceae4; position: relative; overflow: hidden; }
.book-cover::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: repeating-linear-gradient(-45deg, #111 0 12px, var(--accent) 12px 24px); }
.book-cover h1 { color: var(--accent); margin: 10px 0 4px; font-size: clamp(40px, 12vw, 64px); }
.book-cover .sub { font-family: var(--font-mono); font-size: 13px; opacity: 0.8; }
.book-chapter { margin-top: 28px; }
.book-chapter > h2 { font-size: 26px; text-transform: uppercase; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin: 0 0 8px; }
.book-entry { padding: 12px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.book-entry h3 { font-size: 19px; text-transform: uppercase; margin: 0 0 4px; }
.book-entry h3 a { text-decoration: none; }
.book-entry .k { color: var(--ink-2); margin: 0 0 6px; }
.book-entry .mine { border-left: 4px solid var(--accent); padding: 6px 12px; background: var(--surface); border-radius: 0 8px 8px 0; white-space: pre-wrap; font-size: 15.5px; }
.book-entry .lv { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

/* ---------- Øvelser ---------- */
.sim { margin-top: 8px; }
.sim-task { padding: 14px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.sim-task h2 { font-size: 22px; margin: 0 0 6px; text-transform: uppercase; }
.sim-task p { margin: 0 0 8px; font-size: 16px; }
.sim-task ul { margin: 0; padding-left: 1.2em; font-size: 15.5px; }
.sim-board { position: relative; border-radius: var(--r-l); background: var(--surface-2); border: 1px solid var(--line); padding: 10px; overflow: hidden; touch-action: manipulation; }
.sim-board svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.sim-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
.wire-colors { display: flex; gap: 8px; }
.wire-colors button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line-strong); cursor: pointer; }
.wire-colors button[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--ink); }
.wire-colors .c-brun { background: #8a5a33; }
.wire-colors .c-sort { background: #1c1c1c; }
.wire-colors .c-graa { background: #8b8f94; }
.wire-colors .c-blaa { background: #1e5bc6; }
.wire-colors .c-gulgron { background: repeating-linear-gradient(45deg, #2e8b3e 0 6px, #f2c200 6px 12px); }
.feedback { margin-top: 12px; border-radius: var(--r-m); padding: 12px 14px; font-size: 16px; }
.feedback.ok { background: var(--ok-soft); border: 1px solid var(--ok); }
.feedback.bad { background: var(--danger-soft); border: 1px solid var(--danger); }
.feedback.info { background: var(--info-soft); border: 1px solid var(--nul); }
.feedback ul { margin: 6px 0 0; padding-left: 1.2em; }
.feedback + .feedback { margin-top: 10px; }
.feedback b.h { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; display: block; }

.level-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(var(--gutter) * -1) 10px; padding: 0 var(--gutter) 4px; scrollbar-width: none; }
.level-tabs button { flex: none; height: 40px; padding: 0 14px; border-radius: 20px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.level-tabs button[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.level-tabs button .ok { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* Tavlebygger */
.tb-rail { position: relative; padding: 14px 6px; }
.tb-rail::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 30px; transform: translateY(-50%); background: var(--rail); border-radius: 3px; }
.tb-modules { position: relative; display: flex; gap: 4px; flex-wrap: wrap; }
.tb-mod { position: relative; width: 58px; min-height: 118px; border-radius: 6px; background: var(--breaker); border: 1.5px solid var(--breaker-edge); box-shadow: var(--breaker-shadow); padding: 5px 3px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-family: var(--font-mono); font-size: 10.5px; text-align: center; line-height: 1.15; }
.tb-mod.w2 { width: 76px; }
.tb-mod.w3 { width: 100px; }
.tb-mod.sel { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent), var(--breaker-shadow); }
.tb-mod .ty { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.tb-mod .sw { width: 20px; height: 30px; border-radius: 4px; background: #1b1d20; position: relative; }
.tb-mod .sw::after { content: ''; position: absolute; left: 2px; right: 2px; top: 2px; height: 13px; border-radius: 3px; background: var(--accent); }
.tb-mod.tripped .sw::after { top: 15px; background: #ddd; }
.tb-mod .lbl { margin-top: auto; font-family: var(--font-display); font-weight: 600; font-size: 11px; text-transform: uppercase; color: var(--ink-2); }
.tb-mod.rcd { background: color-mix(in srgb, var(--accent) 12%, var(--breaker)); }
.tb-mod.main { background: color-mix(in srgb, var(--danger) 10%, var(--breaker)); }
.tb-mod.add { border-style: dashed; background: transparent; box-shadow: none; justify-content: center; color: var(--ink-3); font-size: 26px; }
.tb-mod .under { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); font-size: 9px; background: var(--ink); color: var(--bg); border-radius: 6px; padding: 0 5px; white-space: nowrap; }
.tb-circuits { display: grid; gap: 8px; margin-top: 12px; }
.tb-circuit { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line); }
.tb-circuit .h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; align-items: baseline; }
.tb-circuit .h b { font-family: var(--font-display); font-size: 18px; text-transform: uppercase; }
.tb-circuit .h span { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.tb-circuit .sel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tb-circuit select { height: 44px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface-2); padding: 0 10px; font-size: 15px; width: 100%; }
.tb-circuit.err { border-color: var(--danger); }
.tb-circuit.good { border-color: var(--ok); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 2px solid var(--ink); border-radius: 18px 18px 0 0; padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,0.25); max-width: 760px; margin: 0 auto; animation: up 0.2s ease-out; }
.sheet h3 { margin: 0 0 10px; font-size: 20px; text-transform: uppercase; }
.sheet .opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.sheet .opts button { min-height: 52px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface-2); cursor: pointer; text-align: left; padding: 8px 12px; font-size: 14px; line-height: 1.25; }
.sheet .opts button b { display: block; font-family: var(--font-display); font-size: 16px; text-transform: uppercase; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,0.35); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Kobl lampen */
.lp-term { cursor: pointer; }
.lp-term circle.hit { fill: transparent; }
.lp-term circle.dot { fill: var(--surface-2); stroke: var(--ink); stroke-width: 2; transition: r 0.1s; }
.lp-term.active circle.dot { fill: var(--accent); stroke-width: 3; }
.lp-term text { font-family: var(--font-mono); font-size: 11px; fill: var(--ink); pointer-events: none; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.lp-box { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.lp-box-title { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; pointer-events: none; }
.lp-wire { fill: none; stroke-width: 5; stroke-linecap: round; cursor: pointer; }
.lp-wire.shadow { stroke: rgba(0,0,0,0.18); stroke-width: 7; pointer-events: none; }
.lp-switch { cursor: pointer; }
.lp-lamp-glow { transition: opacity 0.25s; }
.lp-hint { font-size: 14px; color: var(--ink-3); margin: 6px 0 0; min-height: 21px; }
.lp-vippe { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; fill: var(--ink-2); pointer-events: none; }
/* Løsningen som svage, stiplede ledere. Glorien under gør sort synlig i mørk tilstand. Kun visning. */
.lp-ghost { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1 8; opacity: 0.75; pointer-events: none; }
.lp-ghost.halo { stroke: var(--ink); stroke-width: 9; stroke-dasharray: none; opacity: 0.1; }
/* Tip og "Sådan gør du": samme kasse som fejlbeskeden, i blå (info). */
.lp-help p { margin: 6px 0 0; line-height: 1.45; }
.lp-help ol { margin: 6px 0 0; padding-left: 1.4em; }
.lp-help li + li { margin-top: 3px; }
.lp-help + .sim-toolbar { margin-top: 10px; }
.lp-ghost-note { font-size: 14px; color: var(--ink-3); }
/* Når fejlbeskeden eller hjælpen rulles frem, skal den stå over bundmenuen og under topbaren. */
#fb, .lp-help { scroll-margin: calc(72px + env(safe-area-inset-top)) 0 calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }

/* Forsøgsbordet */
.lab-safe { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); border-left: 3px solid var(--warn); padding-left: 8px; }
.lab-goals { padding: 12px 14px; border-radius: var(--r-l); background: var(--surface); border: 2px solid var(--accent); margin-bottom: 4px; }
.lab-goals h3 { margin: 0 0 8px; font-size: 18px; text-transform: uppercase; letter-spacing: 0.04em; }
.lab-goals ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: maal; }
.lab-goal { display: grid; grid-template-columns: 26px 1fr; gap: 0 8px; align-items: start; font-size: 15.5px; line-height: 1.35; counter-increment: maal; }
.lab-goal .box { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line-strong); background: var(--surface-2); display: grid; place-items: center; font: 600 12px var(--font-mono); color: var(--ink-3); }
.lab-goal .box::before { content: counter(maal); }
.lab-goal.ok .box { background: var(--ok); border-color: var(--ok); }
.lab-goal.ok .box::before { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-1px) rotate(45deg); }
.lab-goal.ok .txt { color: var(--ink-2); }
.lab-goal.ny .box { animation: lab-ny 0.6s ease-out; }
@keyframes lab-ny { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: none; } }
.lab-felt { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; }
.lab-felt label { font-family: var(--font-mono); font-size: 14px; }
.lab-felt-in { display: inline-flex; align-items: center; gap: 6px; }
.lab-felt .input { width: 7.5em; height: 40px; }
.lab-felt .enhed { font-family: var(--font-mono); font-size: 14px; color: var(--ink-2); }
.lab-felt-msg { flex-basis: 100%; margin: 0; font-size: 14.5px; min-height: 0; }
.lab-felt-msg:empty { display: none; }
.lab-felt-msg.ok { color: var(--ok); font-weight: 600; }
.lab-felt-msg.bad { color: var(--danger); }
.wire-colors .c-lab-roed { background: #d23a2f; }
.wire-colors .c-lab-sort { background: #1c1c1c; }
.wire-colors .c-lab-blaa { background: #1e5bc6; }
.wire-colors .c-lab-gul { background: #e0a800; }
.lab-board { padding: 6px; }
.lab-kilde { display: flex; align-items: center; gap: 10px; margin: 10px 0 0; flex-wrap: wrap; }
.lab-kilde .lbl { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 15px; margin-right: auto; }
.lab-u { min-width: 52px; min-height: 48px; font-size: 26px; line-height: 1; padding: 0; }
.lab-u-vis { min-width: 64px; text-align: center; font: 600 22px var(--font-mono); }
.lab-readout { margin: 8px 0 0; font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.lab-readout:empty { display: none; }
.feedback.warn { background: var(--accent-soft); border: 1px solid var(--warn); }
.lab-hvad p { margin: 6px 0 0; line-height: 1.45; }
.lab-hvad-act { margin-top: 10px !important; }
#lab-hvad .feedback:first-child { margin-top: 12px; }
#lab-hvad, #lab-fb, #lab-help .lp-help { scroll-margin: calc(72px + env(safe-area-inset-top)) 0 calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); }
.lab-sheet { max-height: 80vh; overflow-y: auto; }
.lab-sheet .lab-opts { grid-template-columns: repeat(3, 1fr); }
.lab-sheet .lab-opts button { min-height: 46px; text-align: center; font-family: var(--font-mono); font-size: 15px; }
.lab-sheet .lab-opts button[aria-pressed='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lab-sheet-note { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); }
/* Tegningen */
.lab-box.kan { cursor: pointer; }
.lab-box.kan:hover { stroke: var(--ink-3); }
.lab-komp[data-k] { cursor: pointer; }
.lab-title { font-size: 12.5px; letter-spacing: 0.03em; }
.lab-ben { fill: none; stroke: var(--ink-3); stroke-width: 2; pointer-events: none; }
.lab-lcd { fill: #c8d5b0; stroke: #4b5a3a; stroke-width: 1.5; }
.lab-lcd.kort { fill: #f3c1b6; stroke: var(--danger); }
.lab-lcd-txt { font: 600 18px var(--font-mono); fill: #1b2414; pointer-events: none; }
.lab-lcd-txt.small { font-size: 13.5px; }
.lab-lcd-txt.fejl { fill: #b3200e; }
.lab-on-dark { fill: #fff; }
.lab-batteri { fill: #2b2f36; stroke: #111; stroke-width: 1.5; }
.lab-batteri-top { fill: #c8321e; }
.lab-sokkel, .lab-haette { fill: #a3a7ad; stroke: #6c7076; stroke-width: 1; }
.lab-glas { fill: var(--sunken); stroke: var(--ink-2); stroke-width: 2; }
.lab-glas.ude { fill: none; stroke-dasharray: 3 4; stroke-width: 1.5; }
.lab-glas.brudt { fill: #5f6368; }
.lab-glas.sod { fill: #3a3633; }
.lab-traad { fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linejoin: round; }
.lab-traad.gloeder { stroke: #ff8a00; }
.lab-traad.brudt { stroke: #222; }
.lab-revne { fill: none; stroke: #ddd; stroke-width: 1.2; }
.lab-modstand { stroke: #6c5a3a; stroke-width: 1.2; }
.lab-led { fill: #6e1f1a; stroke: #3a0d0a; stroke-width: 1.5; }
.lab-led.brudt { fill: #111; }
.lab-motor { stroke: var(--ink-2); stroke-width: 2; }
.lab-rotor { fill: #e8eaed; stroke: #444; stroke-width: 1; }
.lab-rotor.spin { animation: lab-spin 0.4s linear infinite; }
.lab-rotor.spin.venstre { animation-direction: reverse; }
@keyframes lab-spin { to { transform: rotate(360deg); } }
.lab-pil { fill: none; stroke: var(--ok); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.lab-vaerdi { font-family: var(--font-mono); font-size: 11px; fill: var(--ink-2); pointer-events: none; }
.lab-glow { pointer-events: none; }
.lab-wire-hit { fill: none; stroke: transparent; stroke-width: 14; stroke-linecap: round; cursor: pointer; }
.lab-hot { fill: none; stroke: #ff6a00; stroke-width: 12; stroke-linecap: round; opacity: 0.45; pointer-events: none; animation: lab-hot 0.8s ease-in-out infinite alternate; }
@keyframes lab-hot { to { opacity: 0.85; } }
/* Pop og røg vises kun med animation. Uden bevægelse skifter tilstanden bare. */
.lab-pop { opacity: 0; fill: #fff6c7; stroke: #ff9a00; stroke-width: 3; stroke-linecap: round; pointer-events: none; animation: lab-pop 0.5s ease-out; }
@keyframes lab-pop { 0% { opacity: 1; transform: scale(0.4); } 100% { opacity: 0; transform: scale(1.5); } }
.lab-smoke circle { transform-box: fill-box; transform-origin: center; fill: #9a9a9a; opacity: 0; pointer-events: none; animation: lab-smoke 1.6s ease-out 3 both; }
.lab-smoke.altid circle { animation-iteration-count: infinite; }
@keyframes lab-smoke { 0% { opacity: 0.7; transform: translateY(0) scale(0.6); } 100% { opacity: 0; transform: translateY(-26px) scale(1.6); } }
@media (prefers-reduced-motion: reduce) {
  .lab-smoke.altid circle { opacity: 0.5; }
}

/* Kobl motoren */
.m-plade { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--r-m); background: linear-gradient(160deg, #e9ebee, #c9cdd3); color: #16181b; border: 1px solid #9aa0a8; box-shadow: 0 1px 0 #fff inset; }
.m-plade-h { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; color: #4b5059; margin-bottom: 4px; }
.m-plade ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font: 500 15px var(--font-mono); }
.m-diagram { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #8b8f94; font-size: 14.5px; line-height: 1.4; font-family: var(--font-body); }
.m-diagram p { margin: 0 0 4px; }
.m-valg { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.m-valg + .lab-felt-msg { grid-column: 2; margin-top: 4px; }
.m-board { padding: 6px; }
.m-panel { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 0; }
.m-panel .m-q1 { flex: 1 1 100%; min-height: 48px; }
.m-panel .m-ir { flex: 1 1 100%; margin: 0; }
.m-panel .m-last { flex: 1 1 100%; }
.m-panel .m-last[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--warn); }
.m-panel #m-f2 { flex: 1 1 100%; }
.m-panel #m-f2[aria-pressed='true'] { border-color: var(--danger); color: var(--danger); }
.m-knapper { flex: 1 1 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.m-tryk { min-height: 64px; border-radius: 14px; border: 2px solid var(--ink); background: var(--surface-2); color: var(--ink); font: 700 16px var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; display: grid; place-items: center; gap: 0; padding: 6px; box-shadow: 0 4px 0 var(--line-strong); }
.m-tryk span { font: 500 11px var(--font-body); text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.m-tryk.stop { background: #c8321e; color: #fff; border-color: #7d1d10; }
.m-tryk.stop span { color: #ffd9d2; }
.m-tryk.start { background: #23823a; color: #fff; border-color: #134d22; }
.m-tryk.start span { color: #d4f1db; }
.m-tryk[aria-pressed='true'] { transform: translateY(3px); box-shadow: 0 1px 0 var(--line-strong); filter: brightness(0.9); }
/* Tegningen */
.m-sub { font-family: var(--font-mono); font-size: 12px; fill: var(--ink-2); }
.m-badge { stroke: var(--line-strong); stroke-width: 1; fill: var(--sunken); }
.m-badge.til { fill: var(--ok); stroke: var(--ok); }
.m-badge.bad { fill: var(--danger); stroke: var(--danger); }
.m-badge-t { font: 700 14px var(--font-display); letter-spacing: 0.08em; fill: var(--ink-2); }
.m-badge-t.til, .m-badge-t.bad { fill: #fff; }
.m-plade-bg { fill: var(--sunken); stroke: var(--line); }
.m-bro { fill: none; stroke: #9c7a43; stroke-width: 10; stroke-linecap: round; pointer-events: none; }
.m-bro-glans { fill: none; stroke: #e3c48d; stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.m-vikling { fill: none; stroke: var(--ink-2); stroke-width: 2; pointer-events: none; }
.m-kond { fill: none; stroke: var(--ink); stroke-width: 3; pointer-events: none; }
.m-kt { font-family: var(--font-mono); font-size: 9.5px; fill: var(--ink-3); pointer-events: none; }
.m-kt.big { font-size: 11.5px; fill: var(--ink-2); }
.m-dev { font: 700 17px var(--font-display); letter-spacing: 0.04em; fill: var(--ink); pointer-events: none; }
.m-ben { fill: none; stroke: var(--ink-3); stroke-width: 2; pointer-events: none; }
.m-kontakt { fill: none; stroke: var(--ink-2); stroke-width: 2.5; stroke-linecap: round; pointer-events: none; }
.m-kontakt.slut { stroke: var(--ok); }
.m-piv { fill: var(--ink-2); }
.m-spole { fill: var(--surface-2); stroke: var(--ink); stroke-width: 2; }
.m-spole.traek { fill: var(--accent); }
.m-status { font: 600 13px var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; fill: var(--ink-2); }
.m-status.bad { fill: var(--danger); }
.m-hus { stroke: #4b5059; stroke-width: 1.5; }
.m-ribbe { stroke: rgba(0, 0, 0, 0.22); stroke-width: 2; pointer-events: none; }
.m-motor-t { font: 700 18px var(--font-display); fill: #fff; paint-order: stroke; stroke: rgba(0, 0, 0, 0.35); stroke-width: 3px; pointer-events: none; }
.m-aksel { fill: #c9ccd1; stroke: #6c7076; }
.m-skive { fill: var(--surface-2); stroke: var(--ink-2); stroke-width: 2; }
.m-pumpe { fill: none; stroke: var(--ink-3); stroke-width: 6; }
.m-pumpepil { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 5 5; }
.m-pumpepil.fast { stroke-dasharray: none; }
.m-varme-bg { fill: var(--sunken); stroke: var(--line-strong); }
.m-varme-streg { stroke: var(--danger); stroke-width: 2; }

/* ---------- Animation ved indlæsning ---------- */
.reveal > * { animation: rise 0.45s cubic-bezier(.2,.8,.2,1) both; }
.reveal > *:nth-child(2) { animation-delay: 0.05s; }
.reveal > *:nth-child(3) { animation-delay: 0.1s; }
.reveal > *:nth-child(4) { animation-delay: 0.15s; }
.reveal > *:nth-child(5) { animation-delay: 0.2s; }
.reveal > *:nth-child(n+6) { animation-delay: 0.25s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Centreres med auto-margener og ikke transform, så animationen rise (der slutter i transform: none) ikke flytter den. */
.toast { position: fixed; left: 0; right: 0; margin-inline: auto; width: fit-content; max-width: calc(100vw - 32px); bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); animation: rise 0.2s both; }

/* ---------- Udskrift af Min bog ---------- */
@media print {
  .nav, .topbar, .no-print, .toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .app { max-width: none; padding: 0; }
  .book-cover { background: #fff; color: #000; border: 2px solid #000; }
  .book-cover h1 { color: #000; }
  a { text-decoration: none; }
}
.goal.focus { background: var(--accent-soft); border-radius: 10px; }

/* Mørk tilstand: sort leder og sort farveknap skal kunne ses mod den mørke baggrund. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='lys']) .lp-wire.shadow { stroke: rgba(255, 255, 255, 0.28); }
  :root:not([data-theme='lys']) .wire-colors .c-sort { box-shadow: 0 0 0 1.5px var(--ink-3); }
}
:root[data-theme='mork'] .lp-wire.shadow { stroke: rgba(255, 255, 255, 0.28); }
:root[data-theme='mork'] .wire-colors .c-sort { box-shadow: 0 0 0 1.5px var(--ink-3); }

/* ---------- Login og admin ---------- */
.auth-screen .nav { display: none; }
.auth-screen .app { padding-bottom: 32px; }
.auth { max-width: 460px; margin: 0 auto; }
.auth-cover { margin-top: 8px; }
.auth-cover h1 { font-size: clamp(36px, 11vw, 52px); }
.form-error { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); border: 1px solid var(--danger); font-size: 15px; }
select.input { appearance: auto; }
.section-title { font-size: 22px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.invite-result { border: 2px solid var(--accent); margin-bottom: 14px; }
.temp-code { font-size: clamp(22px, 7vw, 30px); letter-spacing: 0.04em; margin: 8px 0 6px; padding: 12px; text-align: center; border-radius: 12px; background: var(--sunken); user-select: all; overflow-wrap: anywhere; }
.user-list { display: grid; gap: 10px; }
.user-card { display: grid; gap: 4px; }
.user-card + .user-card { margin-top: 0; }
.uc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 18px; }
.uc-status { font-size: 14px; color: var(--ink-2); }
.uc-status.bad { color: var(--danger); }
.uc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.audit li { font-size: 14.5px; line-height: 1.4; padding: 9px 0; }
.audit .mono { font-size: 12px; margin-right: 4px; }
.auth-screen .sync { display: none; }
