/* ==========================================================================
   bgdb — Design-Tokens und Komponenten
   Abgeleitet aus inspo/bgdb Mobile.dc.html (Varianten 1a/1f).
   Tokens stehen als CSS-Variablen, nicht in der Tailwind-Config, damit ein
   spaeterer Wechsel vom Play-CDN zu gebautem CSS sie nicht anfasst.
   ========================================================================== */

:root {
    /* Akzent wird per inline style="--accent: …" aus settings.accent_color
       ueberschrieben; dieser Wert ist nur der Fallback. */
    --accent: #c94a9c;
    --accent-ink: #fff;
    /* Von renderHead() aus der gewaehlten Akzentfarbe berechnet, damit
       Buttontext und Akzent-Text bei jeder Farbwahl lesbar bleiben.
       Diese Werte greifen nur, wenn PHP sie nicht setzt. */
    --accent-fill: #c94a9c;
    --accent-on-l: #b83f86;
    --accent-on-d: #c94a9c;
    --accent-text: var(--accent-on-l);

    /* Hell */
    --bg:            #f6f5f2;
    --surface:       #fff;
    --surface-sunk:  #ece9e2;
    --ink:           #171614;
    --ink-meta:      #6f6b63;
    --ink-dim:       #6f6b63;
    --line:          rgba(0, 0, 0, .07);
    --line-strong:   rgba(0, 0, 0, .14);
    --line-dashed:   rgba(0, 0, 0, .14);
    --sheet-shadow:  0 -12px 40px rgba(0, 0, 0, .18);
    --cover-bg:      var(--surface-sunk);
    --cell-border:   1px solid rgba(0, 0, 0, .08);
    --ok:            #2f7d52;
    --bad:           #b3261e;

    --r-cell:   12px;
    --r-sheet:  20px;
    --r-btn:    12px;
    --r-field:  14px;
    --pad-side: 18px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:           #121110;
        --surface:      #1c1b19;
        --surface-sunk: #2a2825;
        --ink:          #f2efe8;
        --ink-meta:     #9a958b;
        --ink-dim:      #827d74;
        --line:         #2a2825;
        --line-strong:  #3a3834;
        --line-dashed:  #33312d;
        --sheet-shadow: 0 -12px 40px rgba(0, 0, 0, .45);
        --cover-bg:     #232220;
        --cell-border:  1px solid transparent;
        --ok:           #5cb686;
        --bad:          #f2857c;
        --accent-text:  var(--accent-on-d);

        --r-cell:  10px;
        --r-sheet: 18px;
    }
}

/* --------------------------------------------------------------- Grundlagen */

/* Ohne das addiert sich Padding auf jede width: 100% — die Panel-Zeilen in
   admin.php liefen dadurch aus ihrer Karte heraus. */
*, *::before, *::after { box-sizing: border-box; }

/* Klassen mit eigenem display (.shelf-list, .results, .row …) schlagen sonst
   das [hidden] des Browser-Stylesheets und das Element bleibt sichtbar. */
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.mono {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}

/* Metadaten-Spur: Positionen, IDs, Zahlen */
.meta {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 12.5px;
    font-weight: 400;
    color: var(--ink-meta);
    font-variant-numeric: tabular-nums;
}

.meta-sm { font-size: 11.5px; }

.page-title {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -.01em;
    line-height: 1.1;
    margin: 0;
}

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

a { color: inherit; }

:where(a, button, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ Shell */

.shell {
    max-width: 560px;
    margin: 0 auto;
    padding: 0 var(--pad-side) 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 0 18px;
}

.backlink {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 15px;
    text-decoration: none;
    color: var(--ink);
}

.backlink .chev { font-size: 22px; line-height: 1; }

/* Admin-Marker */
.pill-accent {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-text);
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 3px 10px;
    text-decoration: none;
    white-space: nowrap;
}

/* ------------------------------------------------------------ Regal-Raster */

.shelf {
    display: grid;
    gap: 6px;
    align-items: center;
}

.axis {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-dim);
}

.axis-col { text-align: center; }

.cell {
    position: relative;
    aspect-ratio: 1;
    background: var(--surface);
    border: var(--cell-border);
    border-radius: var(--r-cell);
    overflow: hidden;
    padding: 5px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Gleich hohe Zeilen, sonst richtet sich die Zeilenhoehe nach dem Cover
       und zwei Spiele lassen die untere Fachhaelfte leer. */
    grid-auto-rows: 1fr;
    gap: 3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.cell-empty { cursor: default; }

.cell-empty .cell-dash {
    grid-column: 1 / -1;
    border: 1px dashed var(--line-dashed);
    border-radius: 6px;
}

.cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: var(--cover-bg);
}

/* Ein einzelnes Cover nutzt das ganze Fach */
.cell-single img { grid-column: 1 / -1; }

.cell-count {
    position: absolute;
    right: 5px;
    bottom: 5px;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 10px;
    font-weight: 600;
    background: var(--bg);
    color: var(--ink);
    padding: 2px 5px;
    border-radius: 5px;
}

.cell[aria-selected="true"]::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--accent);
    border-radius: var(--r-cell);
    pointer-events: none;
}

/* ------------------------------------------------------------------ Sheets */

.sheet-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    opacity: 0;
    transition: opacity .22s ease;
    z-index: 40;
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    max-height: 88vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    border-radius: var(--r-sheet) var(--r-sheet) 0 0;
    box-shadow: var(--sheet-shadow);
    padding: 14px 20px calc(28px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform .26s cubic-bezier(.32, .72, 0, 1);
}

.sheet-inner { max-width: 560px; margin: 0 auto; }

[data-sheet-open] .sheet-scrim { opacity: 1; }
[data-sheet-open] .sheet      { transform: translateY(0); }

.grabber {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--line-strong);
    margin: 0 auto 14px;
}

.sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.sheet-title { font-size: 18px; font-weight: 600; }

.sheet-cancel {
    font-size: 15px;
    color: var(--ink-meta);
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

/* ------------------------------------------------------------ Listenzeilen */

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
}

.row:last-of-type { border-bottom: 0; }

.row-thumb {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 8px;
    object-fit: contain;
    background: var(--cover-bg);
}

.row-body { flex: 1; min-width: 0; }

.row-name {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: none;
    color: var(--ink-meta);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover { color: var(--ink); border-color: var(--ink-meta); }

/* ----------------------------------------------------------------- Aktionen */

.btn-accent {
    flex: 1;
    display: block;
    background: var(--accent-fill);
    color: var(--accent-ink);
    border: 0;
    border-radius: var(--r-btn);
    padding: 13px;
    text-align: center;
    font: 600 15px 'Source Sans 3', system-ui, sans-serif;
    text-decoration: none;
    cursor: pointer;
}

.btn-quiet {
    height: 36px;
    padding: 0 14px;
    flex: none;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: none;
    color: var(--ink);
    font: 600 14px 'Source Sans 3', system-ui, sans-serif;
    cursor: pointer;
}

.btn-quiet-accent {
    height: 36px;
    padding: 0 14px;
    flex: none;
    border-radius: 10px;
    border: 0;
    background: var(--accent-fill);
    color: var(--accent-ink);
    font: 600 14px 'Source Sans 3', system-ui, sans-serif;
    cursor: pointer;
}

/* ------------------------------------------------------------------- Suche */

.field {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-field);
    padding: 12px 14px;
}

.field:focus-within { border-color: var(--accent); }

.field input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: 400 16px 'Source Sans 3', system-ui, sans-serif;
}

.field input:focus { outline: none; }

.field-tag {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px;
    color: var(--ink-meta);
    flex: none;
}

.is-cached { color: var(--ok); }

.empty {
    text-align: center;
    color: var(--ink-meta);
    padding: 28px 0;
    font-size: 15px;
}

.spinner {
    width: 22px;
    height: 22px;
    margin: 24px auto;
    border: 2px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .sheet, .sheet-scrim { transition: none; }
    .spinner { animation-duration: 2s; }
}

/* ========================================================== Startseite (1d) */

.masthead {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    padding: 16px 0 0;
}

/* Ohne min-width:0 behaelt der Textblock die Breite seines laengsten Wortes
   und schiebt den Avatar auf schmalen Displays aus dem Bild. */
.masthead > div { min-width: 0; }

.wordmark {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-meta);
}

.collection-title {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -.015em;
    line-height: 1.05;
    margin: 4px 0 0;
    text-wrap: balance;
    overflow-wrap: break-word;
    hyphens: auto;
}

.avatar {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    text-decoration: none;
}

.avatar:hover { border-color: var(--accent); color: var(--accent-text); }

/* Zahlenzeile: Wert kraeftig, Einheit zurueckgenommen */
.tally {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 20px 0 0;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 12.5px;
    color: var(--ink-meta);
}

.tally b {
    color: var(--ink);
    font-weight: 600;
}

/* Chip-Reihe zieht bis an den Rand, damit sie sichtbar scrollt */
.chiprow {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 20px calc(var(--pad-side) * -1) 0;
    padding: 0 var(--pad-side);
    scrollbar-width: none;
}

.chiprow::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    font: 500 13.5px 'Source Sans 3', system-ui, sans-serif;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    white-space: nowrap;
}

.chip[aria-pressed="true"] {
    background: var(--accent-fill);
    color: var(--accent-ink);
    border-color: transparent;
}

.facet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 20px 0 10px;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 12px;
    color: var(--ink-meta);
}

.facet-head b { color: var(--ink); font-weight: 600; }

.sort-btn {
    font: inherit;
    color: var(--ink-meta);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.facets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.facet {
    font: 400 13px 'Source Sans 3', system-ui, sans-serif;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 5px 9px;
    cursor: pointer;
}

.facet[aria-pressed="true"] {
    background: var(--accent-fill);
    color: var(--accent-ink);
    border-color: transparent;
}

.facet .n {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px;
    color: var(--ink-meta);
    margin-left: 2px;
}

/* Kein opacity: auf der Akzentflaeche kostet es den Kontrast, den die
   berechnete Farbe noch ausweist. */
.facet[aria-pressed="true"] .n { color: inherit; }

.facet-more {
    font: 400 13px 'Source Sans 3', system-ui, sans-serif;
    color: var(--ink-meta);
    background: none;
    border: 0;
    padding: 5px 4px;
    cursor: pointer;
}

/* ------------------------------------------------------------ Regal-Karten */

.shelf-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.shelf-card {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--surface);
    border: var(--cell-border);
    border-radius: 16px;
    padding: 14px;
    text-decoration: none;
    color: var(--ink);
}

.shelf-card:hover { border-color: var(--accent); }

/* Regalminiatur: ein Punkt je Fach, belegte tragen ihr Cover */
.shelf-dots {
    display: grid;
    gap: 3px;
    flex: none;
}

.shelf-dots span,
.shelf-dots img {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: block;
}

.shelf-dots span { background: var(--surface-sunk); }
.shelf-dots img { object-fit: cover; }

.shelf-card-body { flex: 1; min-width: 0; }

.shelf-card-name { font-size: 18px; font-weight: 600; }

.shelf-card .chev {
    font-size: 22px;
    color: var(--ink-meta);
    flex: none;
}

/* --------------------------------------------------------- Trefferkacheln */

.results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.result {
    background: var(--surface);
    border: var(--cell-border);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
}

.result:hover { border-color: var(--accent); }

.result-cover {
    aspect-ratio: 1;
    width: 100%;
    object-fit: contain;
    background: var(--cover-bg);
}

.result-body { padding: 10px 11px 12px; }

.result-name {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.25;
    margin-bottom: 3px;
}

.result-where {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px;
    color: var(--ink-meta);
    margin-top: 4px;
    display: block;
}

/* ------------------------------------------------------------ Filter-Sheet */

.filter-group { margin-top: 18px; }

.filter-label {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.filter-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.filter-pair .field { padding: 10px 12px; }
.filter-pair .field input { font-size: 15px; }

.sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.btn-plain {
    flex: none;
    border-radius: var(--r-btn);
    border: 1px solid var(--line-strong);
    background: none;
    color: var(--ink);
    padding: 13px 16px;
    font: 600 15px 'Source Sans 3', system-ui, sans-serif;
    cursor: pointer;
}

select.field-select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-field);
    background: var(--bg);
    color: var(--ink);
    padding: 12px 14px;
    font: 400 16px 'Source Sans 3', system-ui, sans-serif;
}

select.field-select:focus { outline: none; border-color: var(--accent); }

/* ======================================================== Spiel-Detail (1e) */

/* Der Held: Cover scharf vor seiner eigenen, weichgezeichneten Fassung */
.hero {
    position: relative;
    height: 340px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 22px;
    overflow: hidden;
    background: var(--surface-sunk);
}

.hero-blur {
    position: absolute;
    inset: -40px;
    background-size: cover;
    background-position: center;
    filter: blur(28px) saturate(1.1);
    transform: scale(1.1);
    /* Auf hellem Grund traegt dieselbe Deckkraft deutlich dicker auf und
       uebertoent die ruhige Palette. */
    opacity: .38;
}

@media (prefers-color-scheme: dark) {
    .hero-blur { opacity: .55; }
}

.hero-cover {
    position: relative;
    max-height: 250px;
    max-width: 72%;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

/* Verlauf traegt den Uebergang zum Seitengrund */
.hero::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 90px;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
}

.hero-bar {
    position: absolute;
    top: 16px;
    left: var(--pad-side);
    right: var(--pad-side);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    z-index: 2;
}

.hero-back {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    text-decoration: none;
    backdrop-filter: blur(6px);
}

.hero-tag {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11.5px;
    font-weight: 500;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    text-decoration: none;
    backdrop-filter: blur(6px);
}

/* Zieht den Titel dicht an den Verlauf. Ohne eigene Position läge er unter
   dem Hero (der ist relative, die Shell nicht) und wäre oben beschnitten. */
.game-head {
    position: relative;
    z-index: 1;
    margin-top: -8px;
}

.game-title {
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -.015em;
    line-height: 1.05;
    margin: 0;
    overflow-wrap: break-word;
    hyphens: auto;
}

.game-credits {
    font-size: 14.5px;
    color: var(--ink-meta);
    margin: 6px 0 0;
    text-wrap: pretty;
}

/* Kennzahlen */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
    /* Bricht die Reihe auf schmalen Displays um, sollen beide Zeilen gleich
       hoch bleiben — sonst steht die Kachel mit dem zweizeiligen Label vor. */
    grid-auto-rows: 1fr;
    gap: 6px;
    margin-top: 20px;
}

.stat {
    background: var(--surface);
    border: var(--cell-border);
    border-radius: 10px;
    padding: 10px 6px;
    text-align: center;
}

.stat-value {
    font: 600 15px 'Source Code Pro', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 10.5px;
    color: var(--ink-meta);
    margin-top: 3px;
    /* „Komplexität" ist das längste Label und passt nur knapp. Bricht die
       Schrift woanders breiter, soll es umbrechen statt über den Rand zu
       laufen — das Grid gleicht die Kachelhöhen ohnehin an. */
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.25;
}

/* Die Bewertung ist der eine hervorgehobene Wert */
.stat-accent { border: 1px solid var(--accent); }
.stat-accent .stat-value { color: var(--accent-text); }

.datastrip {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 18px;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 12px;
    color: var(--ink-meta);
}

.datastrip b { color: var(--ink); font-weight: 600; }

/* Standortkarte */
.place {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: var(--cell-border);
    border-radius: 14px;
    padding: 14px;
    margin-top: 18px;
    text-decoration: none;
    color: inherit;
}

.place:hover { border-color: var(--accent); }

.place-dots { display: grid; gap: 2px; flex: none; }

.place-dots span {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: var(--surface-sunk);
    display: block;
}

.place-dots .here { background: var(--accent); }

.place-label { font-size: 12px; color: var(--ink-meta); }
.place-name { font-size: 16px; font-weight: 600; }

/* Abschnittsmarken */
.section { margin-top: 24px; }

.section-label {
    font: 500 11px 'Source Code Pro', ui-monospace, monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-dim);
    margin-bottom: 8px;
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Kategorien tragen eine Kontur, Mechaniken eine Flaeche — der Unterschied
   trennt die beiden Listen ohne zweite Überschrift. */
.tag-outline {
    font-size: 13.5px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 5px 10px;
}

.tag-solid {
    font-size: 13.5px;
    color: var(--ink);
    background: var(--surface);
    border: var(--cell-border);
    border-radius: 8px;
    padding: 5px 10px;
}

.prose {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    text-wrap: pretty;
    max-width: 68ch;
}

.prose p { margin: 0 0 .7em; }
.prose p:last-child { margin-bottom: 0; }

.prose-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.more-btn {
    font: 500 15px 'Source Sans 3', system-ui, sans-serif;
    color: var(--accent-text);
    background: none;
    border: 0;
    padding: 0;
    margin-top: 6px;
    cursor: pointer;
}

/* ============================================================== Admin (1g) */

/* Gruppierte Zeilen in einer gemeinsamen Flaeche */
.panel {
    background: var(--surface);
    border: var(--cell-border);
    border-radius: 14px;
    overflow: hidden;
}

.panel-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
    background: none;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.panel-row:last-child { border-bottom: 0; }
.panel-row:hover { background: var(--bg); }

.panel-key { flex: 1; min-width: 0; font-size: 15px; color: var(--ink-meta); }

/* Zeilen, deren Inhalt nebeneinander nicht passt: Bezeichnung oben,
   Bedienung darunter. */
.panel-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.panel-stack .panel-key { flex: none; }

.inline-edit {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-edit .field { flex: 1; min-width: 0; padding: 9px 12px; }
.inline-edit .field input { font-size: 15px; }
.panel-value { font-size: 15px; font-weight: 500; text-align: right; }
.panel-chev { color: var(--ink-dim); flex: none; }

.section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px 12px;
    margin-bottom: 8px;
}

.link-accent {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-text);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}

/* Farbwahl */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }

.swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, .15);
    padding: 0;
    cursor: pointer;
}

.swatch[aria-pressed="true"] {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* Regalliste, sortierbar */
.sortable .panel-row { cursor: default; }

.grip {
    color: var(--ink-dim);
    font-size: 16px;
    letter-spacing: -2px;
    cursor: grab;
    flex: none;
    touch-action: none;
    user-select: none;
    padding: 4px 2px;
}

.grip:active { cursor: grabbing; }

.panel-row.dragging {
    opacity: .5;
    background: var(--bg);
}

.panel-row.dropzone { border-top: 2px solid var(--accent); }

.row-title { font-size: 15px; font-weight: 500; }

/* Stepper */
.stepper {
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stepper-label { font-size: 13px; color: var(--ink-meta); }

.stepper-ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
    font: 600 15px 'Source Code Pro', ui-monospace, monospace;
}

.stepper-ctrl button {
    background: none;
    border: 0;
    font: inherit;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
}

.stepper-minus { color: var(--ink-dim); }
.stepper-plus { color: var(--accent-text); }
.stepper-ctrl button:disabled { opacity: .35; cursor: default; }

/* Vorschau des neuen Regals */
.preview-grid {
    display: grid;
    gap: 4px;
    padding: 6px 0;
}

.preview-grid span {
    aspect-ratio: 1;
    border: 1px dashed var(--line-strong);
    border-radius: 5px;
    display: block;
}

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

.notice {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14.5px;
    margin-top: 16px;
    border: 1px solid;
}

.notice-ok {
    border-color: var(--ok);
    color: var(--ok);
    background: var(--surface);
}

.notice-bad {
    border-color: var(--bad);
    color: var(--bad);
    background: var(--surface);
}

/* Login */
.login-wrap {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
}

/* =================================================================== Toasts */
/* Die Toast-Styles lagen nur in style.css. Die umgestellten Seiten laden das
   nicht mehr, ihre Meldungen waren daher unformatiert. */

.toast-container {
    position: fixed;
    left: var(--pad-side);
    right: var(--pad-side);
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 60;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

@media (min-width: 560px) {
    .toast-container {
        left: auto;
        max-width: 380px;
    }
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
    transition: opacity .3s ease;
}

/* Der Typ steckt im Rand und im Zeichen, nicht in einer Vollfläche —
   sonst schlägt die Meldung lauter an als alles andere auf der Seite. */
.toast-success { border-left: 3px solid var(--ok); }
.toast-error   { border-left: 3px solid var(--bad); }
.toast-info    { border-left: 3px solid var(--accent); }
.toast-warning { border-left: 3px solid var(--accent); }

.toast-icon {
    font-size: 15px;
    line-height: 1.4;
    flex: none;
}

.toast-success .toast-icon { color: var(--ok); }
.toast-error .toast-icon   { color: var(--bad); }
.toast-info .toast-icon,
.toast-warning .toast-icon { color: var(--accent-text); }

.toast-content { flex: 1; min-width: 0; }

.toast-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13.5px;
    color: var(--ink-meta);
    overflow-wrap: break-word;
}

.toast-close {
    flex: none;
    background: none;
    border: 0;
    color: var(--ink-meta);
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
}

.toast-close:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
    .toast { transition: none; }
}

/* ========================================================== Spielprotokoll */

.play-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: var(--accent-fill);
    color: var(--accent-ink);
    border: 0;
    border-radius: var(--r-btn);
    padding: 14px;
    margin-top: 20px;
    font: 600 15px 'Source Sans 3', system-ui, sans-serif;
    cursor: pointer;
}

.play-btn:disabled { opacity: .6; cursor: default; }

/* Kurze Bestätigung direkt am Knopf, danach zurück in den Ruhezustand */
.play-btn.done {
    background: var(--surface);
    color: var(--ok);
    box-shadow: inset 0 0 0 1px var(--ok);
}

.play-list { margin-top: 10px; }

.play-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.play-row:last-child { border-bottom: 0; }

.play-when {
    flex: 1;
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.play-count {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 12px;
    color: var(--ink-meta);
}

/* Balkenliste der Statistik */
.rank-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    text-decoration: none;
    color: inherit;
}

.rank-thumb {
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 5px;
    object-fit: cover;
    background: var(--cover-bg);
}

.rank-body { flex: 1; min-width: 0; }

.rank-name {
    font-size: 14.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Der Balken sitzt unter dem Namen und trägt die Länge als einzige Aussage */
.bar {
    height: 5px;
    border-radius: 3px;
    background: var(--surface-sunk);
    margin-top: 5px;
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
}

.rank-n {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex: none;
    min-width: 2ch;
    text-align: right;
}

.rank-when {
    font-family: 'Source Code Pro', ui-monospace, monospace;
    font-size: 11px;
    color: var(--ink-meta);
    flex: none;
}

/* Nie gespielt: dieselbe Zeile, ohne Balken */
.quiet-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.quiet-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13.5px;
    background: var(--surface);
    border: var(--cell-border);
    border-radius: 8px;
    padding: 5px 10px 5px 5px;
    text-decoration: none;
    color: inherit;
}

.quiet-chip img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--cover-bg);
}

.quiet-chip:hover { border-color: var(--accent); }
