/* Vinterknopp-duellen – mobil først. Mørk vinterskumring, lys «snøkort» for lesestoff. */

:root {
    --night: #0c1729;
    --deep: #1a3150;
    --frost: #e9f1fa;
    --mist: #a8bbd2;
    --snow: #f7fafd;
    --ink: #14233a;
    --amber: #f4bf5a;
    --amber-d: #e08f2e;
    --rowan: #d9483b;
    --pine: #38a878;
    --pine-d: #1d7a55;
    --glass: rgba(255, 255, 255, 0.07);
    --glass-2: rgba(255, 255, 255, 0.12);
    --line: rgba(255, 255, 255, 0.15);
    --radius: 20px;
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

html {
    background: var(--night);
    color: var(--frost);
    font: 16px/1.45 var(--sans);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100dvh;
    background:
        linear-gradient(180deg, #0f1d33 0%, #152a49 55%, #1c3659 100%);
    background-attachment: fixed;
    overscroll-behavior-y: none;
}

#snow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

#app {
    position: relative;
    z-index: 1;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.005em;
}

p {
    margin: 0;
}

button {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 3px solid #8fd0ff;
    outline-offset: 2px;
}

.muted { color: var(--mist); }
.center { text-align: center; }
.small { font-size: 0.85rem; }

.eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--amber);
    font-weight: 700;
}

.lead {
    color: #cfdcec;
    font-size: 1.02rem;
}

/* ---------- Skjermramme ---------- */

.screen {
    max-width: 520px;
    margin: 0 auto;
    padding: max(14px, var(--safe-top)) 16px calc(28px + var(--safe-bottom));
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: rise 0.35s ease both;
}

.center-screen {
    align-items: center;
    justify-content: center;
    text-align: center;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.bar {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 8px;
}

.bar h1 {
    text-align: center;
    font-size: 1.35rem;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--glass);
    border: 1px solid var(--line);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.icon-btn:active { transform: scale(0.92); background: var(--glass-2); }
.icon { display: block; }

/* ---------- Knapper ---------- */

.btn {
    min-height: 52px;
    padding: 12px 20px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--glass);
    font-weight: 650;
    font-size: 1.02rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-wide { width: 100%; }

.btn-primary {
    color: #2a1a00;
    border-color: #f9d58c;
    background: linear-gradient(180deg, #ffd272 0%, var(--amber) 55%, #eea43e 100%);
    box-shadow: 0 4px 0 #a45f12, 0 8px 18px rgba(0, 0, 0, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #a45f12, 0 3px 8px rgba(0, 0, 0, 0.25);
}

.btn-ghost:active:not(:disabled) { background: var(--glass-2); transform: scale(0.98); }

.btn-danger { color: #ffb4ab; }

.panel {
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(6px);
}

.panel h2 {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-input {
    width: 100%;
    min-height: 52px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1.5px solid var(--line);
    background: rgba(0, 0, 0, 0.22);
    color: var(--frost);
    font: inherit;
    font-size: 1.1rem;
}

.text-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(244, 191, 90, 0.25); }
.code-input { text-align: center; letter-spacing: 0.4em; font-size: 1.5rem; font-weight: 700; text-transform: uppercase; }
.form-error { color: #ffb4ab; font-size: 0.92rem; }

/* ---------- Hjem ---------- */

.home { gap: 12px; }

.home-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.home-tools { display: flex; gap: 8px; }

.chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--line);
    cursor: pointer;
    text-align: left;
    min-height: 44px;
    justify-content: center;
}

.chip-name { font-weight: 700; line-height: 1.1; }
.chip small { color: var(--amber); font-size: 0.74rem; letter-spacing: 0.05em; }

.hero {
    position: relative;
    border-radius: 28px;
    overflow: hidden;
    aspect-ratio: 16 / 11;
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    background: #0b1424;
}

.hero canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.12) translateY(-4%);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(8, 16, 32, 0.72) 0%, rgba(8, 16, 32, 0.1) 52%, rgba(8, 16, 32, 0) 100%);
}

.hero-text {
    position: absolute;
    z-index: 2;
    left: 18px;
    top: 14px;
    right: 18px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.hero-text h1 {
    font-size: clamp(1.9rem, 8.4vw, 2.6rem);
    line-height: 1.02;
    font-weight: 700;
    color: #fff;
}

.hero-text p {
    margin-top: 6px;
    color: #e5eefb;
    font-size: 0.98rem;
}

.rank-bar {
    height: 5px;
    border-radius: 99px;
    background: var(--glass-2);
    overflow: hidden;
    margin: -2px 6px 2px;
}

.rank-bar i {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #ffd272, var(--amber-d));
}

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

.menu-card {
    display: grid;
    grid-template-columns: 46px 1fr 20px;
    align-items: center;
    gap: 14px;
    min-height: 70px;
    padding: 10px 14px;
    text-align: left;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s, border-color 0.15s;
}

.menu-card:active { transform: scale(0.985); background: var(--glass-2); }

.mc-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, rgba(244, 191, 90, 0.28), rgba(244, 191, 90, 0.08));
    color: var(--amber);
}

.mc-text { display: flex; flex-direction: column; min-width: 0; }
.mc-text b { font-size: 1.08rem; }
.mc-text small { color: var(--mist); font-size: 0.86rem; line-height: 1.3; }
.mc-chev { color: var(--mist); transform: rotate(180deg); }
.mc-chev .icon { width: 18px; height: 18px; }

.home-foot {
    text-align: center;
    color: var(--mist);
    font-size: 0.86rem;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.streak {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #ffb27a;
    font-weight: 700;
}

.streak .icon { width: 16px; height: 16px; fill: currentColor; }

/* ---------- Solo ---------- */

.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.cat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
    padding: 12px 14px;
    min-height: 74px;
    border-radius: 16px;
    background: var(--glass);
    border: 1.5px solid var(--line);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.08s;
}

.cat:first-child, .cat:last-child { grid-column: 1 / -1; }
.cat small { color: var(--mist); font-size: 0.8rem; line-height: 1.25; }
.cat:active { transform: scale(0.98); }
.cat.active {
    border-color: var(--amber);
    background: rgba(244, 191, 90, 0.13);
    box-shadow: 0 0 0 3px rgba(244, 191, 90, 0.12);
}

.start-row { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    padding: 4px 12px;
    border-radius: 99px;
    background: rgba(217, 72, 59, 0.2);
    border: 1px solid rgba(217, 72, 59, 0.5);
    font-size: 0.9rem;
}

/* ---------- Spill ---------- */

.game {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: max(12px, var(--safe-top)) 14px calc(24px + var(--safe-bottom));
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game.enter .g-card { animation: cardIn 0.35s ease both; }
.game.enter .g-options { animation: cardIn 0.35s 0.05s ease both; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

.game.shake .g-card { animation: shake 0.45s ease; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-9px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(3px); }
}

.g-top {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 10px;
}

.g-progress { display: flex; flex-direction: column; min-width: 0; }
.g-progress small { color: var(--mist); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-count { font-weight: 700; font-size: 1.02rem; }

.g-dots { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.g-dots .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--glass-2); transition: background 0.2s, transform 0.2s; }
.g-dots .dot.now { background: #fff; transform: scale(1.25); }
.g-dots .dot.good { background: var(--pine); }
.g-dots .dot.bad { background: var(--rowan); }
.g-dots.hearts { gap: 2px; margin-top: 2px; }
.g-dots.hearts span { color: rgba(255, 255, 255, 0.25); }
.g-dots.hearts span.on { color: var(--rowan); }
.g-dots.hearts .icon { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.g-dots.hearts span.on .icon { filter: none; }

.g-score { position: relative; text-align: right; line-height: 1; }
.g-score .num { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
.g-score small { display: block; color: var(--mist); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }

.g-gain {
    position: absolute;
    right: 0;
    top: -4px;
    font-weight: 800;
    color: #9be3b4;
    opacity: 0;
    pointer-events: none;
}

.g-gain.go { animation: gain 1.1s ease-out both; }

@keyframes gain {
    0% { opacity: 0; transform: translateY(14px) scale(0.8); }
    20% { opacity: 1; transform: translateY(0) scale(1.15); }
    100% { opacity: 0; transform: translateY(-26px) scale(1); }
}

.g-timer {
    height: 7px;
    border-radius: 99px;
    background: var(--glass);
    overflow: hidden;
}

.g-timer i {
    display: block;
    height: 100%;
    transform-origin: left;
    border-radius: 99px;
    background: linear-gradient(90deg, #7dd3fc, #9be3b4);
}

.g-timer.warn i { background: linear-gradient(90deg, #ffd272, var(--amber-d)); }
.g-timer.danger i { background: linear-gradient(90deg, #ff8a7a, var(--rowan)); animation: pulse 0.5s ease-in-out infinite alternate; }

@keyframes pulse { from { opacity: 0.65; } to { opacity: 1; } }

.g-live {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--line);
    font-size: 0.82rem;
}

.live-row { display: grid; grid-template-columns: minmax(60px, 90px) 1fr 52px; align-items: center; gap: 8px; }
.live-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.live-bar { height: 6px; border-radius: 99px; background: var(--glass-2); overflow: hidden; }
.live-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7dd3fc, #c4b5fd); transition: width 0.5s ease; }
.live-row.done .live-bar i { background: var(--pine); }
.live-score { text-align: right; font-variant-numeric: tabular-nums; color: var(--amber); font-weight: 700; }

.g-card {
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.g-kind { display: flex; align-items: center; justify-content: space-between; min-height: 28px; padding: 0 4px; }

.pill {
    padding: 3px 12px;
    border-radius: 99px;
    background: rgba(244, 191, 90, 0.16);
    border: 1px solid rgba(244, 191, 90, 0.4);
    color: var(--amber);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 800;
}

.g-kind .streak { font-size: 0.86rem; }

.g-tabs { display: flex; gap: 6px; }

.tab {
    flex: 1;
    min-height: 40px;
    border-radius: 12px;
    border: 1.5px solid var(--line);
    background: var(--glass);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.86rem;
    font-weight: 650;
    cursor: pointer;
}

.tab .icon { width: 15px; height: 15px; }
.tab em { font-style: normal; color: #ff9a8c; font-size: 0.78rem; font-weight: 800; }
.tab.locked { border-style: dashed; color: var(--mist); }
.tab.active { border-color: var(--amber); background: rgba(244, 191, 90, 0.15); color: var(--frost); }

.g-stage {
    position: relative;
    width: min(100%, 46dvh);
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 18px;
    overflow: hidden;
    background: #0b1424;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: box-shadow 0.25s, width 0.35s ease;
}

.g-canvas { width: 100%; height: 100%; display: block; animation: fadeIn 0.35s ease both; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.g-stage.flash-good { box-shadow: 0 0 0 3px var(--pine), 0 10px 28px rgba(0, 0, 0, 0.4); }
.g-stage.flash-bad { box-shadow: 0 0 0 3px var(--rowan), 0 10px 28px rgba(0, 0, 0, 0.4); }

.g-prompt {
    text-align: center;
    font-family: var(--serif);
    font-size: 1.12rem;
    padding: 0 6px;
}

.g-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.opt {
    position: relative;
    min-height: 60px;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--glass-2);
    border: 1.5px solid var(--line);
    text-align: left;
    font-weight: 650;
    font-size: 1.04rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: transform 0.08s, background 0.15s, border-color 0.15s;
}

.opt:active:not(:disabled) { transform: scale(0.97); background: rgba(255, 255, 255, 0.2); }

.opt kbd {
    display: none;
    position: absolute;
    right: 8px;
    top: 6px;
    font: 600 0.7rem var(--sans);
    color: var(--mist);
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .opt kbd { display: block; }
    .opt:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.35); }
}

.opt.correct { background: linear-gradient(180deg, #3fb884, var(--pine-d)); border-color: #8fe3bd; }
.opt.wrong { background: linear-gradient(180deg, #e5675b, #a8332a); border-color: #ffb4ab; }
.opt.dim { opacity: 0.4; }

.g-options.two { grid-template-columns: 1fr 1fr; }

.opt-arr {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    padding: 10px 8px 12px;
}

.opt-arr .arr-diagram { width: 92px; height: 78px; }
.opt-arr small { color: var(--mist); font-weight: 500; font-size: 0.76rem; line-height: 1.25; }
.opt-arr.correct small, .opt-arr.wrong small { color: #fff; }

.arr-diagram { display: block; }

.is-answered .g-options { display: none; }
.is-answered .g-prompt, .is-answered .g-tabs { display: none; }
.is-answered .g-stage { width: min(100%, 24dvh); }

/* ---------- Tilbakemeldingsark ---------- */

.g-sheet {
    background: var(--snow);
    color: var(--ink);
    border-radius: 22px;
    padding: 14px 14px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
}

.g-sheet.in { animation: sheetIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }

@keyframes sheetIn {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: none; }
}

.sheet-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--serif);
}

.sheet-head strong { font-size: 1.5rem; }
.sheet-head.good strong { color: var(--pine-d); }
.sheet-head.bad strong { color: #b3362c; }
.sheet-pts { font-weight: 800; font-size: 1.25rem; color: #b9700f; font-family: var(--sans); }
.sheet-pts small { font-weight: 500; font-size: 0.74rem; color: #5b6b82; }
.sheet-pts.bad { color: #8392a8; }
.sheet-detail { font-weight: 650; font-size: 1.05rem; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs figure { margin: 0; text-align: center; }
.thumbs canvas { width: 100%; aspect-ratio: 1; border-radius: 10px; display: block; animation: fadeIn 0.3s ease both; }
.thumbs figcaption { font-size: 0.72rem; color: #5b6b82; margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; }

.g-sheet p { font-size: 0.94rem; line-height: 1.45; }
.sheet-tip.strong {
    background: #fff3d6;
    border: 1px solid #f0cf86;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 600;
}

.sheet-more summary { cursor: pointer; font-weight: 650; color: #35557f; padding: 4px 0; min-height: 32px; }
.sheet-more p { margin-top: 6px; }
.fact, .sheet-more .fact { color: #4b5d76; font-style: italic; }

.g-sheet .btn-primary {
    position: sticky;
    bottom: max(10px, var(--safe-bottom));
    margin: 4px 0 12px;
    z-index: 2;
}

/* ---------- Resultat ---------- */

.res-hero { text-align: center; display: flex; flex-direction: column; gap: 6px; padding-top: 8px; align-items: center; }
.res-hero h1 { font-size: 1.8rem; line-height: 1.1; }
.res-score { display: flex; flex-direction: column; align-items: center; margin: 4px 0; }
.big-num { font-family: var(--serif); font-size: 4.6rem; font-weight: 700; line-height: 1; color: var(--amber); font-variant-numeric: tabular-nums; }
.res-score small { color: var(--mist); }
.res-sub { color: #cfdcec; }
.res-note { color: #9be3b4; font-weight: 700; }
.res-rank { color: var(--mist); font-size: 0.9rem; }
.res-rank small { font-size: inherit; }
.res-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

.recap { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recap li {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.recap .mark {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.recap .good .mark { background: rgba(56, 168, 120, 0.25); color: #9be3b4; }
.recap .bad .mark { background: rgba(217, 72, 59, 0.25); color: #ffb4ab; }
.recap .what { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.recap .what small { color: var(--mist); font-size: 0.8rem; }
.recap .pts { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--amber); }
.recap .bad .pts { color: var(--mist); }

/* ---------- Tavle ---------- */

.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.board li {
    display: grid;
    grid-template-columns: 34px 1fr auto 62px;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
}

.board li.gap { display: block; text-align: center; background: none; color: var(--mist); padding: 0; }
.board li.me { border-color: var(--amber); background: rgba(244, 191, 90, 0.12); }
.board .rank { font-weight: 800; color: var(--mist); text-align: center; }
.board .gold .rank { color: #ffd45e; }
.board .silver .rank { color: #d6dde8; }
.board .bronze .rank { color: #e3a06b; }
.board .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.board .who em, .duel-board em { font-style: normal; color: var(--amber); font-weight: 500; }
.board .ok { color: var(--mist); font-size: 0.84rem; }
.board .pts { text-align: right; font-weight: 800; color: var(--amber); font-variant-numeric: tabular-nums; }

.tabs-row { display: flex; gap: 6px; background: rgba(0, 0, 0, 0.22); padding: 4px; border-radius: 14px; }
.tab-btn { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-weight: 650; color: var(--mist); }
.tab-btn.active { background: var(--glass-2); color: var(--frost); }

.hero-panel { gap: 10px; }
.your-best { font-weight: 700; color: var(--amber); }

.mission { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.mission-item, .found-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: 30px 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    text-align: left;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1.5px solid var(--line);
    cursor: pointer;
    min-height: 56px;
}

.mission-item small { display: block; color: var(--mist); font-size: 0.82rem; line-height: 1.3; }

.box {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: 2px solid var(--line);
    display: grid;
    place-items: center;
    color: transparent;
    transition: all 0.2s;
}

.box .icon { width: 18px; height: 18px; stroke-width: 3; }
.mission-item.found, .found-toggle.on { border-color: var(--pine); background: rgba(56, 168, 120, 0.14); }
.mission-item.found .box, .found-toggle.on .box { background: var(--pine); border-color: var(--pine); color: #fff; }

/* ---------- Duell ---------- */

.code-panel { text-align: center; align-items: center; }

.code-tiles { display: flex; gap: 8px; justify-content: center; }

.code-tiles span {
    width: 52px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--snow);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 2.2rem;
    font-weight: 700;
    box-shadow: 0 5px 0 #b9c6d6;
    animation: tile 0.5s ease both;
}

.code-tiles span:nth-child(2) { animation-delay: 0.05s; }
.code-tiles span:nth-child(3) { animation-delay: 0.1s; }
.code-tiles span:nth-child(4) { animation-delay: 0.15s; }
.code-tiles span:nth-child(5) { animation-delay: 0.2s; }

@keyframes tile { from { opacity: 0; transform: translateY(-14px) rotate(-6deg); } to { opacity: 1; transform: none; } }

.row-btns { display: flex; gap: 8px; width: 100%; }
.row-btns .btn { flex: 1; }

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.players li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); animation: rise 0.3s ease both; }
.players li.me { border: 1px solid rgba(244, 191, 90, 0.5); }
.players em { font-style: normal; color: var(--amber); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(160deg, #7dd3fc, #6366f1); color: #fff; font-weight: 800; }
.pname { flex: 1; font-weight: 650; }
.badge { padding: 2px 10px; border-radius: 99px; font-size: 0.72rem; background: rgba(244, 191, 90, 0.18); color: var(--amber); font-weight: 700; }
.badge.motsatt { background: rgba(217, 72, 59, 0.2); color: #ffb4ab; }
.badge.spredt { background: rgba(244, 191, 90, 0.18); color: var(--amber); }
.badge.found { background: rgba(56, 168, 120, 0.22); color: #9be3b4; }

.lobby-action { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }

.waiting { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 14px; }
.dots::after { content: "…"; animation: blink 1.2s steps(4, end) infinite; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.countdown {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: rgba(10, 18, 32, 0.96);
}

.countdown span { font-family: var(--serif); font-weight: 700; font-size: min(42vw, 220px); color: var(--amber); }
.countdown span.pop { animation: pop 0.9s ease-out both; }
@keyframes pop { 0% { opacity: 0; transform: scale(1.6); } 25% { opacity: 1; transform: scale(1); } 100% { opacity: 0.85; transform: scale(0.92); } }

.duel-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.duel-board li {
    display: grid;
    grid-template-columns: 30px 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid transparent;
}

.duel-board li.me { border-color: var(--amber); background: rgba(244, 191, 90, 0.1); }
.duel-board .rank { text-align: center; font-weight: 800; color: var(--mist); font-size: 1.1rem; }
.duel-board .gold .rank { color: #ffd45e; }
.duel-board .silver .rank { color: #d6dde8; }
.duel-board .bronze .rank { color: #e3a06b; }
.duel-board .who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.duel-board .who small { color: var(--mist); }
.duel-board .pts { font-weight: 800; font-size: 1.3rem; color: var(--amber); font-variant-numeric: tabular-nums; }
.duel-board .crown { color: #ffd45e; font-size: 1.3rem; }
.marks { display: flex; gap: 3px; }
.marks i { width: 12px; height: 12px; border-radius: 3px; background: var(--glass-2); }
.marks i.good { background: var(--pine); }
.marks i.bad { background: var(--rowan); }

/* ---------- Artsbok ---------- */

.rule { gap: 10px; }
.rule-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-row > div { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); }
.rule-row .arr-diagram { width: 90px; height: 76px; }
.rule-row small { color: var(--mist); font-size: 0.8rem; }

.guide-list { display: flex; flex-direction: column; gap: 10px; }

.guide-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    text-align: left;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
}

.guide-card:active { transform: scale(0.985); background: var(--glass-2); }
.gc-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gc-thumbs canvas { width: 100%; aspect-ratio: 1; border-radius: 10px; display: block; background: rgba(0, 0, 0, 0.25); animation: fadeIn 0.3s ease both; }
.gc-thumbs:empty { aspect-ratio: 3 / 1; border-radius: 10px; background: rgba(0, 0, 0, 0.18); }
.gc-body { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.gc-body b { font-family: var(--serif); font-size: 1.15rem; }
.gc-body small { color: var(--mist); font-style: italic; grid-column: 1; }
.gc-body .badge { grid-column: 2; grid-row: 1; justify-self: end; }
.gc-body .badge.found { grid-row: 2; }
.mastery { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--glass-2); overflow: hidden; margin-top: 4px; }
.mastery i { display: block; height: 100%; background: linear-gradient(90deg, #7dd3fc, var(--pine)); }

.detail { display: flex; flex-direction: column; gap: 10px; }
.carousel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin: 0 -4px; padding-left: 4px; }
.carousel figure { flex: 0 0 82%; margin: 0; scroll-snap-align: center; }
.carousel canvas { width: 100%; aspect-ratio: 1; border-radius: 14px; display: block; background: #0b1424; }
.carousel figcaption { text-align: center; font-size: 0.78rem; color: #5b6b82; margin-top: 4px; letter-spacing: 0.06em; text-transform: uppercase; }
.arr-line { display: flex; align-items: center; gap: 10px; }
.arr-line .arr-diagram { width: 64px; height: 56px; flex: none; }
.arr-line small { display: block; color: #5b6b82; }

/* ---------- Modal ---------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 10, 20, 0.72);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.18s ease both;
}

.overlay.out { opacity: 0; transition: opacity 0.18s; }

.modal {
    width: min(100%, 460px);
    max-height: 88dvh;
    overflow-y: auto;
    padding: 20px;
    border-radius: 24px;
    background: var(--snow);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: pop-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes pop-in { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: none; } }

.modal-title { font-size: 1.4rem; }
.modal .muted { color: #5b6b82; }
.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }
.modal .btn-ghost { background: #fff; border-color: #c5d3e3; color: #1b2f4d; }
.modal .text-input { background: #fff; color: var(--ink); border-color: #c5d3e3; }
.modal .form-error { color: #b3362c; }
.modal .field { display: flex; flex-direction: column; gap: 4px; font-weight: 650; }
.modal .box { border-color: #b7c5d6; }
.modal .found-toggle { background: #eef3f9; border-color: #c5d3e3; color: var(--ink); }
.modal .found-toggle.on { background: #e3f5ec; border-color: var(--pine); }

.settings { display: flex; flex-direction: column; gap: 12px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; cursor: pointer; }
.switch span { display: flex; flex-direction: column; }
.switch small { color: #5b6b82; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch i {
    position: relative;
    flex: none;
    width: 52px;
    height: 30px;
    border-radius: 99px;
    background: #c5d3e3;
    transition: background 0.2s;
}

.switch i::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.switch input:checked + i { background: var(--pine); }
.switch input:checked + i::after { transform: translateX(22px); }
.switch input:focus-visible + i { outline: 3px solid #8fd0ff; outline-offset: 2px; }

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + var(--safe-bottom));
    transform: translate(-50%, 20px);
    z-index: 60;
    max-width: min(92vw, 420px);
    padding: 12px 18px;
    border-radius: 99px;
    background: var(--snow);
    color: var(--ink);
    font-weight: 650;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #ffe1dd; color: #7a1d14; }

/* ---------- Større skjermer ---------- */

@media (min-width: 700px) {
    .screen, .game { padding-top: 28px; }
    .g-stage { width: min(100%, 52dvh); }
}

@media (max-height: 640px) {
    .g-stage { width: min(100%, 40dvh); }
    .g-prompt { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Konto og personvern ---------- */

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 0.95rem; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--pine); }
.modal .check { color: var(--ink); }

.account .field { display: flex; flex-direction: column; gap: 6px; font-weight: 650; }

.link, .link-btn {
    color: var(--amber);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.link-btn {
    background: none;
    border: 0;
    padding: 8px 4px;
    font: inherit;
    cursor: pointer;
    min-height: 44px;
}
.link-btn:disabled { color: var(--mist); text-decoration: none; cursor: default; }
.link-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }

.danger-zone { border-color: rgba(217, 72, 59, 0.55); }
.btn .icon { display: inline-block; vertical-align: -5px; margin-right: 4px; }
.modal .btn-danger { color: #b3362c; border-color: #e3b1ab; }

.legal h2 { font-size: 1.05rem; }
.legal p, .legal li { font-size: 0.95rem; color: var(--frost); }
.legal ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 4px; }
