/* Holdleder-træning — playful learning app in the spirit of Duolingo.
   Layout: one phone-width column; top bar with streak and points; bottom tab bar;
   lessons run full screen with a progress bar and a feedback sheet. */
/* Fonts ship with the app (SIL Open Font License) so it works offline. */
@font-face { font-family: "Fredoka"; font-weight: 300 700; font-display: swap; src: url("../fonts/fredoka.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 200 1000; font-display: swap; src: url("../fonts/nunito.woff2") format("woff2"); }
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --sunk: #f3f5f7;
  --ink: #2b3a41;
  --muted: #7a8a92;
  --line: #e2e7ea;
  --fire: #e8453c;
  --fire-dark: #b9302a;
  --good: #4cb51a;
  --good-dark: #3a8f12;
  --good-soft: #dcf7c6;
  --bad: #e8453c;
  --bad-soft: #ffe1df;
  --gold: #f4b400;
  --gold-dark: #c98f00;
  --hose-b: #e8453c;
  --hose-c: #f08a24;
  --icon-cut: #ffffff;
  --sel: #d9efff;
  --sel-line: #2f9ae0;
  --f-display: "Fredoka", "Nunito", "Arial Rounded MT Bold", system-ui, sans-serif;
  --f-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --r: 16px;
  --shadow-line: #d5dbdf;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131f24; --surface: #18262c; --sunk: #1f3038; --ink: #e8eef1; --muted: #8fa3ad; --line: #2c3f48;
    --good-soft: #1d3a14; --bad-soft: #43201e; --sel: #12324a; --sel-line: #4fb3f5; --shadow-line: #0c1518; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131f24; --surface: #18262c; --sunk: #1f3038; --ink: #e8eef1; --muted: #8fa3ad; --line: #2c3f48;
  --good-soft: #1d3a14; --bad-soft: #43201e; --sel: #12324a; --sel-line: #4fb3f5; --shadow-line: #0c1518; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 600 17px/1.45 var(--f-body); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 3px solid var(--sel-line); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; margin: 0; text-wrap: balance; }
.ic { display: block; flex: none; }

.shell { max-width: 520px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); border-bottom: 2px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; padding-block: 10px; }
.topbar .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font: 600 19px/1 var(--f-display); }
.stat { display: flex; align-items: center; gap: 5px; font: 700 17px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat.streak { color: #ff8a00; }
.stat.streak.off { color: var(--muted); }
.stat.xp { color: var(--gold); }

main { flex: 1; padding-block: 18px 110px; display: flex; flex-direction: column; gap: 18px; }

/* Bottom tabs */
.tabbar { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 2px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabbar nav { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px 8px; gap: 6px; }
.tabbar button { border-radius: 12px; padding: 7px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 800; color: var(--muted); border: 2px solid transparent; }
.tabbar button[aria-current="page"] { color: var(--sel-line); background: var(--sel); border-color: var(--sel-line); }

/* Chunky press buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; border-radius: var(--r); padding: 14px 18px;
  font: 700 17px/1.1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; background: var(--good); color: #fff;
  box-shadow: 0 4px 0 var(--good-dark); transition: transform .06s, box-shadow .06s; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--good-dark); }
.btn.fire { background: var(--fire); box-shadow: 0 4px 0 var(--fire-dark); }
.btn.fire:active { box-shadow: 0 0 0 var(--fire-dark); }
.btn.plain { background: var(--surface); color: var(--sel-line); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.plain:active { box-shadow: 0 0 0 var(--line); }
.btn:disabled { background: var(--sunk); color: var(--muted); box-shadow: 0 4px 0 var(--line); cursor: default; transform: none; }
.btn.small { width: auto; padding: 10px 14px; font-size: 14px; }

/* Home */
.hello { display: flex; align-items: center; gap: 14px; }
.hello .bubble { position: relative; background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px; flex: 1; min-width: 0; }
.hello .bubble::before { content: ""; position: absolute; left: -10px; top: 26px; width: 16px; height: 16px; background: var(--surface); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.hello .bubble h2 { font-size: 22px; line-height: 1.15; }
.hello .bubble p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.goal { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 14px; }
.goal .ring { --p: 0; width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--sunk) 0); }
.goal .ring span { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--gold); }
.goal b { display: block; font: 600 19px/1.2 var(--f-display); }
.goal small { color: var(--muted); font-size: 14px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week div { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: var(--muted); }
.week i { width: 30px; height: 30px; border-radius: 50%; background: var(--sunk); border: 2px solid var(--line); display: grid; place-items: center; color: #fff; }
.week .done i { background: #ff8a00; border-color: #ff8a00; }
.week .today i { border-color: #ff8a00; }
.section-title { font: 600 21px/1.1 var(--f-display); margin-top: 4px; }
.fag-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fag { --c: var(--fire); --cd: var(--fire-dark); text-align: left; border-radius: var(--r); padding: 14px; background: var(--surface); border: 2px solid var(--line);
  box-shadow: 0 4px 0 var(--line); display: flex; flex-direction: column; gap: 10px; min-height: 150px; min-width: 0; transition: transform .06s, box-shadow .06s; }
.fag:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line); }
.fag .badge { width: 52px; height: 52px; border-radius: 16px; background: var(--c); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 0 var(--cd); }
.fag b { font: 600 19px/1.1 var(--f-display); }
.fag .prog { margin-top: auto; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.meter { height: 10px; border-radius: 6px; background: var(--sunk); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--good)); }

/* Path */
.unit { --c: var(--fire); --cd: var(--fire-dark); border-radius: var(--r); background: var(--c); color: #fff; padding: 14px 16px; box-shadow: 0 4px 0 var(--cd); display: flex; flex-direction: column; gap: 2px; }
.unit small { font: 800 13px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.unit h2 { font-size: 22px; }
.path { display: flex; flex-direction: column; align-items: center; gap: 30px; padding: 14px 0 22px; }
.node { --c: var(--fire); --cd: var(--fire-dark); position: relative; width: 74px; height: 68px; border-radius: 50%; display: grid; place-items: center;
  background: var(--sunk); color: var(--muted); box-shadow: 0 6px 0 var(--shadow-line); transition: transform .06s, box-shadow .06s; }
.node:active { transform: translateY(6px); box-shadow: 0 0 0 var(--shadow-line); }
.node.done { background: var(--c); color: #fff; box-shadow: 0 6px 0 var(--cd); }
.node.done:active { box-shadow: 0 0 0 var(--cd); }
.node.next { background: var(--c); color: #fff; box-shadow: 0 6px 0 var(--cd), 0 0 0 7px var(--bg), 0 0 0 11px color-mix(in srgb, var(--c) 35%, transparent); }
.node .tip { position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--surface); color: var(--c);
  border: 2px solid var(--line); border-radius: 12px; padding: 7px 12px; font: 800 14px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; }
.node .tip::after { content: ""; position: absolute; left: 50%; top: 100%; width: 12px; height: 12px; background: var(--surface); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translate(-50%, -6px) rotate(45deg); }
.node-wrap .stars { display: flex; gap: 1px; color: var(--gold); margin-top: 10px; }
.node-wrap .stars .off { color: var(--line); }
.node-label { font-size: 13px; color: var(--muted); text-align: center; max-width: 150px; line-height: 1.2; margin-top: 8px; }
.path .node-wrap:has(.next) { margin-top: 26px; }
.node-wrap { display: flex; flex-direction: column; align-items: center; }
@media (prefers-reduced-motion: no-preference) { .node.next .tip { animation: bob 1.4s ease-in-out infinite; } @keyframes bob { 50% { transform: translate(-50%, -4px); } } }

/* Lesson */
.lesson { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.lesson .inner { max-width: 560px; width: 100%; margin: 0 auto; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.lesson-top { display: flex; align-items: center; gap: 14px; padding-block: 14px; }
.lesson-top .x { color: var(--muted); padding: 4px; }
.progress { flex: 1; height: 16px; border-radius: 9px; background: var(--sunk); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 9px; background: var(--good); transition: width .3s; box-shadow: inset 0 -5px 0 rgba(0,0,0,.08); }
.task { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-block: 6px 20px; }
.task .kind { font: 800 13px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--sel-line); display: flex; align-items: center; gap: 8px; }
.task h2 { font-size: 24px; line-height: 1.2; }
.task .pic { background: var(--sunk); border: 2px solid var(--line); border-radius: var(--r); padding: 8px; overflow-x: auto; }
.task .pic svg { display: block; width: 100%; min-width: 300px; height: auto; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; border: 2px solid var(--line); border-radius: 14px; padding: 13px 15px; background: var(--surface); box-shadow: 0 4px 0 var(--line);
  display: flex; gap: 12px; align-items: center; line-height: 1.3; transition: transform .06s, box-shadow .06s; }
.opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.opt .k { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; color: var(--muted); }
.opt[aria-pressed="true"] { border-color: var(--sel-line); background: var(--sel); box-shadow: 0 4px 0 var(--sel-line); }
.opt[aria-pressed="true"] .k { border-color: var(--sel-line); color: var(--sel-line); }
.opt.right { border-color: var(--good); background: var(--good-soft); box-shadow: 0 4px 0 var(--good); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 4px 0 var(--bad); }
.opts.locked .opt { pointer-events: none; }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf .opt { justify-content: center; font: 600 20px/1 var(--f-display); padding: 22px 10px; }
.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.roles .opt { justify-content: center; text-align: center; }
.statement { background: var(--sunk); border-radius: var(--r); padding: 16px; font-size: 19px; line-height: 1.35; }
.bank, .built { display: flex; flex-direction: column; gap: 8px; }
.built { min-height: 64px; border: 2px dashed var(--line); border-radius: var(--r); padding: 8px; }
.built:empty::before { content: "Tryk på trinnene i rækkefølge"; color: var(--muted); padding: 10px; font-size: 15px; }
.tile { text-align: left; border: 2px solid var(--line); border-radius: 12px; padding: 11px 13px; background: var(--surface); box-shadow: 0 3px 0 var(--line); display: flex; gap: 10px; align-items: flex-start; }
.tile .n { font: 600 18px/1.2 var(--f-display); color: var(--sel-line); min-width: 16px; }
.tile.used { display: none; }
.story { background: var(--sunk); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.story .tag { font: 800 12px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--fire); }
.story p { margin: 0; }
.say { display: flex; gap: 12px; align-items: flex-end; }
.say .bubble { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; flex: 1; min-width: 0; }

.lesson-foot { border-top: 2px solid var(--line); padding-block: 16px; }
.sheet { padding-block: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.sheet.good { background: var(--good-soft); }
.sheet.bad { background: var(--bad-soft); }
.sheet h3 { font-size: 23px; display: flex; align-items: center; gap: 10px; }
.sheet.good h3 { color: var(--good-dark); }
.sheet.bad h3 { color: var(--bad); }
.sheet p { margin: 0; font-size: 16px; }
.sheet .src { font-size: 13px; color: var(--muted); font-weight: 700; }
.sheet .btn.fire { background: var(--bad); }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .18s ease-out; } @keyframes up { from { transform: translateY(16px); opacity: .6; } } }
.draft { display: inline-block; font: 800 11px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: #fff; background: #f08a24; border-radius: 6px; padding: 4px 6px; }

/* Lesson done */
.done-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding-block: 20px; }
.done-screen h2 { font-size: 30px; color: var(--gold); }
.big-stars { display: flex; gap: 6px; color: var(--gold); }
.big-stars .off { color: var(--line); }
.tiles3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.tiles3 div { border: 2px solid var(--c, var(--gold)); border-radius: 14px; overflow: hidden; }
.tiles3 small { display: block; background: var(--c, var(--gold)); color: #fff; font: 800 12px/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; padding: 6px 4px; }
.tiles3 b { display: block; font: 600 24px/1 var(--f-display); padding: 12px 4px; color: var(--c, var(--gold)); font-variant-numeric: tabular-nums; }

/* Cards and lists */
.panel { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { font-size: 22px; }
.panel p { margin: 0; color: var(--muted); }
.panel .row { display: flex; gap: 12px; align-items: center; }
.panel .row > div { flex: 1; min-width: 0; }
.list { display: flex; flex-direction: column; gap: 10px; }
.li { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
.li > div { flex: 1; min-width: 0; }
.li small { display: block; color: var(--muted); font-size: 14px; }
.pill { font: 800 13px/1 var(--f-body); padding: 6px 9px; border-radius: 99px; background: var(--sunk); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good-dark); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.gold { background: color-mix(in srgb, var(--gold) 20%, transparent); color: var(--gold-dark); }
.c-points { display: flex; flex-direction: column; gap: 8px; }
.score-big { font: 600 54px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.examcard ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.examcard h3 { font-size: 19px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.node.next + .node-label { margin-top: 18px; }

/* Training: three steps per topic */
.drill-topic { gap: 12px; }
.drill-topic small { display: block; font-size: 14px; }
.badge-s { width: 42px; height: 42px; border-radius: 12px; background: var(--fire); color: #fff; display: grid; place-items: center; flex: none; }
.steps3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.step { border: 2px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 0 var(--line); padding: 9px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; min-width: 0; transition: transform .06s, box-shadow .06s; }
.step:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.step b { width: 26px; height: 26px; border-radius: 50%; background: var(--sel-line); color: #fff; display: grid; place-items: center; font: 600 15px/1 var(--f-display); }
.step span { font-size: 14px; font-weight: 800; line-height: 1.2; margin-top: 3px; }
.step small { font-size: 12px; color: var(--muted); line-height: 1.2; }
.facit, .why, .reflect, .quote, .mine { border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.facit small, .why small, .reflect small, .quote small, .mine small { font: 800 12px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; }
.facit { background: var(--good-soft); }
.facit small { color: var(--good-dark); }
.facit ul, .role ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.why { background: var(--sel); }
.why small { color: var(--sel-line); }
.reflect { background: var(--sunk); border: 2px dashed var(--line); }
.reflect small { color: #7a5af8; }
.quote { background: var(--sunk); border-left: 5px solid var(--fire); border-radius: 8px; font-style: italic; }
.quote small { color: var(--fire); font-style: normal; }
.mine { background: var(--sunk); }
.mine small { color: var(--muted); }
.roles-list { display: flex; flex-direction: column; gap: 10px; }
.role { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.answer { width: 100%; min-height: 110px; font: 600 17px/1.4 var(--f-body); color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 12px; resize: vertical; }
.answer:focus { outline: none; border-color: var(--sel-line); }
.score-row { font-size: 15px; color: var(--muted); }
.score-row b { font: 600 34px/1 var(--f-display); color: var(--ink); margin-right: 4px; }
.src-line { font-size: 13px; color: var(--muted); font-weight: 700; }
/* Long tasks scroll; nothing inside may shrink (a drawing with overflow-x collapsed to a line). */
.task > * { flex-shrink: 0; }
