/* ------------------------------------------------------------------
 * Farben: hell (Standard) und dunkel (Umschalter im Kopfbereich)
 * ---------------------------------------------------------------- */
:root {
    color-scheme: light;
    --blue: #003781;
    --blue-dark: #002a63;
    --blue-soft: #e6eef8;      /* dezente blaue Flächen (Tabellenkopf, aktive Navigation) */
    --blue-soft-hover: #d9e5f5;
    --on-blue: #ffffff;
    --text: #1f2933;
    --muted: #5b6470;
    --border: #d9dee5;
    --bg: #ffffff;
    --card: #ffffff;
    --surface: #f7f9fc;        /* leicht abgesetzte Flächen (Zeilen-Hover, QR-Bereich) */
    --input-bg: #ffffff;
    --error: #b42318;
    --error-bg: #fdecea;
    --error-border: #f5c2c0;
    --success: #067647;
    --success-bg: #e6f4ec;
    --success-border: #b7e0c7;
    --info: #003781;
    --info-bg: #eef4fb;
    --info-border: #c7d8ef;
    --warn: #7a4b00;
    --warn-bg: #fff4e0;
    --warn-border: #f3d5a0;
    --target-bg: #fff8dc;
    --badge-admin-bg: #fde7c4;
    --badge-admin: #8a4b00;
    --gold: #c9a227;
    --silver: #9aa3ad;
    --bronze: #b6784a;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-toast: 0 6px 24px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --blue: #7fb1ff;
    --blue-dark: #a5c8ff;
    --blue-soft: #1c2a47;
    --blue-soft-hover: #24365a;
    --on-blue: #ffffff;
    --text: #e6ebf3;
    --muted: #a3adbf;
    --border: #2b3750;
    --bg: #0e1526;
    --card: #161f33;
    --surface: #1b2540;
    --input-bg: #0f1829;
    --error: #ff9c94;
    --error-bg: #3a1d1c;
    --error-border: #5a2b29;
    --success: #8fe0b0;
    --success-bg: #123021;
    --success-border: #1f4a33;
    --info: #cfe0ff;
    --info-bg: #1b2a45;
    --info-border: #2b4470;
    --warn: #ffd58a;
    --warn-bg: #3a2a10;
    --warn-border: #5a4320;
    --target-bg: #3a3612;
    --badge-admin-bg: #4a3410;
    --badge-admin: #ffd58a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-toast: 0 6px 24px rgba(0, 0, 0, 0.6);
}
/* Kräftige Aktionsfarbe (Buttons, Tabellenkopf der Rangliste) bleibt in beiden Modi Allianz-Blau */
:root { --brand: #003781; --brand-hover: #002a63; }
html[data-theme="dark"] { --brand: #2f6fd6; --brand-hover: #4a84e6; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--blue); }
a:hover { color: var(--blue-dark); }

h1 { font-size: 1.75rem; margin: 0 0 0.5rem; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
h1:first-child, h2:first-child { margin-top: 0; }
p { margin: 0 0 1rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.main { flex: 1; padding-top: 1.5rem; padding-bottom: 3rem; }
body.intern .wrap { max-width: 1400px; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); z-index: 20; }
@media (min-width: 721px) { .site-header { position: sticky; top: 0; } }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 0.75rem; padding-top: 0.4rem; padding-bottom: 0.4rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--blue); text-decoration: none; font-weight: 600; font-size: 1.05rem; min-width: 0; }
.brand-logo { height: 42px; width: auto; max-width: 52vw; display: block; }
html[data-theme="dark"] .brand-logo { background: #fff; padding: 4px 8px; border-radius: 6px; box-sizing: content-box; height: 34px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--on-blue); font-weight: 700; flex-shrink: 0; }
.nav { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.nav-link { color: var(--blue); text-decoration: none; padding: 0.4rem 0.6rem; border-radius: 6px; font-size: 0.95rem; white-space: nowrap; }
.nav-link:hover, .nav-link.active { background: var(--blue-soft); color: var(--blue); }
.rank-btn.active { background: var(--brand-hover); }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; padding: 0; flex-shrink: 0; }
.theme-toggle:hover { background: var(--blue-soft); }
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--card); font-size: 0.85rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; padding: 1rem; }

/* Hero */
.hero { text-align: center; padding: 1.25rem 0 0.75rem; }
.hero h1 { font-size: 2.1rem; color: var(--blue); }
.hero-sub { font-size: 1.15rem; color: var(--muted); margin: 0 0 0.75rem; }
.hero-intro { max-width: 640px; margin: 0 auto 1rem; font-size: 1.05rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.card-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.card-medium { max-width: 760px; margin-left: auto; margin-right: auto; }
.card-table { padding: 1rem; }
#registrierung { max-width: 760px; margin-left: auto; margin-right: auto; }

/* Forms */
.form .field { margin-bottom: 1rem; }
.field > label, .field legend { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.95rem; }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="password"],
.field input[type="date"], .field input[type="number"], .field input[type="url"], .field textarea, .select {
    width: 100%; padding: 0.7rem 0.8rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); min-height: 48px;
}
.field input[type="date"] { -webkit-appearance: none; appearance: none; }
.field input:focus, .field textarea:focus, .select:focus, .search:focus, .time-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.field.has-error input, .field.has-error textarea, fieldset.has-error { border-color: var(--error); }
fieldset.field { border: 1px solid transparent; padding: 0; margin: 0 0 1rem; min-inline-size: auto; }
fieldset.field legend { padding: 0; }
fieldset.has-error { border: 1px solid var(--error); border-radius: 8px; padding: 0.5rem 0.75rem; }
.field-error { color: var(--error); font-size: 0.875rem; margin: 0.3rem 0 0; }
.req { color: var(--error); }
.hint { color: var(--muted); font-size: 0.875rem; margin: 0.3rem 0 0.75rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-zip { grid-template-columns: 1fr 2fr; }
.yesno-options { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.field label.radio, .field label.check, .radio, .check { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 400; cursor: pointer; min-height: 44px; margin: 0; padding: 0.25rem 0.25rem 0.25rem 0; font-size: 1rem; }
.radio input, .check input { width: 1.4rem; height: 1.4rem; margin: 0; flex-shrink: 0; accent-color: var(--brand); }
.field label.check, .check { align-items: flex-start; }
.check input { margin-top: 0.15rem; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; }
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.code-input { font-size: 1.5rem !important; letter-spacing: 0.3em; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
.alt-actions { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.9rem; align-items: flex-start; }
.alt-actions .btn-link { min-height: 32px; display: inline-flex; align-items: center; }
.steps { padding-left: 1.25rem; }
.steps li { margin-bottom: 0.4rem; }
.breadcrumb { font-size: 0.9rem; margin-bottom: 0.75rem; }
.center-text { text-align: center; }
textarea.mono { background: var(--input-bg); color: var(--text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.65rem 1.1rem; min-height: 44px; font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.btn-primary { background: var(--brand); color: var(--on-blue); }
.btn-primary:hover { background: var(--brand-hover); color: var(--on-blue); }
.btn-outline { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover { background: var(--blue-soft); }
.btn-danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-bg); }
.btn-small { padding: 0.45rem 0.85rem; font-size: 0.9rem; min-height: 40px; }
.btn-large { padding: 0.85rem 1.6rem; font-size: 1.1rem; width: 100%; min-height: 52px; }
.btn-link { background: none; border: none; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }

/* Flash */
.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-error { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.flash-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.flash-info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.flash ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
/* Im internen Bereich als Einblendung unten, damit die Meldung auch nach dem Sprung zur Zeile sichtbar ist */
body.intern .main > .flash { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); z-index: 50; max-width: min(92vw, 720px); width: max-content; box-shadow: var(--shadow-toast); font-weight: 600; cursor: pointer; }
body.intern .main > .flash-hide { display: none; }
.ops-warning { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); border-radius: 8px; padding: 0.6rem 0.9rem; margin-bottom: 1rem; font-size: 0.9rem; }

/* Thanks */
.thanks { text-align: center; max-width: 620px; margin: 1.5rem auto; padding: 2.5rem 1.5rem; }
.thanks-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--success-bg); color: var(--success); font-size: 2rem; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.thanks .lead { font-size: 1.15rem; }

/* Terms */
.terms { max-width: 760px; margin: 0 auto; font-size: 0.92rem; color: var(--text); }
.terms h2 { font-size: 1.1rem; }
.terms ol { padding-left: 1.25rem; }
.terms li { margin-bottom: 0.4rem; }

/* Rangliste */
.leaderboard { max-width: 640px; margin: 0 auto; }
.leaderboard-head { text-align: center; margin-bottom: 1rem; }
.leaderboard-head h1 { color: var(--blue); font-size: 2rem; }
.leaderboard-sub { color: var(--muted); margin: 0; }
/* Tagesfilter: heute ist Standard, vergangene Wettbewerbstage wählbar */
.lb-day-form { display: flex; justify-content: center; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }
.lb-day-label { color: var(--muted); font-size: 0.9rem; }
.leaderboard-table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 1.1rem; }
.lb-table th { background: var(--brand); color: var(--on-blue); text-align: left; padding: 0.7rem 1rem; font-weight: 600; font-size: 0.9rem; letter-spacing: 0.03em; text-transform: uppercase; }
.lb-table td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); background: var(--card); }
.lb-table tr:last-child td { border-bottom: 0; }
.lb-rank { width: 5.5rem; font-weight: 700; white-space: nowrap; }
.lb-table td.lb-rank { color: var(--blue); }
.lb-time { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; white-space: nowrap; }
.lb-table th.lb-time { text-align: right; }
.lb-name { letter-spacing: 0.05em; }
.lb-anon-label { display: inline-block; font-size: 0.8em; font-weight: 500; letter-spacing: 0.02em; color: var(--muted); border: 1px dashed var(--border); border-radius: 999px; padding: 0.15em 0.7em; }
body.display-mode .lb-anon-label { color: #5b6470; border-color: #b8c0cc; }
.lb-top td { font-size: 1.2rem; }
.lb-top-1 .lb-rank::before, .lb-top-2 .lb-rank::before, .lb-top-3 .lb-rank::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-right: 0.4em; vertical-align: 0.02em; }
.lb-top-1 .lb-rank::before { background: var(--gold); }
.lb-top-2 .lb-rank::before { background: var(--silver); }
.lb-top-3 .lb-rank::before { background: var(--bronze); }
.lb-empty td { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.leaderboard-foot { text-align: center; color: var(--muted); margin-top: 1rem; font-size: 0.95rem; }
.lb-rule { display: inline-block; margin-top: 0.3rem; font-size: 0.9em; }
body.display-mode .lb-rule { color: rgba(255, 255, 255, 0.75); }
.lb-cta { margin-top: 0.9rem; }

/* Vollbild-Anzeige für einen Bildschirm am Stand (immer blau, unabhängig vom Modus) */
body.display-mode { background: #003781; color: #fff; }
body.display-mode .main { padding-top: 2.5vh; }
body.display-mode .leaderboard { max-width: 1100px; }
body.display-mode .leaderboard-head h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 4rem); }
body.display-mode .leaderboard-sub { color: rgba(255, 255, 255, 0.85); font-size: clamp(1rem, 2.2vw, 1.6rem); }
body.display-mode .leaderboard-table-wrap { background: #fff; border-color: #fff; }
body.display-mode .lb-table { font-size: clamp(1.2rem, 3vw, 2.4rem); }
body.display-mode .lb-table th { background: #003781; color: #fff; font-size: clamp(0.9rem, 1.6vw, 1.3rem); }
body.display-mode .lb-table td { padding: clamp(0.5rem, 1.4vw, 1.1rem) 1.2rem; background: #fff; color: #1f2933; border-color: #d9dee5; }
body.display-mode .lb-table td.lb-rank { color: #003781; }
body.display-mode .lb-rank { width: 3.2em; }
body.display-mode .lb-top td { font-size: clamp(1.4rem, 3.4vw, 2.8rem); }
body.display-mode .leaderboard-foot { color: rgba(255, 255, 255, 0.85); font-size: clamp(1rem, 2vw, 1.4rem); }
body.display-mode .leaderboard-brand { text-align: center; font-weight: 700; font-size: clamp(1.1rem, 2.4vw, 1.8rem); margin-top: 1.5rem; }
body.display-mode .flash, body.display-mode .ops-warning { display: none; }

/* QR-Code-Seite (Codefläche bleibt immer weiss, damit sie sich scannen lässt) */
.qr-sheet { text-align: center; padding: 1.5rem 1rem; border: 1px dashed var(--border); border-radius: var(--radius); margin: 1.25rem 0; background: #fff; color: #1f2933; }
.qr-large { display: inline-block; }
.qr-large img, .qr-large canvas { max-width: min(100%, 640px); height: auto !important; width: min(100%, 640px) !important; }
.qr-caption { font-size: 1.1rem; font-weight: 600; margin: 1rem 0 0.25rem; word-break: break-all; }
.qr-claim { color: #003781; font-weight: 700; font-size: 1.3rem; margin: 0; }

/* Toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar h1 { margin-bottom: 0.2rem; }
.toolbar .hint { margin: 0; }
.toolbar-right { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.day-form .select { width: auto; padding: 0.45rem 0.6rem; font-size: 0.95rem; min-height: 40px; }

/* Tables */
.table-tools { display: flex; gap: 0.75rem 1rem; align-items: center; margin-bottom: 0.75rem; flex-wrap: wrap; }
.filter-group { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card); }
.filter-btn { font: inherit; font-size: 0.9rem; font-weight: 600; padding: 0.5rem 0.9rem; min-height: 44px; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--blue); cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.filter-btn:last-child { border-right: 0; }
.filter-btn:hover { background: var(--blue-soft); }
.filter-btn[aria-pressed="true"] { background: var(--brand); color: var(--on-blue); }
.filter-count { display: inline-block; min-width: 1.6em; padding: 0 0.4em; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 0.8em; text-align: center; }
.filter-btn[aria-pressed="true"] .filter-count { background: rgba(255, 255, 255, 0.22); color: var(--on-blue); }
.search { flex: 1; min-width: 220px; max-width: 420px; padding: 0.6rem 0.75rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; min-height: 44px; background: var(--input-bg); color: var(--text); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.table th, .table td { padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--blue-soft); color: var(--blue); font-weight: 600; white-space: nowrap; }
/* Kompakte Liste: Detailspalten nur auf Wunsch ("Details anzeigen") */
.table .col-detail { display: none; }
.table.show-details .col-detail { display: table-cell; }
.table-compact td { padding-top: 0.55rem; padding-bottom: 0.55rem; }
.time-meta { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 400; white-space: nowrap; }
.time-cell .badge-hidden { display: inline-block; margin-top: 0.2rem; }
/* Ohne Details: Spalten hugging, der Rest der Breite geht an die Bemerkungsspalte */
.table-compact:not(.show-details) th:not(.col-note), .table-compact:not(.show-details) td:not(.col-note) { width: 1%; white-space: nowrap; }
.table-compact:not(.show-details) td { padding-right: 1.2rem; }
.note-form { display: flex; gap: 0.35rem; align-items: center; margin: 0; }
.note-input { flex: 1 1 auto; min-width: 11rem; padding: 0.45rem 0.6rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 8px; min-height: 40px; background: var(--input-bg); color: var(--text); }
.note-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.col-note { min-width: 14rem; }
.details-toggle { min-height: 44px; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { background: var(--blue-soft-hover); }
.table th[data-sort]::after { content: "\2195"; opacity: 0.35; margin-left: 0.3rem; font-size: 0.8em; }
.table th.sorted-asc::after { content: "\2191"; opacity: 1; }
.table th.sorted-desc::after { content: "\2193"; opacity: 1; }
.table tbody tr:hover { background: var(--surface); }
.table tr:target { background: var(--target-bg); }
/* Namen gut lesbar */
.table td.col-first, .table td.col-last { font-weight: 600; color: var(--text); font-size: 0.95rem; }
/* Im Filter "Ohne Zeit" sind Rang und Zeit leer */
.table.hide-rank .col-rank, .table.hide-rank .col-time { display: none !important; }
.num { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.small { font-size: 0.8rem; }
.muted { color: var(--muted); }
.highlight { font-weight: 600; color: var(--success); }
.empty { color: var(--muted); padding: 1rem 0; text-align: center; }
.row-actions { display: flex; gap: 0.5rem; align-items: center; }
.time-form { display: flex; gap: 0.35rem; align-items: center; margin: 0; }
.time-input { width: 7.5rem; padding: 0.45rem 0.5rem; font: inherit; font-size: 16px; font-family: ui-monospace, Menlo, Consolas, monospace; border: 1px solid var(--border); border-radius: 8px; min-height: 40px; background: var(--input-bg); color: var(--text); }
.time-cell strong { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.95rem; }
.email { white-space: nowrap; }
.addr { min-width: 160px; }

.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-admin { background: var(--badge-admin-bg); color: var(--badge-admin); }
.badge-staff { background: var(--blue-soft); color: var(--blue); }
.badge-role { background: var(--brand); color: var(--on-blue); margin-left: 0.25rem; }
.badge-hidden { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); font-weight: 500; }
.badge-expired { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); font-weight: 600; }
.badge-protected { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); font-weight: 500; margin-left: 0.3rem; }
/* Statusknopf Rangliste an/aus */
.btn-toggle { background: var(--card); color: var(--text); border-color: var(--border); font-weight: 500; gap: 0.5rem; }
.btn-toggle .toggle-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--muted); flex-shrink: 0; box-shadow: 0 0 0 3px transparent; }
.btn-toggle.is-on { color: var(--success); border-color: var(--success-border); background: var(--success-bg); }
.btn-toggle.is-on .toggle-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.btn-toggle.is-off { color: var(--warn); border-color: var(--warn-border); background: var(--warn-bg); }
.btn-toggle.is-off .toggle-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.btn-toggle:hover { filter: brightness(0.96); }
html[data-theme="dark"] .btn-toggle:hover { filter: brightness(1.15); }

/* Verlosung */
.draw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin: 0 0 1.25rem; }
.draw-stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0.9rem; }
.draw-stats dt { font-size: 0.8rem; color: var(--muted); margin: 0 0 0.2rem; }
.draw-stats dd { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--blue); line-height: 1.1; }
.draw-button { max-width: 420px; }
.draw-note { margin-bottom: 1.25rem; }
.draw-table td.draw-pos { font-size: 1.2rem; font-weight: 700; color: var(--blue); }
.draw-table td.draw-name { font-weight: 600; font-size: 1rem; }
.draw-table td.draw-email { word-break: break-all; }
.draw-redo { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.draw-redo summary, .card details > summary { cursor: pointer; font-weight: 600; color: var(--blue); min-height: 44px; display: flex; align-items: center; }
.draw-history { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }

/* Interne Tagesrangliste (Admin) */
.rank-table td.rank-pos { font-size: 1.15rem; font-weight: 700; color: var(--blue); white-space: nowrap; }
.rank-table td.rank-name { font-weight: 600; font-size: 1rem; }
.rank-table td.rank-time { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 600; font-size: 1rem; }
.rank-table td.rank-email { word-break: break-all; }
.rank-table td.podium-1::before, .rank-table td.podium-2::before, .rank-table td.podium-3::before { content: ""; display: inline-block; width: 0.65em; height: 0.65em; border-radius: 50%; margin-right: 0.35em; vertical-align: 0.05em; }
.rank-table td.podium-1::before { background: var(--gold); }
.rank-table td.podium-2::before { background: var(--silver); }
.rank-table td.podium-3::before { background: var(--bronze); }
.rank-table tr.rank-podium td { background: var(--surface); }

/* Smartphone: gezogene Personen bzw. Rangliste als Karten, ohne seitliches Scrollen */
@media (max-width: 720px) {
    .draw-table thead, .rank-table thead { display: none; }
    .draw-table tbody tr, .rank-table tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.5rem; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--border); }
    .draw-table tbody tr:hover, .rank-table tbody tr:hover { background: transparent; }
    .draw-table td, .rank-table td { display: block; border: 0; padding: 0; white-space: normal !important; text-align: left; background: transparent !important; }
    .draw-table td.draw-pos, .rank-table td.rank-pos { flex: 0 0 auto; min-width: 2rem; }
    .draw-table td.draw-name, .rank-table td.rank-name { font-size: 1.05rem; }
    .draw-table td.draw-name + td.draw-name, .rank-table td.rank-name + td.rank-name { flex: 1 0 30%; }
    .rank-table td.rank-time { flex: 0 0 auto; margin-left: auto; font-size: 1.1rem; }
    .rank-table td.rank-actions { flex-basis: 100%; margin-top: 0.3rem; }
    .draw-table td[data-label], .rank-table td[data-label] { flex-basis: 100%; font-size: 0.95rem; }
    .draw-table td[data-label]::before, .rank-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.85rem; }
    .rank-table tr.rank-podium { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.4rem; }
}

/* QR (Authenticator) – Codefläche immer weiss */
.qr-box { text-align: center; margin: 1rem 0 1.5rem; }
.qr { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px; min-height: 40px; color: #1f2933; }
.qr img, .qr canvas { display: block; max-width: 100%; }
.secret code { font-size: 1.05rem; letter-spacing: 0.05em; background: var(--blue-soft); padding: 0.4rem 0.6rem; border-radius: 6px; display: inline-block; word-break: break-all; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* Hinweise, die nur auf grossen bzw. nur auf kleinen Bildschirmen Sinn ergeben (z. B. «Spaltentitel antippen») */
.mobile-only { display: none; }
@media (max-width: 720px) { .mobile-only { display: inline; } }

/* Mobile */
@media (max-width: 720px) {
    .main { padding-top: 1rem; padding-bottom: 2rem; }
    .grid-2, .grid-zip { grid-template-columns: 1fr; }
    .hero { padding-top: 0.75rem; }
    .hero h1 { font-size: 1.6rem; }
    .hero-sub { font-size: 1rem; }
    .hero-intro { font-size: 1rem; }
    .card { padding: 1.1rem; border-radius: 8px; }
    .header-inner { min-height: 56px; }
    .brand-logo { height: 32px; }
    html[data-theme="dark"] .brand-logo { height: 26px; }
    .brand-name { font-size: 0.95rem; }
    .nav-link { padding: 0.35rem 0.45rem; font-size: 0.85rem; }
    .btn-small { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
    .theme-toggle { width: 36px; height: 36px; }
    .toolbar { align-items: flex-start; }
    .toolbar-right { width: 100%; }
    .filter-group { width: 100%; }
    .filter-btn { flex: 1 1 0; justify-content: center; padding: 0.5rem 0.4rem; font-size: 0.85rem; }
    .search { max-width: none; }
    .toolbar-right .btn { flex: 1 1 auto; }
    .day-form { width: 100%; }
    .day-form .select { width: 100%; }
    .time-input { width: 6.5rem; }
    .yesno-options { gap: 1rem; }
    .leaderboard-head h1 { font-size: 1.6rem; }
    .lb-table { font-size: 1rem; }
    .lb-table th, .lb-table td { padding: 0.65rem 0.75rem; }
    .lb-top td { font-size: 1.1rem; }
    .thanks { padding: 2rem 1rem; margin-top: 0.5rem; }
    .footer-inner { flex-direction: column; text-align: center; }
    body.intern .nav { justify-content: flex-start; }
    body.intern .header-inner { flex-wrap: wrap; }
    body.intern .nav-user { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}

/* Smartphone: Zeiterfassung als Karte pro Person (kein seitliches Scrollen nötig), auch mit «Details anzeigen» */
@media (max-width: 720px) {
    .desktop-only { display: none !important; }
    .table-compact { display: block; }
    .table-compact thead { display: none; }
    .table-compact tbody { display: block; }
    .table-compact tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; padding: 0.85rem 0.9rem 0.9rem; margin-bottom: 0.75rem; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
    .table-compact tbody tr[hidden] { display: none; }
    .table-compact tbody tr:hover { background: var(--card); }
    .table-compact tr:target { background: var(--target-bg); border-color: var(--warn-border); }
    .table-compact td { display: block; border: 0; padding: 0; width: auto !important; white-space: normal !important; text-align: left; }
    .table-compact td.col-detail { display: none; }
    /* Kopf der Karte: Tag (nur «Alle Tage»), Name, dann Rang und erfasste Zeit */
    .table-compact td.col-tag { order: 0; flex-basis: 100%; font-size: 0.85rem; color: var(--muted); }
    .table-compact td.col-first, .table-compact td.col-last { font-weight: 700; font-size: 1.2rem; line-height: 1.25; margin: 0; }
    .table-compact td.col-first { order: 1; }
    .table-compact td.col-last { order: 2; flex: 1 1 auto; }
    .table-compact td.col-rank { order: 3; font-weight: 700; color: var(--blue); font-size: 1.05rem; }
    .table-compact td.col-rank::before { content: "Rang "; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
    .table-compact td.col-time { order: 4; flex-basis: 100%; }
    .table-compact .time-cell strong { font-size: 1.15rem; }
    .table-compact .time-meta { white-space: normal; }
    /* Zeiteingabe: grosses Feld über die ganze Breite mit Speichern-Knopf daneben */
    .table-compact td.col-actions, .table-compact td.col-actions2, .table-compact td.col-note { min-width: 0; max-width: 100%; box-sizing: border-box; }
    .table-compact td.col-actions { order: 5; flex-basis: 100%; margin-top: 0.2rem; }
    .table-compact .time-form { display: flex; gap: 0.5rem; align-items: stretch; width: 100%; }
    .table-compact .time-input { flex: 1 1 3rem; width: 3rem; min-width: 0; min-height: 56px; font-size: 1.55rem; text-align: center; letter-spacing: 0.06em; padding: 0.4rem 0.6rem; border-radius: 10px; }
    .table-compact .time-input::placeholder { color: var(--muted); opacity: 0.6; letter-spacing: 0.04em; }
    .table-compact .time-form .btn { min-height: 56px; padding: 0 1.25rem; flex: 0 0 auto; font-size: 1.05rem; border-radius: 10px; }
    .table-compact td.col-actions .muted { display: block; padding: 0.4rem 0; }
    /* Nebenaktionen (Bearbeiten, Rangliste an/aus) und Bemerkung darunter */
    .table-compact td.col-actions2 { order: 6; flex-basis: 100%; margin: 0; }
    .table-compact .row-actions { display: flex; gap: 0.5rem; }
    .table-compact .row-actions > * { flex: 1 1 0; min-width: 0; }
    .table-compact .row-actions .btn { width: 100%; min-height: 44px; }
    .table-compact td.col-note { order: 7; flex-basis: 100%; min-width: 0; margin: 0; }
    .note-input { min-width: 0; min-height: 44px; }
    .note-form .btn { min-height: 44px; }
    /* «Details anzeigen»: Adresse, Kontakt und Antworten als beschriftete Zeilen unten in der Karte */
    .table-compact.show-details td.col-detail { display: block; order: 8; flex-basis: 100%; font-size: 0.95rem; text-align: left; margin: 0; }
    .table-compact.show-details td.col-detail:first-of-type { margin-top: 0.35rem; }
    .table-compact.show-details td.col-detail::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.85rem; }
    .table-compact.show-details td.col-detail a { display: inline-block; padding: 0.35rem 0; }
    /* Tippziele auf dem Smartphone */
    .btn-small, .day-form .select { min-height: 44px; }
    .rank-table a:not(.btn) { display: inline-block; padding: 0.35rem 0; }
}

@media (max-width: 380px) {
    .brand-logo { height: 28px; max-width: 46vw; }
    .btn-small { padding: 0.35rem 0.55rem; font-size: 0.8rem; }
}

/* ------------------------------------------------------------------
 * Münzglas «Schätzen & Gewinnen» (zweites Gewinnspiel)
 * ---------------------------------------------------------------- */
/* Startseite */
.hero-jar h1 { text-transform: uppercase; letter-spacing: 0.03em; }
.hero-emoji { font-size: 0.85em; vertical-align: 0.05em; }
.hero-question { font-size: 1.5rem; font-weight: 700; color: var(--text); margin: 0 0 0.6rem; line-height: 1.25; }
.jar-howto, .jar-why { max-width: 760px; margin-left: auto; margin-right: auto; }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.checklist li { position: relative; padding-left: 2.3rem; margin-bottom: 0.75rem; font-size: 1.05rem; line-height: 1.5; }
.checklist li::before { content: "\2713"; position: absolute; left: 0; top: 0.1rem; width: 1.45rem; height: 1.45rem; border: 2px solid var(--blue); border-radius: 5px; color: var(--blue); font-weight: 700; font-size: 0.95rem; line-height: 1.25rem; text-align: center; box-sizing: border-box; }
.jar-win { font-size: 1.1rem; margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.jar-why p { font-size: 1.05rem; }
.jar-why p:last-child { margin-bottom: 0; }
.form-section { font-size: 1.05rem; margin: 0.25rem 0 0.75rem; color: var(--blue); }

/* CHF-Eingabe (Schätzung im Formular, Betrag im Glas) */
.estimate-field { background: var(--blue-soft); border: 1px solid var(--info-border); border-radius: var(--radius); padding: 1rem 1rem 0.4rem; margin-bottom: 1.25rem; }
.estimate-field > label { font-size: 1.05rem; }
.estimate-field .hint { margin-bottom: 0.5rem; }
.chf-input { display: flex; align-items: stretch; }
.chf-prefix { display: inline-flex; align-items: center; padding: 0 0.85rem; border: 1px solid var(--border); border-right: 0; border-radius: 8px 0 0 8px; background: var(--surface); color: var(--muted); font-weight: 700; flex-shrink: 0; }
.chf-input input[type="text"] { border-radius: 0 8px 8px 0; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.field.has-error .chf-prefix { border-color: var(--error); }

/* Reiter Auto-Simulator | Münzglas über der Registrierungsliste */
.contest-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.contest-tab { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; min-height: 44px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--blue); font-weight: 600; text-decoration: none; }
.contest-tab:hover { background: var(--blue-soft); color: var(--blue); }
.contest-tab.is-current { background: var(--brand); color: var(--on-blue); border-color: var(--brand); }
.contest-tab.is-current:hover { background: var(--brand-hover); color: var(--on-blue); }
.badge-live { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); font-weight: 600; }
.contest-tab.is-current .badge-live { background: rgba(255, 255, 255, 0.2); color: var(--on-blue); border-color: rgba(255, 255, 255, 0.45); }

/* Gewinnspiel umschalten: Auswahlkarten */
.option-cards { display: grid; gap: 0.9rem; margin: 1rem 0 1.25rem; }
.option-card { display: block; position: relative; cursor: pointer; }
.option-radio { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.option-body { display: block; height: 100%; border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--card); }
.option-card:hover .option-body { border-color: var(--blue); }
.option-radio:checked + .option-body { border-color: var(--brand); background: var(--blue-soft); }
.option-radio:focus-visible + .option-body { outline: 2px solid var(--blue); outline-offset: 2px; }
.option-title { display: block; font-size: 1.15rem; font-weight: 700; color: var(--blue); margin-bottom: 0.35rem; }
.option-desc { display: block; font-size: 0.95rem; margin-bottom: 0.6rem; }
.option-meta { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; }

/* Münzglas intern: Betrag im Glas, Rangfolge der Schätzungen */
.jar-value-form { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 0.75rem; }
.jar-value-form .field { flex: 1 1 260px; max-width: 420px; margin: 0; }
.jar-value-form .btn { min-height: 48px; }
.jar-value-card .inline-form { display: block; margin-top: 0.5rem; }
.draw-stats dd.stat-amount { font-size: 1.2rem; white-space: nowrap; }
.draw-stats dd.stat-sub { font-size: 0.8rem; font-weight: 400; color: var(--muted); margin-top: 0.2rem; line-height: 1.3; }
.deviation { font-variant-numeric: tabular-nums; }
.deviation-exact { color: var(--success); font-weight: 700; }
.rank-table td.rank-amount { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1rem; }
.jar-table .time-cell strong { font-family: inherit; font-variant-numeric: tabular-nums; }
.leaderboard-off .lead { max-width: 560px; margin-left: auto; margin-right: auto; }

@media (min-width: 721px) {
    .option-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
    .hero-question { font-size: 1.25rem; }
    .checklist li { font-size: 1rem; }
    .contest-tabs { margin-bottom: 0.75rem; }
    .contest-tab { flex: 1 1 0; justify-content: center; padding: 0.5rem 0.6rem; }
    .jar-value-form .field { max-width: none; }
    .jar-value-form .btn { width: 100%; }
    /* Rangfolge als Karte: Schätzung rechts neben dem Namen, Abweichung als beschriftete Zeile darunter */
    .rank-table td.rank-amount { flex: 0 0 auto; margin-left: auto; font-size: 1.1rem; }
    .rank-table td.rank-amount[data-label] { flex-basis: 100%; margin-left: 0; font-size: 1rem; }
}

/* Druck: immer hell */
@media print {
    @page { size: A4 landscape; margin: 12mm; }
    @page qr { size: A4 portrait; margin: 15mm; }
    .qr-page { page: qr; }
    html, html[data-theme="dark"] { --bg: #fff; --card: #fff; --text: #000; --muted: #444; --border: #bbb; --blue: #003781; --blue-soft: #eee; color-scheme: light; }
    .site-header, .site-footer, .table-tools, .time-form, .toolbar-right, .btn, .col-actions, .col-actions2, .flash, .ops-warning, .card > .hint, .no-print, .qr-form, .breadcrumb, .theme-toggle { display: none !important; }
    .table .col-detail { display: table-cell; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; padding: 0; border: 0; }
    .table-wrap { overflow: visible; }
    .table { font-size: 0.7rem; width: auto; }
    .table th, .table td { padding: 0.2rem 0.35rem; }
    .qr-page h1, .qr-page > .hint { display: none; }
    .qr-sheet { border: 0; padding-top: 3rem; }
    .qr-large img, .qr-large canvas { width: 140mm !important; max-width: 140mm; }
    .qr-caption { font-size: 14pt; }
    .qr-claim { font-size: 20pt; }
}
