/* =============================================================================
   Dartly – Design-System der App.

   Richtung: Kneipe und Wettkampf zugleich. Dart-Rot als Akzent für die eine
   Hauptaktion je Ansicht, Board-Grün für Erfolg (Checkout, Sieg), Gold nur für
   Höhepunkte (180, High Finish). Große Zahlen in Barlow Condensed mit
   tabular-nums, Text in Inter.

   Zwei Themes (Entscheidung 14/26): Dunkel auf tiefem Anthrazit, Hell auf
   warmem Off-White. Das Inline-Skript in index.html setzt data-theme vor dem
   ersten Zeichnen; theme.js übernimmt danach. Komponenten benutzen nur Tokens,
   nie Rohfarben – sonst passt eine Seite nur in einem Theme.

   Kontraste (WCAG, geprüft):
     Dunkel  --text 17:1 · --muted 7,9:1 · --faint 5,7:1 auf --bg
             --accent 6,4:1 · --pos 9,9:1 · --gold 10,7:1 auf --bg
             Weiß auf --accent-fill 5,0:1 · --on-gold auf --gold-fill 10,3:1
     Hell    --text 15,2:1 · --muted 5,8:1 · --faint 4,5:1 auf --bg
             --accent 6,3:1 · --pos 5,6:1 · --gold 5,4:1 auf --bg
             Weiß auf --accent-fill 6,0:1
   Ränder (--border) tragen nie Text.
   ============================================================================= */

:root {
    /* --- Maße und Rhythmus (4/8-Raster) --- */
    --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --radius-pill: 999px;

    --tap: 44px;              /* Mindestgröße für Tippziele */
    --tap-spiel: 56px;        /* Tasten im Spiel (Tastenfeld) */
    --tabbar-h: 64px;
    --topbar-h: 56px;
    --sidebar-w: 248px;
    --dock-h: 0px;            /* misst shell.js */
    --safe-b: env(safe-area-inset-bottom, 0px);

    --font:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-zahl: 'Barlow Condensed', 'Arial Narrow', 'Inter', sans-serif;

    --ease:  cubic-bezier(.2, .8, .2, 1);
    --dauer: 180ms;

    --z-sheet: 100;
    --z-toast: 200;
}

/* --- Dunkel (Standard, falls das Skript im Kopf nicht läuft) --- */
:root, :root[data-theme="dark"] {
    --bg:        #0f1115;
    --bg-2:      #0a0b0e;   /* tiefer als bg: Eingabefelder, Vertiefungen */
    --surface:   #191c23;   /* Karten, Listen */
    --surface-2: #222631;   /* gehobene Fläche, gedrückt */
    --surface-3: #2b303d;
    --border:    #2c313d;   /* nur Ränder */
    --border-2:  #3a404d;
    --text:      #f1f3f6;
    --muted:     #a0a8b8;
    --faint:     #858d9d;

    --accent:      #ff6066; /* Dart-Rot als Text/Symbol */
    --accent-fill: #d42a31; /* Dart-Rot als Fläche, weiße Schrift */
    --accent-ink:  #ffffff;
    --accent-soft: rgba(255, 96, 102, .14);
    --accent-line: rgba(255, 96, 102, .40);

    --pos: #45d483;         /* Board-Grün: Checkout, Sieg */
    --pos-soft: rgba(69, 212, 131, .14);
    --neg: #ff7a7a;         /* Fehler, Bust */
    --neg-soft: rgba(255, 122, 122, .14);
    --warn: #f5b942;
    --warn-soft: rgba(245, 185, 66, .14);
    --gold: #f5b942;        /* 180, High Finish */
    --gold-fill: #f5b942;
    --on-gold: #1d1400;

    --scrim: rgba(4, 5, 8, .66);
    --shadow:    0 10px 30px -12px rgba(0, 0, 0, .7);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
    --ring: 0 0 0 3px rgba(255, 96, 102, .5);
    --glass: rgba(15, 17, 21, .86);

    --sb-rand:   #07080a;
    --sb-dunkel: #202228;
    --sb-hell:   #e9dcc0;
    --sb-rot:    #d7363c;
    --sb-gruen:  #1d8f55;
    --sb-zahl:   #f1f3f6;
    --sb-draht:  rgba(205, 210, 220, .38);
    --qr-grund:  #ffffff;

    /* Diagramme (dataviz, Referenzpalette Blau; Kontrast zur Fläche geprüft) */
    --reihe:      #3987e5;
    --reihe-wash: rgba(57, 135, 229, .12);
    --heat-min:   #1f4a85;   /* selten – nah an der Fläche */
    --heat-max:   #cde2fb;   /* oft – im Dunkeln hell */
    --heat-leer:  #262a35;   /* nie getroffen: neutral */

    color-scheme: dark;
}

/* --- Hell (warm) --- */
:root[data-theme="light"] {
    --bg:        #f6f3ee;
    --bg-2:      #ece7df;
    --surface:   #ffffff;
    --surface-2: #f3efe8;
    --surface-3: #e8e2d8;
    --border:    #e2dbd0;
    --border-2:  #cbc2b3;
    --text:      #1c1d22;
    --muted:     #5b5f6b;
    --faint:     #6b6f7b;

    --accent:      #b3141c;
    --accent-fill: #c21f28;
    --accent-ink:  #ffffff;
    --accent-soft: rgba(194, 31, 40, .09);
    --accent-line: rgba(194, 31, 40, .32);

    --pos: #15703c;
    --pos-soft: rgba(21, 112, 60, .10);
    --neg: #b3261e;
    --neg-soft: rgba(179, 38, 30, .09);
    --warn: #8a5a00;
    --warn-soft: rgba(245, 185, 66, .22);
    --gold: #8a5a00;        /* als Text; als Fläche --gold-fill */
    --gold-fill: #f5b942;
    --on-gold: #1d1400;

    --scrim: rgba(28, 29, 34, .42);
    --shadow:    0 10px 28px -14px rgba(28, 29, 34, .25);
    --shadow-lg: 0 24px 56px -22px rgba(28, 29, 34, .3);
    --ring: 0 0 0 3px rgba(194, 31, 40, .35);
    --glass: rgba(246, 243, 238, .9);

    --sb-rand:   #1c1d22;
    --sb-dunkel: #202228;
    --sb-hell:   #efe3c8;
    --sb-rot:    #d7363c;
    --sb-gruen:  #1d8f55;
    --sb-zahl:   #f6f3ee;
    --sb-draht:  rgba(205, 210, 220, .38);
    --qr-grund:  #ffffff;

    --reihe:      #2a78d6;
    --reihe-wash: rgba(42, 120, 214, .10);
    --heat-min:   #cde2fb;
    --heat-max:   #104281;
    --heat-leer:  #ece7df;

    color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
    :root { --dauer: 0ms; }
    *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}

/* ----------------------------------------------------------------------------
   Grundlage
   ---------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
/* Das hidden-Attribut gewinnt immer – sonst überstimmt etwa .badge (inline-flex) es. */
[hidden] { display: none !important; }

html { height: 100%; -webkit-tap-highlight-color: transparent; }

body {
    height: 100dvh;
    margin: 0;
    overflow: hidden;              /* die SEITE scrollt nie – nur .content */
    overscroll-behavior: none;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;               /* unter 16px zoomt iOS beim Fokus */
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font: 800 clamp(30px, 6vw, 40px)/1.05 var(--font-zahl); letter-spacing: .01em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
button, .tab, .sb-link, .chip { user-select: none; touch-action: manipulation; }
img { max-width: 100%; display: block; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: var(--sp-3); top: -60px; z-index: 50;
    display: inline-flex; align-items: center; min-height: var(--tap);
    background: var(--accent-fill); color: var(--accent-ink); padding: var(--sp-2) var(--sp-4); border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--sp-3); }

.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-lg { gap: var(--sp-5); }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.zahl { font-family: var(--font-zahl); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.mittig { text-align: center; }
.text-danger { color: var(--neg); }

/* Strich und Füllung MÜSSEN hier stehen: Bei <use> auf eine externe Sprite
   erbt das Symbol nichts von deren Wurzel-<svg>, sondern nur vom <use>. */
.icon {
    width: 20px; height: 20px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

/* ----------------------------------------------------------------------------
   Knöpfe
   ---------------------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    min-height: var(--tap); padding: 0 var(--sp-4);
    border: 1px solid transparent; border-radius: var(--radius);
    font-weight: 650; font-size: 15px; line-height: 1;
    cursor: pointer; text-decoration: none !important; white-space: nowrap;
    transition: transform var(--dauer) var(--ease), background-color var(--dauer), border-color var(--dauer), opacity var(--dauer);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent-fill); color: var(--accent-ink); box-shadow: 0 6px 18px -8px var(--accent-line); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-2); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--neg-soft); color: var(--neg); border-color: var(--neg-soft); }
.btn-ok { background: var(--pos); color: var(--bg); }
/* Auch „klein“ bleibt eine volle Tippfläche (pro-rules: mindestens 44 px). */
.btn-sm { min-height: var(--tap); padding: 0 var(--sp-3); font-size: 14px; border-radius: var(--radius-sm); }
.btn-lg { min-height: 52px; font-size: 17px; padding: 0 var(--sp-6); }
.btn-block { width: 100%; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: var(--tap); height: var(--tap); flex: none;
    border: 0; border-radius: var(--radius); background: transparent; color: var(--text);
    cursor: pointer; transition: background-color var(--dauer);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ----------------------------------------------------------------------------
   Formulare
   ---------------------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--muted); }
.hint { font-size: 13px; color: var(--faint); }
.field-error, .feld-fehler { color: var(--neg); font-size: 13px; }
.feld-fehler:empty { display: none; }

input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="search"],
input:not([type]), textarea, select {
    width: 100%; min-height: 46px;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-2); color: var(--text);
    border: 1px solid var(--border-2); border-radius: var(--radius);
    font: inherit; font-size: 16px;
    transition: border-color var(--dauer), box-shadow var(--dauer);
}
:root[data-theme="light"] :is(input, textarea, select) { background: var(--surface); }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--neg); }
input::placeholder, textarea::placeholder { color: var(--faint); }

/* Schalter */
/* position: relative – der unsichtbare Input bleibt in seiner Zeile statt irgendwo auf der Seite. */
.schalter { position: relative; display: flex; align-items: center; gap: var(--sp-3); cursor: pointer; min-height: var(--tap); }
.schalter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.schalter .bahn {
    width: 46px; height: 28px; flex: none; border-radius: var(--radius-pill);
    background: var(--surface-3); border: 1px solid var(--border-2); position: relative;
    transition: background-color var(--dauer);
}
.schalter .bahn::after {
    content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--text); transition: transform var(--dauer) var(--ease);
}
.schalter input:checked + .bahn { background: var(--accent-fill); border-color: var(--accent-fill); }
.schalter input:checked + .bahn::after { transform: translateX(18px); background: var(--accent-ink); }
.schalter input:focus-visible + .bahn { box-shadow: var(--ring); }

/* Segmente (zwei bis vier Möglichkeiten) */
.seg { display: flex; gap: 2px; padding: 3px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); }
.seg button {
    flex: 1 1 0; min-width: 0; min-height: var(--tap); padding: 0 var(--sp-3);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
    font: inherit; font-size: 14px; font-weight: 650; cursor: pointer;
    transition: background-color var(--dauer) var(--ease), color var(--dauer) var(--ease);
}
.seg button[aria-selected="true"], .seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 var(--border), inset 0 0 0 1px var(--border-2); }
.seg button:focus-visible { outline: none; box-shadow: var(--ring); }

/* ----------------------------------------------------------------------------
   Karten, Listen, Kleinteile
   ---------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-4);
}

.list { display: flex; flex-direction: column; }
.list-row {
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: 56px; padding: var(--sp-3) var(--sp-2);
    color: var(--text); text-decoration: none !important;
    border: 0; border-bottom: 1px solid var(--border); background: none;
    width: 100%; text-align: left; cursor: pointer;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-title { font-weight: 600; display: block; }
.list-sub { font-size: 13px; color: var(--muted); display: block; }
.row-icon {
    display: grid; place-items: center; width: 40px; height: 40px; flex: none;
    border-radius: var(--radius); background: var(--surface-2); color: var(--muted);
}
.row-icon.is-gold { background: var(--warn-soft); color: var(--gold); }
.row-icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.row-icon.is-neg { background: var(--neg-soft); color: var(--neg); }

.badge {
    display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
    border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; letter-spacing: .02em;
    background: var(--surface-3); color: var(--muted);
}
.badge-gold, .badge-accent { background: var(--accent-fill); color: var(--accent-ink); }
.badge-ok { background: var(--pos-soft); color: var(--pos); }
.badge-bad { background: var(--neg-soft); color: var(--neg); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

.avatar {
    display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%;
    background: var(--surface-3); color: var(--text); font-size: 13px; font-weight: 700; object-fit: cover;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

.trenner { height: 1px; background: var(--border); margin: var(--sp-4) 0; border: 0; }

.error-box {
    padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
    background: var(--neg-soft); border: 1px solid var(--neg-soft); color: var(--neg);
}
.info-box {
    padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    display: flex; gap: var(--sp-3); align-items: flex-start;
}
.warn-box {
    padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
    background: var(--warn-soft); border: 1px solid var(--warn-soft); color: var(--text);
    display: flex; gap: var(--sp-3); align-items: flex-start;
}
.warn-box > .icon { color: var(--warn); }

.spinner {
    width: 32px; height: 32px; border-radius: 50%;
    border: 3px solid var(--border-2); border-top-color: var(--accent);
    animation: drehen .8s linear infinite;
}
@keyframes drehen { to { transform: rotate(360deg); } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-4); padding: var(--sp-10) var(--sp-4); }
.empty-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: var(--accent-soft); color: var(--accent); }
.empty-icon .icon { width: 34px; height: 34px; }
.empty h3 { font-size: 20px; }
.empty p { color: var(--muted); max-width: 42ch; margin-top: var(--sp-1); }

.skelett { display: flex; flex-direction: column; gap: var(--sp-3); }
.sk { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: schimmer 1.4s linear infinite; }
.sk-titel { height: 34px; width: 60%; }
.sk-zeile { height: 16px; width: 40%; }
.sk-karte { height: 88px; }
.sk-karte.hoch { height: 200px; }
@keyframes schimmer { to { background-position: -200% 0; } }

/* ----------------------------------------------------------------------------
   Toast, Banner und Blätter (ui.js)
   ---------------------------------------------------------------------------- */

.toast {
    position: fixed; left: 50%; z-index: var(--z-toast);
    bottom: calc(var(--dock-h) + var(--tabbar-off, 0px) + var(--safe-b) + 20px);
    transform: translate(-50%, 24px); opacity: 0; pointer-events: none;
    max-width: min(92vw, 460px); padding: var(--sp-3) var(--sp-4);
    background: var(--text); color: var(--bg); border-radius: var(--radius);
    font-weight: 600; box-shadow: var(--shadow-lg);
    transition: transform 220ms var(--ease), opacity 220ms;
    display: flex; align-items: center; gap: var(--sp-3);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast.error { background: var(--neg); color: var(--bg); }
.toast-aktion { border: 0; background: none; color: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; padding: var(--sp-1) var(--sp-2); }

/* Neue Version bereit (sw-update.js) */
.action-banner {
    position: fixed; left: 0; right: 0; z-index: 80;
    bottom: calc(var(--dock-h) + var(--tabbar-off, 0px) + var(--safe-b) + 20px);
    display: flex; align-items: center; gap: var(--sp-2);
    width: min(100% - 2 * var(--sp-4), 460px); margin-inline: auto;
    padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4);
    border-radius: var(--radius-lg); border: 1px solid var(--accent-line);
    background: var(--surface); box-shadow: var(--shadow-lg);
    font-size: 14px; font-weight: 650;
}

.sheet-scrim {
    position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px);
    animation: einblenden 200ms ease both;
}
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0;
    max-height: min(92dvh, 900px); display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg);
    animation: hochfahren 260ms var(--ease) both; padding-bottom: var(--safe-b);
}
.sheet.is-closing, .sheet-scrim.is-closing { animation: ausblenden 180ms ease both; }
.sheet.is-dragging { transition: none; }
.sheet-grab { width: 44px; height: 5px; border-radius: 3px; background: var(--border-2); margin: var(--sp-2) auto 0; }
.sheet-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-5); }
.sheet-head .title { font-weight: 700; font-size: 18px; }
.sheet-body { padding: var(--sp-2) var(--sp-5) var(--sp-5); overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { padding: var(--sp-3) var(--sp-5) var(--sp-4); border-top: 1px solid var(--border); }
@media (min-width: 768px) {
    .sheet {
        left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 92vw);
        transform: translate(-50%, -50%); border-radius: var(--radius-xl); border-bottom: 1px solid var(--border);
        animation: aufzoomen 220ms var(--ease) both;
    }
    .sheet-grab { display: none; }
}
@keyframes einblenden { from { opacity: 0; } }
@keyframes ausblenden { to { opacity: 0; } }
@keyframes hochfahren { from { transform: translateY(100%); } }
@keyframes aufzoomen { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }

.patchnotes { white-space: pre-line; color: var(--muted); }
.install-benefits, .install-steps {
    list-style: none; margin: 0; padding: 0; color: var(--muted);
    display: flex; flex-direction: column; gap: var(--sp-3); counter-reset: schritt;
}
.install-benefits li, .install-steps li { display: flex; align-items: flex-start; gap: var(--sp-3); line-height: 1.45; }
.install-benefits > li > .icon, .install-steps > li > .icon { flex: none; margin-top: 2px; color: var(--accent); }
.install-steps > li::before {
    counter-increment: schritt; content: counter(schritt);
    flex: none; width: 24px; height: 24px; display: grid; place-items: center;
    border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 12px; font-weight: 700;
}

/* ----------------------------------------------------------------------------
   Anmeldung (modules/auth.js)
   ---------------------------------------------------------------------------- */

.auth { height: 100dvh; overflow-y: auto; }
.auth-shell {
    min-height: 100dvh; display: grid; align-content: center; gap: var(--sp-8);
    padding: max(var(--sp-8), env(safe-area-inset-top)) var(--sp-4) calc(var(--sp-8) + var(--safe-b));
    max-width: 1080px; margin: 0 auto;
}
.auth-pitch { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.auth-pitch h1 { font-size: clamp(36px, 8vw, 58px); }
.auth-pitch .unterzeile { color: var(--muted); max-width: 40ch; }
.auth-steps { display: none; list-style: none; padding: 0; margin: var(--sp-4) 0 0; gap: var(--sp-4); }
.auth-steps li { display: flex; gap: var(--sp-3); align-items: flex-start; text-align: left; }
.auth-steps b { display: block; }
.auth-steps span:not(.row-icon) { color: var(--muted); font-size: 14px; }
.auth-steps .row-icon { background: var(--accent-soft); color: var(--accent); }
.auth-card {
    width: 100%; max-width: 420px; margin: 0 auto; padding: var(--sp-6);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: var(--sp-3);
}
.auth-card.is-status { text-align: center; }
.auth-lead { color: var(--muted); }
.auth-note { padding: var(--sp-2) var(--sp-3); background: var(--warn-soft); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-2); }
.auth-field { display: flex; flex-direction: column; gap: var(--sp-2); }
.auth-field label { font-size: 14px; font-weight: 600; color: var(--muted); }
.auth-input-group { position: relative; }
.auth-input-group input { padding-right: 52px; }
.auth-reveal { position: absolute; right: 2px; top: 1px; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.auth-switch { text-align: center; font-size: 14px; color: var(--muted); }
.auth-retry { margin-top: var(--sp-4); }
@media (min-width: 900px) {
    .auth-shell { grid-template-columns: 1.1fr 1fr; align-items: center; }
    .auth-pitch { text-align: left; align-items: flex-start; }
    .auth-steps { display: flex; flex-direction: column; }
}

/* Wortmarke: Scheibe + „Dartly“ */
.wortmarke {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    font: 800 28px/1 var(--font-zahl); letter-spacing: .01em;
    color: var(--text); text-decoration: none !important;
}
.wortmarke img { width: 32px; height: 32px; }
.wortmarke b { color: var(--accent); font-weight: 800; }

/* ----------------------------------------------------------------------------
   App-Hülle
   Handy: Kopf / Inhalt / Tab-Leiste, exakt 100dvh, gescrollt wird nur .content.
   Ab 900 px: Seitenleiste links, Tab-Leiste aus.
   ---------------------------------------------------------------------------- */

.app { display: flex; height: 100dvh; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }

.topbar {
    position: relative; z-index: 20; flex: none;
    display: flex; align-items: center; gap: var(--sp-1);
    min-height: var(--topbar-h); padding: 6px var(--sp-2); padding-top: max(6px, env(safe-area-inset-top));
    background: var(--bg);
    border-bottom: 1px solid transparent; transition: border-color var(--dauer);
}
.topbar.is-scrolled { border-bottom-color: var(--border); }
.topbar .title { font-weight: 700; font-size: 17px; padding: 0 var(--sp-2); }
.topbar-lead { display: flex; align-items: center; }
.kopf-marke { padding: 0 var(--sp-2); font-size: 26px; }
.kopf-marke img { width: 28px; height: 28px; }

.content { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain; scroll-padding-top: var(--sp-4); }
/* Der Router fokussiert den Inhalt nach jedem Wechsel (für Screenreader) – ein
   Ring um die ganze Fläche wäre dabei nur Rauschen. */
.content:focus, .content:focus-visible { outline: none; box-shadow: none; border-radius: 0; }
.seite { width: 100%; max-width: 860px; margin: 0 auto; padding: var(--sp-4) var(--sp-4) calc(var(--sp-12) + var(--dock-h)); }
.seite-breit { max-width: 1280px; }
.seite-kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-2) 0 var(--sp-5); flex-wrap: wrap; }
.seite-kopf p { color: var(--muted); margin-top: var(--sp-1); }

.dock { flex: none; }
.actionbar:empty { display: none; }
.actionbar {
    display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4);
    background: var(--glass); border-top: 1px solid var(--border);
}

/* --- Tab-Leiste (Handy) --- */
.tabbar {
    flex: none; display: flex; align-items: stretch;
    min-height: var(--tabbar-h); padding-bottom: var(--safe-b);
    background: var(--bg); border-top: 1px solid var(--border);
}
.tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: var(--tap); padding: var(--sp-2) 2px;
    border: 0; background: none; color: var(--muted);
    font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .01em;
    text-decoration: none !important; cursor: pointer; position: relative;
    transition: color var(--dauer) var(--ease);
}
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"]::before {
    content: ''; position: absolute; top: 0; left: 50%;
    width: 28px; height: 3px; transform: translateX(-50%);
    border-radius: 0 0 3px 3px; background: var(--accent);
}
.tab:active .icon { transform: scale(.9); }
.tab .icon { width: 22px; height: 22px; transition: transform var(--dauer) var(--ease); }
.tab .badge { position: absolute; top: 4px; left: calc(50% + 6px); height: 18px; padding: 0 6px; font-size: 11px; }

/* In einer Partie verschwinden Tab-Leiste und Seitenleiste (Entscheidung 27). */
.app[data-chrome="spiel"] .tabbar,
.app[data-chrome="spiel"] .sidebar { display: none; }

/* --- Seitenleiste (Desktop) --- */
.sidebar { display: none; }
@media (min-width: 900px) {
    .tabbar { display: none; }
    .sidebar {
        display: flex; flex-direction: column; gap: var(--sp-1);
        width: var(--sidebar-w); flex: none; height: 100dvh;
        padding: var(--sp-4) var(--sp-3); border-right: 1px solid var(--border);
        background: var(--bg-2); overflow-y: auto;
    }
    :root[data-theme="light"] .sidebar { background: var(--surface-2); }
    .sb-marke { margin: var(--sp-1) var(--sp-2) var(--sp-5); }
    .sb-link {
        display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); padding: 0 var(--sp-3);
        border-radius: var(--radius); color: var(--muted); text-decoration: none !important; font-weight: 600;
        border: 0; background: none; width: 100%; cursor: pointer; text-align: left;
        transition: background-color var(--dauer), color var(--dauer);
    }
    .sb-link:hover { background: var(--surface); color: var(--text); }
    .sb-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
    .sb-label { font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin: var(--sp-4) var(--sp-3) var(--sp-1); }
    .sb-fuss { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-1); }
    .sb-neu { margin: 0 0 var(--sp-3); }
    .topbar .nur-mobil { display: none; }
    .content .seite { padding-left: var(--sp-6); padding-right: var(--sp-6); }
}
@media (min-width: 900px) { .nur-schmal { display: none !important; } }
@media (max-width: 899px) { .nur-breit { display: none !important; } }

/* ----------------------------------------------------------------------------
   Start, Verlauf, Statistik
   ---------------------------------------------------------------------------- */

.start-hero {
    display: grid; gap: var(--sp-4); align-items: center;
    padding: var(--sp-6) var(--sp-5); border-radius: var(--radius-xl);
    background: radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 60%), var(--surface);
    border: 1px solid var(--border);
}
.start-hero h1 { font-size: clamp(34px, 7vw, 48px); }
.start-hero p { color: var(--muted); max-width: 46ch; }
.start-hero .scheibe { width: 120px; height: 120px; justify-self: center; }
@media (min-width: 640px) { .start-hero { grid-template-columns: 1fr auto; } .start-hero .scheibe { width: 150px; height: 150px; } }

.modus-raster { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-top: var(--sp-5); }
.modus-karte {
    display: flex; flex-direction: column; gap: var(--sp-1);
    padding: var(--sp-4); border-radius: var(--radius-lg);
    background: var(--surface); border: 1px solid var(--border);
}
.modus-karte b { font: 800 26px/1 var(--font-zahl); }
a.modus-karte { color: var(--text); text-decoration: none !important; transition: border-color var(--dauer), background-color var(--dauer); }
.modus-karte.is-bereit { border-color: var(--accent-line); }
.modus-karte.is-bereit:hover { background: var(--surface-2); border-color: var(--accent); }
.modus-karte.is-bald { opacity: .72; }
.modus-karte .badge { align-self: flex-start; margin-top: var(--sp-1); }
.modus-karte span { color: var(--muted); font-size: 14px; }
.abschnitt-titel { font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; margin: var(--sp-8) 0 var(--sp-2); }

/* ----------------------------------------------------------------------------
   Profil
   ---------------------------------------------------------------------------- */

.seite > .profil-hero, .seite > .settings-label, .seite > .settings-group,
.seite > .seg, .seite > .profil-version { max-width: 560px; margin-inline: auto; }
.profil-hero {
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
    padding: var(--sp-8) var(--sp-5) var(--sp-6);
    border: 1px solid var(--border); border-radius: var(--radius-xl);
    background: radial-gradient(90% 80% at 50% 0%, var(--accent-soft), transparent 70%), var(--surface);
    text-align: center;
}
.profil-hero h1 { font-size: 30px; }
.avatar-xl { width: 88px; height: 88px; font-size: 28px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--accent-line); }
.profil-version { margin-top: var(--sp-6); text-align: center; font-size: 13px; color: var(--faint); }

.settings-label {
    margin-top: var(--sp-6); margin-bottom: var(--sp-2); padding-inline: var(--sp-1);
    font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint);
}
.settings-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.settings-row {
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: 56px; padding: var(--sp-3) var(--sp-4); width: 100%;
    background: none; border: 0; text-align: left; font: inherit;
    color: var(--text); text-decoration: none !important; cursor: pointer;
}
.settings-row + .settings-row { box-shadow: 0 -1px 0 var(--border); }
.settings-row:hover { background: var(--surface-2); }
.settings-row:focus-visible { outline: none; box-shadow: inset var(--ring); }
.chev { color: var(--faint); width: 18px; height: 18px; flex: none; }

/* ----------------------------------------------------------------------------
   Hilfe & Feedback (#/support) – die Meldungen liegen im Hub
   ---------------------------------------------------------------------------- */

.seite > .support-liste, .seite > .support-kopf, .seite > .thread, .seite > .support-form,
.seite > #antwort-form, .seite > .info-box { max-width: 720px; margin-inline: auto; }
.support-zeile { gap: var(--sp-3); }
.support-zeile.is-neu .list-title { color: var(--accent); }
.support-rechts { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-1); flex: none; }
.support-kopf { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; margin-bottom: var(--sp-4); }
.support-kopf h1 { font: 700 22px/1.25 var(--font); }
.thread { list-style: none; margin: var(--sp-4) auto; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.thread-msg { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); max-width: 92%; }
.thread-msg.is-ich { align-self: flex-end; background: var(--surface-2); }
.thread-msg.is-team { align-self: flex-start; border-left: 4px solid var(--accent); }
.thread-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-1); }
.thread-body { line-height: 1.5; overflow-wrap: anywhere; }
.thread-system { display: flex; align-items: center; gap: var(--sp-2); justify-content: center; font-size: 13px; color: var(--faint); }
.thread-bilder { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.thread-bild { display: grid; place-items: center; width: 88px; height: 88px; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); color: var(--faint); }
.thread-bild img { width: 100%; height: 100%; object-fit: cover; }
.typ-wahl { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.typ-raster { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.typ-karte {
    position: relative; display: flex; flex-direction: column; gap: var(--sp-1); min-height: var(--tap);
    padding: var(--sp-3); border-radius: var(--radius-lg); border: 2px solid var(--border); background: var(--surface);
    cursor: pointer; transition: border-color var(--dauer);
}
.typ-karte:hover { border-color: var(--border-2); }
.typ-karte:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.typ-karte:has(input:focus-visible) { box-shadow: var(--ring); }
.typ-karte input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.typ-karte > .icon { color: var(--accent); }
@media (max-width: 480px) { .typ-raster { grid-template-columns: 1fr; } }
.ablage {
    display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-3) var(--sp-4);
    border: 2px dashed var(--border-2); border-radius: var(--radius-lg); cursor: pointer; color: var(--muted);
    transition: border-color var(--dauer), background-color var(--dauer);
}
.ablage:hover, .ablage.is-ueber, .ablage:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.ablage > span { display: flex; flex-direction: column; gap: 2px; }
.ablage b { color: var(--text); }
.vorschau { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.vorschau li { position: relative; width: 88px; height: 88px; border-radius: var(--radius); overflow: hidden; }
.vorschau img { width: 100%; height: 100%; object-fit: cover; }
.vorschau .icon-btn { position: absolute; top: 2px; right: 2px; background: var(--glass); }
.diag-box summary { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); cursor: pointer; color: var(--muted); font-size: 14px; }
.diag { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-1) var(--sp-3); margin: var(--sp-2) 0; font-size: 13px; }
.diag dt { color: var(--faint); }
.diag dd { margin: 0; overflow-wrap: anywhere; }

/* Toast und Banner stehen auf dem Handy über der Tab-Leiste. */
@media (max-width: 899px) { :root { --tabbar-off: var(--tabbar-h); } }

/* ----------------------------------------------------------------------------
   Netz-Streifen (offline.js) – zwischen Kopf und Inhalt, nimmt Platz ein
   ---------------------------------------------------------------------------- */

.netz-streifen {
    flex: none; display: flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4); font-size: 13px; font-weight: 600; line-height: 1.35;
    background: var(--warn-soft); color: var(--text); border-bottom: 1px solid var(--border);
}
.netz-streifen > .icon { color: var(--warn); }
.netz-streifen.is-bad { background: var(--neg-soft); }
.netz-streifen.is-bad > .icon { color: var(--neg); }
.netz-streifen.is-info { background: var(--surface-2); }
.netz-streifen.is-info > .icon { color: var(--accent); animation: drehen 1.4s linear infinite; }

/* Farbpunkt eines Spielers – Farbe nur als Fläche, nie als Schrift. */
.farbpunkt {
    display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 50%;
    background: var(--spieler, var(--border-2)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}
.farbpunkt-gross { width: 22px; height: 22px; }

/* ----------------------------------------------------------------------------
   Lobby (#/neu)
   ---------------------------------------------------------------------------- */

.seite > #lobby, .seite > #lobby-offline { max-width: 640px; margin-inline: auto; }
.lobby-warn { margin-bottom: var(--sp-2); }
.lobby-frei { margin-top: var(--sp-3); }
.lobby-zwei { display: grid; gap: 0 var(--sp-4); }
@media (min-width: 560px) { .lobby-zwei { grid-template-columns: 1fr 1fr; } }
.lobby-row { gap: var(--sp-3); cursor: default; }
.lobby-row:hover { background: none; }
.lobby-row > .seg { flex: 1; }
.lobby-format-text { padding: var(--sp-3) var(--sp-4); color: var(--muted); font-size: 14px; box-shadow: 0 -1px 0 var(--border); }
.lobby-hint { margin: var(--sp-2) var(--sp-1) 0; }

.stepper {
    display: inline-flex; align-items: center; gap: 2px; padding: 2px;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
}
:root[data-theme="light"] .stepper { background: var(--surface-2); }
.stepper output { min-width: 2.6ch; text-align: center; font: 800 24px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }

.spieler-liste { list-style: none; margin: 0; padding: 0; }
.spieler-liste > li + li { box-shadow: 0 -1px 0 var(--border); }
.spieler-zeile { display: flex; align-items: center; gap: var(--sp-1); min-height: 60px; padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-1); }
.spieler-zeile .list-title { display: block; }
.spieler-zeile.is-veraltet .list-sub { color: var(--neg); }
.spieler-liste button.settings-row:disabled { cursor: not-allowed; opacity: .55; }
.farb-knopf {
    width: var(--tap); height: var(--tap); flex: none; display: grid; place-items: center;
    border: 0; background: none; border-radius: var(--radius); cursor: pointer;
}
.farb-knopf:hover { background: var(--surface-2); }
.farb-knopf .farbpunkt { width: 22px; height: 22px; }

.farben { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.farbe {
    aspect-ratio: 1; min-height: var(--tap); border-radius: 50%; cursor: pointer;
    border: 3px solid transparent; background: var(--spieler); display: grid; place-items: center;
    box-shadow: 0 0 0 1px var(--border); transition: transform var(--dauer) var(--ease);
}
.farbe:active { transform: scale(.94); }
.farbe[aria-checked="true"] { border-color: var(--surface); box-shadow: 0 0 0 3px var(--text); }
.farbe .icon { stroke: #fff; width: 22px; height: 22px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .55)); }
.gast-neu { margin-top: var(--sp-5); }
.gast-neu .row { align-items: stretch; }
.gast-neu input { flex: 1 1 auto; min-width: 0; }
.list-row:disabled { cursor: default; opacity: .6; }
.list-row:disabled:hover { background: none; }

/* ----------------------------------------------------------------------------
   Spiel (#/partie/…) – Handy: Tafel oben, Eingabe unten; ab 900 px zwei Spalten
   ---------------------------------------------------------------------------- */

.content .seite.seite-spiel {
    max-width: 1320px; min-height: 100%; display: flex; flex-direction: column;
    padding: var(--sp-3) var(--sp-3) calc(var(--sp-3) + var(--safe-b));
}
.spiel { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--sp-3); }
.spiel-links { display: flex; flex-direction: column; gap: var(--sp-3); }
.spiel-rechts { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-3); }
.spiel-hinweise { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.spiel-hinweise:empty { display: none; }
.spiel-hinweise > div { width: 100%; }
.spiel-hinweise p { margin: 0; }

@media (max-width: 899px) {
    .spiel-rechts { flex: 1 1 auto; justify-content: flex-end; }
    .eingabe { display: flex; flex-direction: column; justify-content: flex-end; flex: 1 1 auto; max-height: 400px; }
    .eingabe-tasten { flex: 1 1 auto; display: flex; flex-direction: column; }
    .eingabe-tasten .tasten { flex: 1 1 auto; grid-auto-rows: minmax(var(--tap-spiel), 1fr); }
    .spiel[data-eingabe="scheibe"] .eingabe { max-height: none; }
}
@media (min-width: 900px) {
    .content .seite.seite-spiel { padding: var(--sp-5) var(--sp-6) var(--sp-6); }
    .spiel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: var(--sp-6); align-items: start; }
    .spiel-rechts { margin-top: 0; position: sticky; top: 0; }
}

/* --- Anzeigetafel --- */
.tafel { display: grid; gap: var(--sp-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tafel[data-anzahl="1"] { grid-template-columns: minmax(0, 1fr); }
.tafel[data-groesse="klein"] { grid-template-columns: minmax(0, 1fr); gap: 6px; }

.kachel {
    position: relative; min-width: 0; overflow: hidden;
    padding: var(--sp-3) var(--sp-3) var(--sp-3) calc(var(--sp-3) + 4px);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    transition: border-color var(--dauer), background-color var(--dauer), opacity var(--dauer);
}
.kachel::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--spieler); }
.kachel.is-am-zug {
    border-color: var(--accent);
    background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--surface);
    box-shadow: inset 0 0 0 1px var(--accent), var(--shadow);
}
.kachel.is-aus { opacity: .5; }
.kachel.is-sieger { border-color: var(--pos); box-shadow: inset 0 0 0 1px var(--pos); }
.tk-kopf { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tk-name { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 15px; }
.tk-anwurf { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.tk-stand { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tk-rest { font: 800 clamp(54px, 16vw, 76px)/1 var(--font-zahl); font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin: var(--sp-1) 0 var(--sp-1); }
.tk-fuss { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.tk-fuss b { color: var(--text); font-size: 15px; font-weight: 700; }
.tk-zug { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.tk-bust { color: var(--neg); font-weight: 700; }
.tk-wert:empty { display: none; }

.tafel[data-groesse="mittel"] .tk-rest { font-size: clamp(40px, 11vw, 56px); }
.tafel[data-groesse="klein"] .kachel {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 var(--sp-3);
    padding-block: var(--sp-2);
}
.tafel[data-groesse="klein"] .tk-rest { grid-column: 2; grid-row: 1 / span 2; font-size: 34px; margin: 0; }
.tafel[data-groesse="klein"] .kachel:not(.is-am-zug) .tk-fuss { display: none; }

@media (min-width: 900px) {
    .tafel[data-groesse="gross"] .tk-rest { font-size: 104px; }
    .tafel[data-groesse="mittel"] .tk-rest { font-size: 68px; }
    .tafel[data-groesse="klein"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kachel { padding: var(--sp-4) var(--sp-4) var(--sp-4) calc(var(--sp-4) + 5px); }
    .tk-name { font-size: 17px; }
}

/* --- Laufende Aufnahme --- */
.aufnahme {
    padding: var(--sp-2) var(--sp-3); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.aufnahme-kopf { display: flex; align-items: center; gap: var(--sp-2); min-height: 28px; font-size: 14px; min-width: 0; }
.aufnahme-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; flex: 0 1 auto; min-width: 0; max-width: 45%; }
.aufnahme-name::before { content: ''; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--spieler); }
.vorher { flex: 1 1 auto; min-width: 0; color: var(--faint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weg { margin-left: auto; display: flex; gap: 4px; flex: none; }
.weg-dart {
    font: 700 16px/1 var(--font-zahl); padding: 5px 8px; border-radius: 6px;
    background: var(--pos-soft); color: var(--pos); font-variant-numeric: tabular-nums;
}
.weg-keiner { color: var(--faint); font-size: 13px; }
.aufnahme-zeile { display: flex; align-items: center; gap: var(--sp-2); margin-top: 6px; }
.plaetze { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.platz {
    height: 42px; display: grid; place-items: center; border-radius: 10px;
    border: 1px dashed var(--border-2); font: 700 21px/1 var(--font-zahl); font-variant-numeric: tabular-nums;
}
.platz.is-voll { border-style: solid; border-color: var(--border); background: var(--surface-2); animation: platz-rein 160ms var(--ease); }
.platz.is-doppel, .platz.is-triple { border-color: var(--accent-line); }
.platz.is-miss { color: var(--muted); }
.platz.is-bust { background: var(--neg-soft); border-color: var(--neg); color: var(--neg); }
.platz.is-checkout { background: var(--pos-soft); border-color: var(--pos); color: var(--pos); }
.platz.is-puffer { border-style: solid; border-color: var(--accent); color: var(--accent); }
@keyframes platz-rein { from { transform: scale(.88); opacity: .4; } }
.aufnahme-summe { min-width: 2.4ch; text-align: right; font: 800 30px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.aufnahme-zeile .btn { flex: none; }

/* --- Eingabe: Tastenfeld oder Scheibe --- */
.spiel[data-eingabe="tasten"] .eingabe-scheibe,
.spiel[data-eingabe="scheibe"] .eingabe-tasten { display: none; }

.tasten { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); }
.taste {
    position: relative; min-height: var(--tap-spiel); min-width: 0; padding: 0 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
    font: 700 25px/1 var(--font-zahl); font-variant-numeric: tabular-nums; cursor: pointer;
    transition: transform 90ms var(--ease), background-color var(--dauer), border-color var(--dauer);
}
.taste:hover:not(:disabled) { background: var(--surface-2); }
.taste:active:not(:disabled) { transform: scale(.95); background: var(--surface-3); }
.taste:disabled { opacity: .38; cursor: not-allowed; }
.taste-klein { font: 600 11px/1.1 var(--font); color: var(--muted); letter-spacing: .02em; }
.taste-gross { font: 800 24px/1 var(--font-zahl); }
.taste-mod { background: var(--surface-2); }
.taste-mod[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); }
.taste-mod[aria-pressed="true"] .taste-klein { color: var(--accent-ink); }
.taste-miss { font: 700 16px/1 var(--font); color: var(--muted); }
.taste-undo { background: var(--surface-2); }
.taste-undo .icon { width: 22px; height: 22px; }
/* Mit D oder T zeigen die Zahlentasten, was sie jetzt eintragen. */
.tasten[data-faktor="2"] .taste[data-s]:not([data-s="0"]):not([data-s="25"])::before { content: 'D'; }
.tasten[data-faktor="3"] .taste[data-s]:not([data-s="0"]):not([data-s="25"])::before { content: 'T'; }
.tasten:not([data-faktor="1"]) .taste[data-s]:not([data-s="0"]) { border-color: var(--accent-line); background: var(--accent-soft); }

.scheibe-flaeche {
    position: relative; width: min(100%, 54dvh, 560px); aspect-ratio: 1; margin: 0 auto;
    touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair;
}
.scheibe-svg { display: block; width: 100%; height: 100%; }
.sb-rand { fill: var(--sb-rand); }
.sb-dunkel { fill: var(--sb-dunkel); }
.sb-hell { fill: var(--sb-hell); }
.sb-rot { fill: var(--sb-rot); }
.sb-gruen { fill: var(--sb-gruen); }
.sb-zahl { fill: var(--sb-zahl); font: 700 .13px var(--font-zahl); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.sb-draht { fill: none; stroke: var(--sb-draht); stroke-width: .005; pointer-events: none; }
.scheibe-svg .is-markiert { filter: brightness(1.45) saturate(1.1); stroke: #fff; stroke-width: .012; }
.sb-hell.is-markiert { filter: brightness(.82); stroke: var(--sb-rand); }
.is-gesperrt .scheibe-flaeche { opacity: .5; cursor: not-allowed; }
.scheibe-label {
    position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none;
    transform: translate(-50%, calc(-100% - 46px)); opacity: 0;
    padding: 6px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg);
    font: 800 34px/1 var(--font-zahl); white-space: nowrap; box-shadow: var(--shadow-lg);
    transition: opacity 120ms ease;
}
.scheibe-label.is-sichtbar { opacity: 1; }
.scheibe-label.is-miss { background: var(--surface-3); color: var(--text); }
.scheibe-leiste { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-top: var(--sp-2); }
.scheibe-leiste .btn { min-height: var(--tap-spiel); }

/* --- Ansage (Bust, 180, Leg) --- */
.ansage {
    position: fixed; left: 50%; top: 34%; z-index: 90; pointer-events: none; width: max-content;
    transform: translate(-50%, -50%) scale(.85); opacity: 0;
    padding: var(--sp-3) var(--sp-6); border-radius: var(--radius-pill); max-width: calc(100vw - 32px);
    font: 800 clamp(28px, 7vw, 44px)/1.05 var(--font-zahl); text-align: center; box-shadow: var(--shadow-lg);
    transition: opacity 180ms ease, transform 220ms var(--ease);
}
.ansage.is-sichtbar { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ansage.is-pos { background: var(--pos); color: var(--bg); }
.ansage.is-neg { background: var(--neg); color: var(--bg); }
.ansage.is-gold { background: var(--gold-fill); color: var(--on-gold); }

/* --- Ende einer Partie --- */
.ende {
    display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
}
.ende-kopf { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); text-align: center; }
.ende-kopf h2 { font: 800 30px/1.1 var(--font-zahl); }
.ende-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; background: var(--surface-2); color: var(--muted); margin-bottom: var(--sp-1); }
.ende-icon .icon { width: 28px; height: 28px; }
.ende-kopf.is-sieg .ende-icon { background: var(--warn-soft); color: var(--gold); }
.ende-stand { font: 800 60px/1 var(--font-zahl); font-variant-numeric: tabular-nums; margin-top: var(--sp-2); }
.ende-werte { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.ende-werte li { display: flex; align-items: center; gap: var(--sp-2); }
.ende-werte .farbpunkt { width: 12px; height: 12px; }
.ende-werte b { font-size: 20px; min-width: 4ch; text-align: right; }

/* ----------------------------------------------------------------------------
   Spielbericht, Verlauf, Gäste, Profil
   ---------------------------------------------------------------------------- */

.bericht-kopf { align-items: flex-start; }
.ergebnis {
    display: flex; flex-direction: column; padding: var(--sp-2) var(--sp-4) var(--sp-3);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
}
.ergebnis-spieler { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; }
.ergebnis-spieler + .ergebnis-spieler { box-shadow: 0 -1px 0 var(--border); }
.ergebnis-name { font-weight: 700; font-size: 17px; }
.ergebnis-krone { color: var(--gold); display: grid; }
.ergebnis-zahl { min-width: 2ch; text-align: right; font: 800 42px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.ergebnis-spieler.is-sieger .ergebnis-zahl { color: var(--pos); }
.ergebnis-fuss { text-align: right; font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }

.tabelle-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tabelle-wrap:focus-visible { box-shadow: var(--ring); }
.tabelle { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.tabelle th, .tabelle td { padding: 9px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); font-size: 14px; }
.tabelle tbody tr:last-child > * { border-bottom: 0; }
.tabelle thead th { font-weight: 700; white-space: normal; vertical-align: bottom; overflow-wrap: anywhere; min-width: 8ch; }
.tabelle td small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.tabelle thead th .farbpunkt { width: 10px; height: 10px; vertical-align: -1px; }
.tabelle th[scope="row"] { position: sticky; left: 0; z-index: 1; text-align: left; font-weight: 600; color: var(--muted); background: var(--surface); }
.tabelle td.is-bester { font-weight: 800; box-shadow: inset 0 -2px 0 var(--pos); }

.legs-liste { list-style: none; margin: 0; padding: 0; }
.legs-liste .settings-row { cursor: default; min-height: 48px; }
.legs-liste .settings-row:hover { background: none; }
.legs-nr { min-width: 5.5ch; color: var(--muted); font: 700 16px/1 var(--font-zahl); }
.legs-liste .farbpunkt { background: var(--spieler); }

.vz-zeile { gap: var(--sp-3); padding-inline: var(--sp-4); }
.vz-namen, .lauf-namen { display: flex; flex-wrap: wrap; gap: 2px var(--sp-3); margin: 4px 0; font-size: 14px; }
.vz-spieler { display: inline-flex; align-items: center; gap: 6px; }
.vz-spieler .farbpunkt { width: 10px; height: 10px; }
.vz-spieler.is-sieger { font-weight: 700; }
.vz-spieler b { font-family: var(--font-zahl); font-size: 16px; }
.vz-badges { gap: 6px; }
.vz-stand { flex: none; font: 800 26px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.lauf-zeile { padding-inline: var(--sp-3); }

.seite > #liste, .seite > #lokal { max-width: 720px; margin-inline: auto; }

.doppel-raster { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); }
.doppel {
    min-height: var(--tap); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
    background: var(--surface-2); color: var(--text); font: 700 18px/1 var(--font-zahl);
}
.doppel:hover { border-color: var(--border-2); }
.doppel[aria-checked="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); }
.doppel-keins { grid-column: span 2; font: 600 15px/1 var(--font); }

/* ----------------------------------------------------------------------------
   Remote (Etappe 4): Lobby-Karte, Geräte, Warteraum, Beitreten, Einladung
   ---------------------------------------------------------------------------- */

.remote-karte {
    display: grid; gap: var(--sp-4); align-items: center; margin-bottom: var(--sp-3);
    padding: var(--sp-4); background: radial-gradient(120% 120% at 100% 0%, var(--accent-soft), transparent 60%), var(--surface);
    border: 1px solid var(--accent-line); border-radius: var(--radius-xl);
}
@media (min-width: 480px) { .remote-karte { grid-template-columns: minmax(0, 1fr) auto; } }
.remote-code { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.remote-code-zahl { font: 800 48px/1 var(--font-zahl); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.remote-qr {
    width: 156px; height: 156px; justify-self: center; padding: 4px;
    background: var(--qr-grund); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--border);
}
.remote-qr:empty { background: var(--surface-2); }
.remote-qr svg { display: block; width: 100%; height: 100%; }
.geraete-liste { list-style: none; margin: 0; padding: 0; }
.geraete-liste .settings-row { cursor: default; }
.geraete-liste .settings-row:hover { background: none; }
.einladen-zeile { cursor: default; gap: var(--sp-3); }
.einladen-zeile:hover { background: none; }

.warteraum { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; }
.warteraum-kopf {
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center;
    padding: var(--sp-6) var(--sp-4); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-xl);
}
.warteraum-kopf h1 { font-size: 32px; }
.warteraum-icon {
    width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px;
    background: var(--accent-soft); color: var(--accent); animation: pulsieren 1.8s ease-in-out infinite;
}
.warteraum-icon .icon { width: 28px; height: 28px; }
@keyframes pulsieren { 50% { transform: scale(1.07); opacity: .8; } }
.warteraum .spieler-zeile .farb-knopf { cursor: default; }
.warteraum .spieler-zeile .farb-knopf:hover { background: none; }
.warteraum-weg { margin-top: var(--sp-6); }

.beitreten { width: 100%; max-width: 440px; margin: 0 auto; }
.code-eingabe {
    min-height: 68px; text-align: center; letter-spacing: .14em;
    font: 800 40px/1 var(--font-zahl) !important; font-variant-numeric: tabular-nums;
}
.spinner-klein { width: 18px; height: 18px; border-width: 2px; }

.einladung { display: flex; gap: var(--sp-4); align-items: flex-start; }
.einladung p { margin: 0; }

.aufnahme-wartet { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.aufnahme-wartet .icon { color: var(--accent); }
.aufnahme.is-fremd { border-style: dashed; }
/* Zuschauer (und Geräte ohne Eingabe) brauchen am Desktop keine leere rechte Spalte. */
@media (min-width: 900px) {
    .spiel.is-zuschauer { grid-template-columns: minmax(0, 1fr); }
    .spiel.is-zuschauer .spiel-rechts { display: none; }
}
.lauf-marken { gap: 6px; margin: 2px 0; }

/* ----------------------------------------------------------------------------
   Statistik (Etappe 5): Kopf, Filter, Kennzahlen, Diagramme, Heatmap
   ---------------------------------------------------------------------------- */

.st { position: relative; max-width: 1080px; margin-inline: auto; }
.st-kopf { align-items: center; flex-wrap: nowrap; }
.st-kopf h1 { font-size: clamp(26px, 6vw, 34px); }
.st-person { flex: none; max-width: 46%; gap: var(--sp-2); padding-inline: 6px var(--sp-3); }
.st-person .avatar-sm { flex: none; }
.st-person > .icon { width: 16px; height: 16px; color: var(--muted); flex: none; }

/* Eine Filterzeile über allem, was sie betrifft. */
.st-filter { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: stretch; margin-bottom: var(--sp-4); }
.st-zeit { flex: 1 1 300px; }
.st-gegner { flex: 1 1 200px; display: flex; }
.st-gegner select { min-height: 48px; }
.st-gegner select:disabled { opacity: .6; }

.st-inhalt { transition: opacity var(--dauer) var(--ease); }
.st-inhalt.is-laedt, .st-karte.is-laedt { opacity: .5; pointer-events: none; }
.st-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

/* --- Überblick: der Average als Held --- */
.st-held {
    display: grid; gap: var(--sp-5); padding: var(--sp-5);
    border: 1px solid var(--border); border-radius: var(--radius-xl);
    background: radial-gradient(120% 150% at 0% 0%, var(--accent-soft), transparent 55%), var(--surface);
}
@media (min-width: 700px) { .st-held { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--sp-8); padding: var(--sp-6); } }
.st-held-haupt { display: flex; flex-direction: column; gap: 4px; }
.st-held-zahl { font: 800 clamp(64px, 17vw, 92px)/.92 var(--font-zahl); letter-spacing: -.01em; }
.st-held-sub { color: var(--muted); font-size: 15px; }
.st-held-sub b { color: var(--text); font: 700 21px/1 var(--font-zahl); margin-left: 4px; }
.st-held-neben { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); margin: 0; }
.st-held-neben div { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-left: var(--sp-3); border-left: 1px solid var(--border); }
.st-held-neben dt { font-size: 12px; font-weight: 650; color: var(--muted); }
.st-held-neben dd { margin: 0; font: 800 clamp(24px, 6vw, 32px)/1 var(--font-zahl); }
.st-held-neben small { display: block; margin-top: 5px; font: 500 12px/1.3 var(--font); color: var(--muted); }

/* --- Aufnahmen-Bänder und Kacheln --- */
.st-baender { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); margin-top: var(--sp-3); }
.st-band {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--sp-3) var(--sp-2);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.st-band b { font: 800 30px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.st-band span { font: 700 14px/1 var(--font-zahl); letter-spacing: .04em; color: var(--muted); }
.st-band.is-gold { background: linear-gradient(var(--warn-soft), var(--warn-soft)), var(--surface); border-color: color-mix(in oklab, var(--gold-fill) 50%, var(--border)); }
.st-band.is-gold b, .st-band.is-gold span { color: var(--gold); }

.st-kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); margin-top: var(--sp-2); }
@media (min-width: 640px) { .st-kacheln { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.st-kachel {
    display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: var(--sp-3) var(--sp-4);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.st-wert { font: 800 28px/1.05 var(--font-zahl); overflow-wrap: anywhere; }
.st-kachel small { font-size: 12px; line-height: 1.3; color: var(--muted); }
.st-kachel.is-gold .st-wert { color: var(--gold); }

/* --- Karten --- */
.st-raster { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }
@media (min-width: 1100px) { .st-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.st-karte { min-width: 0; padding: var(--sp-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: opacity var(--dauer); }
.st-karte-kopf { display: flex; gap: var(--sp-3); align-items: flex-start; margin-bottom: var(--sp-3); }
.st-karte h2 { font-size: 17px; font-weight: 700; }
.st-karte-kopf p { margin-top: 2px; font-size: 13px; color: var(--muted); }
.st-trend-steuer { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.st-trend-steuer .seg { flex: 1 1 auto; }
.seg-klein button { font-size: 13px; padding: 0 var(--sp-2); }

/* --- Diagramme (diagramme.js) --- */
.dg { position: relative; }
.dg-plot { position: relative; height: 168px; margin: 22px 0 0 36px; }
.dg-gitter { position: absolute; left: 0; right: 0; bottom: var(--y); height: 0; border-top: 1px solid var(--border); pointer-events: none; }
.dg-gitter.is-basis { border-top-color: var(--border-2); }
.dg-gitter > span {
    position: absolute; right: calc(100% + 6px); top: -8px;
    font-size: 11px; line-height: 16px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dg-spalten { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.dg-spalte { position: relative; display: flex; justify-content: center; align-items: flex-end; height: 100%; outline: none; }
.dg-spalte:focus-visible { box-shadow: var(--ring); border-radius: var(--radius-sm); }
.dg-saeule { position: relative; width: min(24px, 72%); height: var(--h); background: var(--reihe); border-radius: 4px 4px 0 0; transition: filter var(--dauer); }
.dg-saeule.is-null { height: 0; }
.dg-spalte:hover .dg-saeule, .dg-spalte:focus-visible .dg-saeule { filter: brightness(1.18); }
.dg-wert, .dg-endwert {
    position: absolute; font-size: 12px; font-weight: 700; color: var(--text);
    white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none;
}
.dg-wert { bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); }
/* Der Höchstwert sitzt oft genau auf der obersten Gitterlinie – ein Grund in Kartenfarbe hält die Ziffern lesbar. */
.dg-wert { background: var(--surface); padding: 0 3px; border-radius: 3px; }
.dg-x {
    display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: 6px 0 0 36px;
    font-size: 11px; color: var(--faint); text-align: center; font-variant-numeric: tabular-nums;
}
.dg-x > span { overflow: hidden; white-space: nowrap; }
.dg-x-frei { position: relative; display: block; height: 16px; }
.dg-x-frei > span { position: absolute; left: var(--x); transform: translateX(-50%); }
.dg-x-frei > span:first-child { transform: none; }
.dg-x-frei > span:last-child { transform: translateX(-100%); }
.dg-x-frei > span:only-child { transform: translateX(-50%); }

.dg-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dg-pfad { fill: none; stroke: var(--reihe); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.dg-flaeche { fill: var(--reihe-wash); }
.dg-punkt {
    position: absolute; left: var(--x); bottom: var(--y); width: 10px; height: 10px; margin: 0 0 -5px -5px;
    border-radius: 50%; background: var(--reihe); box-shadow: 0 0 0 2px var(--surface); pointer-events: none;
}
.dg-endwert { left: var(--x); bottom: var(--y); transform: translate(-100%, -12px); }
.dg-kreuz { position: absolute; top: 0; bottom: 0; left: var(--x); border-left: 1px solid var(--muted); pointer-events: none; }
.dg-fang { position: absolute; inset: -10px 0; cursor: crosshair; outline: none; border-radius: var(--radius-sm); touch-action: pan-y; }
.dg-fang:focus-visible { box-shadow: var(--ring); }
.dg-plot:has(.dg-zeiger:not([hidden])) .dg-endwert { opacity: 0; }

/* Ein Tooltip je Ansicht – Wert vorn, Beschriftung dahinter. */
.dg-tip {
    position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 1px;
    padding: 6px 10px; border-radius: var(--radius-sm); pointer-events: none;
    background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 12px; white-space: nowrap;
}
.dg-tip b { font-size: 15px; font-variant-numeric: tabular-nums; }
.dg-tip span { opacity: .82; }

.dg-tabelle { margin-top: var(--sp-2); }
.dg-tabelle summary { display: inline-flex; align-items: center; min-height: var(--tap); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.dg-tabelle summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.dg-tabelle .tabelle th[scope="row"] { color: var(--text); font-weight: 600; }

/* --- Heatmap auf der Scheibe (echte Maße) --- */
.st-heat { display: grid; gap: var(--sp-4); align-items: center; }
/* Nebeneinander nur, wenn die Karte breit ist – in der zweispaltigen
   Desktop-Ansicht steht die Scheibe in voller Kartenbreite. */
.st-karte { container-type: inline-size; }
@container (min-width: 560px) { .st-heat { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); } }
.hm-svg { display: block; width: 100%; max-width: 380px; margin-inline: auto; aspect-ratio: 1; }
.hm-rand { fill: var(--surface-2); }
.hm-feld { fill: color-mix(in oklab, var(--heat-max) var(--h), var(--heat-min)); stroke: var(--surface); stroke-width: .006; transition: filter var(--dauer); }
.hm-feld.is-leer { fill: var(--heat-leer); }
.hm-feld:hover { filter: brightness(1.25); }
.hm-draht { fill: none; stroke: var(--surface); stroke-width: .006; pointer-events: none; }
.hm-zahl { fill: var(--muted); font: 700 .12px var(--font-zahl); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.hm-legende { display: grid; gap: 4px; }
.hm-skala { height: 8px; border-radius: var(--radius-pill); background: linear-gradient(90deg, color-mix(in oklab, var(--heat-max) 14%, var(--heat-min)), var(--heat-max)); }
.hm-skala-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hm-nie { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; color: var(--muted); }
.hm-nie-feld { width: 12px; height: 12px; border-radius: 3px; background: var(--heat-leer); box-shadow: inset 0 0 0 1px var(--border-2); }
.st-top { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.st-top li { display: flex; align-items: baseline; gap: var(--sp-2); padding: 7px 0; border-bottom: 1px solid var(--border); }
.st-top li:last-child { border-bottom: 0; }
.st-top b, .st-top .zahl { font: 700 19px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.st-top small { min-width: 6ch; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-miss { margin-top: var(--sp-2); font-size: 13px; color: var(--muted); }

/* --- Checkout-Ziele --- */
.st-lieb {
    display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); margin-bottom: var(--sp-3);
    border-radius: var(--radius); background: var(--warn-soft);
}
.st-lieb-feld { display: block; font: 800 26px/1 var(--font-zahl); margin-top: 2px; }
.st-lieb-zahl { text-align: right; font: 800 24px/1 var(--font-zahl); }
.st-lieb-zahl small { display: block; margin-top: 3px; font: 500 12px/1.2 var(--font); color: var(--muted); }
.st-meterliste { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.st-meter { display: grid; grid-template-columns: 4.5ch minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3); min-height: 34px; }
.st-meter.is-mehr { display: none; }
.st-meter-feld { font: 700 18px/1 var(--font-zahl); }
.st-meter-bahn { height: 8px; border-radius: var(--radius-pill); overflow: hidden; background: color-mix(in oklab, var(--reihe) 18%, var(--surface)); }
.st-meter-bahn > span { display: block; width: var(--q); height: 100%; border-radius: inherit; background: var(--reihe); }
.st-meter-zahl { min-width: 10ch; text-align: right; font: 700 17px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.st-meter-zahl small { margin-left: 6px; font: 500 12px var(--font); color: var(--muted); }
[data-alle-ziele] { margin-top: var(--sp-2); }

/* --- Rekorde und Head-to-Head --- */
.st-liste { margin-inline: calc(-1 * var(--sp-2)); }
.st-liste .list-row { padding-inline: var(--sp-2); border-radius: var(--radius-sm); font: inherit; }
.list-row.is-still { cursor: default; }
.list-row.is-still:hover { background: none; }
.st-liste-zahl { flex: none; font: 800 24px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.st-h2h:focus-visible { outline: none; box-shadow: inset var(--ring); }
.st-h2h.is-aktiv { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.st-h2h .badge { margin-left: 4px; vertical-align: 1px; }
.st-h2h-stand { flex: none; display: inline-flex; align-items: baseline; gap: 4px; font: 800 24px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.st-h2h-stand span { color: var(--faint); }
.st-h2h-stand .is-vorn { color: var(--pos); }

/* ----------------------------------------------------------------------------
   Etappe 6: Cricket-Tafel, Around the Clock, Shanghai
   ---------------------------------------------------------------------------- */

/* Cricket: eine Zeile je Ziel, eine Spalte je Spieler. */
.ct {
    display: grid; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.ct-kopf, .ct-zeile { display: grid; grid-template-columns: 3.4rem repeat(var(--n), minmax(0, 1fr)); }
.ct-kopf { border-bottom: 1px solid var(--border-2); }
.ct-ecke { background: var(--surface-2); }
.ct-spieler {
    position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: calc(var(--sp-2) + 4px) 4px var(--sp-2); border-left: 1px solid var(--border); text-align: center;
}
.ct-spieler::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--spieler); }
.ct-spieler.is-am-zug { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
.ct-spieler.is-aus { opacity: .5; }
.ct-spieler.is-sieger { background: var(--pos-soft); }
.ct-name { max-width: 100%; font-weight: 700; font-size: 14px; }
.ct-punkte { font: 800 clamp(30px, 9vw, 46px)/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.ct-klein { font-size: 11px; line-height: 1.3; color: var(--muted); font-variant-numeric: tabular-nums; }
.ct-zeile + .ct-zeile { border-top: 1px solid var(--border); }
.ct-ziel { display: grid; place-items: center; background: var(--surface-2); font: 800 22px/1 var(--font-zahl); }
.ct-zelle { display: grid; place-items: center; min-height: 34px; border-left: 1px solid var(--border); }
.ct-zelle.is-am-zug { background: var(--accent-soft); }
.ct-mark { width: 26px; height: 26px; color: var(--text); }
.ct-mark svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.ct-mark.is-zu { color: var(--pos); }
.ct-zeile.is-tot .ct-ziel { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 2px; }
.ct-zeile.is-tot .ct-zelle { opacity: .45; }
@media (min-width: 900px) {
    .ct-zelle { min-height: 46px; }
    .ct-mark { width: 34px; height: 34px; }
    .ct-ziel { font-size: 26px; }
    .ct-name { font-size: 16px; }
}

/* ATC: Fortschritt unter dem Ziel. */
.tk-fortschritt { flex: 1 0 100%; height: 6px; margin: 2px 0 4px; overflow: hidden; border-radius: var(--radius-pill); background: var(--surface-3); }
.tk-fortschritt > span { display: block; width: var(--q); height: 100%; border-radius: inherit; background: var(--pos); transition: width var(--dauer) var(--ease); }

/* Shanghai: wer im Stechen nicht dabei ist. */
.kachel.is-draussen { opacity: .55; }

/* Ziele des Modus auf dem Tastenfeld (ATC, Shanghai, Cricket). */
.taste.is-ziel { border-color: var(--pos); box-shadow: inset 0 0 0 1px var(--pos); }

/* Einheit neben der Summe der Aufnahme (Marks, Treffer). */
.aufnahme-summe small { margin-left: 3px; font: 600 12px/1 var(--font); color: var(--muted); }

/* Statistik: Spielart in der Filterzeile. */
.st-modus { flex: 1 1 100%; }

/* =====================================================================
   Etappe 7: Trainings (Bob's 27, 121, Score, Checkout-Training)
   ===================================================================== */

/* Acht Spielarten: zwei Zeilen zu vier – oben die Spiele, unten die Trainings. */
.seg.seg-raster { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg.seg-raster button { padding: 0 var(--sp-2); }

/* Lobby: Auswahl und Zahl in einer Einstellungszeile. */
.lobby-select { width: auto; min-width: 8.5rem; max-width: 60%; }
input.lobby-zahl { width: 6.5rem; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.lobby-abstand { margin-top: var(--sp-3); }

/* =====================================================================
   Etappe 8: Killer, Halve-It
   ===================================================================== */

/* Spiele in 3 × 2, darunter die Trainings in einer Reihe. */
.seg.seg-raster.seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lobby-abstand-klein { margin-top: var(--sp-2); }
.st-modus { display: grid; gap: var(--sp-2); }

/* Killer: Leben als Punkte, Killer als Marke. */
.tk-leben { font-size: 15px; letter-spacing: 2px; color: var(--accent); }
.tk-leben-weg { color: var(--faint); }
.badge-killer { background: var(--accent-fill); color: var(--accent-ink); }

/* =====================================================================
   Etappe 9: pro-rules – Tippflächen
   ===================================================================== */
@media (max-width: 899px) { .topbar .nur-mobil { display: inline-flex; align-items: center; min-height: var(--tap); } }
.sb-marke { display: flex; align-items: center; min-height: var(--tap); }
