:root {
  --bg: oklch(98.4% 0.006 85);
  --surface: oklch(99.6% 0.003 85);
  --surface-2: oklch(95.6% 0.009 85);
  --border: oklch(89.5% 0.01 85);
  --border-strong: oklch(80% 0.012 85);
  --text: oklch(22% 0.01 260);
  --text-2: oklch(44% 0.012 260);
  --text-3: oklch(54% 0.01 260);
  --accent: oklch(44% 0.13 262);
  --accent-text: oklch(99% 0 0);
  --form: oklch(62% 0.13 22);          /* svarsblankettens tryckfärg */
  --form-soft: oklch(93% 0.035 22);
  --right: oklch(50% 0.11 150);
  --right-soft: oklch(94.5% 0.04 150);
  --wrong: oklch(52% 0.15 27);
  --wrong-soft: oklch(94.5% 0.035 27);
  --radius: 8px;
  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(18.5% 0.008 260); --surface: oklch(21.5% 0.009 260); --surface-2: oklch(25% 0.01 260);
    --border: oklch(30% 0.01 260); --border-strong: oklch(38% 0.012 260);
    --text: oklch(93% 0.006 85); --text-2: oklch(76% 0.01 85); --text-3: oklch(64% 0.01 85);
    --accent: oklch(74% 0.1 262); --accent-text: oklch(18% 0.02 262);
    --form: oklch(70% 0.11 22); --form-soft: oklch(30% 0.04 22);
    --right: oklch(76% 0.11 150); --right-soft: oklch(29% 0.045 150);
    --wrong: oklch(73% 0.12 27); --wrong-soft: oklch(30% 0.05 27);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: oklch(18.5% 0.008 260); --surface: oklch(21.5% 0.009 260); --surface-2: oklch(25% 0.01 260);
  --border: oklch(30% 0.01 260); --border-strong: oklch(38% 0.012 260);
  --text: oklch(93% 0.006 85); --text-2: oklch(76% 0.01 85); --text-3: oklch(64% 0.01 85);
  --accent: oklch(74% 0.1 262); --accent-text: oklch(18% 0.02 262);
  --form: oklch(70% 0.11 22); --form-soft: oklch(30% 0.04 22);
  --right: oklch(76% 0.11 150); --right-soft: oklch(29% 0.045 150);
  --wrong: oklch(73% 0.12 27); --wrong-soft: oklch(30% 0.05 27);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* Topp */
.top {
  display: flex; align-items: center; gap: 24px;
  max-width: 1040px; width: 100%; margin: 0 auto; padding: 18px 24px;
}
.brand {
  font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); text-decoration: none;
}
.top nav { display: flex; gap: 4px; margin-left: auto; }
.top nav a {
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 8px 12px; border-radius: var(--radius); transition: background .15s ease-out, color .15s ease-out;
}
.top nav a:hover { background: var(--surface-2); color: var(--text); }
.top nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius);
  border: 1px solid var(--border); background: transparent; color: var(--text-2); cursor: pointer;
}
.theme:hover { color: var(--text); background: var(--surface-2); }

main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 8px 24px 64px; outline: none; }
.foot {
  max-width: 1040px; width: 100%; margin: 0 auto; padding: 24px; color: var(--text-3); font-size: 13px;
  border-top: 1px solid var(--border);
}

/* Knappar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--radius);
  font: 500 15px/1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: background .15s ease-out, border-color .15s ease-out, transform .1s ease-out;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.quiet:hover { color: var(--text); background: var(--surface-2); }
.kbd {
  font-size: 12px; color: inherit; opacity: .7; border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px;
}

/* Hem */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: end; padding: 40px 0 48px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(40px, 6vw, 64px);
  line-height: 1.04; letter-spacing: -0.03em;
}
.hero h1 em { font-style: italic; color: var(--form); }
.hero p { color: var(--text-2); font-size: 18px; max-width: 46ch; margin: 20px 0 28px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Svarsblanketten som illustration */
.sheet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; color: var(--form);
  background-image: repeating-linear-gradient(to bottom, transparent 0 39px, var(--form-soft) 39px 40px);
  background-position: 0 52px;
}
.sheet-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: .02em; margin-bottom: 12px; }
.sheet-row { display: flex; align-items: center; gap: 10px; height: 40px; }
.sheet-row .n { width: 22px; font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sheet-row span.b {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--form);
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
}
.sheet-row span.b.fill { background: var(--text); border-color: var(--text); color: transparent; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat { padding: 20px 20px 20px 0; }
.stat + .stat { padding-left: 20px; border-left: 1px solid var(--border); }
.stat b { display: block; font-family: var(--font-display); font-size: 36px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { color: var(--text-2); font-size: 14px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; display: flex; margin-top: 28px; }
.bar i { display: block; height: 100%; }
.bar-legend { display: flex; gap: 20px; font-size: 13px; color: var(--text-2); margin-top: 10px; flex-wrap: wrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding: 56px 0 8px; }
.split h2 { font-family: var(--font-display); font-weight: 500; font-size: 28px; letter-spacing: -0.02em; margin-bottom: 12px; }
.split p { color: var(--text-2); margin: 0 0 12px; max-width: 60ch; }
.tips { margin: 0; padding: 0; list-style: none; }
.tips li { padding: 12px 0; border-top: 1px solid var(--border); color: var(--text-2); }
.tips li b { color: var(--text); font-weight: 600; }

/* Filter */
.filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter label { font-size: 14px; color: var(--text-2); margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.seg button {
  font: 500 14px var(--font-body); border: 0; background: transparent; color: var(--text-2);
  padding: 0 14px; min-height: 38px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button:hover { background: var(--surface-2); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* Fråga */
.quiz { max-width: 640px; margin: 24px auto 0; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--text-3); font-size: 14px; margin-bottom: 8px; }
.progress { height: 3px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-bottom: 36px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .2s ease-out; }
.word {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(40px, 9vw, 60px);
  letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 6px; overflow-wrap: anywhere;
}
.word-sub { color: var(--text-3); font-size: 14px; margin-bottom: 28px; }
.opts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.opt {
  display: flex; align-items: center; gap: 16px; width: 100%; min-height: 56px; padding: 10px 8px;
  background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--text);
  font: 400 18px/1.35 var(--font-body); text-align: left; cursor: pointer;
  transition: background .15s ease-out;
}
.opt:hover:not(:disabled) { background: var(--surface-2); }
.opt:disabled { cursor: default; }
.bubble {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--form);
  color: var(--form); display: grid; place-items: center; font-size: 13px; font-weight: 600;
  transition: background .15s ease-out, color .15s ease-out;
}
.opt:hover:not(:disabled) .bubble { background: var(--form-soft); }
.opt.picked .bubble { background: var(--text); border-color: var(--text); color: var(--bg); }
.opt.right { background: var(--right-soft); }
.opt.right .bubble { background: var(--right); border-color: var(--right); color: var(--surface); }
.opt.wrong { background: var(--wrong-soft); }
.opt.wrong .bubble { background: var(--wrong); border-color: var(--wrong); color: var(--surface); }
.opt.dim { color: var(--text-3); }
.feedback { margin-top: 24px; min-height: 96px; }
.feedback p { margin: 0 0 16px; font-size: 17px; }
.feedback .verdict { font-weight: 600; }
.feedback .verdict.ok { color: var(--right); }
.feedback .verdict.no { color: var(--wrong); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--text-3); font-size: 13px; margin-top: 28px; }

/* Provpass */
.timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.timer.low { color: var(--wrong); }
.prov-start { max-width: 640px; padding: 40px 0; }
.prov-start h1, .page-head h1 { font-family: var(--font-display); font-weight: 500; font-size: 44px; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 12px; }
.prov-start p, .page-head p { color: var(--text-2); max-width: 58ch; }
.choice { display: grid; gap: 12px; margin: 28px 0; }
.choice button {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; text-align: left;
  padding: 18px 20px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: 500 17px var(--font-body); cursor: pointer;
  transition: border-color .15s ease-out, background .15s ease-out;
}
.choice button:hover { border-color: var(--accent); }
.choice button span { color: var(--text-3); font-weight: 400; font-size: 14px; }
.result-score { font-family: var(--font-display); font-size: 88px; font-weight: 500; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.result-score small { font-size: 40px; color: var(--text-3); }

/* Tabeller */
.page-head { padding: 32px 0 20px; display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search {
  flex: 1; min-width: 220px; min-height: 42px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--text); font: 400 16px var(--font-body);
}
.search::placeholder { color: var(--text-3); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text-3); padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); }
td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--border); vertical-align: baseline; }
td.w { font-family: var(--font-display); font-size: 19px; font-weight: 500; }
td.r { text-align: right; font-variant-numeric: tabular-nums; }
th.r { text-align: right; }
.tag { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.tag .dot { margin-right: 6px; }
.more { margin-top: 20px; }
.empty { padding: 48px 0; color: var(--text-2); max-width: 52ch; }

/* Resultatlista */
.review { list-style: none; padding: 0; margin: 24px 0; border-top: 1px solid var(--border); }
.review li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.review .mark { font-weight: 600; }
.review .mark.ok { color: var(--right); }
.review .mark.no { color: var(--wrong); }
.review b { font-family: var(--font-display); font-weight: 500; font-size: 19px; }
.review span { color: var(--text-2); }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 14px 16px; }
  .top nav { order: 3; width: 100%; margin: 0 -12px; overflow-x: auto; }
  .theme { margin-left: auto; }
  main { padding: 0 16px 48px; }
  .foot { padding: 20px 16px; }
  .hero, .split { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding-top: 20px; }
  .sheet { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .opt { font-size: 17px; }
  thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  td { border: 0; padding: 2px 0; }
  td.r { text-align: left; color: var(--text-3); font-size: 14px; }
  td.r::before { content: attr(data-label) ": "; }
  .result-score { font-size: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (hover: none) { .hint { display: none; } }
