/* ============================================================
   style.css – Aussehen der ganzen App

   Aufbau:
   1. Variablen (Farben, Abstände) für Light und Dark Mode
   2. Grundlayout
   3. Kopfbereich & Navigation
   4. Formulare, Buttons, Meldungen
   5. Bibliothek (Filter, Karten, Etiketten)
   ============================================================ */


/* ---------- 0. Schriften ----------
   "Saira Semi Condensed" für Überschriften und große Zahlen (sportlich,
   passend zum Logo). Liegt SELBST im Ordner public/fonts/ – der Browser
   fragt also nie bei Google an (DSGVO). Lizenz: SIL Open Font License
   (public/fonts/OFL.txt) – frei nutzbar, auch kommerziell.
   font-display: swap = erst Systemschrift zeigen, dann austauschen
   (kein unsichtbarer Text, solange die Schrift lädt). */
@font-face {
    font-family: 'Saira Semi Condensed';
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/saira-semi-condensed-latin-600-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Saira Semi Condensed';
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/saira-semi-condensed-latin-700-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Saira Semi Condensed';
    font-weight: 800;
    font-display: swap;
    src: url('../fonts/saira-semi-condensed-latin-800-normal.woff2') format('woff2');
}


/* ---------- 1. Variablen ----------
   CSS-Variablen beginnen mit "--" und werden mit var(--name) benutzt.
   Vorteil: Jede Farbe steht nur EINMAL hier. Für den Dark Mode
   überschreiben wir einfach die Werte – der Rest der Datei bleibt gleich. */

:root {
    /* Sagt dem Browser, welcher Modus gerade gilt.
       Dann passt er z. B. Scrollbalken und Eingabefelder automatisch an. */
    color-scheme: light;

    /* Flächen und Text */
    --color-bg:            #f4f5f7;  /* Seitenhintergrund */
    --color-surface:       #ffffff;  /* Karten, Formulare */
    --color-surface-muted: #eceef2;  /* zurückhaltende Flächen */
    --color-border:        #d7dbe1;
    --color-text:          #1c1f24;
    --color-text-muted:    #5b616b;

    /* Hauptfarbe für Buttons und Links */
    --color-primary:       #2d6bd5;  /* 4,6:1 auf dem Seitenhintergrund (WCAG AA); vorher #2f6fde = 4,3:1 */
    --color-primary-hover: #2459b8;
    --color-on-primary:    #ffffff;  /* Text AUF der Hauptfarbe */

    /* Meldungen */
    --color-success-bg:    #e3f4ea;
    --color-success-text:  #1b6a3c;
    --color-error-bg:      #fbe7e7;
    --color-error-text:    #9b2c2c;

    /* Gefährliche Aktionen (Löschen) */
    --color-danger:        #c0392b;
    --color-danger-hover:  #a12f23;
    --color-on-danger:     #ffffff;

    /* Kategoriefarben – mit einem Prüfskript getestet: alle vier Paare sind
       auch bei Farbenblindheit unterscheidbar (Hell UND Dunkel).
       Regel: Farbe nur für Flächen/Streifen/Punkte, Text bleibt neutral,
       und der Kategoriename steht immer dabei. */
    --cat-kraft:        #2a78d6;  /* Blau */
    --cat-koordination: #e87ba4;  /* Magenta */
    --cat-athletik:     #eda100;  /* Gelb/Amber */
    --cat-dehnen:       #008300;  /* Grün */

    /* Aktivitätskalender: EINE Farbe von hell (wenig) nach dunkel (viel) */
    --heat-1: #6da7ec;
    --heat-2: #3987e5;
    --heat-3: #256abf;
    --heat-4: #104281;

    /* Rundungen */
    --radius:    12px;
    --radius-sm: 8px;

    /* Schatten für Karten: ruhend und angehoben (Hover bei klickbaren Kacheln) */
    --shadow-card:   0 1px 2px rgba(16, 24, 40, 0.06), 0 2px 8px rgba(16, 24, 40, 0.06);
    --shadow-raised: 0 4px 10px rgba(16, 24, 40, 0.10), 0 12px 28px rgba(16, 24, 40, 0.10);

    /* Schriften: Display = Überschriften & große Zahlen, Text = alles andere */
    --font-display: 'Saira Semi Condensed', system-ui, sans-serif;
    --font-text:    system-ui, sans-serif;
}

/* Dark Mode: gilt, wenn am <html>-Element data-theme="dark" steht.
   Das setzt ein kleines Skript im <head> (src/layout.php): entweder
   nach der gespeicherten Wahl des Users oder nach der Systemeinstellung. */
:root[data-theme="dark"] {
    color-scheme: dark;

    --shadow-card:   0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-raised: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 10px 24px rgba(0, 0, 0, 0.45);

    --color-bg:            #131518;
    --color-surface:       #1c1f24;
    --color-surface-muted: #272b31;
    --color-border:        #353a42;
    --color-text:          #e6e8eb;
    --color-text-muted:    #9aa1ab;

    --color-primary:       #6b9bf0;
    --color-primary-hover: #8cb2f4;
    --color-on-primary:    #0e1420;

    --color-success-bg:    #16331f;
    --color-success-text:  #8fd6a8;
    --color-error-bg:      #3a1b1b;
    --color-error-text:    #f0a3a3;

    --color-danger:        #e5736a;
    --color-danger-hover:  #ec8f88;
    --color-on-danger:     #1c1012;

    /* Für den dunklen Grund eigens abgestimmte Stufen (ebenfalls geprüft) */
    --cat-kraft:        #3987e5;
    --cat-koordination: #d55181;
    --cat-athletik:     #c98500;
    --cat-dehnen:       #008300;

    /* Kalender im Dunkeln umgekehrt: mehr Training = HELLER (leuchtet) */
    --heat-1: #184f95;
    --heat-2: #256abf;
    --heat-3: #3987e5;
    --heat-4: #86b6ef;
}


/* ---------- 2. Grundlayout ---------- */

* {
    box-sizing: border-box;
}

/* Elemente mit dem Attribut "hidden" IMMER verstecken – auch wenn eine
   andere Regel ihnen z. B. display: flex gibt (die würde sonst gewinnen). */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: var(--font-text);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh; /* mind. Bildschirmhöhe – damit der Fußbereich unten sitzt */
}

a {
    color: var(--color-primary);
}

/* Überschriften: sportliche Display-Schrift, kräftig, eng gesetzt.
   Einzelne Bereiche ändern danach nur noch die Größe. */
h1,
h2,
h3 {
    font-family: var(--font-display);
    line-height: 1.15;
    letter-spacing: 0.005em;
}

h1 {
    font-size: clamp(2rem, 4.5vw, 2.6rem); /* wächst mit der Breite, Handy ↔ iPad */
    font-weight: 800;
    margin: 0 0 0.75rem;
}

h2 {
    font-size: 1.55rem;
    font-weight: 700;
}

h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

/* Große Zahlen und Titel, die zur Display-Schrift gehören */
.brand__name,
.stat-value,
.player-title,
.player-big,
.button--start,
.theme-tile__name,
.onboarding-step legend {
    font-family: var(--font-display);
}

/* Inhaltsbreite: Der RAHMEN ist immer 1200px breit wie der Kopfbereich.
   Stufen (renderHeader($titel, $breite)):
     wide / default – volle Breite, beginnt an derselben Kante wie das Logo
     narrow 640px   – reine Formular-Seiten (Login, Konto, Feedback …):
                      ZENTRIERT – eine Seite mit nur einem Formular wirkt
                      mittig ausgewogen, sehr breite Eingabefelder lesen sich schlecht
   ">" = nur direkte Kinder von <main>; Popup-Fenster (<dialog>) ausgenommen,
   die haben ihre eigene Breite. */
.container {
    max-width: 1200px;
    margin: 1.5rem auto 2rem;
    padding: 0 1rem;
}

.container--narrow > :not(dialog) {
    max-width: 640px;
    margin-inline: auto; /* links und rechts gleicher Abstand = zentriert */
}

/* KARTEN: eine gemeinsame Regel für alle Bausteine mit weißer Fläche.
   Steht weit oben, damit einzelne Bausteine weiter unten Abweichungen
   (z. B. Innenabstand) ergänzen können. Neue Karten-Bausteine hier
   ergänzen statt Fläche/Rundung/Schatten jedes Mal neu zu schreiben. */
.form,
.filters,
.exercise-card,
.empty-state,
.workout-item,
.entry-card,
.focus,
.card,
.run-entry,
.stat-tile,
.hub-tile,
.prepared-card,
.feedback-item,
.stats-card,
.legal-toc,
.theme-tile,
.landing-steps li,
.landing-account {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}


/* ---------- 3. Kopfbereich & Navigation ---------- */

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

/* Logo | Menü | Trennstrich | Hell/Dunkel (| Burger, nur Handy) */
.site-header__inner {
    max-width: 1200px; /* so breit wie die breiteste Seite (.container--wide) */
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.brand {
    margin-right: auto; /* schiebt alles andere nach rechts */
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
    text-decoration: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.main-nav a,
.nav-logout {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.main-nav a:hover,
.nav-logout:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

/* Die Seite, auf der man gerade ist */
.main-nav a.active {
    color: var(--color-primary);
    font-weight: 600;
}

/* "Jetzt registrieren" für Gäste: ein echter (blauer) Button.
   ".main-nav" davor, sonst gewinnt die Regel ".main-nav a" (Spezifität). */
.main-nav .nav-register {
    margin-left: 0.25rem;
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.main-nav .nav-register:hover {
    background: var(--color-primary-hover);
    color: var(--color-on-primary);
}

/* Abmelden: Button ohne eigenen Look, nur mit Symbol */
.nav-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    background: none;
    font-family: inherit;
    cursor: pointer;
}

.nav-logout svg {
    width: 1.15rem;
    height: 1.15rem;
}

/* Burger-Button: am Desktop unsichtbar */
.nav-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: none;
    color: var(--color-text);
    cursor: pointer;
}

.nav-burger svg {
    width: 1.4rem;
    height: 1.4rem;
}

/* Geschlossen: drei Striche; geöffnet: X */
.nav-burger .icon-close,
.site-header.is-open .nav-burger .icon-burger {
    display: none;
}

.site-header.is-open .nav-burger .icon-close {
    display: block;
}

/* ----- Handy: Burger-Menü -----
   Gilt nur mit Menü (has-nav). Ohne Login bleibt es bei Logo + Hell/Dunkel. */
@media (max-width: 640px) {
    .has-nav .nav-burger {
        display: inline-flex;
        order: 3;               /* ganz rechts in der ersten Zeile */
    }

    .has-nav .theme-toggle {
        display: none;          /* nur bei geöffnetem Menü … */
        order: 2;               /* … dann links neben dem Burger */
    }

    .has-nav .header-divider {
        display: none;
    }

    /* Das Menü: eigene Zeile über die ganze Breite, Punkte untereinander */
    .has-nav .main-nav {
        display: none;
        order: 4;
        flex-basis: 100%;       /* volle Breite = erzwingt neue Zeile */
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
        padding: 0.5rem 0 0.25rem;
        border-top: 1px solid var(--color-border);
    }

    .site-header.is-open .main-nav,
    .site-header.is-open .theme-toggle {
        display: flex;
    }

    .has-nav .main-nav a,
    .has-nav .nav-logout {
        padding: 0.7rem 0.75rem;  /* große Tippflächen */
        font-size: 1rem;
    }

    .has-nav .main-nav .nav-register {
        margin: 0.4rem 0;
        text-align: center;
    }

}

.header-divider {
    width: 1px;
    height: 1.5rem;
    background: var(--color-border);
}

/* ----- Avatar (Profilbild oder Anfangsbuchstabe) ----- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;           /* in Flex-Zeilen nie zum Oval quetschen */
    border-radius: 50%;       /* 50 % = Kreis */
    object-fit: cover;        /* Bild füllt den Kreis, ohne sich zu verzerren */
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-weight: 700;
    line-height: 1;
    user-select: none;
}

.avatar--sm { width: 2rem;   height: 2rem;   font-size: 0.9rem; }
.avatar--md { width: 2.25rem; height: 2.25rem; font-size: 1rem; }
.avatar--lg { width: 6rem;   height: 6rem;   font-size: 2.5rem; }

/* ----- Avatar-Menü (Dropdown) ----- */
.user-menu {
    position: relative;       /* Bezugspunkt für den aufklappenden Kasten */
    margin-left: 0.25rem;
}

/* Der runde Button: nur der Avatar, mit Ring beim Hover/Fokus */
.user-menu__toggle {
    display: flex;
    padding: 2px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.user-menu__toggle:hover,
.user-menu.is-open .user-menu__toggle {
    border-color: var(--color-border);
}

/* Man ist gerade auf Dashboard, Konto, Einstellungen oder Verlauf */
.user-menu__toggle.is-current {
    border-color: var(--color-primary);
}

/* Der Kasten: unsichtbar, bis Hover (nur Maus) oder .is-open (nav.js) */
.user-menu__panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 50;              /* über dem Seiteninhalt */
    min-width: 14rem;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--color-text) 15%, transparent);
}

/* Unsichtbare "Brücke" über der Lücke zwischen Avatar und Kasten –
   sonst schließt sich das Hover-Menü, sobald die Maus die Lücke kreuzt */
.user-menu__panel::before {
    content: "";
    position: absolute;
    top: -0.6rem;
    left: 0;
    right: 0;
    height: 0.6rem;
}

.user-menu.is-open .user-menu__panel {
    display: flex;
}

/* Hover nur bei echten Mäusen: Auf Touch-Geräten (iPad) würde ein
   "klebendes" Hover sonst das Menü nicht mehr schließen lassen */
@media (hover: hover) and (min-width: 641px) {
    .user-menu:hover .user-menu__panel {
        display: flex;
    }
}

.user-menu__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.6rem 0.6rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--color-border);
    overflow-wrap: anywhere;  /* lange Namen umbrechen statt überlaufen */
}

.user-menu__sub {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Abmelden: abgetrennt am Ende, mit Text */
.user-menu .nav-logout {
    margin-top: 0.25rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--color-border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    text-align: left;
    font-size: 0.95rem;
}

/* Handy: kein Dropdown – die Punkte stehen offen im Burger-Menü */
@media (max-width: 640px) {
    .has-nav .user-menu {
        margin: 0.25rem 0 0;
    }

    .has-nav .user-menu__toggle {
        display: none;
    }

    .has-nav .user-menu__panel {
        display: flex;
        position: static;
        min-width: 0;
        padding: 0.5rem 0 0;
        border: none;
        border-top: 1px solid var(--color-border);
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .has-nav .user-menu__panel::before {
        display: none;
    }

    .has-nav .user-menu__head {
        border-bottom: none;
        margin-bottom: 0;
        padding-left: 0.75rem;
    }
}

/* Runder Button nur mit Symbol */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: none;
    color: var(--color-text-muted); /* das SVG übernimmt diese Farbe (currentColor) */
    cursor: pointer;
}

.theme-toggle:hover {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.theme-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* Im hellen Modus nur den Mond zeigen, im dunklen nur die Sonne */
.icon-sun {
    display: none;
}

:root[data-theme="dark"] .icon-sun {
    display: block;
}

:root[data-theme="dark"] .icon-moon {
    display: none;
}


/* ---------- 4. Formulare, Buttons, Meldungen ---------- */

.form {
    display: flex;
    flex-direction: column; /* Felder untereinander statt nebeneinander */
    gap: 0.4rem;
    padding: 1.5rem;
}

.form label {
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Gemeinsamer Stil für alle Eingabefelder */
.form input,
.form select,
.form textarea,
.filters input,
.filters select,
.admin-search input {
    padding: 0.6rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

/* Gruppe aus Beschriftung + Feld, die man gemeinsam ein-/ausblenden kann */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Datei-Auswahl: kein Rahmen ums ganze Feld */
.form input[type="file"] {
    border: none;
    padding: 0.25rem 0;
}

/* Vorschau des ausgewählten Bildes/Videos */
.media-preview img,
.media-preview video {
    max-width: 100%;
    max-height: 240px;
    border-radius: var(--radius-sm);
}

/* Gesperrter Button (z. B. während des Speicherns) */
.form button:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Mehrzeiliges Textfeld: nur in der Höhe vergrößerbar */
.form textarea {
    resize: vertical;
}

/* Kleiner grauer Zusatztext, z. B. "(optional)" */
.form-hint {
    font-weight: normal;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Gruppe von Radio-Buttons oder Checkboxen */
.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 0.5rem 0 0;
    padding: 0;
    border: none;
}

.choice-group legend {
    font-weight: 600;
    margin-bottom: 0.4rem;
    padding: 0;
}

/* Einzelne Auswahl: Kästchen und Text nebeneinander */
.form .choice {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: normal;
    margin-top: 0;
    cursor: pointer;
}

/* Kästchen und Kreise in der Hauptfarbe */
.choice input {
    accent-color: var(--color-primary);
    width: 1.1rem;
    height: 1.1rem;
}

/* Überschrift mit Button daneben */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.page-header .button {
    margin-top: 0;
}

/* Komma = gleiche Regeln für beide: Buttons im Formular UND alles mit class="button" */
.form button,
.button {
    margin-top: 1rem;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: var(--color-on-primary);
    cursor: pointer;
}

.form button:hover,
.button:hover {
    background: var(--color-primary-hover);
}

/* Links, die wie Buttons aussehen sollen */
a.button {
    display: inline-block;
    text-decoration: none;
}

/* Zweitrangiger Button: zurückhaltender.
   ".form .button--secondary" zusätzlich, weil sonst die Regel ".form button"
   gewinnen würde: Sie ist "spezifischer" (Klasse + Element schlägt nur Klasse). */
.button--secondary,
.form .button--secondary {
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.button--secondary:hover,
.form .button--secondary:hover {
    background: var(--color-border);
}

/* Button für gefährliche Aktionen wie Löschen */
.button--danger {
    background: var(--color-danger);
    color: var(--color-on-danger);
}

.button--danger:hover {
    background: var(--color-danger-hover);
}

/* Kleiner Button, z. B. auf den Übungskarten */
.button--small {
    margin-top: 0;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

/* Zeile unter einem Formular: Zurück-Link links, Löschen rechts */
.form-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.form-footer .button {
    margin-top: 0;
}

/* Beschriftung ohne zugehöriges Eingabefeld (sieht aus wie ein label) */
.form-label {
    font-weight: 600;
    margin-top: 0.5rem;
}

/* ---------- Dialog (Popup-Fenster) ---------- */

.dialog {
    width: min(92vw, 380px); /* höchstens 380px, auf dem Handy 92 % der Breite */
    padding: 0;
    border: none;
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
}

/* ::backdrop = der abgedunkelte Hintergrund hinter dem Dialog */
.dialog::backdrop {
    background: rgb(0 0 0 / 0.45);
}

.dialog-title {
    margin: 0;
    font-size: 1.15rem;
}

.dialog-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dialog-buttons button {
    flex: 1 1 auto; /* Buttons teilen sich den Platz */
}

.message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
}

.message.ok {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.message.error {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}


/* ---------- 5. Bibliothek ---------- */

.filters {
    display: grid;
    /* So viele Spalten wie passen, jede mindestens 180px breit.
       Auf dem Handy rutschen die Filter automatisch untereinander. */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    align-items: end;
    padding: 1rem;
}

.filters label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.filters input,
.filters select {
    padding: 0.5rem;
    font-weight: normal;
}

.filters .button {
    margin-top: 0;
    padding: 0.55rem;
}

/* Checkbox im Filter: Kästchen und Text nebeneinander statt untereinander,
   auf Höhe der Eingabefelder ausgerichtet */
.filters .filter-checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.4rem;
    font-weight: normal;
    font-size: 0.95rem;
    cursor: pointer;
}

.filter-checkbox input {
    accent-color: var(--color-primary);
    width: 1.1rem;
    height: 1.1rem;
}

.result-count {
    color: var(--color-text-muted);
}

.exercise-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Kategorie → Farbe.
   Das Attribut data-category setzt JavaScript. Jede Regel legt nur
   die Variable --cat-color fest; Karte und Etikett benutzen sie dann. */
[data-category="Kraft"]        { --cat-color: var(--cat-kraft); }
[data-category="Koordination"] { --cat-color: var(--cat-koordination); }
[data-category="Athletik"]     { --cat-color: var(--cat-athletik); }
[data-category="Dehnen"]       { --cat-color: var(--cat-dehnen); }

.exercise-card {
    padding: 1rem;
    /* Schmaler Farbstreifen links in der Kategoriefarbe.
       Fehlt die Kategorie, nimm die Rahmenfarbe. */
    border-left: 4px solid var(--cat-color, var(--color-border));
}

/* Etwas Luft zum Titel darüber und zu den Wiederholungen darunter */
.exercise-media {
    margin: 0.5rem 0 0.6rem;
}

.exercise-media img,
.exercise-media video {
    display: block; /* entfernt die kleine Lücke, die Bilder sonst unten haben */
    width: 100%;
    border-radius: var(--radius-sm);
}

/* Kopfzeile: Name links, Etikett rechts */
.exercise-head {
    display: flex;
    justify-content: space-between; /* an die beiden Ränder schieben */
    align-items: flex-start;        /* oben bündig, auch wenn der Name umbricht */
    gap: 0.5rem;
}

.exercise-name {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

/* Etikett "Eigene Übung" */
.own-badge {
    flex-shrink: 0;       /* nie zusammenquetschen – lieber bricht der Name um */
    white-space: nowrap;  /* "Eigene Übung" bleibt in einer Zeile */
    margin-top: 0.1rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid color-mix(in srgb, var(--color-success-text) 30%, transparent);
}

.exercise-dosage {
    margin: 0 0 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.exercise-tags {
    display: flex;
    flex-wrap: wrap; /* Etiketten in die nächste Zeile umbrechen, wenn kein Platz */
    gap: 0.35rem;
}

/* Hinweis "angepasst · Standard: 10 Wdh." neben dem Wert */
.dosage-note {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    font-weight: normal;
    font-style: italic;
}

/* Button-Zeile unten auf der Karte */
.exercise-actions {
    margin-top: 0.75rem;
}

.exercise-description {
    margin-bottom: 0;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--color-text-muted);
}

/* Kleine Etiketten */
.tag {
    font-size: 0.8rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px; /* sehr großer Radius = Pillenform */
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
}

/* Kategorie-Etikett: normaler Text + farbiger Punkt davor.
   Die Farbe sitzt nur im Punkt – Text in Kategoriefarbe wäre bei Gelb
   und Magenta schlecht lesbar. color-mix() tönt den Hintergrund ganz
   zart (10 % Kategoriefarbe + 90 % Kartenfarbe). */
.tag--category {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: color-mix(in srgb, var(--cat-color) 10%, var(--color-surface));
    color: var(--color-text);
    font-weight: 600;
}

.tag--category::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--cat-color);
}

/* Equipment: nur umrandet, damit es sich von den Zonen abhebt */
.tag--equipment {
    background: transparent;
    border: 1px solid var(--color-border);
}


/* ---------- 6. Workouts: Übersicht ---------- */

/* Hinweis, wenn eine Liste leer ist */
.empty-state {
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
}

.workout-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workout-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}

.workout-name {
    margin: 0;
    font-size: 1.15rem;
}

.workout-meta,
.workout-description {
    margin: 0.25rem 0 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.workout-actions {
    display: flex;
    gap: 0.5rem;
}

/* Zeile "Schwerpunkt: [Kraft] [Hüfte & Gesäß]" */
.workout-focus {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.workout-focus__label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}


/* ---------- 7. Workout-Editor ---------- */

/* Vier kleine Zahlenfelder nebeneinander (auf dem Handy 2 × 2) */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem; /* Abstand zur Überschrift "Ablauf" */
}

.form .settings-grid label {
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Feld immer unten, auch bei 2-zeiliger Beschriftung */
    gap: 0.3rem;
    margin-top: 0;
    font-size: 0.9rem;
}

.entries-section {
    margin-top: 1.5rem;
}

.entries-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.entries-header h2 {
    margin: 0 0 0.75rem;
}

.duration {
    font-weight: 600;
    color: var(--color-text-muted);
}

.entry-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Ein Eintrag: Karte mit Kategorie-Streifen links */
.entry-card {
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--cat-color, var(--color-border));
}

.entry-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.entry-number {
    color: var(--color-text-muted);
    min-width: 1.6rem;
}

.entry-name {
    flex: 1; /* nimmt den freien Platz → Buttons rutschen nach rechts */
}

.entry-buttons {
    display: flex;
    gap: 0.25rem;
}

/* Kleiner quadratischer Button nur mit Symbol (↑ ↓ ✕) */
.icon-button {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
}

.icon-button:hover:not(:disabled) {
    background: var(--color-surface-muted);
}

.icon-button:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Körperzonen unter dem Namen, bündig mit dem Namen */
.entry-zones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
    padding-left: 2.1rem;
}

.entry-zones:empty {
    display: none; /* :empty = Element ohne Inhalt → keinen Platz belegen */
}

/* ----- Schwerpunkt: Balken, Legende, Zonen-Zeile ----- */

.focus {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
}

/* Der Balken: ein Container, in dem die Abschnitte nebeneinander liegen */
.focus-bar {
    display: flex;
    height: 0.6rem;
    border-radius: 999px;
    overflow: hidden; /* Abschnitte an den runden Enden abschneiden */
    background: var(--color-surface-muted);
}

/* Ein Abschnitt in der Kategoriefarbe. Die Breite setzt JavaScript. */
.focus-bar span {
    background: var(--cat-color);
}

/* Feine Trennlinie zwischen zwei Abschnitten */
.focus-bar span + span {
    border-left: 2px solid var(--color-surface);
}

.focus-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.focus-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Farbiger Punkt vor jedem Legenden-Eintrag.
   ::before erzeugt ein zusätzliches Element VOR dem Inhalt – ganz ohne HTML. */
.focus-legend__item::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%; /* 50 % Rundung = Kreis */
    background: var(--cat-color);
}

.focus-zones {
    margin: 0.4rem 0 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.entry-values {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-left: 2.1rem; /* bündig mit dem Namen (unter der Nummer weg) */
}

/* Eingabefelder außerhalb von .form brauchen eigene Grundstyles */
.entry-values input,
.add-filters input,
.add-filters select {
    padding: 0.45rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.entry-values input {
    width: 4.5rem;
}

.entry-unit {
    color: var(--color-text-muted);
}

/* Gewicht hinter "Sätze × Wert": gleiche Optik, kg grau dahinter */
.entry-values {
    flex-wrap: wrap;
}

.entry-weight:not([hidden]) {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
}

.entry-sync {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-left: 2.1rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    cursor: pointer;
}

.entry-sync input {
    accent-color: var(--color-primary);
}

/* Footer: rechts mehrere Buttons nebeneinander */
.form-footer__buttons {
    display: flex;
    gap: 0.5rem;
}


/* ---------- 8. Fenster "Übung hinzufügen" ---------- */

.dialog--wide {
    width: min(94vw, 560px);
}

.dialog-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-filters {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr; /* Suche doppelt so breit */
    gap: 0.5rem;
}

/* Auf schmalen Bildschirmen untereinander */
@media (max-width: 480px) {
    .add-filters {
        grid-template-columns: 1fr;
    }
}

.add-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 55vh;  /* höchstens 55 % der Bildschirmhöhe … */
    overflow-y: auto;  /* … der Rest wird scrollbar */
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.add-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    border-left: 4px solid var(--cat-color, var(--color-border));
}

.add-item > div {
    display: flex;
    flex-direction: column;
}

.add-details {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.add-item .button {
    flex-shrink: 0;
}

.add-empty {
    padding: 1rem;
    text-align: center;
    color: var(--color-text-muted);
}


/* ---------- 9. Training: Vorstart ---------- */

/* Allgemeiner Kasten mit Hintergrund */
.card {
    padding: 1rem;
    margin-bottom: 1rem;
}

.intensity-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.intensity-header .form-label {
    margin-top: 0;
}

.intensity-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Schieberegler über die ganze Breite, in der Hauptfarbe */
.intensity-slider {
    width: 100%;
    margin: 0.75rem 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.intensity-presets {
    display: flex;
    gap: 0.5rem;
}

.card .form-hint {
    display: block;
    margin: 0.75rem 0 0;
}

.run-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.run-entry {
    border-left: 4px solid var(--cat-color, var(--color-border));
}

/* Die immer sichtbare Zeile von <details> */
.run-entry summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none; /* Standard-Dreieck des Browsers ausblenden … */
}

.run-entry summary::-webkit-details-marker {
    display: none;    /* … auch in Chrome/Safari */
}

/* Eigener Pfeil rechts, der sich beim Aufklappen dreht */
.run-entry summary::after {
    content: "›";
    margin-left: auto;          /* ganz nach rechts schieben */
    font-size: 1.3rem;
    line-height: 1;
    color: var(--color-text-muted);
    transition: transform 0.15s; /* sanft drehen statt springen */
}

/* [open] = das Attribut, das <details> im aufgeklappten Zustand hat */
.run-entry details[open] summary::after {
    transform: rotate(90deg);
}

.run-number {
    color: var(--color-text-muted);
}

.run-name {
    font-weight: 600;
}

.run-dosage {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.run-dosage s {
    opacity: 0.7;
}

/* Bereich, der beim Aufklappen erscheint */
.run-edit {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

.run-edit label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.run-edit input {
    width: 5.5rem;
    padding: 0.55rem;
    font-size: 1.1rem; /* etwas größer – gut zu treffen am Handy */
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.run-times {
    padding-bottom: 0.6rem;
    color: var(--color-text-muted);
}

/* Hinweis "Du hast Werte geändert" + Speichern-Button */
.save-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
}

/* Großer Start-Button über die ganze Breite – gut zu treffen am Handy */
.button--start {
    display: block;
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.button--start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ---------- 10. Training: Übungsbildschirm ---------- */

/* Während des Trainings: Header weg, weniger Rand → volle Fläche */
.is-training .site-header {
    display: none;
}

.is-training .container {
    margin-top: 0.75rem;
}

/* Im Training: Übungsbildschirm über die volle Breite (Tablet/Desktop),
   die Begrenzung der Breiten-Stufen gilt hier nicht */
.is-training .container > * {
    max-width: none;
}

.player {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* mindestens so hoch wie der Bildschirm, damit die Bedienleiste unten sitzt.
       dvh = "dynamische" Bildschirmhöhe, berücksichtigt Handy-Adressleisten */
    min-height: calc(100dvh - 1.5rem);
}

.player-progress {
    height: 0.4rem;
    border-radius: 999px;
    background: var(--color-surface-muted);
    overflow: hidden;
}

#player-progress-bar {
    height: 100%;
    width: 0;
    background: var(--color-primary);
    transition: width 0.3s; /* Balken wächst sanft */
}

.player-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-meta {
    color: var(--color-text-muted);
    font-weight: 600;
}

.player-toggles {
    display: flex;
    gap: 0.5rem;
}

/* Ausgeschaltet: blass und durchgestrichen */
.icon-button.is-off {
    opacity: 0.45;
    text-decoration: line-through;
}

.music-label {
    margin-top: 0;
}

/* Die große Fläche in der Mitte */
.player-stage {
    flex: 1; /* nimmt den freien Platz zwischen oben und Bedienleiste */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    /* Kategoriefarbe als dicker Streifen oben */
    border-top: 6px solid var(--cat-color, var(--color-border));
}

/* Pausen: ruhiger, getönter Hintergrund – sofort von Übungen unterscheidbar */
.player-stage[data-kind="rest"] {
    background: var(--color-surface-muted);
    border-top-color: var(--color-text-muted);
}

.player-label {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase; /* GROSSBUCHSTABEN, nur optisch */
    color: var(--color-text-muted); /* Text neutral – die Farbe trägt der Streifen oben */
}

.player-title {
    margin: 0;
    font-size: clamp(1.5rem, 6vw, 2.25rem);
    line-height: 1.2;
}

.player-stage[data-kind="rest"] .player-title {
    font-size: clamp(1.15rem, 4.5vw, 1.5rem);
    font-weight: 600;
}

/* Der Bildbereich ist IMMER so breit wie die Bühne und zentriert das Bild.
   (Ohne width: 100% wäre er so breit wie das Originalbild – dann würde
   max-width: 100% beim Bild nichts verkleinern und die Seite zu breit.) */
.player-media {
    display: flex;
    justify-content: center;
    width: 100%;
}

.player-media:empty {
    display: none;
}

.player-media img,
.player-media video {
    display: block;
    max-width: 100%;
    max-height: 32vh; /* höchstens ein Drittel der Bildschirmhöhe */
    border-radius: var(--radius-sm);
    object-fit: contain; /* Seitenverhältnis bleibt erhalten */
}

/* DER Timer. clamp(min, ideal, max): wächst mit dem Bildschirm, bleibt aber
   zwischen 4rem und 9rem. min(22vw, 20vh) nimmt den KLEINEREN der beiden
   Werte – so passt er auch auf breite, aber niedrige Bildschirme (Querformat).
   tabular-nums: alle Ziffern gleich breit, damit nichts wackelt. */
.player-big {
    font-size: clamp(4rem, min(22vw, 20vh), 9rem);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin: 0.5rem 0;
}

/* Pausiert: Timer blasser und blinkend */
.is-paused .player-big {
    opacity: 0.4;
    animation: blink 1.2s ease-in-out infinite;
}

/* @keyframes beschreibt eine Animation: bei 50 % fast unsichtbar */
@keyframes blink {
    50% { opacity: 0.15; }
}

.player-sub {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.player-description {
    margin: 0.5rem 0 0;
    max-width: 34rem;
    line-height: 1.5;
    color: var(--color-text-muted);
}

/* Bedienleiste: drei runde Buttons, der mittlere größer */
.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.control-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}

.control-button svg {
    width: 1.6rem;
    height: 1.6rem;
}

.control-button:hover:not(:disabled) {
    background: var(--color-surface-muted);
}

.control-button:disabled {
    opacity: 0.35;
    cursor: default;
}

.control-button--main {
    width: 5.5rem;
    height: 5.5rem;
    border: none;
    background: var(--color-primary);
    color: var(--color-on-primary);
}

.control-button--main:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.control-button--main svg {
    width: 2.2rem;
    height: 2.2rem;
}

/* Im Modus "Fertig" wird der Button zur breiten Pille mit Text */
.control-button--main[data-mode="done"] {
    width: auto;
    padding: 0 1.75rem;
    border-radius: 999px;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Je nach data-mode nur das passende Symbol zeigen */
.control-button--main .icon-pause,
.control-button--main .icon-play,
.control-button--main .label-done {
    display: none;
}

.control-button--main[data-mode="pause"] .icon-pause,
.control-button--main[data-mode="play"] .icon-play {
    display: block;
}

.control-button--main[data-mode="done"] .label-done {
    display: inline;
}

.player-end {
    align-self: center;
    margin-top: 0;
}

/* ----- Querformat & Desktop (z. B. iPad quer, Laptop) -----
   Gilt nur, wenn der Bildschirm mindestens 800px breit UND breiter als hoch ist.
   Dann: Bild links, Text und Timer rechts – nebeneinander statt untereinander. */
@media (min-width: 800px) and (orientation: landscape) {
    .player {
        gap: 0.75rem;
    }

    /* Raster mit benannten Bereichen ("grid-template-areas"):
       Jede Zeile in Anführungszeichen ist eine Rasterzeile. "media" steht
       in allen Zeilen links → das Bild erstreckt sich über die volle Höhe. */
    .player-stage {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-areas:
            "media label"
            "media title"
            "media big"
            "media sub"
            "media desc";
        align-content: center; /* Inhalt senkrecht mittig in der Bühne */
        column-gap: 2.5rem;
        row-gap: 0.5rem;
        padding: 1.5rem 2rem;
    }

    /* Jedes Element seinem Bereich zuordnen */
    .player-label       { grid-area: label; }
    .player-title       { grid-area: title; }
    .player-big         { grid-area: big; }
    .player-sub         { grid-area: sub; }
    .player-description { grid-area: desc; }

    .player-media {
        grid-area: media;
        align-self: center;
    }

    .player-media img,
    .player-media video {
        max-height: 58vh;
    }

    /* Kein Bild (z. B. Pausen)? Dann eine Spalte, alles mittig.
       :has() fragt: "Enthält die Bühne ein LEERES Medienfeld?" */
    .player-stage:has(.player-media:empty) {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "label"
            "title"
            "big"
            "sub"
            "desc";
    }

    .player-stage:has(.player-media:empty) .player-description {
        justify-self: center;
    }

    /* Größere Buttons – auf dem Tablet gut mit dem Daumen zu treffen */
    .control-button {
        width: 4.75rem;
        height: 4.75rem;
    }

    .control-button--main {
        width: 6.25rem;
        height: 6.25rem;
    }

    .player-controls {
        gap: 2.5rem;
    }
}

/* Großer Bildschirm im HOCHformat (z. B. iPad hochkant): Inhalt nicht
   endlos breit ziehen, Bild etwas größer erlauben */
@media (min-width: 700px) and (orientation: portrait) {
    .player-description {
        font-size: 1.1rem;
    }

    .player-media img,
    .player-media video {
        max-height: 40vh;
    }
}


/* ---------- 11. Training: Geschafft ---------- */

.finish {
    text-align: center;
    padding: 2rem 1rem;
}

.finish-emoji {
    font-size: 4rem;
    margin: 0;
}

.finish-summary {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

.finish-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}


/* ---------- 12. Profil / Dashboard ---------- */

/* Begrüßung oben, mit deutlichem Abstand zum Dashboard darunter */
.profile-intro {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* Gefahrenzone (Konto löschen): roter Rand als Warnsignal */
.danger-zone {
    border: 1px solid var(--color-danger);
    margin-top: 2rem;
}

/* Roter Button auch IN einem .form – sonst gewinnt ".form button" (blau) */
.form .button--danger {
    background: var(--color-danger);
    color: var(--color-on-danger);
}

.form .button--danger:hover {
    background: var(--color-danger-hover);
}

/* ----- Musikbibliothek ----- */

.library-section {
    margin-top: 3.5rem; /* abgesetzt vom "Einstellungen speichern"-Button */
}

.settings-subheading {
    margin: 1.25rem 0 0.25rem;
    font-size: 1rem;
}

/* Hochladen: Zeile 1 = Datei, Zeile 2 = Titel | Kategorie | Button */
.music-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 11rem auto;
    gap: 0.5rem;
    align-items: center;
}

.music-upload input[type="file"] {
    grid-column: 1 / -1; /* über alle Spalten */
}

/* Der "Datei auswählen"-Knopf des Browsers: ::file-selector-button
   spricht genau diesen Knopf im Datei-Feld an */
.music-upload input[type="file"]::file-selector-button,
.form input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.45rem 0.9rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-family: inherit;
    cursor: pointer;
}

/* Handy: alles untereinander */
@media (max-width: 600px) {
    .music-upload {
        grid-template-columns: 1fr;
    }
}

.form .music-upload .button {
    margin-top: 0;
}

.music-list {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Eigener Titel: ▶ | Titel | Kategorie | Speichern | 🗑 */
.music-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 9rem auto auto;
    align-items: center;
    gap: 0.5rem 0.75rem; /* Zeilen | Spalten: mehr Luft zwischen Auswahl, Speichern, 🗑 */
}

.form .music-row .button {
    margin-top: 0;
}

/* Voreingestellter Titel: ▶ | Titel | Ordner */
.music-row--preset {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.music-preset-title {
    overflow: hidden;
    text-overflow: ellipsis; /* zu lange Titel mit "…" abschneiden */
    white-space: nowrap;
}

.music-delete:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* Schmale Bildschirme: zwei Zeilen je Titel
     Zeile 1:  ▶  | Titel ……………………………
     Zeile 2:  Kategorie ……… | Speichern | 🗑
   Jeder Titel bekommt eine Trennlinie, damit klar ist, was zusammengehört. */
@media (max-width: 600px) {
    .music-row {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--color-border);
    }
    .music-row:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    .music-title {
        grid-column: 2 / -1;
    }
    .music-category {
        grid-column: 1 / 3;
    }
    .music-list {
        gap: 0.75rem;
    }
}

/* Eigenes Equipment: deutlich abgesetzt vom "Einstellungen speichern"-Button,
   denn es ist ein eigenständiger Bereich (speichert jede Aktion sofort) */
.equipment-section {
    margin-top: 3.5rem;
}

/* Zeile zum Hinzufügen: Eingabefeld + Button nebeneinander */
.equipment-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.equipment-add input {
    flex: 1;
    min-width: 0; /* darf schrumpfen, damit der Button auf dem Handy Platz hat */
}

.form .equipment-add .button {
    margin-top: 0;
    white-space: nowrap;
}

/* Häkchen "mit Gewicht": klein und ohne den Abstand normaler Formular-Labels */
.form .equipment-weight {
    margin: 0;
    font-weight: 400;
    font-size: 0.9rem;
    white-space: nowrap;
}

.equipment-add {
    flex-wrap: wrap;
    align-items: center;
}

.equipment-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Jede Zeile ist ein eigenes Raster. Damit alle Namensfelder gleich lang
   sind, bekommt die Spalte "benutzt …" eine FESTE Breite (statt "auto",
   das sich nach dem jeweiligen Text richten würde). */
.equipment-row {
    display: grid;
    /* Name | kg-Häkchen | Nutzung | Speichern | Löschen */
    grid-template-columns: minmax(0, 1fr) auto 8.5rem auto auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.equipment-usage {
    font-size: 0.85rem;
    white-space: nowrap;
    text-align: right;
}

.equipment-row .button {
    margin-top: 0;
}

/* Symbol- und kleine Buttons innerhalb eines .form-Kastens: Die allgemeine
   Regel ".form button" (blau, groß) würde sie sonst überschreiben, weil sie
   spezifischer ist als ".icon-button" bzw. ".button--small" allein. */
.form .icon-button {
    margin-top: 0;
    padding: 0;
    background: var(--color-surface);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.form .icon-button:hover:not(:disabled) {
    background: var(--color-surface-muted);
}

.form .button--small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.equipment-delete:hover:not(:disabled) {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.equipment-delete:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Schmale Bildschirme: Name über die volle Breite, Rest darunter */
@media (max-width: 600px) {
    .equipment-row {
        grid-template-columns: auto 1fr auto auto;
    }
    .equipment-usage {
        text-align: left;
    }
    .equipment-name {
        grid-column: 1 / -1; /* von der ersten bis zur letzten Spalte */
    }
}

/* Formulare auf der Konto-Seite: Buttons nicht über die volle Breite */
.account-form button[type="submit"] {
    align-self: flex-start;
}

/* ----- Einstellungen ----- */

/* Musik-Auswahlfelder nicht über die ganze Seite strecken: Das allgemeine
   Feld ist so breit wie Name-Spalte (8rem) + Abstand (0.75rem) + Auswahl-
   Spalte (26rem) unten – so enden alle Felder rechts an derselben Stelle. */
.form .music-select, /* ".form …": sonst gewinnt die allgemeine ".form select"-Regel */
.form .music-volume {
    max-width: 34.75rem;
}

/* Lautstärke-Regler in der Akzentfarbe (wie der Intensitäts-Regler im Vorstart) */
.music-volume {
    accent-color: var(--color-primary);
}

/* Musik je Schwerpunkt: zwei Spalten (Kategorie | Auswahl) */
.music-by-category {
    display: grid;
    grid-template-columns: 8rem minmax(0, 26rem);
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.25rem;
}

/* Kategoriename mit farbigem Punkt davor (Farbe kommt über data-category) */
.form .music-category-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0;
    font-weight: 600;
}

.music-category-label::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--cat-color);
}

/* Auf schmalen Bildschirmen: Name über der Auswahl */
@media (max-width: 480px) {
    .music-by-category {
        grid-template-columns: minmax(0, 1fr); /* 1fr allein wäre mind. so breit wie der längste Titel */
    }
    .form .music-category-label {
        margin-top: 0.5rem;
    }
}

.settings-section {
    margin-bottom: 1rem;
}

.settings-heading {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
}

.settings-section .button--small {
    align-self: flex-start;
    margin-top: 0.75rem;
}

/* … aber NICHT in Zeilen, in denen Buttons neben Feldern stehen:
   dort mittig zur Zeile ausrichten (sonst sitzen sie zu weit oben) */
.settings-section :is(.music-row, .music-upload, .equipment-add, .equipment-row) .button--small {
    align-self: center;
    margin-top: 0;
}

/* Datei-Feld darf nicht breiter werden als der Kasten (Handy) */
.music-upload input[type="file"] {
    min-width: 0;
    max-width: 100%;
}

code {
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    background: var(--color-surface-muted);
    font-size: 0.9em;
}

.profile-intro h1 {
    margin-bottom: 0.25rem;
}

.profile-intro__text {
    margin: 0;
    color: var(--color-text-muted);
}

/* Vier Kennzahl-Kacheln: auf dem Handy 2 × 2, ab Tablet nebeneinander */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-tile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Die große Zahl – das Wichtigste der Kachel */
.stat-value {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap; /* Zahl und Einheit nie umbrechen */
}

.stat-unit {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.stat-hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.dashboard-empty {
    padding: 2rem;
}

/* Kalender und Fokus: nebeneinander, wenn Platz ist, sonst untereinander */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-grid .card {
    margin-bottom: 0;
}

.card-title {
    margin: 0;
    font-size: 1.15rem;
}

.card-subtitle {
    margin: 0.2rem 0 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ----- Monatskalender ----- */

/* Kopf: ‹  November 2026  › */
.month-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.month-title {
    text-align: center;
}

/* 7 gleich breite Spalten (Mo–So). minmax(0, 1fr): Spalten dürfen schrumpfen */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.month-weekday {
    padding-bottom: 0.25rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Ein Tag */
.month-day {
    aspect-ratio: 1 / 0.9; /* fast quadratisch, wächst mit der Breite */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    font-variant-numeric: tabular-nums;
}

/* Leere Felder vor dem 1. des Monats */
.month-day--empty {
    background: none;
}

/* Zukünftige Tage: blass */
.month-day--future {
    opacity: 0.4;
}

.month-day__number {
    font-size: 0.9rem;
}

.month-day__minutes {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

/* Tage mit Training: Blau in vier Stufen zur Kartenfarbe gemischt.
   So bleibt die Tageszahl in normaler Textfarbe immer gut lesbar –
   in Hell und Dunkel heißt "kräftiger" immer "mehr Training". */
.month-day[data-level="1"], .legend-swatch[data-level="1"] { background: color-mix(in srgb, var(--heat-2) 22%, var(--color-surface)); }
.month-day[data-level="2"], .legend-swatch[data-level="2"] { background: color-mix(in srgb, var(--heat-2) 38%, var(--color-surface)); }
.month-day[data-level="3"], .legend-swatch[data-level="3"] { background: color-mix(in srgb, var(--heat-2) 54%, var(--color-surface)); }
.month-day[data-level="4"], .legend-swatch[data-level="4"] { background: color-mix(in srgb, var(--heat-2) 70%, var(--color-surface)); }

.month-day[data-level] .month-day__number {
    font-weight: 700;
}

.month-day[data-level] .month-day__minutes {
    color: var(--color-text);
}

/* Heute: Rahmen in Textfarbe */
.month-day--today {
    outline: 2px solid var(--color-text);
    outline-offset: -2px; /* Rahmen nach innen, damit nichts überlappt */
}

.month-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    min-height: 2rem;
    font-size: 0.9rem;
}

.month-footer .button {
    margin-top: 0;
}

.calendar-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.calendar-legend span:first-child { margin-right: 0.3rem; }
.calendar-legend span:last-child  { margin-left: 0.3rem; }

.legend-swatch {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 3px;
}

/* ----- Fokus ----- */

.focus-bar--large {
    height: 0.9rem;
}

.zone-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.95rem;
}

.zone-bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

/* Name | Balken | Prozent – feste Spalten, damit alle Balken bündig starten */
.zone-bars li {
    display: grid;
    grid-template-columns: 9rem 1fr 3rem;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.zone-track {
    height: 0.6rem;
    border-radius: 999px;
    background: var(--color-surface-muted);
    overflow: hidden;
}

.zone-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--heat-2); /* eine einzige Farbe: es ist EINE Datenreihe */
}

.zone-value {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted);
}

/* ----- Letzte Trainings ----- */

.history {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.history th {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    padding: 0.5rem 0.75rem 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.history td {
    padding: 0.6rem 0.75rem 0.6rem 0;
    border-bottom: 1px solid var(--color-surface-muted);
    white-space: nowrap;
}

/* Zahlen rechtsbündig, damit man sie untereinander vergleichen kann */
.history .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.muted {
    color: var(--color-text-muted);
}

/* Karten-Kopf: Titel links, Link rechts */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

/* Spalte mit dem Mülleimer: schmal, rechtsbündig */
.history .actions {
    width: 1%;           /* so schmal wie möglich */
    text-align: right;
    padding-right: 0;
}

/* Kleiner Symbol-Button, z. B. der Mülleimer */
.icon-button--small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    color: var(--color-text-muted);
}

.icon-button--small svg {
    width: 1rem;
    height: 1rem;
}

/* Beim Drüberfahren rot – signalisiert "Achtung, löscht" */
.delete-session:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

/* Unsichtbar, aber für Screenreader vorhanden (z. B. Spaltenüberschrift) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Blättern auf "Alle Trainings" */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.pagination .button {
    margin-top: 0;
}

/* Status immer mit Symbol + Text, nie nur Farbe */
.status {
    font-size: 0.85rem;
}

.status--done {
    color: var(--color-success-text);
}

.status--partial {
    color: var(--color-text-muted);
}

/* ==================== Gastzugang ==================== */

/* Hinweiskasten für Gäste (Login-Seite, Profil, gesperrte Seiten) */
.guest-box {
    margin-top: 1.5rem;
    border-left: 4px solid var(--color-primary);
}

.guest-box h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.guest-box ul {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

/* Etwas schlanker, z. B. über der Bibliothek */
.guest-box--compact {
    margin: 0 0 1.25rem;
}

.guest-box--compact p:first-child {
    margin-top: 0;
}

/* Button "Kostenloses Konto erstellen" + kleiner Hinweis daneben */
.guest-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin: 1rem 0 0;
}

/* ==================== Auswahlfelder (select) ==================== */

/* Eigener Dropdown-Pfeil statt des Browser-Pfeils: Der Browser-Pfeil klebt
   am Rand und sieht in jedem Browser anders aus.
   appearance: none   → Browser-Optik (inkl. Pfeil) abschalten
   Pfeil = zwei kleine, schräg geteilte Farbverläufe, die zusammen ein "V"
   ergeben. Weil sie var(--color-text-muted) nutzen, passt der Pfeil
   automatisch zu Hell und Dunkel (ein Bild hätte eine feste Farbe).
   :is(.form, .filters, .add-filters) select zählt so "spezifisch" wie
   ".form select" – nötig, weil die älteren Regeln mit "background: …"
   das Hintergrundbild sonst wieder löschen würden. Steht darum am Ende. */
select,
:is(.form, .filters, .add-filters) select {
    appearance: none;
    padding-right: 2.25rem; /* Platz für den Pfeil */
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position:
        right 1.15rem center,
        right 0.8rem center;
    background-size: 0.35rem 0.35rem;
    background-repeat: no-repeat;
    /* Lange Einträge dürfen das Feld nicht über den Rand hinausschieben:
       min-width: 0 erlaubt dem Feld, schmaler als sein längster Eintrag zu sein */
    min-width: 0;
    max-width: 100%;
    text-overflow: ellipsis;
}

/* Überschrift mit Button (z. B. "+ Eigene Übung"): Rutscht der Button auf
   schmalen Bildschirmen unter die Überschrift, braucht er Abstand nach unten –
   sonst klebt er am nächsten Kasten (z. B. am Filter der Bibliothek). */
@media (max-width: 600px) {
    .page-header {
        margin-bottom: 1rem;
    }
}

/* "Passwort vergessen?" rechtsbündig unter dem Passwortfeld */
.form .forgot-link {
    align-self: flex-end;
    font-size: 0.9rem;
}

/* ==================== Bibliothek: Filter am Handy einklappen ==================== */

/* Der Auf-/Zuklapp-Button: am Desktop unsichtbar */
.filter-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.filter-active {
    font-weight: 400;
    color: var(--color-primary);
}

/* Pfeil dreht sich beim Aufklappen um */
.filter-toggle__arrow {
    transition: transform 0.2s;
}

.filters.is-open .filter-toggle__arrow {
    transform: rotate(180deg);
}

@media (max-width: 600px) {
    .filter-toggle {
        display: flex;
    }

    /* Eingeklappt: alles außer Suche und Button ausblenden.
       ":not(…)" = "alle, die NICHT …" */
    .filters:not(.is-open) > :not(.filter-search):not(.filter-toggle) {
        display: none;
    }
}

/* ==================== Workouts: Schnellstart-Kacheln ==================== */

/* Zwei Kacheln nebeneinander, auf dem Handy untereinander */
.workout-hub {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin: 1rem 0 2.5rem;
}

.hub-tile {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.5rem;
    border-top: 4px solid var(--color-primary); /* Akzent für die zwei Hauptwege */
    color: var(--color-text);
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

/* Leicht anheben beim Drüberfahren – zeigt: anklickbar */
a.hub-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-raised);
}

.hub-tile__icon {
    font-size: 2rem;
    line-height: 1;
}

.hub-tile__title {
    margin: 0.25rem 0 0;
    font-size: 1.35rem;
}

.hub-tile__text {
    margin: 0;
    color: var(--color-text-muted);
    flex-grow: 1; /* schiebt den Button-Text nach unten → beide Kacheln gleich aufgebaut */
}

.hub-tile__cta {
    margin-top: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
}

/* Noch nicht verfügbar: zurückgenommen */
.hub-tile--soon {
    border-top-color: var(--color-border);
}

.hub-tile--soon .hub-tile__cta {
    color: var(--color-text-muted);
}

/* Zwischenüberschrift "Meine Workouts" neben dem Button */
.section-title {
    margin: 0;
    font-size: 1.4rem;
}

.page-intro {
    color: var(--color-text-muted);
    max-width: 60ch; /* angenehme Zeilenlänge */
}

/* ==================== Für dich vorbereitet ==================== */

/* Ab Tablet zwei Spalten: links Express, rechts Full desselben Themas */
.prepared-grid {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 700px) {
    .prepared-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.prepared-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
}

.prepared-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
}

.prepared-card__name {
    margin: 0;
    font-size: 1.15rem;
}

.prepared-card__time {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--color-text-muted);
}

.prepared-card__meta,
.prepared-card__description {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.prepared-card__description {
    flex-grow: 1; /* Buttons sitzen in allen Karten unten auf einer Linie */
}

.prepared-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.prepared-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Zahlenfelder (Sekunden, Prozent …) brauchen keine volle Breite –
   auf breiten Seiten wirken sie sonst verloren */
.settings-section input[type="number"] {
    max-width: 10rem;
}

/* ==================== Random Workout ==================== */

.random-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Eine Gruppe von Chips mit Überschrift (fieldset + legend) */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    border: none; /* fieldset hat von Haus aus einen Rahmen */
}

.chip-group legend {
    margin-bottom: 0.5rem;
    padding: 0;
    font-weight: 600;
}

/* Chip = Label, das wie ein Knopf aussieht. Das eigentliche Kästchen
   (Checkbox/Radio) ist unsichtbar, aber noch da: Tastatur und
   Screenreader können es weiter bedienen. */
.chip {
    position: relative;
    cursor: pointer;
}

.chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.chip span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    user-select: none; /* kein Text-Markieren beim schnellen Tippen */
}

/* Angehakt: Rahmen und Fläche in der Hauptfarbe.
   "input:checked + span" = das span direkt NACH einem angehakten input */
.chip input:checked + span {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
    color: var(--color-text);
    font-weight: 600;
}

/* Angehakte Kästchen-Chips zusätzlich mit Häkchen – so ist der Zustand
   eindeutig, auch ohne Farbe (wichtig bei Farbsehschwäche) */
.chip input[type="checkbox"]:checked + span::after {
    content: "✓";
    font-weight: 700;
    color: var(--color-primary);
}

/* Tastatur-Fokus sichtbar machen (Tab-Taste) */
.chip input:focus-visible + span {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Kategorie-Chips mit farbigem Punkt */
.chip--category span::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--cat-color);
}

/* ----- Ergebnis ----- */

.random-result {
    margin-top: 1.5rem;
    scroll-margin-top: 1rem; /* Abstand nach oben beim automatischen Scrollen */
}

.random-result__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.random-result__head h2 {
    margin: 0;
}

.random-list {
    margin: 1rem 0;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Eine Übung: farbiger Streifen links, Name, Dosierung rechts */
.random-item {
    padding: 0.55rem 0.75rem;
    border-left: 4px solid var(--cat-color);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
}

.random-item__name {
    font-weight: 600;
}

/* Name links, Dosierung rechts – bei Platzmangel rutscht sie darunter */
.random-item__row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.25rem 1rem;
}

.random-item__dosage {
    color: var(--color-text-muted);
}

/* Musik + Name nebeneinander, auf dem Handy untereinander */
.random-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
}

.random-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0; /* lange Musiktitel dürfen das Raster nicht sprengen */
    font-weight: 600;
}

.random-field input,
.random-field select {
    padding: 0.6rem;
    font: inherit;
    font-weight: 400;
    color: var(--color-text);
    background-color: var(--color-surface); /* NICHT "background:" – das löscht den Dropdown-Pfeil */
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

/* Platz für den eigenen Dropdown-Pfeil (das "padding" oben setzt ihn zurück) */
.random-field select {
    padding-right: 2.25rem;
}

.random-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.random-actions .button {
    margin-top: 0;
}

/* ==================== Druckansicht / PDF (workout_print.php) ==================== */

.print-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1.5rem;
}

.print-toolbar .button {
    margin-top: 0;
}

.print-toolbar .form-hint {
    flex-basis: 100%;
    margin: 0;
}

/* Am Bildschirm: wie ein Blatt Papier auf dem Tisch */
.print-sheet {
    padding: 2.5rem;
    border-radius: var(--radius);
    background: var(--color-surface);
}

/* Logo im Kopf des Druckblatts (Hell-Logo, siehe workout_print.php) */
.print-brand__logo {
    display: block;
    height: 34px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    object-position: left center; /* schmale Bildmarke links statt mittig */
}

/* Am Bildschirm im Dunkelmodus: Dunkel-Logo statt Hell-Logo (wie im Header) */
.print-brand__logo--dark,
:root[data-theme="dark"] .print-brand__logo--light {
    display: none;
}

:root[data-theme="dark"] .print-brand__logo--dark {
    display: block;
}

.print-brand {
    margin: 0 0 2rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary);
}

.print-head h1 {
    margin: 0;
}

.print-description {
    margin: 0.5rem 0 0;
    color: var(--color-text-muted);
}

/* Eckdaten: vier kleine Blöcke nebeneinander */
.print-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem 1.5rem;
    margin: 1.25rem 0 0;
    padding: 1rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.print-facts dt {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.print-facts dd {
    margin: 0.15rem 0 0;
    font-weight: 600;
}

.print-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Eine Übung: Nummer | (Bild) | Text | Abhak-Kästchen */
.print-item {
    display: grid;
    grid-template-columns: 2rem auto 1fr auto;
    gap: 1rem;
    align-items: start;
    padding: 1rem 0 1rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    border-left: 4px solid var(--cat-color); /* Kategoriefarbe */
}

.print-item__number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text-muted);
}

/* Ohne Bild bleibt die Bild-Spalte einfach leer (auto = 0 breit) */
.print-item__image {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.print-item__body {
    grid-column: 3;
}

.print-item__name {
    margin: 0;
    font-size: 1.1rem;
}

.print-item__dosage {
    margin: 0.2rem 0 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.print-item__meta {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.print-item__description {
    margin: 0.4rem 0 0;
    font-size: 0.92rem;
}

.print-item__checks {
    grid-column: 4;
    display: flex;
    gap: 0.4rem;
}

/* Leeres Kästchen; die kleine Zahl = Zirkel-Nummer */
.print-check {
    display: inline-flex;
    align-items: flex-end;
    justify-content: flex-end;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0.1rem 0.15rem;
    border: 1.5px solid var(--color-text-muted);
    border-radius: 4px;
    font-size: 0.6rem;
    color: var(--color-text-muted);
}

.print-foot {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: right;
}

@media (max-width: 600px) {
    .print-sheet {
        padding: 1.25rem;
    }

    /* Handy: Kästchen unter den Text statt daneben */
    .print-item {
        grid-template-columns: 1.5rem auto 1fr;
    }
    .print-item__checks {
        grid-column: 3;
    }
    .print-item__image {
        width: 64px;
        height: 64px;
    }
}

/* ----- Beim Drucken (und beim "Als PDF speichern") ----- */
@media print {
    /* Papier ist immer hell – auch wenn jemand den Dunkelmodus nutzt.
       Darum hier die hellen Werte der Farb-Variablen erzwingen. */
    :root,
    :root[data-theme="dark"] {
        color-scheme: light;
        --color-bg:            #ffffff;
        --color-surface:       #ffffff;
        --color-surface-muted: #eceef2;
        --color-border:        #c9ced6;
        --color-text:          #1c1f24;
        --color-text-muted:    #4f555e;
        --color-primary:       #2d6bd5;
        --cat-kraft:           #2a78d6;
        --cat-koordination:    #e87ba4;
        --cat-athletik:        #eda100;
        --cat-dehnen:          #008300;
    }

    /* Alles weg, was nicht aufs Papier gehört */
    .site-header,
    .no-print {
        display: none !important;
    }

    body {
        background: var(--color-bg); /* oben auf Weiß gesetzt */
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .print-sheet {
        padding: 0;
        border-radius: 0;
    }

    /* Eine Übung nie über zwei Seiten zerreißen */
    .print-item {
        break-inside: avoid;
    }

    /* Farbstreifen auch drucken (Browser lassen Farben sonst gern weg) */
    .print-item,
    .print-brand {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Papier ist hell → immer das Hell-Logo, auch wenn am Bildschirm Dunkel aktiv ist */
    :root[data-theme="dark"] .print-brand__logo--light {
        display: block;
    }

    .print-brand__logo--dark,
    :root[data-theme="dark"] .print-brand__logo--dark {
        display: none;
    }
}

/* Seitenränder fürs Papier */
@page {
    margin: 15mm;
}

/* Lockfeld gegen Bots: aus dem sichtbaren Bereich geschoben.
   (Nicht "display: none" – manche Bots überspringen versteckte Felder.) */
.hp-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ==================== Fußbereich ==================== */

.site-footer {
    margin-top: 3rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    /* Trick: "klebt" frühestens 100 % Bildschirmhöhe unter dem Seitenanfang.
       Ist die Seite kurz, rutscht der Fuß so ans untere Ende statt in die
       Mitte. Ist sie lang, steht er ganz normal am Ende. */
    position: sticky;
    top: 100vh;
}

.site-footer__inner {
    max-width: 1200px; /* wie die Kopfzeile */
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Im Training (Vollbild) und auf Papier stört der Fußbereich */
.is-training .site-footer {
    display: none;
}

@media print {
    .site-footer {
        display: none;
    }
}

/* ==================== Admin ==================== */

/* Reiter "Neu | Erledigt | Alle" */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 1rem 0 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.tabs__item {
    padding: 0.6rem 1rem;
    border-bottom: 3px solid transparent;
    color: var(--color-text-muted);
    text-decoration: none;
}

.tabs__item:hover {
    color: var(--color-text);
}

.tabs__item.is-active {
    border-bottom-color: var(--color-primary);
    color: var(--color-text);
    font-weight: 600;
}

.tabs__count {
    margin-left: 0.25rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--color-surface-muted);
    font-size: 0.8rem;
}

.feedback-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feedback-item {
    padding: 1.25rem;
}

/* Erledigt: zurückgenommen */
.feedback-item.is-done {
    opacity: 0.65;
}

.feedback-item__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.feedback-item__date,
.feedback-item__meta {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.feedback-item__message {
    margin: 0.75rem 0;
    white-space: normal;
    overflow-wrap: anywhere; /* lange Wörter/Links umbrechen statt überstehen */
}

.feedback-item__meta {
    margin: 0;
}

.feedback-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Kategorie-Etikett – Farbe kommt aus den vorhandenen Meldungsfarben */
.feedback-category {
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--color-surface-muted);
    color: var(--color-text);
}

.feedback-category--fehler {
    background: var(--color-error-bg);
    color: var(--color-error-text);
}

.feedback-category--lob {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.feedback-category--idee {
    background: color-mix(in srgb, var(--color-primary) 15%, var(--color-surface));
}

/* Links rechts im Fußbereich (Feedback, Admin-Menü …) */
.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

/* Zwischenüberschrift mit Button (z. B. "Meine Workouts" + "Neues Workout"):
   Abstand zum Inhalt darunter. ":has()" = "Seitenkopf, der eine
   .section-title ENTHÄLT" – die großen h1-Köpfe bringen ihren Abstand selbst mit. */
.page-header:has(.section-title) {
    margin-bottom: 1rem;
}

/* ==================== Hinweis: E-Mail bestätigen ==================== */

.verify-banner {
    background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
    border-bottom: 1px solid var(--color-border);
}

.verify-banner__inner {
    max-width: 1200px; /* wie Kopf- und Fußbereich */
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font-size: 0.95rem;
}

/* Im Training (Vollbild) und auf Papier nicht stören */
.is-training .verify-banner {
    display: none;
}

@media print {
    .verify-banner {
        display: none;
    }
}

/* ==================== Admin: Tabellen, Musik ==================== */

.admin-section {
    margin-bottom: 2rem;
}

/* Abschnittstitel mit farbigem Kategorie-Punkt davor */
.admin-section__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.admin-section__title[data-category]::before {
    content: "";
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--cat-color);
}

/* Breite Tabellen: auf dem Handy seitlich scrollen statt das Layout zu sprengen */
.table-scroll {
    overflow-x: auto; /* bei Platzmangel seitlich wischen statt quetschen */
    border-radius: var(--radius);
    background: var(--color-surface);
}

.admin-table {
    width: 100%;
    border-collapse: collapse; /* keine Doppel-Linien zwischen Zellen */
    font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background: var(--color-surface-muted);
}

/* Buttons rechts, nebeneinander */
.admin-table__actions {
    text-align: right;
    white-space: nowrap;
}

.admin-table__actions .button {
    margin-top: 0;
}

/* Admin-Formular "Standard je Schwerpunkt": Button nicht volle Breite */
.settings-section[data-action="defaults"] .button {
    align-self: flex-start;
}

/* ==================== Admin: Statistik ==================== */

/* Karten im Raster: zwei Spalten ab Tablet, eine auf dem Handy */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stats-card {
    margin: 0;
    padding: 1.25rem;
}

.stats-card__title {
    margin: 0;
    font-size: 1.05rem;
}

.stats-card__subtitle {
    margin: 0.2rem 0 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.stats-empty {
    color: var(--color-text-muted);
}

/* Kachel-Zusatzzeile darf einen Link enthalten */
.stat-hint a {
    color: var(--color-primary);
}

/* Zeitraum-Reiter neben der Überschrift: ohne Abstand nach unten */
.tabs--compact {
    margin: 0;
}

/* ----- Säulendiagramm ----- */

.chart-plot {
    position: relative;
    height: 180px;
    margin-left: 2rem; /* Platz für die Zahlen an den Hilfslinien */
}

/* Hilfslinie: dünn, zurückhaltend, durchgezogen */
.chart-grid {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--color-border);
}

.chart-grid span {
    position: absolute;
    right: calc(100% + 0.4rem);
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums; /* Ziffern gleich breit → bündig */
}

/* Die Säulen stehen nebeneinander auf der Grundlinie */
.chart-columns {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

/* Eine Spalte = Trefferfläche (ganze Höhe, leichter zu treffen als die Säule) */
.chart-col {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 4px;
    cursor: default;
    outline-offset: 2px;
}

.chart-col:hover,
.chart-col:focus-visible {
    background: var(--color-surface-muted);
}

/* Die Säule selbst: höchstens 24px breit, oben 4px abgerundet */
.chart-col__bar {
    width: min(100%, 24px);
    border-radius: 4px 4px 0 0;
    background: var(--color-primary);
}

.chart-col:hover .chart-col__bar,
.chart-col:focus-visible .chart-col__bar {
    opacity: 0.8;
}

.chart-xaxis {
    display: flex;
    justify-content: space-between;
    margin: 0.4rem 0 0 2rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.chart-table {
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.chart-table summary {
    cursor: pointer;
    color: var(--color-text-muted);
}

.chart-table table {
    margin-top: 0.5rem;
}

/* Hinweis beim Drüberfahren (admin_stats.js setzt Position und Text) */
.chart-tip {
    position: absolute;
    z-index: 20;
    padding: 0.35rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none; /* der Hinweis selbst fängt keine Maus ab */
    box-shadow: 0 4px 12px color-mix(in srgb, var(--color-text) 15%, transparent);
}

/* ----- Rangliste: Name | Balken | Zahl ----- */

.ranking {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ranking__row {
    display: grid;
    grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
}

.ranking__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking__track {
    display: block;
    height: 12px;
}

.ranking__bar {
    display: block;
    height: 100%;
    min-width: 2px;
    border-radius: 0 4px 4px 0; /* an der Grundlinie eckig, am Ende rund */
    background: var(--color-primary);
}

/* Kategorie-Balken: Farbe kommt über data-category → --cat-color */
.ranking__bar--category {
    background: var(--cat-color);
}

.ranking__value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ranking__unit {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* Handy: Name über dem Balken */
@media (max-width: 480px) {
    .ranking__row {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .ranking__label {
        grid-column: 1 / -1;
    }
}

/* ==================== Branding (Admin → Design) ==================== */

/* Logo im Kopfbereich neben dem Namen */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Bildmarke: etwa quadratisch, so hoch wie die Schrift-Zeile */
.brand__logo {
    display: block;
    height: 32px;
    width: auto;
    max-width: 48px;
    object-fit: contain; /* nie verzerren – lieber kleiner */
}

/* Getrennte Logos für Hell/Dunkel: immer nur das passende zeigen.
   data-theme setzt das Skript im <head> (bzw. der Hell/Dunkel-Knopf). */
.brand__logo--dark,
:root[data-theme="dark"] .brand__logo--light {
    display: none;
}

:root[data-theme="dark"] .brand__logo--dark {
    display: block;
}

/* Wortmarke: Schriftzug im Querformat → darf deutlich breiter sein */
.brand--wordmark .brand__logo {
    height: 36px;
    max-width: 220px;
}

/* Handy: weniger Platz neben Burger-Menü und Hell/Dunkel */
@media (max-width: 640px) {
    .brand--wordmark .brand__logo {
        height: 30px;
        max-width: 160px;
    }
}

/* Admin: Farbe wählen */
.design-color {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.design-color input[type="color"] {
    width: 3.5rem;
    height: 2.75rem;
    padding: 0.2rem;
    cursor: pointer;
}

.design-color input[type="text"] {
    max-width: 8rem;
    font-family: ui-monospace, monospace;
}

/* Vorschau: nutzt die Variable --preview (gesetzt von admin_design.js) */
.design-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin-top: 0.75rem;
    padding: 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    /* Fest HELL bzw. (--dark) fest DUNKEL – unabhängig vom Modus, in dem
       der Admin gerade ist. Werte wie die Hintergründe in src/branding.php */
    background: #f4f5f7;
    color: #1c1f24;
}

.design-preview--dark {
    background: #1c1f24;
    color: #e6e8eb;
}

/* Hell- und Dunkel-Kasten nebeneinander, auf schmalen Bildschirmen untereinander */
.design-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.design-mode {
    min-width: 0; /* sonst schieben lange Inhalte das Raster auseinander */
}

.design-mode .settings-subheading {
    margin-top: 0;
}

/* Live-Kontrastprüfung unter der Vorschau */
.design-contrast {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.design-contrast.is-error {
    color: var(--color-error-text);
    font-weight: 600;
}

.design-preview__button {
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-sm);
    background: var(--preview);
    color: var(--preview-on, #ffffff); /* Schrift auf Button – berechnet admin_design.js */
    font-weight: 600;
}

.design-preview__link {
    color: var(--preview);
    text-decoration: underline;
}

.design-preview__bar {
    width: 8rem;
    height: 12px;
    border-radius: 0 4px 4px 0;
    background: var(--preview);
}

.design-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form .design-actions .button,
.form .design-actions button {
    margin-top: 0.75rem;
}

/* Farbfeld in der Tabelle */
.design-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 4px;
    vertical-align: middle;
}

.design-table {
    max-width: 36rem;
}

/* Logo-Vorschau auf hellem und dunklem Grund nebeneinander */
.design-logo-preview {
    display: flex;
    flex-wrap: wrap; /* breite Wortmarken-Kästen auf dem Handy untereinander */
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.design-logo-preview span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 7rem;
    height: 5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

/* Fest hell/dunkel – zeigt, wie das Logo in BEIDEN Modi wirkt */
.design-logo-preview--wordmark span {
    width: 14rem;
}

.design-logo-preview__light { background: #ffffff; }
.design-logo-preview__dark  { background: #1c1f24; }

.design-logo-preview img {
    max-width: 80%;
    max-height: 70%;
}

/* Ersatz-Logo aus dem anderen Modus: blasser, damit klar ist "nicht eigenes" */
.design-logo-preview img.is-fallback {
    opacity: 0.45;
}

.design-logo-preview__empty {
    font-size: 0.85rem;
    color: #8a9099; /* fester Grauton: lesbar auf hellem UND dunklem Kasten */
}

/* ==================== Admin: Nutzerverwaltung ==================== */

/* Suchzeile: Feld wächst, Buttons daneben; auf dem Handy umbrechen */
.admin-search {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.admin-search input {
    flex: 1 1 16rem;
    min-width: 0; /* sonst schiebt das Feld das Layout auseinander */
    margin: 0;
}

.admin-search .button {
    margin-top: 0;
}

.admin-search__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Aktiver Schnellfilter: Rahmen in Akzentfarbe */
.admin-search__filters .is-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Kleine Status-Etiketten (Admin, Gesperrt, Unbestätigt) */
.status-badge {
    display: inline-block;
    margin-right: 0.25rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    vertical-align: middle;
    white-space: nowrap;
}

.status-badge--locked {
    background: var(--color-error-bg);
    color: var(--color-error-text);
    border-color: transparent;
}

.status-badge--pending {
    border-style: dashed;
}

/* Karten der Detailseite untereinander mit Abstand */
#account .stats-card,
.admin-log {
    margin-top: 1rem;
}

/* Kontodaten: Begriff links, Wert rechts (Handy: untereinander) */
.admin-facts {
    display: grid;
    gap: 0.5rem;
    margin: 0;
}

.admin-facts div {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: 1rem;
}

.admin-facts dt {
    color: var(--color-text-muted);
}

.admin-facts dd {
    margin: 0;
    overflow-wrap: anywhere; /* lange E-Mail-Adressen umbrechen */
}

@media (max-width: 480px) {
    .admin-facts div {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-actions .button {
    margin-top: 0;
}

/* Löschen: roter Streifen links als Warnsignal */
.admin-danger {
    border-left: 4px solid var(--color-danger);
}

.admin-danger .admin-search {
    margin-bottom: 0;
}

/* Protokoll: Zeit in fester Breite, damit die Zeilen fluchten */
.admin-log__list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

.admin-log__list li {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
}

.admin-log__list li:last-child {
    border-bottom: none;
}

.admin-log__time {
    min-width: 9rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

.admin-log__list a {
    color: var(--color-primary);
}

/* Konto: Download-Button nicht über die volle Breite ziehen */
.account-export {
    align-self: flex-start;
}

/* ==================== Impressum / Datenschutz ==================== */

/* Lesetext: etwas mehr Zeilenabstand, Überschriften mit Luft */
.legal {
    line-height: 1.6;
}

.legal h2 {
    margin-top: 2rem;
    font-size: 1.15rem;
    /* Sprungmarke aus dem Inhaltsverzeichnis: nicht unter den Rand rutschen */
    scroll-margin-top: 1rem;
}

.legal a {
    color: var(--color-primary);
}

.legal ul {
    padding-left: 1.25rem;
}

.legal .table-scroll {
    margin: 1rem 0;
}

.legal-toc {
    padding: 1rem 1.25rem;
}

.legal-toc ol {
    margin: 0;
    padding-left: 1.25rem;
}

/* Fehlende Angaben auffällig markieren (src/legal.php) */
.legal-todo {
    padding: 0 0.25rem;
    border-radius: 3px;
    background: var(--color-error-bg);
    color: var(--color-error-text);
    font-weight: 600;
}

/* ==================== Konto: Profilbild ==================== */

.avatar-edit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
}

.avatar-edit__controls {
    flex: 1 1 14rem;
    min-width: 0;
}

.avatar-edit__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form .avatar-edit__buttons .button {
    margin-top: 0;
}

/* Das <label> als Button: ".form label" würde es sonst fett/mit Abstand setzen */
.form .avatar-edit__pick {
    position: relative;
    margin-top: 0;
    font-weight: 400;
    cursor: pointer;
}

/* Dateifeld unsichtbar, aber per Tastatur erreichbar (nicht display: none!) */
.avatar-edit__pick input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

/* Tastatur-Fokus auf dem versteckten Feld → Rahmen am "Button" zeigen */
.avatar-edit__pick:focus-within {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ==================== Kraft-Fortschritt ==================== */

/* Kleiner Punkt in der Kategoriefarbe vor dem Übungsnamen */
.category-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    margin-right: 0.4rem;
    border-radius: 50%;
    background: var(--cat-color);
}

.progress-table a {
    color: var(--color-text);
    font-weight: 600;
}

.progress-chart,
.progress-history {
    margin-top: 1rem;
}

/* Dashboard-Karte: eine Zeile je Übung */
.progress-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.progress-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.25rem 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border);
}

.progress-list li:last-child {
    border-bottom: none;
}

.progress-list a {
    color: var(--color-text);
    font-weight: 600;
    text-decoration: none;
}

.progress-list a:hover {
    text-decoration: underline;
}

.progress-list__weights {
    font-variant-numeric: tabular-nums;
}

/* Veränderung: dezent, Zahl in Textfarbe (keine Ampelfarben) */
.progress-list__change {
    min-width: 4.5rem;
    text-align: right;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}

/* ==================== Training im Detail ==================== */

/* Workout-Name in der Verlaufstabelle: als Link erkennbar, aber ruhig */
.history-link {
    color: var(--color-text);
    font-weight: 600;
    text-decoration-color: var(--color-border);
    text-underline-offset: 3px;
}

.history-link:hover {
    color: var(--color-primary);
    text-decoration-color: currentColor;
}

.session-exercises .num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.session-exercises a {
    color: var(--color-text);
    font-weight: 600;
}

/* ==================== Explore ==================== */

/* Themen-Kacheln: so viele Spalten, wie mit mind. 280px hineinpassen */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
}

.theme-tile {
    display: flex;
    gap: 1rem;
    height: 100%;
    box-sizing: border-box;
    padding: 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.theme-tile:hover,
.theme-tile:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-raised);
}

/* Emoji in einem runden, dezent getönten Feld */
.theme-tile__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: var(--color-surface-muted);
    font-size: 1.6rem;
}

.theme-tile__body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.theme-tile__name {
    font-size: 1.15rem;
    font-weight: 700;
}

.theme-tile__text {
    flex-grow: 1; /* schiebt die Anzahl in allen Kacheln nach unten */
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.theme-tile__count {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary);
}

.explore-more {
    margin-top: 2.5rem;
}

/* ----- Admin: Explore-Themen ----- */
.theme-form__row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.theme-form__row label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.theme-form__name {
    flex: 1 1 14rem;
    min-width: 0;
}

.theme-form__icon {
    width: 4.5rem;
    text-align: center;
    font-size: 1.2rem;
}

.theme-form__sort {
    width: 6rem;
}

/* Häkchen in Spalten statt einer langen Liste */
.theme-form__workouts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
    gap: 0.25rem 1rem;
}

.theme-form__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.form .theme-form__actions .button {
    margin-top: 0.5rem;
}

.form.theme-form > .button {
    align-self: flex-start;
}

/* Beschreibung: Feld unter der Beschriftung, volle Breite */
.form.theme-form > label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.form.theme-form textarea {
    width: 100%;
    box-sizing: border-box;
}

/* ==================== Startseite (Landingpage, index.php) ==================== */

/* Header ohne Anmeldung: dezenter Link "Anmelden" neben Hell/Dunkel */
.header-login {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
}

.header-login:hover {
    background: var(--color-surface-muted);
}

/* Begrüßung: große Überschrift, kurzer Text, zwei Buttons */
.landing-hero {
    padding: 2.5rem 0 1.5rem;
}

.landing-hero h1 {
    /* clamp(min, Wunsch, max): wächst mit der Bildschirmbreite mit */
    font-size: clamp(2rem, 6vw, 3.25rem);
    line-height: 1.1;
    margin: 0 0 1rem;
}

.landing-hero__text {
    font-size: 1.15rem;
    max-width: 38rem;
    color: var(--color-text-muted);
}

.landing-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0 0.75rem;
}

.landing-hero__actions .button {
    margin-top: 0; /* Abstand regelt hier "gap" */
    padding: 0.9rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.landing-stats {
    margin: 1rem 0 2.5rem;
}

.landing-section {
    margin-bottom: 2.5rem;
}

/* Schritte: Zahl im Kreis (Akzentfarbe), daneben Titel + Text */
.landing-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step; /* eigener Zähler statt der Standard-Nummern */
}

.landing-steps li {
    counter-increment: step;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem;
}

.landing-steps li::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-bottom: 0.25rem;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-on-primary);
    font-weight: 700;
}

.landing-steps span {
    color: var(--color-text-muted);
}

/* Themen-Kachel als <button> (startet Gastzugang): Browser-Optik zurücksetzen */
button.theme-tile {
    width: 100%;
    border: none; /* Browser-Rahmen von <button> weg – die Karte trennt der Schatten */
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.landing-account {
    padding: 1.5rem;
}

.landing-account h2 {
    margin-top: 0;
}

.landing-account .button {
    margin-top: 0.5rem;
}

/* ==================== Startfragen (welcome.php) ==================== */

/* Fortschritt: drei Striche, der aktuelle in Akzentfarbe */
.onboarding-progress {
    display: flex;
    gap: 0.4rem;
    margin: 1rem 0 1.5rem;
    padding: 0;
    list-style: none;
}

.onboarding-progress li {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--color-surface-muted);
}

.onboarding-progress li.is-done,
.onboarding-progress li.is-current {
    background: var(--color-primary);
}

.onboarding-step {
    margin: 0;
    padding: 0;
    border: none;
}

.onboarding-step legend {
    margin-bottom: 0.75rem;
    padding: 0;
    font-size: 1.35rem;
    font-weight: 700;
}

/* Ziel-Kacheln: groß zum Antippen, zwei Spalten wenn Platz ist */
.onboarding-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 0.75rem;
}

.onboarding-option {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    cursor: pointer;
}

/* Radio unsichtbar, aber bedienbar (wie bei den Chips) */
.onboarding-option input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.onboarding-option__icon {
    grid-row: span 2; /* Symbol links über beide Textzeilen */
    font-size: 1.8rem;
}

.onboarding-option__label {
    font-weight: 700;
}

.onboarding-option__hint {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* :has() = "Kachel, die ein angehaktes Feld enthält" */
.onboarding-option:has(input:checked) {
    border-color: var(--color-primary);
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
}

.onboarding-option:has(input:focus-visible) {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Geräte- und Zeit-Chips etwas größer als im Random Workout (iPad) */
.onboarding-chips .chip span {
    padding: 0.7rem 1.2rem;
    font-size: 1.05rem;
}

.onboarding-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.onboarding-nav .button {
    margin-top: 0;
}

/* "Weiter"/"Vorschläge anzeigen" rechts, "Zurück" links.
   Bewusst über eine KLASSE, nicht über die IDs: "next-button" gibt es
   auch im Übungsbildschirm – eine ID-Regel hat dort den Pause-Knopf verschoben. */
.onboarding-nav .onboarding-nav__forward {
    margin-left: auto;
}

/* "Überspringen" als dezenter Text-Link (ist aber ein Button) */
.onboarding-skip {
    margin-top: 2rem;
    text-align: center;
}

.onboarding-skip button {
    padding: 0.25rem;
    border: none;
    background: none;
    color: var(--color-text-muted);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Ergebnis */
.onboarding-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.onboarding-summary .tag {
    font-size: 0.9rem;
}

.onboarding-random {
    margin: 2rem 0 1.5rem;
}

.onboarding-random h2 {
    margin-top: 0;
}

/* Einladung im Dashboard (nur solange die Startfragen fehlen) */
.onboarding-invite {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--color-primary);
}

.onboarding-invite h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}

.onboarding-invite p {
    margin: 0;
    color: var(--color-text-muted);
}

.onboarding-invite__icon {
    font-size: 2rem;
}

.onboarding-invite div {
    flex: 1 1 14rem; /* Text nimmt den Platz, Button rutscht notfalls darunter */
}

.onboarding-invite .button {
    margin-top: 0;
}

/* Admin → Design: App-Icon-Vorschau wie auf dem Home-Bildschirm */
.design-icon-preview {
    align-self: flex-start; /* im Formular (Flex-Spalte) links statt mittig */
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0;
}

.design-icon-preview img {
    border-radius: 22%; /* so rund wie iOS-Icons */
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-text) 20%, transparent);
}

.design-icon-preview__name {
    font-size: 0.8rem;
}

/* Admin → Statistik: Messung & Bereinigen */
.stats-admin {
    margin-top: 1.5rem;
    padding: 1.25rem 1.5rem 1.5rem;
}

.stats-admin h2 {
    margin-top: 0;
}

.stats-admin h3 {
    margin: 1.25rem 0 0.25rem;
}

.stats-admin p {
    max-width: 70ch;
    color: var(--color-text-muted);
}

.stats-admin .button {
    margin-top: 0.25rem;
}
