/* Systemmanden Live · elevens mobil (v2).
   Bygger på tema.css: farver, skrifter, .svar-N og .form. Ingen egne farvekoder. */

:root { color-scheme: light; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 17px;
  line-height: 1.4;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; touch-action: manipulation; }

:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; }
h1:focus { outline: none; }

h1 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(30px, 8.5vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

p { margin: 0; }

/* ---------- Ramme og top ---------- */

.ramme {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    max(10px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.maerke { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.maerke-former { display: grid; grid-template-columns: repeat(2, 8px); gap: 2px; }
.maerke-former .form { width: 8px; height: 8px; color: var(--svar-bg); }
.maerke-navn {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.maerke-live {
  padding: 3px 7px 2px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Smal skærm: navnet og pointene er vigtigere end ordet "Systemmanden". */
@media (max-width: 380px) {
  .top:has(.mig:not([hidden])) .maerke-navn { display: none; }
}

.mig { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.mig-navn { max-width: 38vw; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mig-point {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-2);
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Forbindelsesbanner ---------- */

.banner {
  position: fixed;
  z-index: 10;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
  animation: banner-ind 0.3s var(--ease) backwards;
}
.banner::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sun);
  animation: puls 1.2s ease-in-out infinite;
}
.banner:empty, .banner.skjult { display: none; }

/* ---------- Visninger ---------- */

.indhold { display: flex; flex: 1; flex-direction: column; min-height: 0; padding-top: 12px; }

.visning {
  display: flex;
  flex: 1;
  flex-direction: column;
  animation: ind 0.32s var(--ease) backwards;
}

.visning-midt {
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-bottom: 8vh;
  text-align: center;
}

.visning-form { gap: 24px; padding-top: clamp(16px, 7vh, 64px); }
.form-hoved { display: flex; flex-direction: column; gap: 8px; }

.overlinje {
  color: var(--ink-3);
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hjaelp { max-width: 32ch; color: var(--ink-2); font-size: 17px; }
.titel-lille { font-size: clamp(24px, 6.5vw, 30px); }
.uden-js { padding: 24px 0; text-align: center; }

/* ---------- Formularer ---------- */

.form-felter { display: flex; flex-direction: column; gap: 10px; }

.etiket { color: var(--ink-2); font-size: 15px; font-weight: 600; }

.felt {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-m);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s var(--ease);
}
.felt:focus { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 4px var(--cobalt-soft); }
.felt[aria-invalid="true"] { border-color: var(--forkert); }
.felt[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px var(--forkert-soft); }
.felt::placeholder { color: var(--ink-3); opacity: 1; }

.felt-kode {
  padding-left: calc(16px + 0.3em);
  font-family: var(--f-mono);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
}

.fejl { min-height: 1.4em; color: var(--forkert); font-size: 16px; font-weight: 500; }

.knap {
  width: 100%;
  min-height: 56px;
  margin-top: 4px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-m);
  background: var(--ink);
  color: var(--paper);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s var(--ease), opacity 0.2s var(--ease), background-color 0.2s var(--ease);
}
.knap:active:not(:disabled) { transform: scale(0.98); }
.knap:disabled { opacity: 0.55; cursor: default; }
.visning-midt .knap { max-width: 360px; margin-top: 12px; }

.knap-sekundaer { border: 2px solid var(--line-2); background: transparent; color: var(--ink); }

.knap-link {
  align-self: center;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.kode-chip {
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.14em;
}

/* ---------- Vent og klar ---------- */

.former-stor { display: grid; grid-template-columns: repeat(2, 30px); gap: 8px; margin-bottom: 10px; }
.former-stor .form {
  width: 30px;
  height: 30px;
  color: var(--svar-bg);
  animation: vugge 1.8s ease-in-out infinite alternate;
}
.former-stor .form:nth-child(2) { animation-delay: 0.3s; }
.former-stor .form:nth-child(3) { animation-delay: 0.6s; }
.former-stor .form:nth-child(4) { animation-delay: 0.9s; }
.former-stor.sekvens .form { animation: blink 1.6s var(--ease) infinite; }
.former-stor.sekvens .form:nth-child(2) { animation-delay: 0.2s; }
.former-stor.sekvens .form:nth-child(3) { animation-delay: 0.6s; }
.former-stor.sekvens .form:nth-child(4) { animation-delay: 0.4s; }

.navn-chip {
  max-width: 100%;
  padding: 8px 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--white);
  box-shadow: var(--shadow-1);
  font-size: 20px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.navn-chip:empty, .stilling-linje:empty, .hjaelp:empty, .overlinje:empty { display: none; }

.stilling-linje { color: var(--ink-2); font-size: 16px; }
.stilling-linje strong, .res-plads strong { color: var(--ink); }

/* Klar: metalinjen øverst, resten samlet i midten. */
.visning-klar { justify-content: flex-start; padding-bottom: 4vh; }
.visning-klar .former-stor { margin-top: auto; }
.visning-klar::after { content: ""; margin-top: auto; }
.visning-klar h1 { animation: ind-stor 0.5s var(--ease) 0.05s backwards; }

.meta-raekke {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-height: 20px;
}
.visning-klar .meta-raekke { align-self: stretch; justify-content: space-between; }
.visning-klar .blok { margin-left: auto; }

.blok {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font-family: var(--f-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.blok-prikker { display: inline-flex; align-items: center; gap: 4px; }
.blok-prik { width: 6px; height: 6px; border-radius: 3px; background: var(--line-2); }
.blok-prik.foer { background: var(--ink-3); }
.blok-prik.nu { width: 16px; background: var(--ink); }

.type-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  font-weight: 600;
  animation: pop 0.5s var(--ease) 0.15s backwards;
}
.type-chip:empty { display: none; }

.point-maerke {
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.point-maerke.ingen { background: var(--paper-2); color: var(--ink-2); }
.point-maerke:empty { display: none; }
.sporg-meta .point-maerke { align-self: flex-start; }

.sporg-kort {
  max-width: 34ch;
  margin-top: 6px;
  padding: 20px 22px;
  border-radius: var(--r-l);
  background: var(--white);
  box-shadow: var(--shadow-1);
  font-family: var(--f-display);
  font-size: clamp(21px, 5.8vw, 28px);
  font-weight: 500;
  line-height: 1.25;
  text-wrap: pretty;
  animation: ind 0.45s var(--ease) 0.2s backwards;
}
.sporg-kort.lang { font-size: clamp(17px, 4.6vw, 21px); }
.sporg-kort:empty { display: none; }

.prikker { display: inline-flex; gap: 8px; }
.prikker span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  animation: prik 1.2s ease-in-out infinite;
}
.prikker span:nth-child(2) { animation-delay: 0.15s; }
.prikker span:nth-child(3) { animation-delay: 0.3s; }

/* ---------- Spørgsmål: hoved og nedtælling ---------- */

.visning-sporg { gap: 12px; }

.sporg-hoved { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.sporg-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sporg-tekst {
  font-size: clamp(21px, 5.8vw, 28px);
  line-height: 1.2;
  text-wrap: pretty;
  animation: ind 0.36s var(--ease) backwards;
}
.lang .sporg-tekst { font-size: clamp(18px, 4.9vw, 23px); line-height: 1.24; }
.meget-lang .sporg-tekst { font-size: clamp(16px, 4.3vw, 19px); line-height: 1.28; }

.tid {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 58px;
  height: 58px;
  transition: opacity 0.3s var(--ease);
}
.tid-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.tid-spor { fill: var(--white); stroke: var(--line); stroke-width: 5; }
.tid-fyld {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 131.95; /* 2π · 21 */
  transition: stroke 0.4s var(--ease);
}
.tid-sek {
  position: relative;
  font-family: var(--f-mono);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.tid-sek.tre { font-size: 16px; letter-spacing: -0.04em; }
.tid.snart .tid-fyld { stroke: var(--orange-deep); }
.tid.snart .tid-sek { color: var(--orange-deep); }
.tid-sek.tik { animation: tik 0.5s var(--ease); }
.svaret .tid { opacity: 0.45; }

/* ---------- Svarflader ---------- */

.flade { display: flex; flex: 1 0 auto; flex-direction: column; gap: 12px; }

.flade-hjaelp { min-height: 1.4em; color: var(--ink-2); font-size: 16px; font-weight: 500; }

.knap.send { margin-top: auto; min-height: 60px; font-size: 19px; }
.knap.send:disabled { opacity: 0.3; }
.knap.send.klar { animation: klar-puls 1.6s var(--ease) infinite; }

/* valg, sandfalsk, afstemning */

.gitter {
  display: grid;
  flex: 1 0 auto;
  grid-auto-rows: 1fr;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-height: 52vh;
  min-height: 52svh;
}
.lang .gitter { min-height: 44svh; }
.meget-lang .gitter { min-height: 38svh; }
.gitter.antal-3 .svar:last-child { grid-column: 1 / -1; }

.svar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  min-height: 96px;
  padding: 16px 12px;
  border: 0;
  border-radius: var(--r-l);
  background: var(--svar-bg);
  color: var(--svar-fg);
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: inset 0 -4px 0 rgba(18, 19, 26, 0.16);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.14s var(--ease), opacity 0.25s var(--ease), filter 0.25s var(--ease), box-shadow 0.2s var(--ease);
  animation: svar-ind 0.4s var(--ease) backwards;
}
.svar:nth-child(2) { animation-delay: 0.05s; }
.svar:nth-child(3) { animation-delay: 0.1s; }
.svar:nth-child(4) { animation-delay: 0.15s; }
.svar.lang { font-size: clamp(16px, 4.2vw, 18px); }
.svar .form { width: clamp(28px, 9vw, 44px); height: clamp(28px, 9vw, 44px); }
.antal-2 .svar { font-size: clamp(22px, 6.5vw, 30px); }
.antal-2 .svar .form { width: 56px; height: 56px; }

.svar:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.svar:active:not([aria-disabled="true"]) { transform: scale(0.97); }
.svar[aria-disabled="true"] { cursor: default; }

.gitter.har-valg .svar:not(.valgt) { opacity: 0.25; filter: saturate(0.3); transform: scale(0.96); }
.gitter.laast:not(.har-valg) .svar { opacity: 0.4; filter: saturate(0.4); }
.svar.valgt { box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--ink); animation: valgt 0.4s var(--ease); }

.valgt-maerke {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
}
.valgt-maerke::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 10px;
  width: 10px;
  height: 16px;
  border: solid var(--ink);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.svar.valgt .valgt-maerke { display: block; animation: pop 0.35s var(--ease) backwards; }

/* tal */

.flade-tal { gap: 10px; }
.tal-visning {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.12em;
  max-width: 100%;
  margin-top: auto;
  padding: 4px 0;
  font-family: var(--f-display);
  font-size: clamp(56px, 19vw, 92px);
  font-weight: 600;
  line-height: 1.05;
  animation: pop 0.45s var(--ease) 0.1s backwards;
}
.tal-visning.lang { font-size: clamp(40px, 13vw, 64px); }
.tal-visning.meget-lang { font-size: clamp(28px, 8.5vw, 44px); }
.tal-felt {
  min-width: 1.4ch;
  max-width: 100%;
  padding: 0 4px;
  border: 0;
  border-bottom: 3px dashed var(--line-2);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-align: center;
  transition: border-color 0.2s var(--ease);
}
.tal-felt:focus { border-bottom-color: var(--cobalt); border-bottom-style: solid; outline: none; }
.tal-felt:disabled { border-bottom-color: transparent; opacity: 1; -webkit-text-fill-color: var(--ink); }
.tal-enhed { color: var(--ink-2); font-family: var(--f-ui); font-size: 0.4em; font-weight: 600; white-space: nowrap; }
.tal-hjaelp { text-align: center; font-size: 15px; color: var(--ink-3); }
.laast .tal-hjaelp { color: var(--ink-2); font-size: 16px; }
.tekst-form.laast .fejl { display: none; }

.tal-raekke { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.tal-trin {
  display: grid;
  flex: none;
  place-items: center;
  width: 64px;
  height: 64px;
  padding: 0 0 4px;
  border: 0;
  border-radius: var(--r-m);
  background: var(--white);
  box-shadow: var(--shadow-1), inset 0 -3px 0 var(--line);
  font-size: 36px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.1s var(--ease), opacity 0.2s var(--ease);
}
.tal-trin:active:not(:disabled) { transform: scale(0.93); background: var(--paper-2); }
.tal-trin:disabled { opacity: 0.35; cursor: default; }

.tal-skyder {
  --pct: 50%;
  flex: 1;
  min-width: 0;
  height: 48px;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.tal-skyder:focus-visible { outline-offset: 0; }
.tal-skyder::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--cobalt) var(--pct), var(--line-2) var(--pct));
}
.tal-skyder::-webkit-slider-thumb {
  width: 36px;
  height: 36px;
  margin-top: -12px;
  border: 5px solid var(--white);
  border-radius: 50%;
  background: var(--cobalt-deep);
  box-shadow: var(--shadow-2);
  -webkit-appearance: none;
  appearance: none;
}
.tal-skyder::-moz-range-track { height: 12px; border-radius: 999px; background: var(--line-2); }
.tal-skyder::-moz-range-progress { height: 12px; border-radius: 999px; background: var(--cobalt); }
.tal-skyder::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 5px solid var(--white);
  border-radius: 50%;
  background: var(--cobalt-deep);
  box-shadow: var(--shadow-2);
}
.tal-skyder:disabled { cursor: default; opacity: 0.45; }

.tal-graenser {
  display: flex;
  justify-content: space-between;
  padding: 0 76px;
  color: var(--ink-3);
  font-family: var(--f-mono);
  font-size: 13px;
}
.tal-fejl { min-height: 1.4em; color: var(--forkert); font-size: 15px; font-weight: 500; text-align: center; }

/* raekkefoelge */

.raekke-liste { display: flex; flex-direction: column; gap: 10px; }
.raekke-el {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px 16px 10px 12px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-m);
  background: var(--white);
  box-shadow: var(--shadow-1);
  font-size: clamp(17px, 4.8vw, 20px);
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.12s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease);
  animation: svar-ind 0.4s var(--ease) backwards;
}
.raekke-el:nth-child(2) { animation-delay: 0.05s; }
.raekke-el:nth-child(3) { animation-delay: 0.1s; }
.raekke-el:nth-child(4) { animation-delay: 0.15s; }
.raekke-el:nth-child(5) { animation-delay: 0.2s; }
.raekke-el:active:not(:disabled) { transform: scale(0.98); }
.raekke-el:disabled { cursor: default; }
.raekke-nr {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px dashed var(--line-2);
  border-radius: 50%;
  font-family: var(--f-mono);
  font-size: 20px;
  font-weight: 500;
}
.raekke-el.har-nr { border-color: var(--cobalt); background: var(--cobalt-soft); }
.raekke-el.har-nr .raekke-nr {
  border: 0;
  background: var(--cobalt-deep);
  color: var(--white);
  animation: pop 0.3s var(--ease);
}
.raekke-handlinger { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }

/* skriv og ordsky */

.flade-skriv, .flade-ordsky { flex: 0 0 auto; }
.flade-skriv + .svar-status, .flade-ordsky + .svar-status { margin-top: 8px; }
.tekst-form { display: flex; flex-direction: column; gap: 10px; }
.tekst-form .flade-hjaelp { margin-bottom: -4px; }
.tekst-felt { min-height: 64px; font-size: 22px; }
.tekst-felt:disabled { border-color: transparent; background: var(--paper-2); opacity: 1; -webkit-text-fill-color: var(--ink); }
.ord-felt { animation: ind 0.25s var(--ease) backwards; }
.ord-mere {
  align-self: flex-start;
  padding: 0 18px;
  border: 2px dashed var(--line-2);
  border-radius: 999px;
  color: var(--cobalt-deep);
  font-weight: 600;
  text-decoration: none;
}
.tekst-form .knap.send { margin-top: 2px; }

/* status under fladen */

.svar-status {
  display: inline-flex;
  align-items: center;
  align-self: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}
.svar-status:empty { visibility: hidden; }
.svar-status.ok { background: var(--ink); color: var(--paper); animation: pop 0.4s var(--ease); }
.svar-status.ok::before {
  content: "";
  flex: none;
  width: 14px;
  height: 8px;
  border: solid var(--mint);
  border-width: 0 0 3px 3px;
  transform: translateY(-2px) rotate(-45deg);
}
.svar-status.fejl { background: var(--forkert-soft); color: var(--forkert); }

/* Liggende telefon: alle svar på én række. */
@media (orientation: landscape) and (max-height: 500px) {
  .gitter { min-height: 44vh; }
  .gitter.antal-3 { grid-template-columns: repeat(3, 1fr); }
  .gitter.antal-4 { grid-template-columns: repeat(4, 1fr); }
  .gitter.antal-3 .svar:last-child { grid-column: auto; }
}

/* ---------- Resultat (fuld farve) ---------- */

.visning-resultat { gap: 14px; }

.res-kort {
  --kort-bg: var(--paper-2);
  --kort-fg: var(--ink);
  --ikon-bg: var(--white);
  --ikon-fg: var(--ink-2);
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 20px;
  border-radius: var(--r-xl);
  background: var(--kort-bg);
  color: var(--kort-fg);
  text-align: center;
  animation: floed 0.6s var(--ease) backwards;
}
.res-kort.rigtig { --kort-bg: var(--rigtig); --kort-fg: var(--white); --ikon-fg: var(--rigtig); }
.res-kort.forkert { --kort-bg: var(--forkert); --kort-fg: var(--white); --ikon-fg: var(--forkert); }
.res-kort.ingen { --kort-bg: var(--ink-2); --kort-fg: var(--white); --ikon-fg: var(--ink-2); }
.res-kort.tak { --kort-bg: var(--cobalt-deep); --kort-fg: var(--white); --ikon-fg: var(--cobalt-deep); }
.res-kort.stilling { --kort-bg: var(--white); --ikon-bg: var(--paper-2); --ikon-fg: var(--ink); box-shadow: var(--shadow-1); }

.res-ikon {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 108px;
  height: 108px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--ikon-bg);
  color: var(--ikon-fg);
  font-family: var(--f-display);
  font-size: 48px;
  font-weight: 700;
  box-shadow: 0 10px 30px -12px rgba(18, 19, 26, 0.45);
  animation: pop 0.55s var(--ease) 0.18s backwards;
}
.res-ikon.p1 { background: var(--sun); }
.res-ikon.p2 { background: var(--cobalt-soft); }
.res-ikon.p3 { background: var(--orange-soft); }
.rigtig .res-ikon::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 3px solid var(--white);
  border-radius: 50%;
  opacity: 0;
  animation: ring 1s var(--ease) 0.45s;
}

/* Flueben */
.ikon-rigtig::after {
  content: "";
  position: absolute;
  top: 22px;
  left: 39px;
  width: 28px;
  height: 50px;
  border: solid currentColor;
  border-width: 0 10px 10px 0;
  border-radius: 3px;
  transform: rotate(45deg);
}
/* Kryds */
.ikon-forkert::before,
.ikon-forkert::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 10px;
  margin: -5px 0 0 -27px;
  border-radius: 5px;
  background: currentColor;
  transform: rotate(45deg);
}
.ikon-forkert::after { transform: rotate(-45deg); }
/* Ur: to visere */
.ikon-ur::before,
.ikon-ur::after {
  content: "";
  position: absolute;
  bottom: 50%;
  left: 50%;
  width: 8px;
  height: 34px;
  margin-left: -4px;
  border-radius: 4px;
  background: currentColor;
  transform-origin: 50% 100%;
}
.ikon-ur::after { height: 26px; transform: rotate(110deg); }
/* Pil op: kig op på skærmen */
.ikon-op::before {
  content: "";
  position: absolute;
  top: 30px;
  left: 50%;
  width: 10px;
  height: 50px;
  margin-left: -5px;
  border-radius: 5px;
  background: currentColor;
}
.ikon-op::after {
  content: "";
  position: absolute;
  top: 30px;
  left: 50%;
  width: 30px;
  height: 30px;
  margin-left: -15px;
  border: solid currentColor;
  border-width: 10px 0 0 10px;
  border-radius: 4px 0 0;
  transform: rotate(45deg);
}
.tak .ikon-op { animation: pop 0.55s var(--ease) 0.18s backwards, svaev 2.2s ease-in-out 0.9s infinite alternate; }

.res-titel { font-size: clamp(34px, 10vw, 50px); animation: ind-stor 0.5s var(--ease) 0.28s backwards; }
.res-titel strong { font-size: 1.15em; }
.stilling .res-titel { font-size: clamp(30px, 8.5vw, 42px); }

.res-plus {
  font-family: var(--f-mono);
  font-size: clamp(30px, 9vw, 44px);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.02em;
  animation: ind 0.4s var(--ease) 0.4s backwards;
}
.res-under { max-width: 30ch; font-size: 18px; font-weight: 500; opacity: 0.92; }

.res-stime {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 12px;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  animation: pop 0.45s var(--ease) 0.6s backwards;
}
.stilling .res-stime { background: var(--paper-2); }
.flamme { width: 22px; height: 22px; fill: var(--orange); transform-origin: 50% 90%; animation: flakker 1.3s ease-in-out infinite alternate; }
.flamme-kerne { fill: var(--sun); }

.res-linjer { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; animation: ind 0.4s var(--ease) 0.5s backwards; }
.res-linjer:empty { display: none; }
.res-svar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  text-align: left;
}
.res-svar .form { width: 16px; height: 16px; color: var(--svar-bg); }
.res-svar-etiket { flex: none; color: var(--ink-2); }
.res-svar-tekst { font-weight: 600; overflow-wrap: anywhere; }

.res-raekke {
  width: min(100%, 340px);
  padding: 12px 14px;
  border-radius: var(--r-m);
  background: var(--white);
  color: var(--ink);
  text-align: left;
}
.res-raekke-titel { margin-bottom: 6px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.res-raekke-liste { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.res-raekke-liste li { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.res-raekke-nr {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--paper-2);
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 500;
}
.res-raekke-tekst { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* Mærket: et flueben eller en streg; teksten er kun til skærmlæsere. */
.res-raekke-maerke {
  position: relative;
  flex: none;
  width: 22px;
  height: 22px;
  overflow: hidden;
  border-radius: 50%;
  color: transparent;
  font-size: 0;
}
.ramt .res-raekke-maerke { background: var(--rigtig-soft); }
.ramt .res-raekke-maerke::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 8px;
  width: 5px;
  height: 10px;
  border: solid var(--rigtig);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.forbi .res-raekke-maerke { background: var(--forkert-soft); }
.forbi .res-raekke-maerke::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 6px;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  background: var(--forkert);
}
.ramt .res-raekke-nr { background: var(--rigtig-soft); }

.res-plus:empty, .res-under:empty, .res-svar:empty, .res-plads:empty, .res-bagop:empty { display: none; }

.res-stilling {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0 2px;
  text-align: center;
  animation: ind 0.4s var(--ease) 0.55s backwards;
}
.res-plads { font-size: 21px; }
.res-plads strong { font-family: var(--f-display); font-size: 1.4em; }
.res-bagop { color: var(--ink-2); font-size: 16px; font-weight: 500; }
.res-point { color: var(--ink-2); font-family: var(--f-mono); font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- Podie ---------- */

.podie-plads {
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  margin: 8px 0;
  border-radius: 50%;
  background: var(--paper-2);
  box-shadow: var(--shadow-2);
  font-family: var(--f-display);
  font-size: 60px;
  font-weight: 700;
  animation: pop 0.6s var(--ease) 0.1s backwards;
}
.podie-plads:empty { display: none; }
.podie-plads.p1 { background: var(--sun); }
.podie-plads.p2 { background: var(--cobalt-soft); }
.podie-plads.p3 { background: var(--orange-soft); }
.podie-plads.p1, .podie-plads.p2, .podie-plads.p3 { animation: pop 0.6s var(--ease) 0.1s backwards, svaev 2.4s ease-in-out 0.8s infinite alternate; }
.podie-titel { font-size: clamp(28px, 8vw, 38px); }

/* ---------- Konfetti ---------- */

.konfetti { position: fixed; z-index: 20; inset: 0; overflow: hidden; pointer-events: none; }
.konfetti .form {
  position: absolute;
  top: var(--y0);
  left: var(--x0);
  width: var(--str, 10px);
  height: var(--str, 10px);
  color: var(--svar-bg);
  animation: konfetti 2s linear forwards;
}

/* ---------- Demo-navigation (kun ?demo=) ---------- */

.demo-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px dashed var(--line-2);
  color: var(--ink-3);
  font-size: 13px;
}
.demo-raekke { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.demo-etiket { min-width: 52px; font-family: var(--f-mono); }
.demo-nav a {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-family: var(--f-mono);
  text-decoration: none;
}
.demo-nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.demo-log {
  padding: 8px 10px;
  border-radius: var(--r-s);
  background: var(--white);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---------- Bevægelse (dæmpes af tema.css ved prefers-reduced-motion) ---------- */

@keyframes ind { from { opacity: 0; transform: translateY(8px); } }
@keyframes ind-stor { from { opacity: 0; transform: translateY(10px) scale(0.94); } }
@keyframes svar-ind { from { opacity: 0; transform: translateY(10px) scale(0.94); } }
@keyframes banner-ind { from { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes pop {
  0% { opacity: 0; transform: scale(0.6); }
  60% { opacity: 1; transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes valgt {
  0% { transform: scale(0.96); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes floed {
  from { clip-path: circle(0% at 50% 30%); }
  to { clip-path: circle(150% at 50% 30%); }
}
@keyframes ring {
  0% { opacity: 0.8; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.5); }
}
@keyframes tik {
  0% { transform: scale(1.4); }
  100% { transform: scale(1); }
}
@keyframes klar-puls {
  0%, 100% { box-shadow: 0 0 0 0 var(--cobalt-soft); }
  50% { box-shadow: 0 0 0 7px var(--cobalt-soft); }
}
@keyframes flakker {
  from { transform: scale(1) rotate(-3deg); }
  to { transform: scale(1.08, 1.12) rotate(3deg); }
}
@keyframes svaev { from { translate: 0 0; } to { translate: 0 -6px; } }
@keyframes konfetti {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(0.4);
    animation-timing-function: cubic-bezier(0.1, 0.7, 0.3, 1);
  }
  28% {
    transform: translate(var(--dx), var(--dy)) rotate(calc(var(--r) * 0.3)) scale(1);
    animation-timing-function: cubic-bezier(0.45, 0, 0.9, 0.6);
  }
  80% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(var(--dx) * 1.5), calc(var(--dy) + var(--fald))) rotate(var(--r)) scale(0.9);
  }
}
@keyframes vugge { from { transform: translateY(0); } to { transform: translateY(-6px); } }
@keyframes blink {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}
@keyframes prik { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@keyframes puls { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* tema.css korter varigheden ned, men uendelige animationer ville så flimre,
   og forsinkelser med "backwards" ville holde elementer usynlige et øjeblik. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-delay: 0s !important; }
  .former-stor .form, .prikker span, .banner::before, .flamme, .knap.send.klar,
  .tak .ikon-op, .podie-plads, .konfetti { animation: none; }
  .res-kort { animation: none; }
}
