/* JU.connects - Einlass-Scanner-PWA (2026-10-13). Gleicher Stil wie die
   Zeit-App (public/zeit-app/app.css): Anthrazit + Sand, hell/dunkel,
   iPhone-Safe-Areas. Dazu Kamerabild und Vollbild-Farbblitz. */
:root {
    --ink: #2c2a2b;
    --sand: #c4bea2;
    --sand-strong: #a39c7b;
    --bg: #f5f3ec;
    --card: #ffffff;
    --text: #2c2a2b;
    --muted: #6f6b62;
    --line: #e4e0d3;
    --ok: #2f7d4f;
    --ok-bg: #e3f1e8;
    --warn: #8a5a00;
    --warn-bg: #fbefd5;
    --danger: #b3261e;
    --danger-bg: #fbe4e2;
    --flash-ok: #1f9d55;
    --flash-bad: #c62828;
    --flash-warn: #e08a00;
    --radius: 18px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1b1b;
        --card: #2c2a2b;
        --text: #f1eee6;
        --muted: #b3ad9d;
        --line: #3d3a3a;
        --ok-bg: #1f3a2a;
        --ok: #8fd3a8;
        --warn-bg: #3d3018;
        --warn: #f0c46c;
        --danger-bg: #43201e;
        --danger: #f2a49d;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body { min-height: 100dvh; overscroll-behavior-y: none; }

.app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 16px)
             calc(env(safe-area-inset-bottom) + 20px) calc(env(safe-area-inset-left) + 16px);
}

.splash { display: grid; place-items: center; min-height: 80dvh; }
.splash img { border-radius: 22px; }
.splash .logo { justify-self: center; margin-bottom: 8px; }

header.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
header.top img { width: 36px; height: 36px; border-radius: 10px; }
header.top .who { flex: 1; min-width: 0; }
header.top .who strong { display: block; font-size: 17px; }
header.top .who span { color: var(--muted); font-size: 13px; }

h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 17px; margin: 0 0 10px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.banner { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 15px; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

button {
    appearance: none; border: 0; cursor: pointer;
    font: inherit; font-weight: 600;
    border-radius: 14px; padding: 14px 18px; min-height: 48px;
    background: var(--line); color: var(--text);
    width: 100%;
    touch-action: manipulation;
}
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--ink); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--line); }
button.link { background: none; padding: 8px 0; min-height: 0; width: auto; color: var(--muted); font-weight: 500; text-decoration: underline; }
@media (prefers-color-scheme: dark) {
    button.primary { background: var(--sand); color: #1c1b1b; }
}

.stack { display: grid; gap: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row > button { flex: 0 0 auto; width: auto; }

label { display: block; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
input {
    width: 100%; font: inherit; font-size: 16px; color: var(--text);
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px; min-height: 48px;
}
input:focus, button:focus-visible { outline: 3px solid var(--sand); outline-offset: 1px; }
.error { color: var(--danger); font-size: 14px; margin-top: 6px; }
.hint { color: var(--muted); font-size: 13px; }

/* --- Einlass-Kopf ----------------------------------------------------------- */

.gate { display: flex; align-items: center; gap: 12px; }
.gate .name { flex: 1; min-width: 0; }
.gate .name small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.gate .name strong { display: block; font-size: 19px; line-height: 1.25; }
.gate .count { text-align: right; font-variant-numeric: tabular-nums; }
.gate .count strong { display: block; font-size: 24px; }
.gate .count span { color: var(--muted); font-size: 12px; }
.gate button { width: auto; min-height: 40px; padding: 8px 12px; font-size: 14px; }

.step { text-align: center; margin: 0 0 12px; }
.step small { display: block; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.step strong { font-size: 20px; }

/* --- Kamera ---------------------------------------------------------------- */

.camera {
    position: relative;
    aspect-ratio: 1 / 1;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: #111;
    margin-bottom: 14px;
}
.camera video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera .frame {
    position: absolute; inset: 16%;
    border: 3px solid rgba(255, 255, 255, .85);
    border-radius: 18px;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, .28);
    pointer-events: none;
}
.camera.busy .frame { border-color: var(--sand); }
.camera .overlay {
    position: absolute; inset: 0;
    display: grid; place-items: center; text-align: center;
    padding: 24px; color: #fff; background: rgba(0, 0, 0, .55);
}
.camera .overlay button { width: auto; }

/* --- Letzte Scans ------------------------------------------------------------ */

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.log li:first-child { border-top: 0; padding-top: 0; }
.log .dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; align-self: center; }
.log .dot.valid { background: var(--flash-ok); }
.log .dot.invalid { background: var(--flash-bad); }
.log .dot.unchecked, .log .dot.error { background: var(--flash-warn); }
.log .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log time { color: var(--muted); font-variant-numeric: tabular-nums; }

details summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
details[open] summary { margin-bottom: 10px; }

/* --- Vollbild-Farbblitz (Ergebnis) --------------------------------------------- */

.flash {
    position: fixed; inset: 0; z-index: 50;
    display: grid; place-items: center; align-content: center; gap: 10px;
    padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px);
    text-align: center; color: #fff;
    animation: flash-in .12s ease-out;
}
.flash[hidden] { display: none; }
.flash.valid { background: var(--flash-ok); }
.flash.invalid { background: var(--flash-bad); }
.flash.unchecked, .flash.error { background: var(--flash-warn); }
.flash.scanner { background: var(--ink); }
.flash svg { width: 120px; height: 120px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.flash .title { font-size: 34px; font-weight: 700; line-height: 1.15; }
.flash .holder { font-size: 24px; font-weight: 600; }
.flash .detail { font-size: 17px; opacity: .92; max-width: 420px; }
.flash .tap { font-size: 14px; opacity: .8; margin-top: 12px; }

@keyframes flash-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
