/* Gideonskolen app — håndskrevet CSS, ingen build-proces.
   Farver og skrifter følger gideonskolen.dk (samme designsprog som
   intra-portalen): marineblå #0A1F41, grøn #56A308, mint #EDFFE1,
   Rubik til overskrifter og Telex til brødtekst.

   Skrifterne ligger lokalt i /public/fonts — af hensyn til GDPR
   (ingen kald til Google) og så appen virker uden internet. */

@font-face {
    font-family: "Rubik";
    src: url("/fonts/rubik-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Telex";
    src: url("/fonts/telex-latin.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --navy: #0a1f41;
    --green: #56a308;
    --green-strong: #457f06;
    --mint: #edffe1;

    --bg: #f7f9fa;
    --surface: #ffffff;
    --surface-2: #f0f3f7;
    --ink: var(--navy);
    --ink-2: #2d3748;
    --muted: #5a6a82;
    --line: #e2e7ee;
    --accent: var(--green-strong);
    --on-accent: #ffffff;

    --ok-bg: #edffe1;
    --ok-ink: #33630a;
    --err-bg: #fdeaed;
    --err-ink: #a3243c;
    --warn-bg: #fdf3e0;
    --warn-ink: #8a5c12;

    /* Fingerfarver til Tastatur Helten — én pr. finger, samme paa begge haender. */
    --finger-lille: #d9e6ff;
    --finger-ring: #d7f0e2;
    --finger-lang: #fdeccd;
    --finger-peg: #f8d9e4;

    --logo-filter: none;
    --shadow: 0 1px 2px rgba(10, 31, 65, 0.06);
    color-scheme: light;
}

/* Mørk palette. Tre tilstande: brugerens valg gemmes i localStorage og
   sættes som data-theme på <html>; uden valg følger siden systemet.
   OBS: de to mørke blokke herunder skal holdes ens — samme tokens begge
   steder (CSS kan ikke dele en blok på tværs af en media query). */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #071630;
        --surface: #0d2247;
        --surface-2: #143059;
        --ink: #e8eef6;
        --ink-2: #cbd8e8;
        --muted: #93a9c6;
        --line: #1e3459;
        --accent: #8cd44b;
        --on-accent: #071630;
        --mint: #14301a;

        --ok-bg: #14301a;
        --ok-ink: #a5dd78;
        --err-bg: #3a1620;
        --err-ink: #f0a2b2;
        --warn-bg: #382a15;
        --warn-ink: #e8c07f;

        --finger-lille: #233d6b;
        --finger-ring: #1d4a37;
        --finger-lang: #4d3d1b;
        --finger-peg: #4d2334;

        /* Logoet er sort artwork — vises hvidt på mørk bund. */
        --logo-filter: brightness(0) invert(1);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #071630;
    --surface: #0d2247;
    --surface-2: #143059;
    --ink: #e8eef6;
    --ink-2: #cbd8e8;
    --muted: #93a9c6;
    --line: #1e3459;
    --accent: #8cd44b;
    --on-accent: #071630;
    --mint: #14301a;

    --ok-bg: #14301a;
    --ok-ink: #a5dd78;
    --err-bg: #3a1620;
    --err-ink: #f0a2b2;
    --warn-bg: #382a15;
    --warn-ink: #e8c07f;

    --finger-lille: #233d6b;
    --finger-ring: #1d4a37;
    --finger-lang: #4d3d1b;
    --finger-peg: #4d2334;

    --logo-filter: brightness(0) invert(1);
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: "Telex", "Segoe UI", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

h1, h2, h3 { font-family: "Rubik", "Segoe UI", system-ui, sans-serif; color: var(--ink); }
h1 { font-size: 1.7rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.3rem; }

a { color: var(--accent); }
.daempet { color: var(--muted); }
.lille { font-size: 0.85rem; }

/* ── Header ─────────────────────────────────────────────── */

.top {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.top-inderside {
    max-width: 960px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.logo { height: 30px; display: block; filter: var(--logo-filter); }
.logo-link { display: flex; align-items: center; }


.top-bruger { display: flex; align-items: center; gap: 10px; }
.brugernavn { color: var(--muted); font-size: 0.9rem; }

/* Temavælger — Lys/Mørk/Auto. Skubber sig selv (og alt efter sig) til højre. */
.temavalg {
    margin-left: auto;
    display: flex;
    gap: 2px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 2px;
}

.temavalg button {
    border: none;
    background: none;
    color: var(--muted);
    font-family: "Rubik", sans-serif;
    font-size: 0.78rem;
    padding: 4px 9px;
    border-radius: 7px;
    cursor: pointer;
}

.temavalg button.aktiv {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.knap-diskret {
    background: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 5px 11px;
    color: var(--ink-2);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.knap-diskret:hover { background: var(--surface-2); }

/* ── Indhold og fod ─────────────────────────────────────── */

.indhold {
    flex: 1;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.bund {
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 14px;
}

/* ── Beskeder ───────────────────────────────────────────── */

.besked { border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
.besked p { margin: 0; }
.besked-ok { background: var(--ok-bg); color: var(--ok-ink); }
.besked-fejl { background: var(--err-bg); color: var(--err-ink); }
.besked-advarsel { background: var(--warn-bg); color: var(--warn-ink); }

/* ── Knapper ────────────────────────────────────────────── */

.knap {
    display: inline-block;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: 10px;
    padding: 11px 22px;
    font-family: "Rubik", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.knap:hover { filter: brightness(1.07); }

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

.knap-bred { display: block; width: 100%; margin-top: 18px; }

/* ── Login ──────────────────────────────────────────────── */

.login-kort {
    max-width: 420px;
    margin: 8vh auto 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.login-kort form { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.login-kort label { font-family: "Rubik", sans-serif; font-weight: 600; font-size: 0.9rem; }

.login-kort input {
    background: var(--surface-2);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px;
    font: inherit;
}
.login-kort input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.kodefelt {
    font-size: 1.6rem !important;
    letter-spacing: 10px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ── Kort på forside og emneoversigt ───────────────────── */

.kort-raekke {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.kort {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kort p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.kort-ikon { font-size: 1.6rem; }
.kort-link { text-decoration: none; }
.kort-link:hover { border-color: var(--accent); }
.kort-passiv { opacity: 0.75; }

.emne-kort form { margin-top: auto; padding-top: 10px; }
.emne-kort .knap-sekundaer { width: 100%; }

.score-linje { color: var(--ink-2) !important; font-size: 0.9rem !important; margin-top: 6px !important; }

.blandet-kort {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--mint);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    margin-top: 18px;
}
.blandet-kort h2 { margin: 0; }
.blandet-kort p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.blandet-tekst { flex: 1; }
.blandet-kort .score-linje { color: var(--ok-ink) !important; }

/* ── Quiz ───────────────────────────────────────────────── */

.quiz-ramme { max-width: 640px; margin: 0 auto; }

.quiz-top { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 6px; }

.fremdrift {
    height: 8px;
    background: var(--surface-2);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 22px;
}
.fremdrift-fyld { height: 100%; background: var(--green); border-radius: 99px; }

.quiz-sporgsmaal { font-size: 1.35rem; line-height: 1.4; margin-bottom: 20px; }

.figur {
    display: flex;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 10px 6px;
    margin-bottom: 16px;
}
.figur svg { max-width: 100%; height: auto; }

.quiz-muligheder {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2×2-grid; én kolonne på smal mobil */
    gap: 10px;
}

.mulighed {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    font: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
}

button.mulighed:hover { border-color: var(--accent); background: var(--surface-2); }

.mulighed-bogstav {
    flex: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-2);
    font-family: "Rubik", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
}

.mulighed-laast { cursor: default; }
.mulighed-rigtig { background: var(--ok-bg); border-color: var(--green); }
.mulighed-rigtig .mulighed-bogstav { background: var(--green); color: #fff; }
.mulighed-valgt-forkert { background: var(--err-bg); border-color: var(--err-ink); }
.mulighed-valgt-forkert .mulighed-bogstav { background: var(--err-ink); color: #fff; }

.mulighed-tag {
    margin-left: auto;
    flex: none;
    font-size: 0.75rem;
    font-family: "Rubik", sans-serif;
    font-weight: 600;
    color: var(--muted);
}

.facit-banner {
    font-family: "Rubik", sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
}
.facit-rigtigt { background: var(--ok-bg); color: var(--ok-ink); }
.facit-forkert { background: var(--err-bg); color: var(--err-ink); }

.forklaring {
    background: var(--surface-2);
    border-left: 4px solid var(--green);
    border-radius: 0 10px 10px 0;
    padding: 12px 16px;
    margin-top: 18px;
    font-size: 0.95rem;
}

.quiz-afbryd { text-align: center; margin-top: 22px; }
.quiz-afbryd a { color: var(--muted); }

/* ── Resultat ───────────────────────────────────────────── */

.resultat { text-align: center; padding-top: 4vh; }

.resultat-score {
    font-family: "Rubik", sans-serif;
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent);
}
.resultat-score span { font-size: 2rem; color: var(--muted); font-weight: 400; }

.resultat-procent { color: var(--muted); margin: 6px 0 18px; }

.resultat-prikker { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.prik { width: 14px; height: 14px; border-radius: 50%; }
.prik-rigtig { background: var(--green); }
.prik-forkert { background: var(--err-ink); opacity: 0.6; }

.resultat-knapper { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }

/* ── Mobil ──────────────────────────────────────────────── */

@media (max-width: 560px) {
    h1 { font-size: 1.4rem; }
    .quiz-muligheder { grid-template-columns: 1fr; }
    .top-inderside { gap: 10px; }
    .brugernavn { display: none; }
    .blandet-kort { flex-direction: column; align-items: stretch; text-align: center; }
    .login-kort { margin-top: 3vh; }
    .resultat-knapper { flex-direction: column; }
    .resultat-knapper .knap, .resultat-knapper form { width: 100%; }
    .resultat-knapper form .knap { width: 100%; }
}

/* ── Tabelspil (fælles) ─────────────────────────────────── */

.spil-ramme { max-width: 560px; margin: 0 auto; }
.spil-bred { max-width: 720px; }
.skjult { display: none !important; }
.spil-etiket { font-size: 0.95rem; margin: 18px 0 8px; }
.spil-tilbage { text-align: center; margin-top: 20px; }
.spil-tilbage a { color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 99px;
    padding: 7px 13px;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}
.chip.valgt { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }

#duelnavne { margin-top: 10px; }
.spil-ramme input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    background: var(--surface-2);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 13px;
    font: inherit;
    margin-bottom: 10px;
}

.spil-ramme .knap-bred { margin-top: 18px; }

/* Runde-UI */
.lyn-top { display: flex; justify-content: space-between; gap: 10px; font-size: 0.95rem; color: var(--muted); min-height: 1.4em; }
.tidbar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.tidbar-fyld { height: 100%; width: 100%; background: var(--green); border-radius: 99px; transition: width 0.1s linear; }
.tidbar-fyld.tid-lav { background: var(--err-ink); }

.lyn-spm {
    font-family: "Rubik", sans-serif;
    font-size: 3.2rem;
    font-weight: 700;
    text-align: center;
    margin: 18px 0 4px;
}
.lyn-spm-lille { font-size: 2rem; margin: 6px 0 2px; }

.lyn-indtast {
    text-align: center;
    font-family: "Rubik", sans-serif;
    font-size: 2rem;
    min-height: 1.3em;
    color: var(--accent);
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
}
.lyn-indtast.rigtig { color: var(--ok-ink); }
.lyn-indtast.forkert { color: var(--err-ink); font-size: 1.5rem; }

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 320px;
    margin: 0 auto;
}
.keypad-lille { max-width: 260px; }

.tast {
    font-family: "Rubik", sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    padding: 13px 0;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    box-shadow: var(--shadow);
}
.tast:active { background: var(--surface-2); transform: scale(0.97); }
.tast-ok { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.keypad-lille .tast { font-size: 1.2rem; padding: 9px 0; }

/* Duel-resultat (lynet) */
.duel-resultat { display: flex; gap: 12px; justify-content: center; margin: 14px 0; }
.duel-resultat > div {
    flex: 1;
    max-width: 200px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}
.duel-resultat span { font-family: "Rubik", sans-serif; font-size: 1.7rem; font-weight: 700; color: var(--accent); }
.duel-resultat small { color: var(--muted); }
.duel-resultat .vinder { border-color: var(--green); background: var(--ok-bg); }

/* ── Trappen ────────────────────────────────────────────── */

.trinliste { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; }

.trin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.trin-navn { font-family: "Rubik", sans-serif; font-weight: 600; }
.trin-status { color: var(--muted); font-size: 0.9rem; }
.trin-diplom { background: var(--ok-bg); border-color: var(--green); }
.trin-diplom .trin-status { color: var(--ok-ink); }
.trin-aktiv { border-color: var(--accent); border-width: 2px; }
.trin-aktiv .trin-status { color: var(--accent); font-weight: 600; }
.trin-laast { opacity: 0.55; cursor: default; }
.trin-top { background: var(--mint); border-color: var(--green); justify-content: center; cursor: default; }

/* ── Pladekampen ────────────────────────────────────────── */

.tur-banner {
    text-align: center;
    font-family: "Rubik", sans-serif;
    font-weight: 600;
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 10px;
}
.tur-p1 { background: var(--ok-bg); color: var(--ok-ink); }
.tur-p2 { background: var(--surface-2); color: var(--ink-2); }

.plade-rul { overflow-x: auto; padding-bottom: 6px; }

.plade {
    display: grid;
    grid-template-columns: repeat(12, minmax(34px, 1fr));
    gap: 3px;
    min-width: 460px;
}

.plade-hoved, .plade-felt {
    font: inherit;
    font-size: 0.85rem;
    padding: 0;
    height: 34px;
    border-radius: 7px;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
}
.plade-hoved { background: none; border: none; color: var(--muted); font-weight: 600; }
.plade-hoved.hoved-lys { color: var(--accent); font-weight: 700; transform: scale(1.15); }
.plade-felt { background: var(--surface); color: var(--ink-2); cursor: pointer; }
.plade-felt:not(:disabled):hover { border-color: var(--accent); }
.felt-valgt { outline: 2px solid var(--accent); }
.felt-p1 { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }
.felt-p2 { background: #3b82f6; color: #fff; border-color: #3b82f6; font-weight: 700; }
.felt-stribe { outline: 3px solid var(--warn-ink); z-index: 1; }

.opgavepanel {
    margin-top: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow);
}

/* ── Topliste ───────────────────────────────────────────── */

.klassevalg { display: flex; align-items: center; gap: 8px; margin: 10px 0 16px; }
.klassevalg select {
    font: inherit;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
}

.liste-raekke { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }

.liste-linje {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.95rem;
}
.liste-linje:last-child { border-bottom: none; }
.liste-linje > span:nth-child(2) { flex: 1; min-width: 0; }
.placering {
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Rubik", sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
}
.liste-linje:first-of-type .placering { background: var(--warn-bg); color: var(--warn-ink); }

/* Konfetti */
.konfetti {
    position: fixed;
    top: -30px;
    z-index: 99;
    pointer-events: none;
    animation: konfetti-fald 2.4s ease-in forwards;
}
@keyframes konfetti-fald {
    to { transform: translateY(105vh) rotate(340deg); opacity: 0.7; }
}

@media (max-width: 560px) {
    .lyn-spm { font-size: 2.4rem; }
    .duel-resultat { flex-direction: column; align-items: stretch; }
    .duel-resultat > div { max-width: none; }
}

/* ---------- Say the Word! (/sig-ordet) ---------- */

.ord-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.ord-frem {
    justify-self: start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 12px;
    font-weight: 700;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}
.ord-ur {
    font-family: "Rubik", sans-serif;
    font-size: 1.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.ord-mik { justify-self: end; display: flex; align-items: center; gap: 7px; font-size: 0.85rem; color: var(--muted); }
.ord-mik .prik { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.ord-mik.taendt { color: var(--accent); font-weight: 600; }
.ord-mik.taendt .prik { background: var(--accent); animation: ord-puls 1.4s infinite; }
@keyframes ord-puls {
    0% { box-shadow: 0 0 0 0 rgba(86, 163, 8, 0.4); }
    70% { box-shadow: 0 0 0 9px rgba(86, 163, 8, 0); }
    100% { box-shadow: 0 0 0 0 rgba(86, 163, 8, 0); }
}

.ord-kort {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 16px;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin: 14px 0 8px;
    box-shadow: var(--shadow);
    transition: background 0.18s, border-color 0.18s;
}
.ord-kort.god { background: var(--ok-bg); border-color: var(--ok-ink); }
.ord-kort.gal { background: var(--err-bg); border-color: var(--err-ink); }
.ord-ord {
    font-family: "Rubik", sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 15vw, 6.5rem);
    line-height: 1;
    animation: ord-pop 0.22s ease-out;
}
@keyframes ord-pop {
    from { transform: scale(0.85); opacity: 0.3; }
    to { transform: scale(1); opacity: 1; }
}

.ord-hoert { text-align: center; min-height: 1.4em; font-size: 0.9rem; color: var(--muted); }
.ord-hoert.ok { color: var(--ok-ink); font-weight: 700; }
.ord-knapper { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.puls { animation: ord-nik 0.8s infinite; }
@keyframes ord-nik { 50% { transform: scale(1.06); } }

.ord-tid {
    text-align: center;
    font-family: "Rubik", sans-serif;
    font-size: 3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.rekord {
    display: inline-block;
    background: var(--warn-bg);
    color: var(--warn-ink);
    border: 1.5px solid var(--warn-ink);
    border-radius: 999px;
    padding: 7px 16px;
    font-weight: 700;
}
.ord-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.ord-stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}
.ord-stat .tal { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ord-stat .tekst { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

.ord-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 10px 0;
}
.ord-panel h2 { font-size: 0.95rem; margin: 0 0 8px; }
.ord-tabel { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.ord-tabel th {
    text-align: left;
    color: var(--muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 8px;
    border-bottom: 1.5px solid var(--line);
}
.ord-tabel td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
#sigordet .chip:disabled { opacity: 0.45; cursor: not-allowed; }

/* Mærkat ved siden af overskriften, når sproget er låst af forsidekortet. */
.sprogmaerkat {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    background: var(--mint);
    color: var(--ok-ink);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 11px;
    font-family: "Telex", system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ---------- Forsidens spilkatalog ---------- */

.trinvaelger { margin: 18px 0 6px; }
.trin-etiket {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 7px;
}
.trin-chip { min-width: 44px; text-align: center; }

.spilgitter {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 16px 0 26px;
}
.spilkort {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}
.spilkort:hover,
.spilkort:focus-visible {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 8px 22px rgba(10, 31, 65, 0.14);
}
.spilkort img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: var(--surface-2);
}
/* Navnet ligger som overlay på billedet, med en mørk bund så teksten kan
   læses uanset hvor lyst billedet er. */
.spilkort-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px 14px;
    background: linear-gradient(to bottom, rgba(10, 31, 65, 0) 22%, rgba(10, 31, 65, 0.55) 55%, rgba(10, 31, 65, 0.92) 100%);
    color: #fff;
}
/* color skal stå eksplicit: h1-h3 får var(--ink) globalt, og det ville
   gøre titlen mørk oven på et mørkt billede. */
.spilkort-overlay h2 {
    margin: 0;
    color: #fff;
    font-size: 1.3rem;
    line-height: 1.15;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}
.spilkort-mærkat {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.92);
    color: var(--navy);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}
.spilkort-trin {
    margin: 2px 0 0;
    color: #fff;
    font-size: 0.78rem;
    opacity: 0.94;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}
.spilkort-tekst {
    margin: 0;
    padding: 11px 14px 13px;
    font-size: 0.88rem;
    color: var(--muted);
}
.forside-ekstra { margin-top: 4px; }

@media (max-width: 420px) {
    .spilgitter { grid-template-columns: 1fr; }
    .spilkort img, .spilkort-overlay { height: 132px; }
}

/* Sig tallet: gangestykket fylder kortet, med luft om gangetegnet. */
.tal-stykke { letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

/* Kig-skærmen: hele tabellen inden runden går i gang. */
.tabel-liste {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 14px;
    margin: 14px 0 4px;
}
.tabel-linje {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: baseline;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px 12px;
    font-variant-numeric: tabular-nums;
}
.tabel-linje .stykke { text-align: right; font-size: 1.05rem; }
.tabel-linje .lig { color: var(--muted); }
.tabel-linje .facit {
    font-family: "Rubik", sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent);
}
@media (max-width: 460px) {
    .tabel-liste { grid-template-columns: 1fr; gap: 5px; }
    .tabel-linje { padding: 6px 12px; }
}

/* Sætningstilstand: sætningen vises ord for ord; hørte ord markeres. */
.ord-ord.saet {
    font-size: clamp(1.5rem, 5.5vw, 2.6rem);
    line-height: 1.45;
    text-align: center;
    max-width: 100%;
}
.saet-ord { opacity: 0.9; }
.saet-ord.hoert {
    color: var(--ok-ink);
    opacity: 1;
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 5px;
}

/* ================= Tastatur Helten =================
   Skrivespillet. Ordene falder med ren CSS — @keyframes th-fald herunder er
   hele animationen, der er ingen tegneloekke i JavaScript. Farten kommer fra
   --faldtid, som serveren saetter for hvert hold.

   Fingerfarverne gaar igen paa tastaturet under banen, saa eleven kan se,
   hvilken finger der skal bruges. De er valgt, saa de kan skelnes ogsaa af
   den, der ser farver anderledes — men de staar aldrig alene: hjaelpeteksten
   under tastaturet siger ordene ("højre pegefinger"). */

.th { max-width: 900px; margin: 0 auto; }

.spil-hoved { margin-bottom: 1rem; }
.spil-hoved h1 { margin-bottom: 0.3rem; }

/* ---- niveaumenu ---- */

.th-niveauer {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
    counter-reset: none;
}

.th-niveau {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    grid-template-areas: "nr navn status" "nr bjaelke status";
    align-items: center;
    gap: 2px 10px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.th-niveau:hover:not(:disabled),
.th-niveau:focus-visible:not(:disabled) { border-color: var(--accent); }

.th-niveau.th-ivaerk { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.th-niveau.th-laast { opacity: 0.5; cursor: not-allowed; }

.th-nummer {
    grid-area: nr;
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--surface-2);
    font-weight: 700;
}

.th-navn { grid-area: navn; font-weight: 600; }
.th-status { grid-area: status; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.th-bjaelke {
    grid-area: bjaelke;
    display: block;
    height: 5px;
    border-radius: 3px;
    background: var(--surface-2);
    overflow: hidden;
}
.th-bjaelke > span { display: block; height: 100%; background: var(--accent); }
.th-bjaelke-hud { flex: 1 1 80px; max-width: 220px; }

/* ---- bogstavtavlen paa niveau 1 ---- */

.th-alfabet {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.th-alfabet li {
    display: grid;
    place-items: center;
    min-width: 46px;
    padding: 6px 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-size: 1.1rem;
    font-weight: 600;
}
.th-alfabet .th-traef { color: var(--muted); font-size: 0.7rem; font-weight: 400; }
.th-alfabet .th-mestret { background: var(--ok-bg); border-color: var(--ok-ink); color: var(--ok-ink); }
.th-alfabet .th-lukket { opacity: 0.35; }

/* ---- spillepladen ---- */

.th-plade { position: relative; }

.th-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin-bottom: 8px;
}
.th-hud .knap-diskret { margin-left: auto; }
.th-point b { font-variant-numeric: tabular-nums; }
.th-liv { color: #d24b63; letter-spacing: 3px; font-size: 1.2rem; }

.th-bane {
    --th-hoejde: 380px;
    position: relative;
    height: var(--th-hoejde);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

/* Bundlinjen: her mister man et liv. */
.th-bane::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: repeating-linear-gradient(90deg, var(--err-ink) 0 12px, transparent 12px 24px);
    opacity: 0.5;
}

.th-ord {
    position: absolute;
    top: 0;
    left: var(--spor);
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow), 0 0 0 1px var(--line);
    font-size: 1.5rem;
    font-weight: 600;
    white-space: nowrap;
    /* Ingen forsinkelse: ordene saettes i luften ét ad gangen af
       public/js/tastatur.js, saa faldet skal begynde med det samme.
       NB: en var(), der ikke er sat, goer HELE animation-linjen ugyldig —
       saa falder ordet slet ikke, og animationend kommer aldrig. */
    animation: th-fald var(--faldtid) linear 1 both;
}

@keyframes th-fald {
    from { transform: translate(-50%, -2.4em); }
    to   { transform: translate(-50%, var(--th-hoejde)); }
}

.th-frossen .th-ord { animation-play-state: paused; }

.th-ord.th-aktiv { box-shadow: var(--shadow), 0 0 0 2px var(--accent); }
.th-ord .th-skrevet { color: var(--accent); }
.th-ord .th-mellemrum { display: inline-block; min-width: 0.5em; border-bottom: 2px solid var(--line); }
.th-ord .th-skrevet.th-mellemrum { border-bottom-color: var(--accent); }

.th-ord.th-klaret,
.th-ord.th-mistet {
    animation-play-state: paused;
    opacity: 0;
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.th-ord.th-klaret { background: var(--ok-bg); color: var(--ok-ink); }
.th-ord.th-mistet { background: var(--err-bg); color: var(--err-ink); }
.th-ord.th-fejl { animation-play-state: running; background: var(--err-bg); }

.th-nedtaelling {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    font-size: 5rem;
    font-weight: 700;
    color: var(--accent);
}

/* Feltet findes kun for at kalde det bløde tastatur frem på tablet. */
.th-fanger {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* ---- tastaturet under banen ---- */

.th-tastatur {
    margin: 14px auto 0;
    display: grid;
    gap: 5px;
    max-width: 620px;
}

.th-raekke { display: flex; justify-content: center; gap: 5px; }
.th-raekke-midt { padding-left: 1.2rem; }
.th-raekke-bund { padding-left: 2.6rem; }

.th-tast {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 6px;
    border-bottom: 3px solid color-mix(in srgb, var(--ink) 18%, transparent);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
}
.th-tast-bred { width: 12rem; font-size: 0.8rem; font-weight: 400; }

/* Én farve pr. finger — samme farve på venstre og højre hånd. Farverne er
   variabler, så de følger temaet ligesom resten af siden; skrives de direkte
   her, bliver bogstaverne usynlige, når systemet står på mørkt. */
.th-f-lille  { background: var(--finger-lille); }
.th-f-ring   { background: var(--finger-ring); }
.th-f-lang   { background: var(--finger-lang); }
.th-f-peg    { background: var(--finger-peg); }
.th-f-tommel { background: var(--surface-2); }

.th-tast.th-naeste {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
    transform: translateY(1px);
}

.th-fingerhjaelp { text-align: center; color: var(--muted); margin-top: 10px; }

/* ---- mellem- og slutskærme ---- */

.th-mellemskaerm { max-width: 460px; margin: 6vh auto 0; text-align: center; }
.th-mellemskaerm h1 { margin-bottom: 0.4rem; }
.th-tal { font-size: 1.25rem; font-weight: 600; margin: 0 0 0.3rem; }
.th-fejring h1 { color: var(--accent); }

@media (max-width: 640px) {
    .th-bane { --th-hoejde: 300px; }
    .th-ord { font-size: 1.2rem; }
    .th-tast { width: 1.9rem; height: 2.1rem; font-size: 0.8rem; }
    .th-tast-bred { width: 9rem; }
    .th-raekke-midt { padding-left: 0.9rem; }
    .th-raekke-bund { padding-left: 2rem; }
    .th-niveauer { grid-template-columns: 1fr; }
}

/* Nogle elever bliver utilpasse af bevægelse. Spillet kan ikke undvære
   faldet, men alt det andet holder op med at røre på sig. */
@media (prefers-reduced-motion: reduce) {
    .th-ord.th-klaret, .th-ord.th-mistet { transition: none; }
    .th-tast.th-naeste { transform: none; }
}

/* ---------- Ordforråd fra bøger (/ordforraad) ---------- */

.bogliste { display: grid; gap: 8px; margin-bottom: 4px; }
.bogkort {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 11px 14px;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.bogkort:hover { border-color: var(--accent); }
.bogkort.valgt { border-color: var(--accent); background: var(--mint); }
.bogkort-tekst { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bogkort-titel { font-family: "Rubik", sans-serif; font-weight: 600; font-size: 1.02rem; }
/* Omslaget har bogformat; en fast højde holder listen rolig, uanset billedet. */
.bogkort-omslag {
    flex: 0 0 auto;
    width: 44px;
    height: 66px;
    object-fit: cover;
    border-radius: 5px;
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.bogkort-omslag-tom {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.bogkort-under { font-size: 0.82rem; color: var(--muted); }
.bogkort.valgt .bogkort-under { color: var(--ok-ink); }

/* Gloser er længere end enkeltord, så kortet skal kunne bryde linjen. */
#ordforraad .ord-kort { text-align: center; }
#ordforraad .ord-ord { line-height: 1.1; }
#ordforraad .ord-ord.lille-ord { font-size: clamp(2rem, 8vw, 3.4rem); }
.ord-betydning {
    margin-top: 10px;
    font-size: 1.05rem;
    color: var(--muted);
    min-height: 1.3em;
}
#oversprungne .chip small { color: var(--muted); font-weight: 400; }

/* ── Placering i klassen («du er nr. 2») — Sig tallet ───── */

.placering-linje { margin: 6px 0 0; font-size: 0.92rem; font-weight: 600; color: var(--ink-2); }
.placering-linje:empty { display: none; }
.placering-runde { text-align: center; margin: 10px 0 0; }
.placering-badge {
    display: inline-block;
    background: var(--ok-bg);
    color: var(--ok-ink);
    border: 1.5px solid var(--ok-ink);
    border-radius: 999px;
    padding: 7px 16px;
    font-weight: 700;
}

/* ── Klassekonkurrencen: ugens point og klassemålet — Sig tallet ── */

.ugekort {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    margin: 14px 0 4px;
}
.ugekort-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.ugebar { height: 8px; border-radius: 99px; background: var(--surface-2); margin: 8px 0 10px; overflow: hidden; }
.ugebar-fyld { height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width 0.4s ease; }
.ugeveje { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }
.ugeveje li { display: grid; grid-template-columns: 7.2em 1fr auto; gap: 8px; padding: 3px 0; align-items: baseline; }
.ugeveje .vej { font-weight: 600; }
.ugeveje .hvad { color: var(--muted); }
.ugeveje li.tom strong { color: var(--muted); font-weight: 400; }
.ugetrin { margin: 6px 0 0; color: var(--ink-2); font-weight: 600; }
.ugemaal { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-2); }
.chip.klaret:not(.valgt) { border-color: var(--accent); }

@media (max-width: 480px) {
    .ugeveje li { grid-template-columns: 1fr auto; }
    .ugeveje .hvad { grid-column: 1 / -1; grid-row: 2; font-size: 0.82rem; }
}

/* ── Sig tallet: 15 sekunders straf pr. stykke sprunget over ── */

.straf-blink {
    text-align: center;
    margin: 6px 0 0;
    min-height: 1.3em;
    font-weight: 700;
    color: var(--err-ink);
    opacity: 0;
}
.straf-blink.vis { animation: straf-blink 1.8s ease-out forwards; }
@keyframes straf-blink {
    0% { opacity: 0; transform: scale(0.9); }
    15% { opacity: 1; transform: scale(1.1); }
    70% { opacity: 1; transform: none; }
    100% { opacity: 0.6; transform: none; }
}

/* ── Guiden til mikrofonen (/mikrofon) ───────────────────── */

.mikrofon-guide { max-width: 720px; margin: 0 auto; }
.guide-kort { margin: 14px 0; }
.guide-kort h2 { margin-top: 0; font-size: 1.1rem; }
.mikrofon-guide .enhed { font-weight: 600; margin: 4px 0 8px; }
.tjekliste { list-style: none; margin: 0 0 8px; padding: 0; font-size: 0.92rem; }
.tjekliste li { padding: 2px 0; }
.tjekliste li.ok { color: var(--ok-ink); }
.tjekliste li.fejl { color: var(--err-ink); font-weight: 600; }
.tjekliste li.maaske { color: var(--muted); }
.guide-valg summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.guide-valg label { display: inline-flex; flex-direction: column; gap: 4px; margin: 8px 12px 0 0; font-size: 0.85rem; }
.guide-valg select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: inherit; font: inherit; }
.guide-test { margin: 10px 0 14px; }
.niveaubar { height: 10px; border-radius: 99px; background: var(--surface-2); margin: 10px 0 6px; overflow: hidden; }
.niveaubar div { height: 100%; width: 0; background: var(--accent); transition: width 0.08s linear; }
.testsvar { margin: 6px 0 0; font-weight: 600; }
.guide-trin { margin: 0; padding-left: 22px; }
.guide-trin > li { margin: 0 0 12px; line-height: 1.5; }
.guide-trin > li > span { display: block; margin-top: 4px; }
.guide-trin > li > span.skjult, .guide-tips li.skjult { display: none; }
.guide-tips { margin: 0; padding-left: 20px; line-height: 1.5; }
.guide-tips li { margin-bottom: 6px; }
.mikrofon-guide .fremhaevet { background: var(--warn-bg); border-left: 4px solid var(--warn-ink); padding: 6px 10px; border-radius: 6px; }
.mikrofon-guide .kopi { margin-top: 8px; }
.lille-knap { padding: 6px 12px; font-size: 0.88rem; }

/* Et fremhaevet trin inde i et fremhaevet trin: kun den ydre ramme. */
.mikrofon-guide .fremhaevet .fremhaevet { background: none; border-left: 0; padding: 0; }


/* ── Regnespillene: Restjagten, Talmaskinen, Mønsterjagten ─────────── */

.niveau-chip small { color: inherit; opacity: 0.8; font-weight: 400; }
#niveautekst { min-height: 1.3em; margin: 8px 0 0; }
.regnespil-opgave { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.regnespil-opgave .keypad { margin-top: 4px; }

/* Svarfelter: «hver får» og «tilovers» side om side. */
.svarfelter { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.svarfelt {
    min-width: 128px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: var(--surface-2);
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 8px 14px;
    cursor: pointer;
}
.svarfelt.aktivt { border-color: var(--accent); }
.svarfelt-etiket { font-size: 0.8rem; color: var(--muted); }
.svarfelt-tal { font-family: "Rubik", sans-serif; font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1.2em; }

.rj-feedback { text-align: center; font-weight: 600; min-height: 0; }
.rj-feedback:empty { display: none; }
.rj-feedback.rigtig { color: var(--ok-ink); background: var(--ok-bg); border-radius: 10px; padding: 8px 12px; }
.rj-feedback.forkert { color: var(--err-ink); background: var(--err-bg); border-radius: 10px; padding: 8px 12px; }

/* Restjagten */
.rj-mission { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 8px 12px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.rj-mission strong { font-family: "Rubik", sans-serif; font-size: 1.15rem; }
.rj-total { text-align: center; display: flex; flex-direction: column; align-items: center; }
.rj-tal { font-family: "Rubik", sans-serif; font-size: 3rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.rj-kort { display: flex; justify-content: center; gap: 10px; }
.rj-kortet {
    width: 84px; height: 84px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--ink);
    font: inherit; cursor: pointer; box-shadow: var(--shadow);
}
.rj-kortet:disabled { cursor: default; }
.rj-kortet.valgt { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rj-kortet-tal { font-family: "Rubik", sans-serif; font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.rj-stykke, .rj-spm { text-align: center; font-family: "Rubik", sans-serif; font-weight: 600; font-size: 1.15rem; margin: 2px 0 0; }
.rj-historie { text-align: center; font-size: 1.05rem; margin: 6px 0 0; }
.rj-bunkeknap { align-self: center; }
.rj-alle { text-align: center; color: var(--ink-2); margin: 0; }
.rj-bunker { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rj-plader { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.rj-plade {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: var(--surface-2); border-radius: 10px; padding: 6px 6px 4px; min-width: 34px;
}
.rj-plade small { font-size: 0.68rem; }
.rj-bolle {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--green); display: inline-block;
    animation: rj-bolle-ind 0.25s ease-out both;
}
.rj-rest { background: var(--warn-ink); }
.rj-kurv {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px;
    background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 6px 12px;
}
.rj-kurv small { width: 100%; text-align: center; font-size: 0.75rem; }
@keyframes rj-bolle-ind { from { transform: translateY(-8px) scale(0.6); opacity: 0; } }

/* Talmaskinen */
.tm-maskine { display: flex; flex-direction: column; align-items: center; gap: 0; }
.tm-ind, .tm-ud {
    background: var(--accent); color: var(--on-accent);
    font-family: "Rubik", sans-serif; font-weight: 600; font-size: 0.8rem;
    padding: 3px 14px; border-radius: 6px; position: relative; z-index: 1;
}
.tm-krop {
    width: min(260px, 100%); height: 120px; margin: -6px 0;
    background: var(--surface-2); border: 2px solid var(--line); border-radius: 18px;
    display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr 1fr; align-items: center; justify-items: center;
}
.tm-skrue { width: 14px; height: 14px; border-radius: 50%; background: var(--green); opacity: 0.55; }
.tm-krop .tm-skrue:nth-child(1) { grid-area: 1 / 1; }
.tm-krop .tm-skrue:nth-child(2) { grid-area: 1 / 3; }
.tm-krop .tm-skrue:nth-child(4) { grid-area: 2 / 1; }
.tm-krop .tm-skrue:nth-child(5) { grid-area: 2 / 3; }
.tm-vindue {
    grid-area: 1 / 2 / 3 / 3;
    min-width: 76px; height: 76px; padding: 0 10px; border-radius: 38px;
    background: var(--surface); border: 2px solid var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.tm-regel { font-family: "Rubik", sans-serif; font-size: 1.6rem; font-weight: 700; white-space: nowrap; }
.tm-maskine.baglaens .tm-regel, .tm-maskine.knaekket .tm-regel, .tm-maskine.opgivet .tm-regel { font-size: 1.15rem; }
.tm-maskine.knaekket .tm-vindue { background: var(--ok-bg); border-color: var(--green); }
.tm-udtal {
    margin-top: 6px; min-width: 64px; min-height: 1.6em; padding: 2px 12px; border-radius: 8px;
    background: var(--mint); color: var(--ok-ink); text-align: center;
    font-family: "Rubik", sans-serif; font-size: 1.4rem; font-weight: 700;
}
.tm-udtal:empty { visibility: hidden; }
.tm-udtal.tm-klonk { background: var(--warn-bg); color: var(--warn-ink); font-size: 1.05rem; }
.tm-maskine.tygger .tm-krop { animation: tm-tyg 0.45s ease; }
@keyframes tm-tyg { 25% { transform: translateX(-3px) rotate(-1deg); } 50% { transform: translateX(3px) rotate(1deg); } 75% { transform: translateX(-2px); } }
.tm-tabel { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-par {
    display: inline-flex; align-items: baseline; gap: 6px;
    background: var(--surface-2); border-radius: 8px; padding: 5px 10px;
    font-variant-numeric: tabular-nums;
}
.tm-par-ind, .tm-par-ud { font-family: "Rubik", sans-serif; font-weight: 700; font-size: 1.05rem; }
.tm-par-ud.tm-klonk { color: var(--warn-ink); font-weight: 600; font-size: 0.9rem; }
.tm-gratis { outline: 1px dashed var(--accent); }
.tm-par.blink { animation: tm-blink 0.6s ease; }
@keyframes tm-blink { 50% { background: var(--mint); } }
.tm-ok { color: var(--ok-ink); font-weight: 700; }
.tm-nej { color: var(--err-ink); font-size: 0.85rem; }
.tm-status { margin: 0; text-align: center; }
.tm-gaet { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.tm-trin .spil-etiket { margin-top: 0; }
.tm-ops .chip { font-size: 1.25rem; min-width: 52px; font-weight: 700; }
.tm-tal .chip { min-width: 40px; }
.tm-opgiv { align-self: center; }

/* Mønsterjagten */
.mj-spm { text-align: center; font-family: "Rubik", sans-serif; font-size: 1.2rem; font-weight: 600; margin: 4px 0 0; }
.mj-foelge { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.mj-tal {
    min-width: 56px; padding: 10px 8px; border-radius: 12px;
    background: var(--surface-2); text-align: center;
    font-family: "Rubik", sans-serif; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.mj-skjult { background: var(--surface); border: 2px dashed var(--accent); color: var(--accent); }
.mj-ramt { background: var(--ok-bg); color: var(--ok-ink); }
.mj-vist { background: var(--err-bg); color: var(--err-ink); }
.mj-hop { display: flex; justify-content: center; gap: 38px; color: var(--muted); font-size: 0.85rem; margin-top: -4px; }
.mj-figurer { display: flex; justify-content: center; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.mj-figur { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mj-figur svg { max-width: 100%; height: auto; }
.mj-antal { font-family: "Rubik", sans-serif; font-size: 1.05rem; }
.mj-klods { fill: var(--green); stroke: var(--surface); stroke-width: 1.5; }
.mj-ny { fill: #f2c94c; }
.mj-hint { text-align: center; margin: 0; }
.mj-trin { display: flex; flex-direction: column; gap: 10px; }
.mj-regel .chips { justify-content: center; }
.mj-regel p { text-align: center; margin: 4px 0; }
.mj-valg:disabled { cursor: default; opacity: 1; }
.mj-valg.mj-rigtig { background: var(--ok-bg); border-color: var(--green); color: var(--ok-ink); font-weight: 600; }
.mj-valg.mj-forkert { background: var(--err-bg); border-color: var(--err-ink); color: var(--err-ink); }
.mj-ok { color: var(--ok-ink); font-weight: 600; }
.mj-nej { color: var(--err-ink); }
.mj-spring {
    display: flex; flex-direction: column; gap: 8px;
    border: 2px solid var(--accent); border-radius: 14px; padding: 12px; background: var(--surface);
}
.mj-spring-etiket { margin: 0; font-family: "Rubik", sans-serif; font-weight: 600; font-size: 0.8rem; letter-spacing: 0.06em; color: var(--accent); text-align: center; }
.mj-spring .knap-diskret { align-self: center; }

/* Slutskærmen */
.slut-stat { list-style: none; padding: 0; margin: 10px 0 14px; text-align: center; color: var(--ink-2); }
.slut-stat li { padding: 2px 0; }
.slut-linje { text-align: center; }
.duel-resultat .kort-navn { font-family: "Rubik", sans-serif; }

/* ── Udfordringer ───────────────────────────────────────── */

.udf-online { margin-top: 22px; padding-top: 4px; border-top: 1px solid var(--line); }
.onlineliste { display: flex; flex-direction: column; gap: 6px; }
.online-raekke {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface-2); border-radius: 10px; padding: 7px 10px;
}
.online-navn { flex: 1; min-width: 0; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.online-navn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.online-raekke.egen-klasse { background: var(--mint); }
.online-knap { flex: none; }

.kampstilling {
    background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin: 6px 0 4px;
    display: flex; flex-direction: column; gap: 6px;
}
.kamp-raekke { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "navn point" "spor spor" "hvor hvor"; gap: 2px 8px; }
.kamp-navn { grid-area: navn; font-weight: 600; }
.kamp-point { grid-area: point; font-family: "Rubik", sans-serif; font-variant-numeric: tabular-nums; }
.kamp-spor { grid-area: spor; height: 8px; border-radius: 99px; background: var(--surface); overflow: hidden; }
.kamp-fyld { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.4s ease; }
.kamp-anden .kamp-fyld { background: #3b82f6; }
.kamp-hvor { grid-area: hvor; }
.kamp-linje { margin: 0; color: var(--ink-2); font-weight: 600; }
.kamp-linje:empty { display: none; }

.udf-boks {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(7, 22, 48, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.udf-kort {
    width: min(380px, 100%);
    background: var(--surface); color: var(--ink);
    border: 2px solid var(--accent); border-radius: 18px;
    padding: 22px 20px 16px; text-align: center;
    box-shadow: 0 12px 40px rgba(7, 22, 48, 0.35);
    animation: udf-ind 0.25s ease-out;
}
.udf-etiket { margin: 0 0 6px; font-family: "Rubik", sans-serif; font-weight: 600; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.udf-kort h2 { margin: 0 0 6px; font-size: 1.3rem; text-wrap: balance; }
.udf-kort p { margin: 0 0 12px; }
.udf-knapper { display: flex; gap: 10px; justify-content: center; }
.udf-knapper .knap { flex: 1; }
.udf-tid { margin-top: 12px; }
.udf-tidspor { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
#udf-tidfyld { height: 100%; width: 100%; background: var(--accent); border-radius: 99px; transition: width 0.25s linear; }
.udf-tid p { margin: 6px 0 0; }
@keyframes udf-ind { from { transform: translateY(12px) scale(0.97); opacity: 0; } }

.udf-banner {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 80;
    background: var(--accent); color: var(--on-accent);
    border-radius: 99px; padding: 9px 18px; font-weight: 600; box-shadow: var(--shadow);
    max-width: calc(100% - 32px);
}
.udf-banner a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
    .rj-bolle, .udf-kort, .tm-maskine.tygger .tm-krop, .tm-par.blink { animation: none; }
}
@media (max-width: 560px) {
    .rj-kortet { width: 74px; height: 74px; }
    .rj-tal { font-size: 2.5rem; }
    .svarfelt { min-width: 110px; }
    .mj-tal { min-width: 46px; font-size: 1.3rem; }
    .mj-hop { gap: 28px; }
}
.topliste-under { margin: 10px 0 2px; }
