/* Lettertypes van Google Fonts, lokaal (OFL): Bricolage Grotesque voor titels en cijfers, Figtree voor de rest. */
@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    font-stretch: 75% 100%;
    src: url("../fonts/bricolage-grotesque.woff2") format("woff2-variations"), url("../fonts/bricolage-grotesque.woff2") format("woff2");
}
@font-face {
    font-family: "Figtree";
    font-style: normal;
    font-display: swap;
    font-weight: 300 900;
    src: url("../fonts/figtree.woff2") format("woff2-variations"), url("../fonts/figtree.woff2") format("woff2");
}

/* ======================================================================
   Kleuren en maten
   ====================================================================== */

:root {
    --paper: #f3f1ed;
    --card: #ffffff;
    --board: #ffffff;
    --fill: rgba(24, 23, 26, .055);
    --fill-2: rgba(24, 23, 26, .09);
    --ink: #18171a;
    --ink-2: #5d5a55;
    --ink-3: #96928b;
    --line: rgba(24, 23, 26, .09);
    --line-2: rgba(24, 23, 26, .16);
    --grid: #ebe8e2;
    --on-ink: #ffffff;
    --given: #f2efe9;
    --sunken: #f6f4f0;

    --red: #db4429;
    --blue: #2a55d6;
    --yellow: #f3b82c;
    --good: #1f8a5b;
    --bad: #d93d24;
    --wa: #1fa855;

    --spoor: var(--red);
    --spoor-soft: color-mix(in srgb, var(--red) 13%, var(--board));
    --sym-a: var(--red);
    --sym-b: var(--blue);
    --me: color-mix(in srgb, var(--yellow) 14%, var(--card));

    --glass: color-mix(in srgb, var(--paper) 74%, transparent);
    --elev: 0 0 0 1px var(--line), 0 1px 2px rgba(24, 23, 26, .04);
    --elev-2: 0 0 0 1px var(--line), 0 8px 24px rgba(24, 23, 26, .08);

    --display: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
    --font: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --r: 14px;
    --r-lg: 20px;
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --spring: cubic-bezier(.3, 1.5, .5, 1);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #111113;
        --card: #1c1c1f;
        --board: #1c1c1f;
        --fill: rgba(255, 255, 255, .07);
        --fill-2: rgba(255, 255, 255, .11);
        --ink: #f3f2ef;
        --ink-2: #aaa7a1;
        --ink-3: #75736f;
        --line: rgba(255, 255, 255, .08);
        --line-2: rgba(255, 255, 255, .15);
        --grid: #2b2b2f;
        --on-ink: #111113;
        --given: #242428;
        --sunken: #151517;
        --red: #ef5a3e;
        --blue: #6088f5;
        --yellow: #f5c04c;
        --good: #3fb07c;
        --bad: #ef5a3e;
        --spoor-soft: color-mix(in srgb, var(--red) 20%, var(--board));
        --me: color-mix(in srgb, var(--yellow) 9%, var(--card));
        --elev: 0 0 0 1px var(--line);
        --elev-2: 0 0 0 1px var(--line), 0 12px 32px rgba(0, 0, 0, .4);
        color-scheme: dark;
    }
}

/* ======================================================================
   Basis
   ====================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    background: var(--paper);
    overscroll-behavior: none;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    letter-spacing: 0;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

button, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-touch-callout: none; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.08; margin: 0; font-weight: 700; }
p { margin: 0; }
b, strong { font-weight: 650; }
[hidden] { display: none !important; }
button, .btn, .tile, .topbar, .game-bar, .controls, .lb, .tabs { -webkit-user-select: none; user-select: none; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }

/* ======================================================================
   Topbalk (matglas zodra er iets onder schuift)
   ====================================================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(8px + env(safe-area-inset-top)) max(16px, calc((100% - 888px) / 2)) 8px;
    transition: background-color .2s, box-shadow .2s;
}
body.scrolled .topbar {
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    box-shadow: 0 1px 0 var(--line);
}
body.is-game .topbar { display: none; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    text-decoration: none;
    font-family: var(--display);
    font-weight: 900;
    font-size: 18px;
    letter-spacing: -0.01em;
}
.brand-mark { width: 28px; height: 28px; flex: none; }

main {
    max-width: 920px;
    margin: 0 auto;
    padding: 4px 16px calc(104px + env(safe-area-inset-bottom)); /* ruimte voor de tabbalk */
}
body.is-game main { padding: 0 12px; max-width: 620px; }

/* ======================================================================
   Tabbalk onderin (Spelen · Duels · Jij), matglas
   ====================================================================== */

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 6px max(8px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 -1px 0 var(--line);
    view-transition-name: tabbar;
}
body.is-game .tabbar { display: none; }
.tabbar a {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 6px 4px 4px;
    border-radius: 14px;
    color: var(--ink-3);
    text-decoration: none;
    font-size: 12px;
    font-weight: 650;
    transition: color .15s, transform .1s;
}
.tabbar a:active { transform: scale(.94); }
.tabbar svg { width: 25px; height: 25px; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] svg { fill: color-mix(in srgb, var(--ink) 12%, transparent); }
.tab-avatar {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--fill-2);
    color: var(--ink-2);
    font-family: var(--display);
    font-size: 13px;
    font-weight: 800;
}
.tabbar a[aria-current="page"] .tab-avatar { background: var(--ink); color: var(--on-ink); }
.tab-dot { position: absolute; top: 5px; left: calc(50% + 9px); width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--paper); }
/* Op een groot scherm: een zwevend pilletje onderin het midden */
@media (min-width: 720px) {
    .tabbar {
        left: 50%;
        right: auto;
        bottom: 16px;
        width: 380px;
        transform: translateX(-50%);
        padding: 6px;
        border-radius: 22px;
        box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(0, 0, 0, .12);
    }
}
.toast { bottom: calc(92px + env(safe-area-inset-bottom)) !important; }
body.is-game .toast { bottom: calc(96px + env(safe-area-inset-bottom)) !important; }

/* Kop van een tabbladpagina */
.page { max-width: 560px; margin: 8px auto 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head .btn { min-height: 44px; padding: 9px 16px; }
.me-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.me-head .link-btn { margin-top: 2px; padding: 2px 0; }
.empty-duels { margin-top: 8px; padding: 22px 20px; border-radius: 24px; background: var(--card); box-shadow: var(--elev); text-align: center; }
.empty-duels .vs-badge { margin: 0 auto 12px; }
.empty-duels h2 { font-family: var(--display); font-size: 26px; font-weight: 800; }
.empty-duels > p { color: var(--ink-2); margin-top: 6px; }
.empty-duels .steps { margin: 18px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; text-align: left; }
.empty-duels .steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
.empty-duels .steps b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--fill-2); font-size: 14px; }
.empty-duels .steps h3 { font-size: 16px; font-weight: 700; }
.empty-duels .steps p { font-size: 14.5px; color: var(--ink-2); margin-top: 2px; }

/* "Jij bent aan de beurt"-balkje op home */
.turn-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: var(--r-lg);
    background: var(--ink);
    color: var(--on-ink);
    text-decoration: none;
    animation: fade-in .25s ease both;
    transition: transform .1s;
}
.turn-banner:active { transform: scale(.985); }
.turn-banner .tb-text { flex: 1; min-width: 0; }
.turn-banner b { display: block; font-weight: 700; }
.turn-banner small { display: block; font-size: 13.5px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-banner > svg { width: 20px; height: 20px; opacity: .6; }

/* Uitslag: direct onder je tijd de volgende stap */
.result-actions { display: grid; gap: 8px; margin-top: 16px; }
.ra-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ra-row .btn { min-height: 46px; font-size: 15px; }

/* ======================================================================
   Knoppen
   ====================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 11px 18px;
    border: 0;
    border-radius: var(--r);
    background: var(--card);
    box-shadow: var(--elev);
    font-weight: 600;
    font-size: 15.5px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .1s ease, background-color .15s, box-shadow .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn-primary {
    background: var(--ink);
    color: var(--on-ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(0, 0, 0, .18), 0 4px 14px rgba(24, 23, 26, .14);
}
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-wa svg { color: var(--wa); }
.btn-block { width: 100%; }
.btn-lg { min-height: 54px; font-size: 16.5px; border-radius: 16px; }
@media (hover: hover) {
    .btn:not(.btn-primary):not(:disabled):hover { background: color-mix(in srgb, var(--ink) 3%, var(--card)); }
    .btn-ghost:hover { background: var(--fill) !important; }
    .btn-primary:not(:disabled):hover { background: color-mix(in srgb, var(--paper) 12%, var(--ink)); }
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    transition: background-color .15s, transform .1s;
}
.icon-btn:active { transform: scale(.92); background: var(--fill); }
@media (hover: hover) { .icon-btn:hover { background: var(--fill); } }
.icon-btn svg { width: 22px; height: 22px; }

/* ======================================================================
   Home
   ====================================================================== */

.hello { padding: 18px 2px 18px; }
.hello h1 { font-family: var(--display); font-size: clamp(30px, 7.6vw, 42px); font-weight: 850; letter-spacing: -0.025em; }
.hello p { margin-top: 8px; color: var(--ink-2); font-size: 16px; max-width: 30em; }

.tiles { display: grid; gap: 12px; }
@media (min-width: 720px) { .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.tile {
    --tile: #db4429;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 14px;
    padding: 18px 16px 16px 18px;
    border-radius: 24px;
    background: var(--tile);
    color: #fff;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(0, 0, 0, .08);
}
.tile-balans { --tile: #2a55d6; }
.tile h2, .tile h1 { font-family: var(--display); font-size: 34px; font-weight: 900; letter-spacing: -0.02em; }
.tile p { font-size: 15px; opacity: .9; max-width: 22em; line-height: 1.35; margin-top: 4px; }
.tile .art { grid-row: 1; grid-column: 2; width: 84px; height: 84px; margin: -2px -2px 0 0; }
.tile-text { grid-row: 1; grid-column: 1; align-self: center; }
.levels { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.level {
    position: relative;
    display: grid;
    gap: 7px;
    justify-items: start;
    min-height: 66px;
    padding: 10px 12px;
    border: 0;
    border-radius: 15px;
    background: rgba(255, 255, 255, .14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 1px 0 rgba(255, 255, 255, .12);
    color: #fff;
    text-align: left;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.1;
    transition: background-color .15s, transform .1s, color .15s;
}
.level small { display: block; font-weight: 500; font-size: 12.5px; opacity: .72; margin-top: 3px; }
.level:active { transform: scale(.96); }
@media (hover: hover) { .level:hover { background: rgba(255, 255, 255, .22); } }
.level.loading { background: #fff; color: var(--tile); }
.level.loading::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: spin .7s linear infinite;
}
.pips { display: flex; gap: 3px; }
.pips i { width: 13px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .32); }
.pips i.on { background: currentColor; }

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-3);
    margin: 28px 4px 8px;
}

.recent { display: grid; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--elev); overflow: hidden; }
.recent a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 10px 16px 10px 12px;
    text-decoration: none;
    border-top: 1px solid var(--line);
    transition: background-color .12s;
}
.recent a:first-child { border-top: 0; }
.recent a:active { background: var(--fill); }
@media (hover: hover) { .recent a:hover { background: color-mix(in srgb, var(--ink) 2.5%, var(--card)); } }
.recent .r-icon { width: 40px; height: 40px; flex: none; }
.recent .r-main { flex: 1; min-width: 0; }
.recent .r-title { font-weight: 600; }
.recent .r-sub { font-size: 13px; color: var(--ink-3); }
.recent .r-time { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }


/* ======================================================================
   Dagpuzzel
   ====================================================================== */

/* Geen kaart om de kaarten heen: een kop, en daaronder twee losse kaarten. */
.daily-slot { min-height: 128px; margin-bottom: 8px; }
.daily { animation: fade-in .25s ease both; }
.daily-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 4px 10px; }
.daily-head h2 { font-family: var(--display); font-size: 22px; font-weight: 800; }
.daily-head p { font-size: 14px; color: var(--ink-2); margin-top: 1px; }
.streak { flex: none; padding: 5px 11px; border-radius: 999px; background: color-mix(in srgb, var(--yellow) 25%, var(--card)); font-weight: 700; font-variant-numeric: tabular-nums; }
/* Een rij die je opzij veegt: geen zichtbare scrollbalk, de rand vervaagt waar nog iets zit.
   Twee kaarten passen precies; bij meer worden ze smaller zodat de volgende al zichtbaar is. */
.daily-games {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 2px 16px 6px;
    scroll-padding: 0 16px;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    --fade: 40px;
}
.daily-games::-webkit-scrollbar { display: none; }
.daily-games.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--fade)), transparent); mask-image: linear-gradient(to right, #000 calc(100% - var(--fade)), transparent); }
.daily-games.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - var(--fade)), transparent); mask-image: linear-gradient(to left, #000 calc(100% - var(--fade)), transparent); }
.daily-games.fade-l.fade-r {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
    mask-image: linear-gradient(to right, transparent, #000 var(--fade), #000 calc(100% - var(--fade)), transparent);
}
.daily-game {
    flex: 0 0 calc((100% - 10px) / 2);
    min-width: 150px;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 72px;
    padding: 12px;
    border-radius: var(--r-lg);
    background: var(--card);
    box-shadow: var(--elev);
    text-decoration: none;
    transition: transform .1s, background-color .15s;
}
.daily-game:active { transform: scale(.98); }
@media (hover: hover) { .daily-game:hover { background: color-mix(in srgb, var(--ink) 2.5%, var(--card)); } }
.daily-game .r-icon { width: 42px; height: 42px; flex: none; }
.dg-main { flex: 1; min-width: 0; }
.dg-main b { display: block; font-weight: 650; }
.dg-main small { display: block; font-size: 12.5px; line-height: 1.3; color: var(--ink-3); }
.daily-game > svg:last-child { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.daily-game.done > svg:last-child { color: var(--good); width: 20px; height: 20px; }
/* Smal scherm: tekst mag over twee regels, het pijltje vervalt; heel smal: onder elkaar. */
@media (max-width: 480px) { .daily-game:not(.done) > svg:last-child { display: none; } .daily-game { gap: 10px; padding: 12px 10px; } .daily-game .r-icon { width: 38px; height: 38px; } }
.daily-games.many .daily-game { flex-basis: 44%; }
@media (min-width: 720px) { .daily-games.many .daily-game { flex-basis: calc((100% - 20px) / 3); } }

/* ======================================================================
   Duels
   ====================================================================== */


.vs-badge {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--yellow);
    color: #18171a;
    font-family: var(--display);
    font-weight: 900;
    font-size: 13px;
}
.vs-badge.big { width: 54px; height: 54px; font-size: 17px; margin-bottom: 12px; }

.recent .r-score { font-family: var(--display); font-weight: 850; font-size: 17px; font-variant-numeric: tabular-nums; }
.recent .r-score i { font-style: normal; color: var(--ink-3); margin: 0 3px; }
.turn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--ink);
    font-weight: 650;
}
.turn::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 30%, transparent); }
.recent .turn { margin-right: 4px; }
.rounds .turn, .rounds .won { flex: none; font-size: 13px; }
.won { color: var(--good); font-weight: 650; }

.picker { margin-top: 18px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 14px 2px 6px; }
dialog.sheet .input { margin-bottom: 2px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 13px; background: var(--fill); }
.seg button {
    min-height: 42px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-weight: 600;
    font-size: 15px;
    color: var(--ink-2);
    transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }
.share-sheet { margin-top: 4px; }

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 6px 0;
    border: 0;
    background: none;
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--line-2);
    text-underline-offset: 3px;
}
.link-btn svg { width: 17px; height: 17px; }

.duel { max-width: 480px; margin: 4px auto 0; }
.tile-duel-head { --tile: #f3b82c; color: #18171a; grid-template-columns: minmax(0, 1fr) auto; align-items: start; padding: 20px; }
.tile-duel-head .eyebrow { font-size: 14px; font-weight: 600; opacity: .75; }
.tile-duel-head h1 { font-size: clamp(26px, 7vw, 34px); margin-top: 4px; overflow-wrap: anywhere; }
.tile-duel-head .vs-badge { background: #18171a; color: #f3b82c; margin: 0; }
.duel-score { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 14px; }
.duel-score div { display: grid; justify-items: center; min-width: 80px; }
.duel-score b { font-family: var(--display); font-size: 52px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.duel-score span { font-size: 14px; font-weight: 600; opacity: .75; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-score i { font-style: normal; font-size: 32px; opacity: .4; }
.duel-rank { grid-column: 1 / -1; margin-top: 10px; font-weight: 650; }
.duel-action { margin-top: 14px; }
.duel-action .btn-lg { flex-direction: column; gap: 1px; min-height: 60px; }
.btn-sub { display: block; font-size: 13px; font-weight: 500; opacity: .65; }
.duel-wait { margin-top: 8px; font-size: 14px; color: var(--ink-2); text-align: center; text-wrap: balance; }
.rounds .results { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.rounds .results .win { color: var(--ink); font-weight: 650; }
.rounds .results .nf { color: var(--ink-3); font-style: italic; }

/* Kaartje voor meldingen */
.push-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 8px 12px 14px;
    border-radius: var(--r-lg);
    background: var(--card);
    box-shadow: var(--elev);
    animation: fade-in .25s ease both;
}
.pc-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: color-mix(in srgb, var(--yellow) 28%, var(--card)); }
.pc-icon svg { width: 20px; height: 20px; }
.pc-text b { display: block; font-size: 15px; font-weight: 650; line-height: 1.25; }
.pc-text p { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.push-card .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.pc-x { width: 36px; height: 36px; }
.pc-x svg { width: 18px; height: 18px; color: var(--ink-3); }
@media (max-width: 400px) {
    .push-card { grid-template-columns: auto minmax(0, 1fr) auto; }
    .push-card .btn { grid-column: 2 / 3; justify-self: start; }
    .pc-x { grid-row: 1; grid-column: 3; }
}

.install-card { margin: 0 0 12px; }
.install-card .ic-icon { width: 40px; height: 40px; border-radius: 10px; }

/* Mini-uitleg */
.tut-board { width: min(250px, 70vw); margin: 18px auto 0; }
.tut-hint { min-height: 22px; margin-top: 12px; text-align: center; font-size: 14.5px; color: var(--ink-3); text-wrap: balance; }
.tut-hint.warn { color: var(--bad); font-weight: 600; }
.tut-hint.ok { color: var(--good); font-weight: 700; font-size: 16px; }
.btn.pulse { animation: btn-pulse 1.4s ease-in-out 2; }
@keyframes btn-pulse { 50% { transform: scale(1.03); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ink) 15%, transparent); } }

/* ======================================================================
   Profiel, overzetten, privacy
   ====================================================================== */

.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head .lead { margin-top: 2px; font-size: 14px; }
.avatar-big {
    flex: none;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--on-ink);
    font-family: var(--display);
    font-weight: 900;
    font-size: 24px;
}
.name-row { display: flex; gap: 8px; margin-top: 18px; }
.name-row .input { min-height: 48px; }
.name-row .btn { flex: none; }
.menu { margin-top: 16px; border-radius: var(--r-lg); box-shadow: var(--elev); overflow: hidden; background: var(--card); }
.menu button, .menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 10px 14px;
    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    text-align: left;
    font-size: 15.5px;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
    transition: background-color .12s;
}
.menu > :first-child { border-top: 0; }
.menu button:active, .menu a:active { background: var(--fill); }
@media (hover: hover) { .menu button:hover, .menu a:hover { background: color-mix(in srgb, var(--ink) 3%, var(--card)); } }
.menu :is(button, a) > svg:first-child { width: 22px; height: 22px; flex: none; color: var(--ink-2); }
.menu :is(button, a) > svg:last-child { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.menu :is(button, a) span { flex: 1; min-width: 0; }
.menu button small { display: block; font-size: 13px; font-weight: 500; color: var(--ink-3); margin-top: 1px; }
.switch { flex: none; position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--fill-2); transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease-out); }
.menu button.on .switch { background: var(--good); }
.menu button.on .switch::after { transform: translateX(18px); }

.sheet-back { margin: -6px 0 6px -10px; }
.big-code {
    margin: 18px 0 8px;
    padding: 18px;
    border-radius: var(--r-lg);
    background: var(--sunken);
    box-shadow: inset 0 0 0 1px var(--line);
    text-align: center;
    font-family: var(--display);
    font-size: 44px;
    font-weight: 900;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
}
.code-input { margin-top: 16px; text-align: center; font-size: 28px; letter-spacing: .15em; font-variant-numeric: tabular-nums; min-height: 64px; }
.fine-center { font-size: 13px; color: var(--ink-3); text-align: center; margin-top: 10px; }
dialog.sheet .steps.small li { gap: 10px; }
dialog.sheet .steps.small b { width: 26px; height: 26px; font-size: 13px; }
dialog.sheet .steps.small p { margin: 2px 0 0; color: var(--ink); }
.loading-box.small { min-height: 120px; }

/* Statistieken */
.stats { max-width: 560px; margin: 8px auto 0; }
.page-title { font-family: var(--display); font-size: clamp(30px, 7vw, 38px); font-weight: 900; letter-spacing: -0.02em; }
.stats > .lead { color: var(--ink-2); margin-top: 8px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.kpi { padding: 14px 12px; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--elev); }
.kpi b { display: block; font-family: var(--display); font-size: 28px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 16px; color: var(--ink-3); font-weight: 700; }
.kpi span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.stat-card { margin-top: 14px; padding: 16px; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--elev); }
.stat-card header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.stat-card header .r-icon { width: 36px; height: 36px; }
.stat-card h2 { font-family: var(--display); font-size: 22px; font-weight: 900; }
.seg button small { margin-left: 5px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.stat-body { margin-top: 14px; }
.stat-empty { color: var(--ink-3); font-size: 15px; margin-bottom: 10px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini-kpis div { padding: 10px 12px; border-radius: 12px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.mini-kpis b { display: block; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-kpis span { font-size: 12.5px; color: var(--ink-3); }
.trend-box { margin-top: 14px; }
.trend-read { font-size: 13.5px; color: var(--ink-2); min-height: 20px; }
.trend-read b { color: var(--ink); font-variant-numeric: tabular-nums; }
.trend { display: block; width: 100%; height: auto; margin-top: 4px; overflow: visible; touch-action: pan-y; }
.trend .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trend.t-spoor .line { stroke: var(--red); }
.trend.t-balans .line { stroke: var(--blue); }
.trend .avg { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.trend .dot, .trend .hover { stroke: var(--card); stroke-width: 2; vector-effect: non-scaling-stroke; }
.trend.t-spoor .dot, .trend.t-spoor .hover { fill: var(--red); }
.trend.t-balans .dot, .trend.t-balans .hover { fill: var(--blue); }
.trend .dot.best { fill: var(--good); }
.trend .cross { stroke: var(--ink-3); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trend-cap { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

.doc { max-width: 620px; margin: 8px auto 0; }
.doc h1 { font-family: var(--display); font-size: 36px; font-weight: 900; }
.doc h2 { font-size: 18px; font-weight: 700; margin: 26px 0 8px; }
.doc .lead { color: var(--ink-2); margin-top: 8px; font-size: 17px; }
.doc ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.doc p, .doc li { color: var(--ink-2); }
.doc .btn { margin-top: 16px; }
.footer-note { margin-top: 28px; font-size: 13px; color: var(--ink-3); text-align: center; }
.footer-note a { color: inherit; }

/* ======================================================================
   Uitnodiging
   ====================================================================== */

.landing { max-width: 480px; margin: 4px auto 0; }
.landing .tile { padding: 20px; }
.landing .tile .eyebrow { grid-column: 1; font-size: 14px; font-weight: 600; opacity: .9; }
.landing .tile h1 { font-size: 40px; }
.landing .tile .sub { font-size: 15px; opacity: .88; font-weight: 500; margin-top: 4px; }
.landing .tile .art { grid-row: 1 / span 3; grid-column: 2; }
.stat {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    padding: 13px 16px;
    border-radius: var(--r);
    background: var(--card);
    box-shadow: var(--elev);
    font-size: 15px;
}
.stat svg { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.landing form { margin-top: 20px; display: grid; gap: 12px; }
.landing .fine { font-size: 13px; color: var(--ink-3); margin-top: 10px; text-align: center; }

.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 0 4px 6px; }
.input {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 1px solid var(--line-2);
    border-radius: var(--r);
    background: var(--card);
    font-size: 17px;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px var(--fill-2); }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 15%, transparent); animation: shake .35s; }

.rules { margin-top: 18px; border-radius: var(--r); background: var(--card); box-shadow: var(--elev); padding: 2px 16px; }
.rules summary {
    cursor: pointer;
    min-height: 50px;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after { content: "+"; font-size: 22px; font-weight: 400; color: var(--ink-3); }
.rules[open] summary::after { content: "–"; }
.rules[open] { padding-bottom: 16px; }
.rule-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: rule; }
.rule-list li { display: flex; gap: 12px; align-items: baseline; font-size: 15px; }
.rule-list li::before {
    counter-increment: rule;
    content: counter(rule);
    flex: none;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--fill-2);
    font-size: 12px;
    font-weight: 700;
    transform: translateY(-1px);
}
.rule-example { display: flex; justify-content: center; gap: 18px; margin: 16px 0 4px; }
.rule-example svg { width: 132px; height: auto; }
.how-hint { font-size: 14px; color: var(--ink-3); margin-top: 8px; }
.ex-rows { display: grid; gap: 8px; justify-items: center; }
.ex-row { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 12px; background: var(--fill); }
.ex-row .mini-sym { width: 20px; height: 20px; margin: 0 3px; }
.ex-row .mini-sym.b { width: 15px; height: 15px; margin: 0 5.5px; }
.ex-row b { margin-left: 10px; font-size: 18px; color: var(--good); }
.ex-row.nok b { color: var(--bad); }

.mini-sym { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin: 0 2px; }
.mini-sym.a { border-radius: 50%; background: var(--sym-a); }
.mini-sym.b { width: 11px; height: 11px; background: var(--sym-b); transform: rotate(45deg); border-radius: 2px; margin: 0 4px; }

/* ======================================================================
   Spelscherm
   ====================================================================== */

.game {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    padding: env(safe-area-inset-top) 0 calc(10px + env(safe-area-inset-bottom));
}
.game-bar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
    align-items: center;
    gap: 2px;
    padding: 8px 0 6px;
}
.game-title { min-width: 0; padding-left: 4px; }
.game-title h1 { font-family: var(--display); font-size: 19px; font-weight: 900; }
.game-title span { display: block; font-size: 13px; color: var(--ink-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sound-btn.off svg { opacity: .45; }

.progress { height: 3px; border-radius: 2px; background: var(--fill); overflow: hidden; margin: 2px 4px 0; }
.progress i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--ink); border-radius: 2px; transition: width .2s var(--ease-out); }
.game.solved .progress i { background: var(--good); }

.stage {
    flex: 1;
    min-height: 0;
    container-type: size;
    display: grid;
    place-items: center;
    padding: 10px 0 4px;
}
.board-wrap { position: relative; width: min(100cqw, 100cqh, 560px); }
.game-hint {
    display: grid;
    place-items: center;
    text-align: center;
    font-size: 14.5px;
    color: var(--ink-3);
    min-height: 48px;
    padding: 6px 12px;
    text-wrap: balance;
    transition: color .2s;
}
.game-hint.warn { color: var(--bad); font-weight: 600; }
.game-hint.tip { color: var(--ink); font-weight: 600; }
.game.solved .game-hint { color: var(--good); font-weight: 700; font-size: 16px; }

/* Werkbalk onderaan, zoals in een app */
.controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 4px;
    margin-top: 4px;
    border-radius: 20px;
    background: var(--card);
    box-shadow: var(--elev-2);
}
.controls .btn {
    flex-direction: column;
    gap: 3px;
    min-height: 58px;
    padding: 6px 4px;
    border-radius: 16px;
    background: transparent;
    box-shadow: none;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
}
.controls .btn svg { width: 22px; height: 22px; color: var(--ink); }
.controls .btn small { font-weight: 500; color: var(--ink-3); }
.controls .btn:active { background: var(--fill); }
@media (hover: hover) { .controls .btn:not(:disabled):hover { background: var(--fill) !important; } }
.controls .btn-hint svg { color: #c98a00; }
.controls .loading-box, .controls .btn-primary { grid-column: 1 / -1; min-height: 58px; }
.controls .btn-primary { color: var(--on-ink); background: var(--ink); font-size: 15px; flex-direction: row; }
@media (prefers-color-scheme: dark) { .controls .btn-hint svg { color: var(--yellow); } }

/* ======================================================================
   Spoor
   ====================================================================== */

.spoor-svg {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overflow: visible;
}
.spoor-svg .cell { fill: var(--board); transition: fill .14s ease; }
.spoor-svg .cell.on { fill: var(--spoor-soft); }
.spoor-svg .grid { fill: none; stroke: var(--grid); stroke-width: 2; }
.spoor-svg .path { fill: none; stroke: var(--spoor); stroke-linecap: round; stroke-linejoin: round; }
.spoor-svg .path-glow { fill: none; stroke: #fff; stroke-opacity: .6; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.spoor-svg .ghost { fill: none; stroke: var(--spoor); stroke-opacity: .7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 0 25; animation: march .8s linear infinite; }
.spoor-svg .wall { stroke: var(--ink); stroke-linecap: round; }
.spoor-svg .frame { fill: none; stroke: var(--ink); stroke-width: 6; }
.spoor-svg .num { transform-box: fill-box; transform-origin: center; }
.spoor-svg .num circle { fill: var(--ink); transition: fill .15s; }
.spoor-svg .num text { fill: var(--board); font-weight: 800; font-family: var(--display); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.spoor-svg .num.hit circle { fill: var(--spoor); }
.spoor-svg .num.hit text { fill: #fff; }
.spoor-svg .num.pop { animation: num-pop .32s var(--spring); }
.spoor-svg .head { fill: #fff; pointer-events: none; }
.spoor-svg .start-ring { fill: none; stroke: var(--spoor); stroke-width: 6; opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.spoor-svg.fresh .start-ring { animation: ring 1.6s ease-out infinite; }
.spoor-svg.blocked { animation: shake .3s; }
.spoor-svg.solved .cell.on { animation: wave .7s ease both; animation-delay: calc(var(--i) * 12ms); }
.spoor-svg.solved .path-glow { visibility: visible; animation: streak 1s cubic-bezier(.45, 0, .25, 1) both; }
.spoor-svg .cell.empty-hint { animation: pulse 1s ease 2; }
.spoor-svg .cell.wrong-hint { animation: pulse .9s ease 3; }

@keyframes num-pop { 40% { transform: scale(1.22); } }
@keyframes ring { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes wave {
    0% { fill: var(--spoor-soft); }
    35% { fill: color-mix(in srgb, var(--spoor) 45%, var(--board)); }
    100% { fill: color-mix(in srgb, var(--spoor) 22%, var(--board)); }
}
@keyframes streak {
    from { stroke-dasharray: .12 2; stroke-dashoffset: .12; }
    to { stroke-dasharray: .12 2; stroke-dashoffset: -1.02; }
}
@keyframes pulse { 50% { fill: color-mix(in srgb, var(--bad) 30%, var(--board)); } }
@keyframes march { to { stroke-dashoffset: -25; } }

/* ======================================================================
   Balans
   ====================================================================== */

.balans {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--n), minmax(0, 1fr));
    aspect-ratio: 1;
    width: 100%;
    background: var(--board);
    border-radius: 12px;
    box-shadow: 0 0 0 3px var(--ink);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}
.b-cell {
    position: relative;
    display: grid;
    place-items: center;
    border: 0;
    border-right: 2px solid var(--grid);
    border-bottom: 2px solid var(--grid);
    background: var(--board);
    padding: 0;
    transition: background-color .12s;
}
.b-cell.lc { border-right: 0; }
.b-cell.lr { border-bottom: 0; }
.b-cell.given { background: var(--given); cursor: default; }
.b-cell:not(.given):active { background: color-mix(in srgb, var(--ink) 6%, var(--board)); }
@media (hover: hover) { .b-cell:not(.given):hover { background: color-mix(in srgb, var(--ink) 3.5%, var(--board)); } }
.b-cell:focus-visible { outline-offset: -4px; }
.b-cell.err::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--bad) 24%, transparent) 0 5px, transparent 5px 10px);
    pointer-events: none;
    animation: fade-in .2s ease both;
}
.b-cell.nope .sym { animation: shake .25s; }
.b-cell.hint-rel { background: color-mix(in srgb, var(--yellow) 20%, var(--board)); }
.b-cell.hint-target { z-index: 1; animation: hint-glow 1.1s ease-in-out infinite alternate; }
.b-cell.hint-wrong { z-index: 1; box-shadow: inset 0 0 0 3px var(--bad); animation: shake .3s; }
.sym { position: relative; z-index: 1; display: block; width: 50%; height: 50%; transform: scale(0); transition: transform .18s var(--spring); }
.sym.a, .sym.b { transform: scale(1); }
.sym.a { border-radius: 50%; background: var(--sym-a); }
.sym.b { width: 42%; height: 42%; border-radius: 12%; background: var(--sym-b); transform: rotate(45deg); }
.sym.ghost { position: absolute; inset: 0; margin: auto; opacity: .3; pointer-events: none; }
.b-cell.given .sym.a, .b-cell.given .sym.b { opacity: .8; }
.b-edge {
    position: absolute;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 50%;
    background: var(--board);
    color: var(--ink);
    font-family: var(--display);
    font-weight: 900;
    font-size: 15px;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--grid);
}
.b-edge.err { color: #fff; background: var(--bad); box-shadow: none; }
.balans.solved .b-cell { animation: pop .55s ease both; animation-delay: calc(var(--i) * 22ms); }
.balans.solved { box-shadow: 0 0 0 3px var(--good); transition: box-shadow .3s; }

@keyframes pop {
    40% { background: color-mix(in srgb, var(--good) 24%, var(--board)); transform: scale(.92); }
    100% { background: color-mix(in srgb, var(--good) 9%, var(--board)); transform: none; }
}
@keyframes hint-glow {
    from { box-shadow: inset 0 0 0 3px var(--yellow); }
    to { box-shadow: inset 0 0 0 5px var(--yellow); }
}

/* ======================================================================
   Resultaat
   ====================================================================== */

.result { max-width: 480px; margin: 0 auto; }
.result-top { text-align: center; padding: 14px 0 6px; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--card);
    box-shadow: var(--elev);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
}
.badge.ok { background: var(--good); color: #fff; box-shadow: none; }
.big-time {
    font-family: var(--display);
    font-size: clamp(68px, 22vw, 96px);
    font-weight: 900;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    margin-top: 12px;
}
.result.fresh .big-time { animation: time-in .5s var(--spring) both; }
.rank-line { margin-top: 8px; font-size: 17px; color: var(--ink-2); }
.rank-line strong { color: var(--ink); font-weight: 700; }
.hint-note { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
.streak-line { display: inline-block; margin-top: 10px; padding: 5px 12px; border-radius: 999px; background: color-mix(in srgb, var(--yellow) 25%, var(--card)); font-weight: 650; font-size: 15px; }
.lb li.gap { border-top: 2px dashed var(--line); }

.panel { margin-top: 16px; padding: 18px; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--elev); }
.panel h2 { font-family: var(--display); font-size: 21px; font-weight: 850; letter-spacing: -0.01em; }
.panel > p { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.share-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 5px 5px 5px 14px;
    border-radius: var(--r);
    background: var(--sunken);
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.share-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.share-link .btn { min-height: 38px; padding: 7px 14px; font-size: 14px; border-radius: 10px; }
.share-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; }

.name-box { margin-top: 16px; padding: 16px; border-radius: var(--r-lg); background: var(--card); box-shadow: var(--elev); }
.name-box p { font-weight: 650; margin-bottom: 10px; }
.name-box form { display: flex; gap: 8px; }
.name-box .input { min-height: 48px; }
.name-box .btn { flex: none; }

.tabs { display: flex; gap: 2px; padding: 3px; margin: 26px 0 10px; border-radius: 13px; background: var(--fill); }
.tab { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink-2); transition: background-color .15s, color .15s, box-shadow .15s; }
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }

.board-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 26px 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.board-title small { font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 13px; }
.lb { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--elev); overflow: hidden; }
.lb li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 8px 16px; border-top: 1px solid var(--line); }
.lb li:first-child { border-top: 0; }
.lb .pos { font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: center; }
.lb .medal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 700; color: #18171a; }
.lb .medal.m1 { background: var(--yellow); }
.lb .medal.m2 { background: #cfccc6; }
.lb .medal.m3 { background: #dca27a; }
.lb .who { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .who small { font-weight: 600; color: var(--ink-3); margin-left: 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.lb .who .sub { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.lb .t { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.lb .t small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.lb li.me { background: var(--me); }
.lb li.playing .who { color: var(--ink-3); font-weight: 500; }
.lb li.playing .t { color: var(--ink-3); font-weight: 500; font-size: 13px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 8px; animation: blink 1.4s infinite; }
.lb-note { font-size: 13px; color: var(--ink-3); margin-top: 8px; text-align: center; }

.lb .who .re { margin-left: 6px; font-size: 16px; }
.react { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.react button {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: var(--card);
    box-shadow: var(--elev);
    font-size: 22px;
    line-height: 1;
    transition: transform .12s var(--spring), background-color .15s, box-shadow .15s;
}
.react button:active { transform: scale(.88); }
.react button[aria-pressed="true"] { background: color-mix(in srgb, var(--yellow) 45%, var(--card)); box-shadow: none; transform: scale(1.06); }
.react button.pop { animation: react-pop .4s var(--spring); }
@keyframes react-pop { 40% { transform: scale(1.3) rotate(-8deg); } }

.next-box { margin-top: 22px; display: grid; gap: 6px; }
.next-box .btn-primary span { opacity: .6; font-weight: 500; font-size: 15px; }

.rate { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; color: var(--ink-2); font-size: 15px; }
.rate button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--elev); display: grid; place-items: center; color: var(--ink-2); transition: transform .1s; }
.rate button:active { transform: scale(.9); }
.rate button svg { width: 19px; height: 19px; }
.rate button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); box-shadow: none; }

/* ======================================================================
   Dialoog (sheet) met vervaagde achtergrond
   ====================================================================== */

dialog.sheet {
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100dvh - 40px);
    padding: 24px;
    border: 0;
    border-radius: 26px;
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 0 0 1px var(--line), 0 24px 64px rgba(0, 0, 0, .22);
    overscroll-behavior: contain;
}
dialog.sheet::backdrop {
    background: rgba(14, 14, 16, .22);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
}
dialog.sheet[open] { animation: rise .3s var(--ease-out); }
dialog.sheet[open]::backdrop { animation: fade .25s ease; }
dialog.sheet h2 { font-family: var(--display); font-size: 28px; font-weight: 900; letter-spacing: -0.015em; }
dialog.sheet .actions { display: grid; gap: 10px; margin-top: 20px; }
dialog.sheet .art { width: 54px; height: 54px; margin-bottom: 12px; }
dialog.sheet .lead { color: var(--ink-2); margin-top: 8px; }
dialog.sheet .steps { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; }
dialog.sheet .steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
dialog.sheet .steps b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--fill-2); font-size: 14px; font-weight: 700; }
dialog.sheet .steps h3 { font-size: 16px; font-weight: 650; }
dialog.sheet .steps p { font-size: 14.5px; color: var(--ink-2); margin-top: 2px; }

@media (max-width: 599px) {
    dialog.sheet {
        width: 100%;
        max-width: 100%;
        margin: auto 0 0;
        border-radius: 26px 26px 0 0;
        padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
        max-height: 92dvh;
    }
    dialog.sheet::before {
        content: "";
        display: block;
        width: 36px;
        height: 5px;
        margin: 0 auto 14px;
        border-radius: 3px;
        background: var(--line-2);
    }
    dialog.sheet[open] { animation: sheet-up .34s var(--ease-out); }
}

/* ======================================================================
   Toast, confetti, laden
   ====================================================================== */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 50;
    transform: translate(-50%, 16px);
    padding: 12px 18px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ink) 84%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
    color: var(--on-ink);
    font-weight: 600;
    font-size: 15px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .25s var(--ease-out);
    max-width: calc(100vw - 32px);
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.is-game .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i { position: absolute; top: 36%; left: 50%; width: 10px; height: 10px; opacity: 0; animation: confetti 1.4s cubic-bezier(.15, .7, .4, 1) forwards; }
.confetti i.c { border-radius: 50%; }
.confetti i.d { transform: rotate(45deg); border-radius: 2px; }
.confetti i.l { width: 16px; height: 5px; border-radius: 3px; }

@keyframes confetti {
    0% { opacity: 1; transform: translate(0, 0) rotate(0); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}

.loading-box { display: grid; place-items: center; min-height: 50vh; color: var(--ink-3); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--fill-2); border-top-color: var(--ink); animation: spin .7s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes time-in { from { transform: scale(.85); opacity: 0; } }
@keyframes view-in { from { opacity: 0; transform: translateX(var(--from, 0)) translateY(6px); } }

.noscript { text-align: center; padding: 60px 0; }

/* ======================================================================
   Schuiven tussen schermen (View Transitions), zoals in een app:
   vooruit schuift het nieuwe scherm er van rechts overheen,
   terug schuift het huidige scherm weer naar rechts weg.
   ====================================================================== */

:root { --push: cubic-bezier(.32, .72, 0, 1); --push-time: .44s; }

/* De topbalk blijft staan terwijl de inhoud eronder schuift (niet bij het spelscherm, dat heeft er geen). */
html:not([data-vt-game]) .topbar { view-transition-name: topbar; }
.toast { view-transition-name: toast; }
.confetti { view-transition-name: confetti; }

::view-transition-group(*) { animation-duration: var(--push-time); animation-timing-function: var(--push); }

html[data-nav="fwd"]::view-transition-old(root) { animation: var(--push-time) var(--push) both vt-push-under; }
html[data-nav="fwd"]::view-transition-new(root) { animation: var(--push-time) var(--push) both vt-slide-in; }
html[data-nav="back"]::view-transition-old(root) { z-index: 1; animation: var(--push-time) var(--push) both vt-slide-out; }
html[data-nav="back"]::view-transition-new(root) { animation: var(--push-time) var(--push) both vt-pop-from-under; }
html[data-nav="fade"]::view-transition-old(root) { animation: .18s ease both vt-fade-out; }
html[data-nav="fade"]::view-transition-new(root) { animation: .22s ease both vt-fade-in; }
::view-transition-new(root) { box-shadow: -12px 0 40px rgba(0, 0, 0, .12); }
html[data-nav="fade"]::view-transition-new(root) { box-shadow: none; }
html[data-nav="back"]::view-transition-old(root) { box-shadow: -12px 0 40px rgba(0, 0, 0, .12); }
html[data-nav="back"]::view-transition-new(root) { box-shadow: none; }

/* Op een groot scherm is een hele pagina die opzij schuift te veel: daar een korte, zachte schuif. */
@media (min-width: 720px) {
    :root { --push-time: .3s; }
    html[data-nav="fwd"]::view-transition-old(root) { animation: .2s ease both vt-desk-out-left; }
    html[data-nav="fwd"]::view-transition-new(root) { animation: .3s var(--ease-out) .04s both vt-desk-in-right; }
    html[data-nav="back"]::view-transition-old(root) { animation: .2s ease both vt-desk-out-right; }
    html[data-nav="back"]::view-transition-new(root) { animation: .3s var(--ease-out) .04s both vt-desk-in-left; }
    html[data-nav]::view-transition-old(root), html[data-nav]::view-transition-new(root) { box-shadow: none; }
}
@keyframes vt-desk-out-left { to { opacity: 0; transform: translateX(-24px); } }
@keyframes vt-desk-in-right { from { opacity: 0; transform: translateX(32px); } }
@keyframes vt-desk-out-right { to { opacity: 0; transform: translateX(24px); } }
@keyframes vt-desk-in-left { from { opacity: 0; transform: translateX(-32px); } }

@keyframes vt-slide-in { from { transform: translateX(100%); } }
@keyframes vt-push-under { to { transform: translateX(-28%); filter: brightness(.92); } }
@keyframes vt-slide-out { to { transform: translateX(100%); } }
@keyframes vt-pop-from-under { from { transform: translateX(-28%); filter: brightness(.92); } }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

/* Zonder View Transitions: alleen het nieuwe scherm schuift kort in. */
.view.anim { animation: view-in .3s var(--ease-out) both; }
.view.anim.fwd { --from: 40px; }
.view.anim.back { --from: -40px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
