/* =============================================================================
   Callit – Design-System der App (design-system/callit/MASTER.md).

   Richtung: Kneipentafel und Wettschein. Dunkel ist eine grünschwarze Tafel
   mit Kreideschrift, Hell ein warmes Papier wie ein Wettschein. Ein Akzent in
   Bernstein (Messing, Bier) für die eine Hauptaktion je Ansicht. Grün heißt
   „gewonnen“, Rot „verloren“ – nie als Bedienfarbe. Text und Überschriften in
   Inter, Beträge und Countdowns mit tabular-nums.

   Zwei Themes (Annahme A11): ohne Wahl folgt Callit dem System. 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, gerechnet am 02.12.2026, auf --bg / --surface):
     Dunkel  --text 16,3/14,7 · --muted 8,7/7,8 · --faint 6,3/5,7
             --accent 10,4/9,3 · --pos 9,5/8,5 · --neg 7,5/6,7 · --reihe 7,2/6,5
             --accent-ink auf --accent-fill 10,2:1
     Hell    --text 15,8/17,1 · --muted 7,3/7,8 · --faint 5,6/6,0
             --accent 5,2/5,6 · --pos 4,9/5,3 · --neg 6,0/6,4 · --reihe 4,6/5,0
             --accent-ink (weiß) auf --accent-fill 5,0:1
   Auf Bernstein nie weiße Schrift im dunklen Theme (Hausregel wie beim Hub).
   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 */
    --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;
    /* Überschriften und Zahlen: dieselbe Inter, schwer und eng gesetzt. */
    --font-zahl: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

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

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

/* --- Dunkel: Tafel (Standard, falls das Skript im Kopf nicht läuft) --- */
:root, :root[data-theme="dark"] {
    --bg:        #0f1613;
    --bg-2:      #0a0f0d;   /* tiefer als bg: Eingabefelder, Vertiefungen */
    --surface:   #17211d;   /* Karten, Listen */
    --surface-2: #1f2b26;   /* gehobene Fläche, gedrückt */
    --surface-3: #283731;
    --border:    #2a3832;   /* nur Ränder */
    --border-2:  #3a4c44;
    --text:      #eef3ea;   /* Kreide */
    --muted:     #a8b6ad;
    --faint:     #8c9b92;

    --accent:      #f6b847; /* Bernstein als Text/Symbol */
    --accent-fill: #f6b847; /* als Fläche – mit dunkler Schrift */
    --accent-ink:  #1f1500;
    --accent-soft: rgba(246, 184, 71, .14);
    --accent-line: rgba(246, 184, 71, .42);

    --pos: #4fd18b;         /* gewonnen */
    --pos-soft: rgba(79, 209, 139, .14);
    --neg: #ff8070;         /* verloren, Fehler */
    --neg-soft: rgba(255, 128, 112, .14);
    --warn: #e9c46a;
    --warn-soft: rgba(233, 196, 106, .16);

    --scrim: rgba(4, 8, 6, .72);
    --shadow:    0 10px 30px -12px rgba(0, 0, 0, .75);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .85);
    --ring: 0 0 0 3px rgba(246, 184, 71, .5);
    --glass: rgba(15, 22, 19, .86);

    /* Datenreihe der Diagramme (Bilanz): Blau, nie für Text */
    --reihe:      #5aa9e6;
    --reihe-wash: rgba(90, 169, 230, .14);
    /* Siege nach oben, Niederlagen nach unten (dataviz-Prüfer am 05.12.2026:
       Helligkeit, Buntheit, Rot-Grün-Schwäche ΔE 20,7, Kontrast – alles bestanden;
       Grün gegen Rot fiel mit ΔE 4,0 durch) */
    --reihe-sieg:       #4a9ae0;
    --reihe-niederlage: #e8784e;

    color-scheme: dark;
}

/* --- Hell: Wettschein-Papier --- */
:root[data-theme="light"] {
    --bg:        #f8f4ea;
    --bg-2:      #efe9db;
    --surface:   #fffdf8;
    --surface-2: #f4eee1;
    --surface-3: #e9e1cf;
    --border:    #e2d9c6;
    --border-2:  #cbbfa6;
    --text:      #1d1a14;
    --muted:     #575044;
    --faint:     #686152;

    --accent:      #9a5500;
    --accent-fill: #b45309;
    --accent-ink:  #ffffff;
    --accent-soft: rgba(180, 83, 9, .10);
    --accent-line: rgba(180, 83, 9, .34);

    --pos: #16794a;
    --pos-soft: rgba(22, 121, 74, .10);
    --neg: #b3261e;
    --neg-soft: rgba(179, 38, 30, .09);
    --warn: #7a5a00;
    --warn-soft: rgba(233, 196, 106, .26);

    --scrim: rgba(29, 26, 20, .42);
    --shadow:    0 10px 28px -14px rgba(29, 26, 20, .25);
    --shadow-lg: 0 24px 56px -22px rgba(29, 26, 20, .3);
    --ring: 0 0 0 3px rgba(180, 83, 9, .35);
    --glass: rgba(248, 244, 234, .9);

    --reihe:      #2a6fc0;
    --reihe-wash: rgba(42, 111, 192, .10);
    --reihe-sieg:       #2a6fc0;   /* ΔE 24,6 bei Rot-Grün-Schwäche */
    --reihe-niederlage: #c2410c;

    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: -.025em; }
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); }
.text-accent { color: var(--accent); }

/* 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[type="datetime-local"], 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(--warn); }
.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-content: Mit left 50 % hätte der Toast sonst nur die halbe Breite und
       bräche lange Texte („… gesehen“ + Rückgängig) in eine schmale Spalte. */
    width: max-content; 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 { flex: none; min-height: var(--tap); white-space: nowrap; border: 0; background: none; color: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; padding: var(--sp-1) var(--sp-2); }
.toast.mit-aktion { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
/* Ein Blatt fährt von unten herein – der Toast der Ansicht darunter (etwa
   „… fortgesetzt · Rückgängig“ und gleich danach das nächste ⋮) weicht dann
   nach oben aus, statt die Einträge des Blatts zu verdecken; „Rückgängig“
   bleibt erreichbar. */
body:has(> .sheet:not(.is-closing)) .toast {
    bottom: auto; top: calc(env(safe-area-inset-top, 0px) + var(--sp-3));
    transform: translate(-50%, -24px);
}
body:has(> .sheet:not(.is-closing)) .toast.show { transform: translate(-50%, 0); }

/* 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; }
/* min-height: 0 – sonst schrumpft der Inhalt im Flex-Layout nicht, und die Fußleiste rutscht unter den Rand. */
.sheet-body { flex: 1 1 auto; min-height: 0; padding: var(--sp-2) var(--sp-5) var(--sp-5); overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { flex: none; 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); }
.patchnotes p { margin: 0; }
.patchnotes p + p { margin-top: var(--sp-3); }
.patchnotes p:first-child { color: var(--text); font-weight: 700; }
.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: Zeichen + „Callit“ */
.wortmarke {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    font: 800 28px/1 var(--font-zahl); letter-spacing: -.03em;
    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); transition: opacity var(--dauer) var(--ease); }
/* Solange die große Überschrift im Bild ist, bleibt der Kopf ohne Titel (ui.js titelBeimScrollen). */
.topbar[data-titel="aus"] > .title { opacity: 0; }
.topbar-lead { display: flex; align-items: center; }
/* Tippflächen ab 44 px (pro-rules-Audit, Etappe 10) – auch die Wortmarken-Links. */
.topbar-lead > a { display: inline-flex; align-items: center; min-height: var(--tap); }
.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; }

/* --- 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 { display: flex; align-items: center; min-height: var(--tap); 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); }
    /* Hell liegt die Leiste auf --surface-2 – dort reicht --accent auf --accent-soft nur für 4,35:1. */
    :root[data-theme="light"] .sb-link[aria-current="page"] { color: #874a00; }
    .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
   ---------------------------------------------------------------------------- */

.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; }
.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; }

/* Ohne Netz (A10) sehen Aktionen gesperrt aus. Sie bleiben antippbar: Der Tipp
   sagt dann, warum nichts passiert – ein stummer, grauer Knopf sagt das nicht. */
body.hat-netz-streifen #actionbar .btn,
body.hat-netz-streifen .seite [data-aktion],
body.hat-netz-streifen .seite [data-abbruch],
body.hat-netz-streifen .seite-kopf .btn-primary,
body.hat-netz-streifen .komm-senden { opacity: .5; filter: grayscale(1); }

/* ----------------------------------------------------------------------------
   Chips (Filter der Wettliste, ab Etappe 1)
   ---------------------------------------------------------------------------- */

.chip-leiste {
    display: flex; gap: var(--sp-2); overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x proximity; scrollbar-width: none;
    margin-inline: calc(-1 * var(--sp-4)); padding: 2px var(--sp-4) var(--sp-1);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--sp-4), #000 calc(100% - var(--sp-8)), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 var(--sp-4), #000 calc(100% - var(--sp-8)), transparent 100%);
}
.chip-leiste::-webkit-scrollbar { display: none; }
.chip {
    flex: none; scroll-snap-align: start; scroll-margin-inline: var(--sp-4);
    min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--radius-pill);
    border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
    font: 600 14px/1 var(--font); white-space: nowrap; cursor: pointer;
    transition: background-color var(--dauer), border-color var(--dauer);
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); }
.chip:focus-visible { outline: none; box-shadow: var(--ring); }

/* ----------------------------------------------------------------------------
   Über Callit (#/ueber) – Ehrenschuld-Hinweis (Annahme A13)
   ---------------------------------------------------------------------------- */

.seite > .ueber-hero, .seite > .settings-group { max-width: 560px; margin-inline: auto; }
.ueber-marke { width: 72px; height: 72px; }
.ueber-hero p { max-width: 44ch; }
.settings-row.quelle { cursor: default; align-items: flex-start; }
.settings-row.quelle:hover { background: none; }
.settings-row.quelle .row-icon { margin-top: 2px; }
.pflicht { margin-top: var(--sp-1); font-style: italic; }

/* ----------------------------------------------------------------------------
   Glocke: Abzeichen im Kopf, #/meldungen
   ---------------------------------------------------------------------------- */

.glocke { position: relative; }
.glocke[aria-current="page"] { color: var(--accent); }
.glocke-zahl {
    position: absolute; top: 4px; right: 2px;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--accent-fill); color: var(--accent-ink);
    font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.glocke-zahl[hidden] { display: none; }

.seite > .meldung, .seite > .meldung-fuss { max-width: 720px; margin-inline: auto; }
/* Die Überschrift steht bündig über der schmalen Liste. */
.seite:has(> .meldung) > .seite-kopf { max-width: 720px; margin-inline: auto; }
.meldung + .meldung .meldung-kopf { margin-top: var(--sp-6); }
.meldung-kopf { display: flex; align-items: center; gap: var(--sp-2); }
.meldung-liste { list-style: none; margin: 0; padding: 0; }
.meldung-liste li + li { box-shadow: 0 -1px 0 var(--border); }
.meldung-zeile { gap: var(--sp-3); border-bottom: 0; padding: var(--sp-2) var(--sp-3); text-decoration: none; color: inherit; }
.meldung-zeile .list-sub { white-space: normal; }
.meldung.is-neu .meldung-liste { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.meldung-fuss { margin-top: var(--sp-6); font-size: 14px; text-align: center; }

/* ----------------------------------------------------------------------------
   Bilanz (ab Etappe 8) – Diagramme
   Eine Datenreihe in --reihe; Texte nie in der Datenfarbe (diagramme.js).
   ---------------------------------------------------------------------------- */

/* --- Diagramme (diagramme.js) --- */
.dg { position: relative; }
.dg-plot { position: relative; height: 168px; margin: 22px 0 0 44px; }
.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); }
/* Der Höchstwert sitzt oft genau auf der obersten Gitterlinie – ein Grund in
   Kartenfarbe hält die Ziffern lesbar; am Rand wird er nach innen gerückt. */
.dg-wert {
    position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    padding: 0 3px; border-radius: 3px; background: var(--surface);
    font-size: 12px; font-weight: 700; color: var(--text);
    white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none;
}
.dg-spalte:first-child .dg-wert { left: 0; transform: none; }
.dg-spalte:last-child .dg-wert { left: auto; right: 0; transform: none; }
.dg-x {
    display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); margin: 6px 0 0 44px;
    font-size: 11px; color: var(--faint); text-align: center; font-variant-numeric: tabular-nums;
}
.dg-x > span { overflow: hidden; white-space: nowrap; }

/* 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; }

/* Rangliste: Name, Balken, Wert – die Balken auf einer gemeinsamen Grundlinie. */
.dg-balken { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.dg-balken-zeile { display: grid; grid-template-columns: minmax(0, 10rem) minmax(0, 1fr) auto; align-items: center; gap: var(--sp-1) var(--sp-3); }
.dg-balken-name { font-size: 14px; font-weight: 600; }
.dg-balken-spur { display: block; height: 12px; }
.dg-balken-wert { display: block; height: 100%; width: max(var(--w), 2px); background: var(--reihe); border-radius: 0 4px 4px 0; }
.dg-balken-text { min-width: 6.5ch; text-align: right; font-size: 14px; font-weight: 600; line-height: 1.25; }
.dg-balken-text small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
/* Schmal: Name und Wert oben, der Balken darunter in voller Breite. */
@container st-karte (max-width: 440px) {
    .dg-balken-zeile { grid-template-columns: minmax(0, 1fr) auto; }
    .dg-balken-spur { grid-column: 1 / -1; grid-row: 2; }
}

.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); }
.tabelle-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tabelle { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabelle th, .tabelle td { padding: 8px 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; color: var(--muted); }
.tabelle th[scope="row"] { text-align: left; font-weight: 600; color: var(--text); }

/* --- Siege und Niederlagen im Wechsel (diagramme.js, wechsel) --- */
.dg-legende { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); margin-bottom: var(--sp-1); font-size: 13px; color: var(--muted); }
.dg-legende > span { display: inline-flex; align-items: center; gap: 6px; }
.dg-farbe { width: 10px; height: 10px; border-radius: 3px; }
.dg-farbe.is-sieg { background: var(--reihe-sieg); }
.dg-farbe.is-niederlage { background: var(--reihe-niederlage); }
.dg-wechsel .dg-plot { margin-top: 14px; }
/* Je Hälfte die halbe Höhe, 1 px Abstand zur Grundlinie (2 px zwischen den Säulen). */
.dg-hoch, .dg-tief {
    position: absolute; left: 50%; width: min(24px, 72%); transform: translateX(-50%);
    height: max(calc(var(--h) / 2 - 1px), 2px); transition: filter var(--dauer);
}
.dg-hoch { bottom: calc(50% + 1px); background: var(--reihe-sieg); border-radius: 4px 4px 0 0; }
.dg-tief { top: calc(50% + 1px); background: var(--reihe-niederlage); border-radius: 0 0 4px 4px; }
.dg-spalte:hover :is(.dg-hoch, .dg-tief), .dg-spalte:focus-visible :is(.dg-hoch, .dg-tief) { filter: brightness(1.15); }
@media (forced-colors: active) {
    .dg-hoch, .dg-tief, .dg-farbe { forced-color-adjust: none; }
    .dg-tief { background: repeating-linear-gradient(45deg, CanvasText 0 2px, Canvas 2px 5px); }
    .dg-farbe.is-niederlage { background: repeating-linear-gradient(45deg, CanvasText 0 2px, Canvas 2px 5px); }
    .dg-hoch, .dg-farbe.is-sieg { background: CanvasText; }
}

/* ----------------------------------------------------------------------------
   Bilanz: Teile, Jahre, Kennzahlen, Karten (Etappe 8)
   ---------------------------------------------------------------------------- */

.bilanz-teile, .seite > .bilanz-teile { max-width: 420px; margin: 0 0 var(--sp-5); }
.bilanz-teile button { flex: 1; }
.bilanz-jahre { margin-bottom: var(--sp-4); }
.bilanz-inhalt { position: relative; transition: opacity var(--dauer); }
.bilanz-inhalt.is-laedt, .rangliste.is-laedt { opacity: .5; pointer-events: none; }

.bilanz-kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
@media (min-width: 720px) { .bilanz-kacheln { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bilanz-kachel {
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
    padding: var(--sp-3) var(--sp-4); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.bilanz-kachel-name { font-size: 13px; font-weight: 600; color: var(--muted); }
.bilanz-kachel-wert { font: 800 26px/1.15 var(--font-zahl); letter-spacing: -.02em; overflow-wrap: anywhere; }
.bilanz-kachel small { font-size: 12px; line-height: 1.35; color: var(--muted); }
.bilanz-kacheln + .hinweis-zeile { margin-top: var(--sp-3); }

.bilanz-raster { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); }
@media (min-width: 1100px) { .bilanz-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.bilanz-karte {
    min-width: 0; padding: var(--sp-4); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    container: st-karte / inline-size;
}
.bilanz-karte-kopf { margin-bottom: var(--sp-3); }
.bilanz-karte h2 { font-size: 17px; font-weight: 700; }
.bilanz-karte-kopf p { margin-top: 2px; font-size: 13px; color: var(--muted); }

.bilanz-geld { display: grid; }
.bilanz-geld-zeile { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); padding: var(--sp-2) 0; font-size: 15px; }
.bilanz-geld-zeile + .bilanz-geld-zeile { box-shadow: 0 -1px 0 var(--border); }
.bilanz-geld-zeile b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bilanz-geld-zeile.is-summe { font-weight: 700; }
.bilanz-geld-zeile.is-summe b { font-size: 17px; }
.bilanz-geld.is-extra { margin-top: var(--sp-2); padding-top: var(--sp-1); border-top: 1px dashed var(--border-2); }
.bilanz-geld.is-extra .bilanz-geld-zeile { font-size: 14px; color: var(--muted); }
.bilanz-geld.is-extra b { color: var(--text); font-weight: 600; }

.bilanz-rivalen { max-width: 640px; }
.rivale-zeile { padding-inline: var(--sp-4); }
.rivale-zeile .grow { min-width: 0; }
.rivale-zeile .badge { margin-left: var(--sp-1); vertical-align: 1px; }
.rivale-saldo { flex: none; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bilanz-fuss { margin-top: var(--sp-4); font-size: 13px; max-width: 640px; }

/* --- Direkter Vergleich (#/gegen/{id}) --- */
.gegner-kopf { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-2) 0 var(--sp-5); }
.gegner-kopf h1 { font-size: 26px; }
.gegner-kopf p { color: var(--muted); margin-top: 2px; }
.gegner-kopf + .bilanz-jahre { margin-top: calc(-1 * var(--sp-2)); }
.gegner-stand {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--sp-3);
    max-width: 640px; padding: var(--sp-5) var(--sp-4); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-xl);
}
.gegner-seite { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); min-width: 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.gegner-seite > span { max-width: 100%; }
.gegner-zahl { font: 800 48px/1 var(--font-zahl); letter-spacing: -.03em; color: var(--text); }
.gegner-trenner { font: 800 36px/1 var(--font-zahl); color: var(--faint); }
.gegner-stand-sub { max-width: 640px; margin-top: var(--sp-2); font-size: 14px; text-align: center; }
.gegner-geld { max-width: 640px; margin-top: var(--sp-4); }
.gegner-wetten { max-width: 640px; }
.gegner-wette { padding-inline: var(--sp-4); }
.gegner-wette .grow { min-width: 0; }
.gegner-wette .list-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.gegner-wette .badge { flex: none; }

/* ----------------------------------------------------------------------------
   Leere Bereiche (Etappe 0) – Start, Wetten, Runden, Bilanz zeigen, was kommt
   ---------------------------------------------------------------------------- */

.leer-karte {
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
    max-width: 520px; margin: var(--sp-6) 0 0; padding: var(--sp-8) var(--sp-5);
    border: 1px dashed var(--border-2); border-radius: var(--radius-xl);
    background: var(--surface); text-align: center;
}
.leer-karte .row-icon { width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.leer-karte .row-icon .icon { width: 28px; height: 28px; }
.leer-karte h2 { font-size: 20px; }
.leer-karte p { color: var(--muted); max-width: 40ch; }

/* Wettschein-Vorschau auf Start: eine Karte, die wie ein Beleg aussieht */
.wettschein-probe {
    position: relative; max-width: 520px; margin: var(--sp-6) 0 0;
    padding: var(--sp-5) var(--sp-5) var(--sp-4);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.wettschein-probe::after {
    /* Abrisskante unten: kleine Halbkreise in der Seitenfarbe */
    content: ''; position: absolute; left: 12px; right: 12px; bottom: -6px; height: 12px;
    background: radial-gradient(circle at 6px 6px, var(--bg) 5px, transparent 5.5px) 0 0 / 16px 12px repeat-x;
}
.wettschein-kopf { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.wettschein-art { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.wettschein-behauptung { margin-top: var(--sp-2); font: 800 22px/1.25 var(--font-zahl); letter-spacing: -.02em; }
.wettschein-zeile {
    display: flex; justify-content: space-between; gap: var(--sp-3);
    margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--border-2);
    font-size: 14px; color: var(--muted);
}
.wettschein-zeile b { color: var(--text); font-variant-numeric: tabular-nums; }

/* Der Avatar im Kopf führt zum Profil (nur Handy, Annahme A11). */
.kopf-ich { position: relative; }
.kopf-ich .avatar { width: 30px; height: 30px; font-size: 12px; }
.kopf-ich[aria-current="page"] .avatar { box-shadow: 0 0 0 2px var(--accent); }
.kopf-ich .badge { position: absolute; top: 2px; right: 0; height: 18px; padding: 0 5px; font-size: 11px; }

/* ----------------------------------------------------------------------------
   Etappe 1: Wettscheine, Wettseite, Assistent
   ---------------------------------------------------------------------------- */

.text-pos { color: var(--pos); }
.avatar-xs { width: 22px; height: 22px; font-size: 9px; }
.badge-leise { background: var(--surface-3); color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: var(--sp-2); }

/* --- Wettscheine in Listen (teile/wettschein.js) --- */
.wettscheine { display: grid; gap: var(--sp-4); max-width: 640px; }
.wettscheine + .abschnitt-titel { margin-top: var(--sp-8); }
.wettschein {
    position: relative; display: block; padding: var(--sp-4) var(--sp-4) var(--sp-3);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    color: var(--text); text-decoration: none !important; box-shadow: var(--shadow);
    transition: border-color var(--dauer), transform var(--dauer) var(--ease);
}
.wettschein:hover { border-color: var(--border-2); }
.wettschein:active { transform: scale(.99); }
.wettschein:focus-visible { outline: none; box-shadow: var(--ring); }
.wettschein::after {
    content: ''; position: absolute; left: 12px; right: 12px; bottom: -6px; height: 12px;
    background: radial-gradient(circle at 6px 6px, var(--bg) 5px, transparent 5.5px) 0 0 / 16px 12px repeat-x;
    pointer-events: none;
}
.wettschein .wettschein-behauptung { font-size: 19px; }
.wettschein .wettschein-zeile { margin-top: var(--sp-2); padding-top: var(--sp-2); align-items: center; }
.wettschein-leute { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.wettschein-leute b { color: var(--text); }
.wetten-seg { max-width: 640px; margin-bottom: var(--sp-5); }

/* --- Wettseite (modules/wette.js) --- */
.wette-schein {
    max-width: 640px; padding: var(--sp-5); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.wette-titel { margin-top: var(--sp-2); font: 800 clamp(24px, 5vw, 30px)/1.2 var(--font-zahl); letter-spacing: -.02em; }
.wette-notiz { margin-top: var(--sp-2); color: var(--muted); white-space: pre-line; }
.seiten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-top: var(--sp-5); }
.seiten-karte {
    display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0;
    padding: var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--radius);
    background: var(--bg-2);
}
:root[data-theme="light"] .seiten-karte { background: var(--surface-2); }
.seiten-karte .row { margin-bottom: var(--sp-1); }
.seiten-karte p { font-size: 14px; overflow-wrap: anywhere; }
.seiten-karte.is-wartet { border-style: dashed; opacity: .8; }
.seiten-karte.is-sieger { border: 1px solid var(--pos); background: var(--pos-soft); }
.seiten-karte.is-verlierer { opacity: .85; }
.seiten-marke { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.seiten-marke.is-pos { background: var(--pos-soft); color: var(--pos); }
.seiten-zustand { font-size: 13px !important; color: var(--muted); }
.seiten-zustand.is-pos { color: var(--pos); font-weight: 700; }
.seiten-zustand.is-neg { color: var(--neg); font-weight: 700; }
.wette-keiner { display: flex; gap: var(--sp-2); align-items: flex-start; margin-top: var(--sp-3); font-size: 13px; color: var(--muted); }
.wette-keiner .icon { margin-top: 2px; }
.wette-fakten { margin: var(--sp-4) 0 0; display: grid; gap: var(--sp-2); }
.fakt {
    display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
    padding-top: var(--sp-2); border-top: 1px dashed var(--border-2); font-size: 14px;
}
.fakt dt { color: var(--muted); }
.fakt dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.person { display: inline-flex; align-items: center; gap: var(--sp-2); }

.wette-block {
    max-width: 640px; margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.wette-block .abschnitt-titel { margin: 0 0 var(--sp-2); }
.wette-block p + p { margin-top: var(--sp-1); }
.wette-block-haupt { display: flex; align-items: center; gap: var(--sp-2); font-size: 17px; }
.wette-block.is-ergebnis.is-pos { border-color: var(--pos); }
.wette-block.is-ergebnis.is-pos .wette-block-haupt { color: var(--pos); }
.wette-block.is-ergebnis.is-neg .wette-block-haupt .icon { color: var(--muted); }
.wette-block.is-geplatzt .wette-block-haupt .icon { color: var(--muted); }
.wette-zitat { margin: var(--sp-2) 0; padding: var(--sp-2) var(--sp-3); border-left: 3px solid var(--accent-line); color: var(--text); font-style: italic; white-space: pre-line; }
.einloesungen { list-style: none; margin: 0; padding: 0; }
.einloesung { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; width: 100%; }
.einloesungen li + li { border-top: 1px solid var(--border); }

/* --- Auswahl-Zeilen (Radio): Freund, Ausgang, Schiedsrichter --- */
.wahl-liste, .freund-wahl { display: flex; flex-direction: column; gap: var(--sp-2); }
.wahl {
    position: relative; display: flex; align-items: center; gap: var(--sp-3);
    min-height: 56px; padding: var(--sp-2) var(--sp-3);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: border-color var(--dauer), background-color var(--dauer);
}
.wahl input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wahl:hover { border-color: var(--border-2); }
.wahl:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.wahl:has(input:focus-visible) { box-shadow: var(--ring); }
.wahl-punkt { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--border-2); }
.wahl:has(input:checked) .wahl-punkt { border: 7px solid var(--accent-fill); }

/* --- Assistent (modules/neu.js) --- */
.neu { max-width: 560px; }
.neu-fortschritt { display: flex; gap: 6px; margin-bottom: var(--sp-3); }
.neu-fortschritt span { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.neu-fortschritt span.is-an { background: var(--accent-fill); }
.neu-schritt { font-size: 13px; }
.neu-frage { margin: var(--sp-1) 0 var(--sp-5); font-size: clamp(26px, 6vw, 32px); }
.neu .feld-fehler { margin-top: var(--sp-3); font-size: 14px; }
.art-wahl { display: grid; gap: var(--sp-2); }
@media (min-width: 560px) { .art-wahl { grid-template-columns: 1fr 1fr; } }
.art-karte {
    display: flex; align-items: center; gap: var(--sp-3); min-height: 64px; padding: var(--sp-2) var(--sp-3);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); text-align: left; font: inherit; cursor: pointer;
}
.art-karte[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.art-karte:disabled { cursor: not-allowed; opacity: .55; }
.art-karte:focus-visible { outline: none; box-shadow: var(--ring); }
.neu-mehr summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.zwei-spalten { display: grid; gap: var(--sp-3); grid-template-columns: 1fr 1fr; margin-bottom: var(--sp-3); }
.einsatz-feld { display: flex; flex-direction: column; gap: var(--sp-2); }
.betrag-feld { position: relative; }
.betrag-feld input { padding-right: 40px; font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; }
.betrag-feld span { position: absolute; right: var(--sp-4); top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
:root[data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }
.neu .chip-leiste { margin-bottom: var(--sp-1); }
.einl-betrag { flex: none; max-width: 45%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seiten-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.25; }
/* Desktop: die Aktionsleiste steht unter der Inhaltsspalte (.seite, 860 px), Knöpfe nicht breiter als nötig. */
@media (min-width: 900px) {
    .actionbar { padding-inline: max(var(--sp-4), calc((100% - 860px) / 2 + var(--sp-4))); }
    .actionbar > .btn { max-width: 320px; }
}

/* ----------------------------------------------------------------------------
   Etappe 2: Mehrpersonenwetten
   ---------------------------------------------------------------------------- */

/* Tipps nach Ausgang (Seiten, Auswahl) und Schätzwerte auf der Wettseite */
.tipps { display: grid; gap: var(--sp-2); margin-top: var(--sp-5); }
.ausgang-block {
    display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0;
    padding: var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--radius);
    background: var(--bg-2);
}
:root[data-theme="light"] .ausgang-block, :root[data-theme="light"] .tipp-liste { background: var(--surface-2); }
.ausgang-block.is-sieger { border-color: var(--pos); background: var(--pos-soft); }
.personen { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); font-size: 14px; }
.tipp-liste { list-style: none; margin: 0; padding: var(--sp-1) var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-2); }
.tipp-zeile { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; font-size: 14px; }
.tipp-zeile + .tipp-zeile { border-top: 1px dashed var(--border-2); }
.tipp-zeile.is-sieger b { color: var(--pos); }
.tipp-zeile b { font-variant-numeric: tabular-nums; }
.tipp-verdeckt { display: inline-flex; align-items: center; gap: var(--sp-1); color: var(--muted); font-style: italic; }
.tipps-rest { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: 13px; }

/* Mehrfachauswahl (Einladen): eckiges Kästchen statt Punkt */
.wahl-punkt.is-eckig { border-radius: 6px; }
.wahl:has(input:checked) .wahl-punkt.is-eckig { border: 0; background: var(--accent-fill); box-shadow: inset 0 0 0 5px var(--accent-fill), inset 0 0 0 11px var(--accent-ink); }

/* Ausgänge der Auswahlwette im Assistenten */
.ausgaenge-feld { display: flex; flex-direction: column; gap: var(--sp-2); }
.ausgang-zeile { display: flex; align-items: center; gap: var(--sp-2); }
.neu-plus { align-self: flex-start; }

/* ----------------------------------------------------------------------------
   Etappe 3: Streit und Abbruch
   ---------------------------------------------------------------------------- */

.wette-block.is-streit { border-color: var(--warn); }
.wette-block.is-streit .wette-block-haupt .icon { color: var(--warn); }
.vorschlaege { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.vorschlag {
    display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0;
    padding: var(--sp-3); border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-2);
}
:root[data-theme="light"] .vorschlag { background: var(--surface-2); }
.vorschlag > .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vorschlag .list-title { font-size: 17px; overflow-wrap: anywhere; }
.vorschlag.is-meins { border-color: var(--accent); background: var(--accent-soft); }
.vorschlag.is-platzen .row-icon { color: var(--muted); }
.vorschlag-notiz { margin-top: var(--sp-1); padding-left: var(--sp-2); border-left: 3px solid var(--accent-line); font-size: 14px; font-style: italic; white-space: pre-line; overflow-wrap: anywhere; }
.stimmen { flex: none; display: inline-flex; align-items: center; gap: 2px; align-self: center; font-variant-numeric: tabular-nums; }
.stimmen .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.stimmen b { margin-left: var(--sp-1); }
.stimmen.is-leer { color: var(--faint); font-weight: 700; }
.wette-block.is-abbruch { border-color: var(--neg); background: var(--neg-soft); }
.wette-block.is-abbruch .wette-block-haupt .icon { color: var(--neg); }
.abbruch-knoepfe { gap: var(--sp-2); margin-top: var(--sp-3); flex-wrap: wrap; }
.abbruch-knoepfe .btn { flex: 1 1 140px; }
.blatt-frage { margin: 0 0 var(--sp-2); font-weight: 700; }

/* ----------------------------------------------------------------------------
   Etappe 4: Schulden (Bilanz, Start, Wettseite, Blatt)
   ---------------------------------------------------------------------------- */

.schuld-summen { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-2); }
.schuld-summe {
    display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-4);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.schuld-summe span { font-size: 13px; }
.schuld-summe b { font-size: 22px; font-variant-numeric: tabular-nums; }
.schuld-aufgabe {
    display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0 0; padding: var(--sp-2) var(--sp-3);
    background: var(--accent-soft); color: var(--accent); border-radius: var(--radius); font-weight: 600; font-size: 14px;
}
.schuld-filter { margin-top: var(--sp-5); max-width: 360px; }
.schuld-filter button { flex: 1; }
.schuld-zeile .grow { min-width: 0; }
.schuld-rechts { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 45%; }
.schuld-rechts .einl-betrag { max-width: 100%; }
.schuld-fuss { margin-top: var(--sp-6); font-size: 13px; text-align: center; }

.abschnitt-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.link-btn {
    background: none; border: 0; padding: var(--sp-2) 0; min-height: var(--tap, 44px);
    color: var(--accent); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }
.link-btn:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* Einlösungen auf der Wettseite: antippbar, wenn man etwas tun darf. */
button.einloesung { background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius-sm); min-height: 52px; }
button.einloesung:hover { background: var(--surface-2); }
button.einloesung:focus-visible { outline: none; box-shadow: var(--ring); }

/* Blatt einer Schuld */
.schuld-blatt { display: flex; flex-direction: column; gap: var(--sp-2); }
.schuld-gross { margin: 0; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.15; }
.schuld-wer { margin: 0; font-size: 17px; font-weight: 600; }
.schuld-stand { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); color: var(--muted); font-size: 14px; }
.schuld-wette {
    display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); min-height: 44px; padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.schuld-wette:hover { background: var(--surface-2); }
.schuld-hinweis { margin: var(--sp-1) 0 0; font-size: 13px; }
.schuld-vonhand { display: flex; justify-content: center; }

/* ----------------------------------------------------------------------------
   Etappe 5: Runden, Zuschauer, Sichtbarkeit
   ---------------------------------------------------------------------------- */

/* Rundenfarben: der Name kommt vom Server, hier wird er hell und dunkel zum Ton.
   --runde markiert (Fläche, Punkt, Rand), --runde-ink ist die Schrift darauf. */
[data-farbe] { --runde: #f6b847; --runde-ink: #10130f; }
[data-farbe="gruen"]    { --runde: #4fd18b; }
[data-farbe="blau"]     { --runde: #5aa9e6; }
[data-farbe="rot"]      { --runde: #ff8070; }
[data-farbe="lila"]     { --runde: #b69cff; }
[data-farbe="tuerkis"]  { --runde: #4fd1c5; }
[data-farbe="rosa"]     { --runde: #f49ac1; }
[data-farbe="schiefer"] { --runde: #a8b6ad; }
:root[data-theme="light"] [data-farbe]              { --runde: #b45309; --runde-ink: #ffffff; }
:root[data-theme="light"] [data-farbe="gruen"]      { --runde: #16794a; }
:root[data-theme="light"] [data-farbe="blau"]       { --runde: #2a6fc0; }
:root[data-theme="light"] [data-farbe="rot"]        { --runde: #b3261e; }
:root[data-theme="light"] [data-farbe="lila"]       { --runde: #6d4bc9; }
:root[data-theme="light"] [data-farbe="tuerkis"]    { --runde: #0f766e; }
:root[data-theme="light"] [data-farbe="rosa"]       { --runde: #b83280; }
:root[data-theme="light"] [data-farbe="schiefer"]   { --runde: #575044; }

/* Zeichen: Anfangsbuchstabe auf der Rundenfarbe */
.runde-zeichen {
    display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px;
    border-radius: var(--radius); background: var(--runde); color: var(--runde-ink);
    font: 800 17px/1 var(--font-zahl); letter-spacing: -.02em;
}
.runde-zeichen.gross { width: 56px; height: 56px; border-radius: var(--radius-lg); font-size: 24px; }
.runde-zeichen.klein { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }

/* „● Stammtisch“ – im Wettschein und auf der Wettseite */
.runde-chip {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
    padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-2);
    font-size: 12px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.runde-chip::before { content: ''; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--runde); }

/* Gesichter übereinander (Rundenliste) */
.gesichter { display: inline-flex; flex: none; }
.gesichter .avatar { box-shadow: 0 0 0 2px var(--surface); }
.gesichter .avatar + .avatar { margin-left: -6px; }
@media (max-width: 380px) { .runde-zeile .gesichter { display: none; } }

/* Einladung in eine Runde (Runden, Start) */
.runde-einladungen { display: grid; gap: var(--sp-3); max-width: 640px; }
.runde-einladung {
    display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4) var(--sp-4);
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--runde);
    border-radius: var(--radius-lg);
}
.runde-einladung-kopf { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); color: var(--text); text-decoration: none !important; border-radius: var(--radius-sm); }
.runde-einladung-kopf .grow { min-width: 0; }
.runde-einladung-kopf:focus-visible { outline: none; box-shadow: var(--ring); }
.runde-einladung-knoepfe { display: flex; justify-content: flex-end; gap: var(--sp-2); flex-wrap: wrap; }
.runde-einladung-knoepfe .btn { min-height: var(--tap); }

/* Rundenliste */
.runde-zeile { padding-inline: var(--sp-4); }
.runde-zeile .grow { min-width: 0; }
.runden-hinweis { max-width: 640px; }
.runden-archiv { margin-top: var(--sp-8); max-width: 640px; }
.runden-archiv summary {
    display: inline-flex; align-items: center; gap: var(--sp-3); min-height: var(--tap); cursor: pointer; list-style: none;
    font-size: 14px; font-weight: 600; color: var(--muted);
}
.runden-archiv summary::-webkit-details-marker { display: none; }
.runden-archiv summary::after {
    content: ''; width: 7px; height: 7px; margin-top: -3px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform var(--dauer) var(--ease);
}
.runden-archiv[open] summary::after { margin-top: 3px; transform: rotate(-135deg); }
.runden-archiv summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.runden-archiv .settings-group { margin-top: var(--sp-2); }
.runden-archiv .runde-zeichen { opacity: .6; }
.seite-kopf + [data-inhalt] > .list.settings-group { max-width: 640px; }

/* Farbwahl im Blatt */
.farb-wahl { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); max-width: 400px; }
.farb-punkt { position: relative; display: grid; place-items: center; height: var(--tap); cursor: pointer; }
.farb-punkt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.farb-punkt span { width: 30px; height: 30px; border-radius: 50%; background: var(--runde); transition: box-shadow var(--dauer); }
.farb-punkt input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }
.farb-punkt input:focus-visible + span { box-shadow: 0 0 0 3px var(--surface), var(--ring); }
.farb-punkt input:checked:focus-visible + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text), 0 0 0 8px var(--accent-line); }

/* Rundenseite */
.runde-kopf { display: flex; align-items: center; gap: var(--sp-4); max-width: 640px; margin: var(--sp-2) 0 var(--sp-5); }
.runde-kopf .grow { min-width: 0; }
.runde-kopf h1 { font: 800 clamp(24px, 5vw, 30px)/1.15 var(--font-zahl); letter-spacing: -.02em; overflow-wrap: anywhere; }
.runde-kopf p { margin-top: var(--sp-1); color: var(--muted); font-size: 14px; }
.runde-kopf + .wette-block { margin-top: 0; }
.seite > .runde-kopf ~ .settings-group, .runde-kopf ~ .muted { max-width: 640px; margin-inline: 0; }
/* In der eigenen Runde braucht der Wettschein ihren Chip nicht. */
.runde-kopf ~ .wettscheine .runde-chip { display: none; }
.rangliste { list-style: none; margin: 0; padding: 0; }
.rangliste .list-row { padding-inline: var(--sp-4); cursor: default; }
.rangliste .list-row:hover { background: none; }
.rangliste .grow { min-width: 0; }
.rang-platz { width: 24px; flex: none; text-align: center; font: 800 16px/1 var(--font-zahl); font-variant-numeric: tabular-nums; color: var(--faint); }
.rangliste li:first-child .rang-platz { color: var(--accent); }
.rang-werte { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rang-siege { flex: none; text-align: right; font-size: 13px; }
.rang-saldo { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rang-regel { max-width: 640px; margin-top: var(--sp-2); font-size: 13px; }
.runde-kopf ~ .bilanz-jahre { margin-bottom: var(--sp-3); }
.rang-siege b { font: 800 18px/1 var(--font-zahl); font-variant-numeric: tabular-nums; }
.rangliste .list-row.is-ich, .rangliste .list-row.is-ich:hover { background: var(--accent-soft); }
.runde-kopf ~ ul.settings-group { list-style: none; margin: 0; padding: 0; }
.runde-kopf ~ ul.settings-group .list-row { padding-inline: var(--sp-4); cursor: default; }
.runde-kopf ~ ul.settings-group .list-row:hover { background: none; }
.runde-kopf ~ ul.settings-group .list-title { overflow-wrap: anywhere; }

.hinweis-zeile {
    display: flex; align-items: center; gap: var(--sp-2); max-width: 640px; margin-top: var(--sp-2);
    font-size: 14px; color: var(--muted);
}
.hinweis-zeile .icon { flex: none; }

/* Hinweisblock (Einladung in die Runde, „Du schaust zu“) */
.wette-block.is-hinweis { border-color: var(--accent-line); background: var(--accent-soft); }
.wette-block.is-hinweis .wette-block-haupt .icon { color: var(--accent); }

/* Wettschein: Art und Runde links im Kopf */
.wettschein-links { display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; flex-wrap: wrap; }
.wettschein-kopf .badge { flex: none; }
.wettschein-zusehen { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }

/* Wettseite: Runde und „Freunde sehen zu“ unter der Behauptung */
.wette-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-3); }
/* Der Chip bleibt klein, die Tippfläche ist 44 px hoch; der Rand oben gleicht das aus. */
.wette-meta:has(> a) { margin-top: var(--sp-1); }
.wette-meta a { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; min-height: var(--tap); text-decoration: none !important; }
.wette-meta a:hover .runde-chip { background: var(--surface-3); }
.wette-meta a:focus-visible { outline: none; }
.wette-meta a:focus-visible .runde-chip { box-shadow: var(--ring); }
.wette-meta-teil { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* Assistent: Runde wählen, Gäste aus der Runde */
.chip[aria-checked="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-ink); }
.chip-runde { display: inline-flex; align-items: center; gap: var(--sp-2); padding-left: var(--sp-2); }
.chip-runde[aria-checked="true"] .runde-zeichen { box-shadow: 0 0 0 2px var(--accent-ink); }
.wahl.is-auto { cursor: default; border-style: dashed; }
.wahl.is-auto:has(input:checked) { background: var(--surface-2); border-color: var(--border-2); }
.wahl.is-auto .wahl-punkt { opacity: .55; }

/* ----------------------------------------------------------------------------
   Etappe 6: Kommentare und Fotos
   ---------------------------------------------------------------------------- */

/* Foto als Knopf (teile/foto.js) – hält seinen Platz, bis das Bild da ist */
.foto {
    position: relative; display: block; overflow: hidden; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
    cursor: zoom-in;
}
.foto img { display: block; width: 100%; height: 100%; object-fit: cover; }
.foto:focus-visible { outline: none; box-shadow: var(--ring); }
.foto.is-fehlt { display: grid; place-items: center; color: var(--faint); cursor: default; }
/* Einzelfoto: Rahmen nach dem Bild (foto.js setzt aspect-ratio), das ganze Bild sichtbar */
.foto.is-frei { background: var(--bg-2); }
.foto.is-frei img { object-fit: contain; }
.komm-foto { width: min(100%, 280px); aspect-ratio: 4 / 3; margin-top: var(--sp-2); }
.vorschlag-foto { width: 88px; aspect-ratio: 1; margin-top: var(--sp-2); }

/* Belege: ein Beweisfoto in der Meldung, alle Fotos einer beendeten Wette */
.belege { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin: var(--sp-3) 0 var(--sp-2); }
.belege > .beleg-foto { width: min(100%, 280px); aspect-ratio: 4 / 3; }
.beleg { margin: 0; display: flex; flex-direction: column; gap: 4px; width: 112px; }
.beleg .beleg-foto { width: 112px; aspect-ratio: 1; }
.beleg figcaption { line-height: 1.3; overflow-wrap: anywhere; }

/* Vollbild (ui.js openVollbild) – immer dunkel, damit das Foto wirkt */
.vollbild {
    position: fixed; inset: 0; display: grid; place-items: center;
    padding: calc(var(--sp-12) + env(safe-area-inset-top, 0px)) var(--sp-3) calc(var(--sp-6) + var(--safe-b));
    background: rgba(4, 7, 6, .94); cursor: zoom-out;
    animation: einblenden var(--dauer) var(--ease) both;
    /* Feste Spur – sonst greift max-height: 100% am Bild nicht, und ein
       Hochformatfoto liefe unten aus dem Bildschirm. */
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
.vollbild:focus { outline: none; }
.vollbild img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-sm); }
.vollbild-zu {
    position: absolute; top: calc(var(--sp-2) + env(safe-area-inset-top, 0px)); right: var(--sp-2);
    color: #fff; background: rgba(255, 255, 255, .12);
}
.vollbild-zu:hover { background: rgba(255, 255, 255, .22); }
.vollbild-lade { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); color: #e6ece8; }

/* Gewähltes Foto vor dem Senden */
.foto-anhang {
    display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2);
    border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-2);
}
:root[data-theme="light"] .foto-anhang { background: var(--surface-2); }
.foto-anhang[hidden], .foto-waehlen[hidden] { display: none; }
.foto-anhang img { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-3); }
.foto-anhang img:not([src]) { visibility: hidden; }
.foto-anhang.is-laedt img { opacity: .5; }
.foto-anhang-status { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.foto-anhang .foto-weg { margin-left: auto; }
.foto-feld { margin-top: var(--sp-4); }
.foto-feld-knopf { display: flex; }

/* Kommentare unter der Wette (teile/kommentare.js) */
.kommentare-zahl { margin-left: 2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.komm-liste { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; gap: var(--sp-4); }
.komm { display: flex; align-items: flex-start; gap: var(--sp-3); min-width: 0; }
.komm > .avatar { flex: none; margin-top: 2px; }
.komm-inhalt { flex: 1; min-width: 0; }
.komm-kopf { display: flex; align-items: center; gap: var(--sp-2); min-height: 28px; font-size: 14px; }
.komm-kopf b { min-width: 0; }
.komm-kopf time { flex: none; font-size: 13px; white-space: nowrap; }
.komm.is-ich .komm-kopf b { color: var(--accent); }
/* Volle Tippfläche, aber ohne die Zeile aufzublähen */
.komm-loeschen { margin: -8px -10px -8px auto; color: var(--muted); }
.komm-loeschen:hover { color: var(--neg); }
.komm-text { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.komm-leer { margin: var(--sp-1) 0 0; font-size: 14px; }
.komm-laedt { display: grid; place-items: center; padding: var(--sp-4); }
.komm-aeltere { margin: var(--sp-1) 0 var(--sp-2) calc(-1 * var(--sp-3)); color: var(--accent); }
.komm-form { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.komm-zeile { display: flex; align-items: flex-end; gap: var(--sp-1); }
.komm-zeile .foto-waehlen { color: var(--muted); }
.komm-zeile .foto-waehlen:hover { color: var(--text); }
.komm-text-eingabe { flex: 1; min-width: 0; min-height: var(--tap); max-height: 200px; resize: none; padding: 10px var(--sp-3); }
.komm-senden:not(:disabled) { color: var(--accent); }
.komm-rest { margin: 0; text-align: right; }
.btn-link {
    display: inline; padding: 0; border: 0; background: none; font: inherit;
    color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

/* Wettschein: Kommentarzahl neben dem Zustand */
.wettschein-rechts { display: inline-flex; align-items: center; gap: var(--sp-2); flex: none; }
.wettschein-komm { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
