/* party – Oberfläche für Gäste und Verwaltung.
   Mobil zuerst; getestet gegen die Eigenheiten von Safari auf dem iPhone. */

:root {
    --accent: #c2412f;
    --accent-2: #e8a33d;

    --bg: #f6f6f8;
    --surface: #ffffff;
    --surface-2: #f1f1f4;
    --ink: #16161a;
    --muted: #6c6c78;
    --line: #e3e3e9;
    --danger: #c0392b;
    --ok: #2e7d4f;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(20,20,30,.05), 0 8px 24px rgba(20,20,30,.07);

    /* Randabstände für Geräte mit Aussparung (iPhone). */
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101014;
        --surface: #1a1a21;
        --surface-2: #23232c;
        --ink: #f2f2f5;
        --muted: #9c9caa;
        --line: #2e2e39;
        --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    }
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 14px; }

/* ------------------------------------------------------------- Kopfzeile */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    padding-top: var(--safe-t);
}

.topbar-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
}

.topbar h1 { font-size: 1.05rem; font-weight: 700; margin: 0; flex: 1; min-width: 0;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { font-size: .78rem; color: var(--muted); font-weight: 500; }

.dot {
    width: 34px; height: 34px; flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid; place-items: center;
    color: #fff;
}
.dot svg { width: 19px; height: 19px; }

/* ------------------------------------------------------------- Bausteine */

.card-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

/* Nur senkrecht setzen – die Kurzform würde den seitlichen Abstand
   aus .wrap überschreiben und den Inhalt an den Bildschirmrand kleben. */
.page {
    padding-top: 20px;
    padding-bottom: calc(40px + var(--safe-b));
}

.hero { padding: 26px 0 18px; }
.hero h1 { font-size: clamp(1.55rem, 6vw, 2.1rem); }
.hero .date { color: var(--accent); font-weight: 700; font-size: .95rem; }

.big-emoji { font-size: 2.6rem; line-height: 1; margin-bottom: 10px; }

/* -------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font: inherit;
    font-weight: 650;
    line-height: 1;
    padding: 15px 22px;
    min-height: 52px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: transform .07s ease, filter .15s ease;
    touch-action: manipulation;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }

.btn-block { width: 100%; }

.btn-ghost {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
}
.btn-quiet {
    background: var(--surface-2);
    color: var(--ink);
    border-color: transparent;
    min-height: 44px;
    padding: 11px 16px;
    font-size: .9rem;
}
.btn-danger { background: var(--danger); }

/* Große Aufnahmetaste auf der Eventseite. */
.upload-cta {
    display: block;
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    padding: 26px 20px;
    text-align: center;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 32%, transparent);
    cursor: pointer;
    border: 0;
    font: inherit;
}
.upload-cta .icon { width: 42px; height: 42px; margin: 0 auto 10px; display: block; }
.upload-cta .t { display: block; font-size: 1.2rem; font-weight: 800; letter-spacing: -.01em; }
.upload-cta .s { display: block; font-size: .88rem; opacity: .92; margin-top: 4px; }
.upload-cta input[type=file] { display: none; }

/* -------------------------------------------------------------- Formular */

label.field { display: block; margin-bottom: 15px; }
label.field > .lab { display: block; font-size: .84rem; font-weight: 650; margin-bottom: 6px; }
label.field > .hint { display: block; font-size: .8rem; color: var(--muted); margin-top: 5px; }

input[type=text], input[type=password], input[type=date], input[type=number],
select, textarea {
    width: 100%;
    /* 16px verhindert das automatische Hineinzoomen von Safari auf dem iPhone. */
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 13px 14px;
    min-height: 50px;
    -webkit-appearance: none;
    appearance: none;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.code-input {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 21px !important;
    letter-spacing: .2em;
    text-align: center;
    text-transform: uppercase;
    font-weight: 700;
}

.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.check .lab { font-weight: 600; font-size: .92rem; }
.check .hint { font-size: .8rem; color: var(--muted); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 190px; min-width: 0; }

/* --------------------------------------------------------------- Meldung */

.note {
    border-radius: var(--radius-sm);
    padding: 13px 15px;
    font-size: .92rem;
    border: 1px solid;
    margin-bottom: 16px;
}
.note-error { background: color-mix(in srgb, var(--danger) 9%, var(--surface));
              border-color: color-mix(in srgb, var(--danger) 32%, transparent); color: var(--danger); }
.note-ok    { background: color-mix(in srgb, var(--ok) 10%, var(--surface));
              border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.note-info  { background: var(--surface-2); border-color: var(--line); color: var(--ink); }

/* --------------------------------------------------------------- Galerie */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 6px;
}
@media (min-width: 620px) {
    .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
}

.tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 11px;
    overflow: hidden;
    background: var(--surface-2);
    border: 0;
    padding: 0;
    cursor: pointer;
    display: block;
}
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.is-hidden img { opacity: .35; filter: grayscale(1); }

.tile .who {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 16px 7px 5px;
    font-size: .68rem;
    color: #fff;
    text-align: left;
    background: linear-gradient(transparent, rgba(0,0,0,.62));
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile .flag {
    position: absolute; top: 5px; right: 5px;
    background: rgba(0,0,0,.6); color: #fff;
    font-size: .62rem; font-weight: 700;
    padding: 2px 6px; border-radius: 20px;
}

.empty {
    text-align: center;
    padding: 44px 20px;
    color: var(--muted);
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
}

/* --------------------------------------------------------------- Ansicht */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(8,8,12,.94);
    display: none;
    flex-direction: column;
}
.lightbox.open { display: flex; }
.lightbox-bar {
    display: flex; align-items: center; gap: 10px;
    padding: calc(10px + var(--safe-t)) 12px 10px;
    color: #fff;
}
.lightbox-bar .meta { flex: 1; min-width: 0; font-size: .84rem; opacity: .85;
                      overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-bar button, .lightbox-bar a {
    background: rgba(255,255,255,.14); color: #fff; border: 0;
    border-radius: 9px; padding: 9px 13px; font: inherit; font-size: .85rem;
    font-weight: 600; cursor: pointer; text-decoration: none;
}
/* Zentriert per Flexbox, nicht per Raster: eine Rasterzeile mit `auto` wächst
   erst auf die natürliche Bildhöhe (Webansicht bis 2560 px). `max-height: 100%`
   am Bild bezog sich dann auf genau diese gewachsene Zeile und begrenzte
   nichts mehr. Auf schmalen Handybildschirmen fiel das nicht auf, weil schon
   `max-width` das Bild klein genug rechnete – auf breiten Bildschirmen lief
   ein hochkant aufgenommenes Foto unten aus dem Fenster. Die Flexbox hat eine
   feste Höhe, die Prozentangabe greift dort. */
.lightbox-img {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px calc(14px + var(--safe-b));
    min-height: 0;
}
.lightbox-img img { max-width: 100%; max-height: 100%; width: auto; height: auto;
                    object-fit: contain; border-radius: 8px; }

.lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 46px; height: 46px; border-radius: 50%;
    background: rgba(255,255,255,.16); color: #fff; border: 0;
    font-size: 22px; cursor: pointer; display: grid; place-items: center;
}
.lb-prev { left: 10px; }
.lb-next { right: 10px; }

/* --------------------------------------------------- QR-Code im Vollbild */

/* Zum Weitergeben: das Handy hinhalten, der andere scannt. Der Code sitzt auf
   weißem Grund, auch im dunklen Erscheinungsbild – ein invertierter QR-Code
   wird von vielen Kamera-Apps nicht erkannt. */
.qr-full {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: calc(20px + var(--safe-t)) 20px calc(20px + var(--safe-b));
    background: rgba(8,8,12,.95);
    cursor: pointer;
}
.qr-full.open { display: flex; }

.qr-card {
    /* Quadratisch und in jeder Lage im Bild – min() greift den knappsten Wert
       ab, egal ob hoch- oder quergehalten. */
    width: min(78vw, 58vh, 420px);
    flex: 0 0 auto;
    background: #fff;
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.qr-card svg { width: 100%; height: auto; display: block; }

.qr-note { text-align: center; color: #fff; max-width: 340px; }
.qr-note strong { display: block; font-size: 1.05rem; font-weight: 700; }
.qr-note span { display: block; font-size: .88rem; opacity: .78; margin-top: 4px; }
.qr-note .qr-close-hint { font-size: .8rem; opacity: .55; margin-top: 12px; }

/* ------------------------------------------------------------ Fortschritt */

.progress {
    display: none;
    margin-top: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}
.progress.on { display: block; }
.progress .bar { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 9px; }
.progress .bar i { display: block; height: 100%; width: 0;
                   background: linear-gradient(90deg, var(--accent), var(--accent-2));
                   transition: width .2s ease; }

/* ----------------------------------------------------------------- Liste */

.list { display: grid; gap: 10px; }

.item {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 17px;
    text-decoration: none;
    color: inherit;
}
.item .grow { flex: 1; min-width: 0; }
.item .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: .82rem; color: var(--muted); }
.item .chev { color: var(--muted); flex: 0 0 auto; }

.pill {
    display: inline-block;
    font-size: .72rem; font-weight: 700;
    padding: 3px 9px; border-radius: 20px;
    background: var(--surface-2); color: var(--muted);
}
.pill-live { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill-off  { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.code-chip {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-weight: 700;
    background: var(--surface-2);
    border-radius: 7px;
    padding: 3px 8px;
    font-size: .85rem;
    display: inline-block;
}

/* Speicheranzeige in der Verwaltung. */
.meter { height: 9px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--accent-2)); }
.meter.warn i { background: linear-gradient(90deg, var(--accent-2), var(--danger)); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { text-align: center; }
.stat .n { font-size: 1.25rem; font-weight: 800; }
.stat .l { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.spacer { flex: 1; }

.section-title {
    font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .09em; color: var(--muted);
    margin: 26px 0 10px;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* Kachel für ein Foto, zu dem kein Vorschaubild erzeugt werden konnte. */
.ohne-vorschau {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 8px;
    text-align: center;
    font-size: .72rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-2);
}

/* Verknüpftes Album auf der Gastseite – bewusst groß und offensichtlich,
   damit auch weniger technikaffine Gäste erkennen, dass es weitergeht. */
.album-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
}
.album-link:active { transform: scale(.995); }

.album-icon {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
}
.album-icon svg { width: 22px; height: 22px; }

.album-text { flex: 1; min-width: 0; }
.album-name { display: block; font-weight: 700; font-size: 1.02rem;
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-meta { display: block; font-size: .84rem; color: var(--muted); margin-top: 2px; }

.album-chev { flex: 0 0 auto; color: var(--muted); }
.album-chev svg { width: 20px; height: 20px; }

/* Passwortfeld mit Anzeigen-Schalter. */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 96px; }
.pw-toggle {
    position: absolute;
    right: 6px; top: 50%;
    transform: translateY(-50%);
    font: inherit;
    font-size: .82rem;
    font-weight: 650;
    color: var(--accent);
    background: var(--surface-2);
    border: 0;
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
}

/* Zeile mit Link und Kopier-Knopf. */
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row input {
    flex: 1; min-width: 0;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 14px;
    background: var(--surface-2);
}
.copy-row .btn { flex: 0 0 auto; padding: 0 18px; min-height: 50px; }
.copy-ok { color: var(--ok); font-weight: 600; }
.copy-fehler { color: var(--danger); font-weight: 600; }

@media (max-width: 460px) {
    .copy-row { flex-direction: column; }
    .copy-row .btn { width: 100%; }
}
