/* ============================================================
   Lavendel-Design.  Farben oben anpassbar.
   ============================================================ */
:root {
    --bg:        #faf5ee;   /* Hintergrund bleibt warm/creme */
    --karte:     #ffffff;
    --ink:       #3c3147;
    --muted:     #9a8fa6;
    --lav:       #d7b5ff;   /* Pastell-Lavendel (Basis) */
    --lav-soft:  #efe2ff;   /* helle Abstufung */
    --lav-line:  #e7d8f7;
    --lav-deep:  #9d6fd6;   /* Knöpfe / aktive Elemente */
    --lav-deeper:#6f44ad;   /* Überschriften / Akzenttext */
    --heart:     #db5a9d;   /* Like-Herz */
    --schatten:  0 10px 30px rgba(110, 68, 173, 0.12);
    --schatten-s:0 4px 14px rgba(110, 68, 173, 0.10);
}
* { box-sizing: border-box; }
/* Muss über allen display-Regeln stehen: sonst bleibt z. B. die Polaroid-Wand
   sichtbar, obwohl hidden gesetzt ist (display:flex schlägt die Browserregel). */
[hidden] { display: none !important; }
body {
    margin: 0;
    font-family: 'Mulish', system-ui, sans-serif;
    color: var(--ink);
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% -5%, rgba(215,181,255,0.22), transparent 42%),
        radial-gradient(circle at 100% 110%, rgba(215,181,255,0.18), transparent 45%);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
.huelle {
    max-width: 1080px; margin: 0 auto;
    padding-top: 18px; padding-bottom: 64px;
    padding-left:  max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
}
@media (min-width: 1500px) { .huelle { max-width: 1320px; } }

/* ---------- Kopf (kompakt) ---------- */
.kopf { text-align: center; margin: 10px 0 16px; }
.logo {
    font-family: 'Cormorant Garamond', serif; font-weight: 600;
    font-size: clamp(2rem, 6vw, 3rem); margin: 0; line-height: 1.05; color: var(--ink);
}
.untertitel {
    font-family: 'Cormorant Garamond', serif; font-style: italic;
    font-size: 1.1rem; color: var(--lav-deeper); margin: 4px 0 0;
}

/* ---------- Karten / Formulare ---------- */
.karte {
    background: var(--karte); max-width: 440px; margin: 0 auto;
    padding: 30px 26px; border-radius: 20px; box-shadow: var(--schatten);
    border: 1px solid var(--lav-line);
}
.karte h2 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.8rem; margin: 0 0 6px; text-align: center; }
.hinweis { color: var(--muted); text-align: center; margin: 0 0 20px; font-size: 0.95rem; }
.formular { display: flex; flex-direction: column; gap: 8px; }
.formular label { font-weight: 600; font-size: 0.86rem; margin-top: 8px; }
.formular input {
    font-family: inherit; font-size: 1.05rem; padding: 13px 15px;
    border: 1px solid var(--lav-line); border-radius: 12px; background: #fdfbff; color: var(--ink);
}
.formular input:focus { outline: none; border-color: var(--lav-deep); box-shadow: 0 0 0 3px rgba(157,111,214,0.18); }

/* ---------- Knöpfe ---------- */
.knopf {
    display: inline-block; text-align: center; font-family: inherit;
    font-size: 1rem; font-weight: 700; color: #fff; background: var(--lav-deep);
    border: none; padding: 14px 24px; border-radius: 12px; cursor: pointer;
    text-decoration: none; transition: transform .15s, background .2s; box-shadow: var(--schatten-s);
}
.knopf:hover { background: var(--lav-deeper); transform: translateY(-2px); }
.knopf-rand { color: var(--lav-deeper); background: var(--lav-soft); box-shadow: none; }
.knopf-rand:hover { background: #e4d2fb; }

/* ---------- Meldungen ---------- */
.meldung { max-width: 560px; margin: 0 auto 18px; padding: 13px 18px; border-radius: 12px; text-align: center; font-size: 0.95rem; }
.meldung.ok     { background: var(--lav-soft); color: var(--lav-deeper); border: 1px solid var(--lav-line); }
.meldung.fehler { background: #fbecea; color: #9a4b3f; border: 1px solid #f0d2cc; }

/* ---------- Reiter ---------- */
.reiter { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 4px 0 20px; }
.reiter a {
    text-decoration: none; font-weight: 600; font-size: 0.92rem; color: var(--lav-deeper);
    background: var(--karte); border: 1px solid var(--lav-line); padding: 8px 16px;
    border-radius: 999px; transition: all .15s;
}
.reiter a:hover { background: var(--lav-soft); }
.reiter a.aktiv { background: var(--lav-deep); color: #fff; border-color: var(--lav-deep); box-shadow: var(--schatten-s); }

/* ---------- Upload-Block ---------- */
.upload-block { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }
.hochladen-knopf {
    font-family: inherit; font-size: 1.05rem; font-weight: 700; color: #fff;
    background: var(--lav-deep); border: none; padding: 14px 28px; border-radius: 14px;
    cursor: pointer; box-shadow: var(--schatten); transition: transform .15s, background .2s;
}
.hochladen-knopf:hover { background: var(--lav-deeper); transform: translateY(-2px); }
.upload-kat { color: var(--muted); font-size: 0.9rem; }
.versteckt { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }

/* ---------- Abschnittstitel ---------- */
.abschnitt {
    font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 1.5rem;
    text-align: center; margin: 26px 0 14px; color: var(--ink);
}
.leer { text-align: center; color: var(--muted); padding: 30px 16px; font-size: 1.05rem; }

/* ---------- Kacheln (gemeinsam) ---------- */
.kachel { position: relative; margin: 0; border-radius: 14px; overflow: hidden; background: var(--karte); box-shadow: var(--schatten-s); }
.kachel img { display: block; width: 100%; image-orientation: from-image; cursor: zoom-in; }
.kachel.q { aspect-ratio: 1 / 1; }
.kachel.q img { width: 100%; height: 100%; object-fit: cover; }
.heic { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 120px; background: var(--lav-soft); text-decoration: none; }
.heic span { font-size: 2rem; }

/* Namensflagge unten links */
.namensflag {
    position: absolute; left: 8px; bottom: 8px; max-width: 70%;
    background: rgba(111,68,173,0.82); color: #fff; font-size: 0.75rem; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(2px);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Like-Knopf unten rechts */
.like {
    position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.9); border: none; border-radius: 999px; padding: 5px 9px;
    cursor: pointer; font-family: inherit; font-size: 0.78rem; font-weight: 700; color: var(--muted);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12); transition: transform .1s;
}
.like:hover { transform: scale(1.06); }
.like:active { transform: scale(0.94); }
.like svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 2; }
.like.aktiv { color: var(--heart); }
.like.aktiv svg { fill: var(--heart); stroke: var(--heart); }

/* ---------- Raster (Kategorie, quadratisch) ---------- */
.raster {
    display: grid; gap: clamp(8px, 1.4vw, 14px);
    grid-template-columns: repeat(auto-fill, minmax(clamp(100px, 22vw, 170px), 1fr));
}
.highlights {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(8px, 1.4vw, 14px); margin: 0 auto 6px; max-width: 760px;
}
.highlights .kachel { box-shadow: var(--schatten); border: 2px solid var(--lav); }

/* ---------- Kollage (Gesamt, frei/masonry) ---------- */
.kollage { column-width: clamp(150px, 19vw, 240px); column-gap: clamp(8px, 1.2vw, 12px); }
.kollage .kachel { margin-bottom: clamp(8px, 1.2vw, 12px); }
.kollage .kachel { break-inside: avoid; margin-bottom: 12px; }

/* ---------- Auswahl-Dialog ---------- */
.wahl { position: fixed; inset: 0; background: rgba(60,49,71,0.5); display: none; align-items: flex-end; justify-content: center; z-index: 200; }
.wahl.offen { display: flex; }
.wahl-box { background: var(--karte); width: 100%; max-width: 460px; border-radius: 20px 20px 0 0; padding: 24px 22px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -10px 40px rgba(0,0,0,0.2); }
.wahl-box h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; text-align: center; margin: 0 0 6px; }
.abbrechen { background: none; border: none; color: var(--muted); font-family: inherit; font-size: 0.95rem; padding: 8px; cursor: pointer; }
@media (min-width: 560px) { .wahl { align-items: center; } .wahl-box { border-radius: 20px; } }

/* ---------- Lade-Overlay ---------- */
.lade-overlay { position: fixed; inset: 0; background: rgba(250,245,238,0.85); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 300; color: var(--lav-deeper); }
.lade-overlay.offen { display: flex; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--lav-soft); border-top-color: var(--lav-deep); border-radius: 50%; animation: dreh 0.9s linear infinite; }
@keyframes dreh { to { transform: rotate(360deg); } }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(45,35,55,0.93); display: none; align-items: center; justify-content: center; flex-direction: column; gap: 12px; z-index: 400; padding: 24px; }
.lightbox.offen { display: flex; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 10px; image-orientation: from-image; }
@supports (height: 100dvh) { .lightbox img { max-height: 82dvh; } }
.lightbox p { color: #f3ecff; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 1.3rem; margin: 0; }
.lightbox-zu { position: absolute; top: 16px; right: 22px; background: none; border: none; color: #fff; font-size: 2.4rem; cursor: pointer; }

/* ---------- Verwaltung ---------- */
.admin-leiste { text-align: center; color: var(--muted); background: var(--karte); border: 1px solid var(--lav-line); border-radius: 12px; padding: 12px; margin-bottom: 20px; }
.admin-leiste a { color: var(--lav-deeper); }
.admin-aktionen { position: absolute; top: 8px; right: 8px; left: 8px; display: flex; gap: 6px; justify-content: flex-end; }
.mini { font-family: inherit; font-size: 0.8rem; font-weight: 700; padding: 7px 10px; border-radius: 9px; border: none; background: rgba(255,255,255,0.92); color: var(--ink); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.mini.gut { background: var(--lav-deep); color: #fff; }
.mini.schlecht { background: #f6dcd6; color: #9a4b3f; }
.admin-leiste .mini { box-shadow: none; }

/* ---------- QR-Seite ---------- */
.qr-bereich { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.qr-karte { background: var(--karte); border: 1px solid var(--lav-line); border-radius: 18px; padding: 22px; text-align: center; box-shadow: var(--schatten-s); }
.qr-karte h3 { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; margin: 0 0 14px; color: var(--lav-deeper); }
.qr-bild { display: flex; justify-content: center; }
.qr-bild img, .qr-bild canvas { border-radius: 10px; }
.qr-url { font-size: 0.7rem; color: var(--muted); word-break: break-all; margin: 12px 0 0; }

/* ---------- Fuß ---------- */
.fuss { text-align: center; margin-top: 50px; color: var(--muted); font-family: 'Cormorant Garamond', serif; }
.fuss .flourish { color: var(--lav); font-size: 1.4rem; display: block; }
.fuss p { font-style: italic; font-size: 1.15rem; margin: 4px 0 0; }

/* ---------- Handy ---------- */
@media (max-width: 560px) {
    .huelle { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
    .karte { padding: 26px 20px; }
}

/* ---------- Druck (für QR-Codes) ---------- */
@media print {
    body { background: #fff; }
    .reiter, .admin-leiste, .fuss, .untertitel { display: none; }
    .qr-karte { break-inside: avoid; border: 1px solid #ccc; box-shadow: none; }
}

/* ---------- Kopf-Banner mit floralen Ranken ---------- */
.kopf-banner { display: flex; align-items: center; justify-content: center; gap: 0; margin-bottom: 6px; flex-wrap: nowrap; }
.sprig { flex: 0 0 auto; line-height: 0; }
.sprig svg { width: clamp(72px, 17vw, 150px); height: auto; display: block; }
.sprig.links { transform: scaleX(-1); }
.deko { flex: 1 1 0; line-height: 0; min-width: 0; max-width: 310px; }
.deko img { width: 100%; height: auto; display: block; }

/* ---------- Rundes Paar-Bild im Kopf ---------- */
.paar-bild {
    flex: 0 0 auto; position: relative; z-index: 2;
    width: clamp(96px, 26vw, 140px); aspect-ratio: 1/1; margin: 0 -12px;
    border-radius: 50%; overflow: hidden; border: 4px solid #fff; box-shadow: var(--schatten);
}
.paar-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 560px) { .kopf-banner { gap: 0; } }

/* ---------- Runde Kategorie-Navigation ---------- */
.kat-nav { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 6px 0 22px; }
.kat-kreis-link { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 6px; width: clamp(62px, 17vw, 92px); }
.kat-kreis {
    width: 100%; aspect-ratio: 1 / 1; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid var(--lav-line); box-shadow: var(--schatten-s); transition: all .15s;
}
.kat-kreis img { width: 100%; height: 100%; object-fit: cover; }
.kat-kreis.platzhalter { background: var(--lav-soft); color: var(--lav-deeper); font-family: 'Cormorant Garamond', serif; font-size: 1.8rem; font-weight: 600; }
.kat-kreis.platzhalter svg { width: 26px; height: 26px; fill: var(--lav-deep); }
.kat-kreis-link.aktiv .kat-kreis { border: 3px solid var(--lav-deep); box-shadow: 0 0 0 3px var(--lav-soft); }
.kat-label { font-size: 0.82rem; font-weight: 600; color: var(--ink); text-align: center; }
.kat-kreis-link.aktiv .kat-label { color: var(--lav-deeper); }

/* ---------- Upload als erste Kachel ---------- */
.kachel.upload {
    aspect-ratio: 1/1; border: 2px dashed var(--lav-deep); background: var(--lav-soft);
    color: var(--lav-deeper); display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; cursor: pointer; font-family: inherit; box-shadow: none;
}
.kachel.upload:hover { background: #e6d6fb; }
.kachel.upload .plus { font-size: 2.4rem; line-height: 1; font-weight: 300; }
.kachel.upload .upload-text { font-size: 0.85rem; font-weight: 700; }

/* ---------- "Ohne Namen"-Textknopf ---------- */
.textknopf { background: none; border: none; color: var(--muted); font-family: inherit; font-size: 0.9rem; padding: 6px; margin-top: 2px; cursor: pointer; text-decoration: underline; }
.textknopf:hover { color: var(--lav-deeper); }

/* ---------- Lightbox-Pfeile ---------- */
.lb-pfeil {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.16); border: none; color: #fff; font-size: 2.4rem; line-height: 1;
    width: 48px; height: 48px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lb-pfeil:hover { background: rgba(255,255,255,0.28); }
.lb-pfeil.prev { left: 14px; }
.lb-pfeil.next { right: 14px; }
@media (max-width: 560px) { .lb-pfeil { width: 40px; height: 40px; font-size: 2rem; } }

/* ---------- Ansicht-Umschalter (Gesamt) ---------- */
.ansicht-schalter { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 2px 0 10px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.schieber { position: absolute; inset: 0; background: #d9cfe6; border-radius: 999px; transition: .25s; cursor: pointer; }
.schieber::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .schieber { background: var(--lav-deep); }
.switch input:checked + .schieber::before { transform: translateX(20px); }

/* ---------- Polaroid-Kollage ---------- */
.pol-wand { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0; padding: 30px 14px; transition: opacity 1s ease; min-height: 320px; }
.polaroid { position: relative; background: #fff; padding: 9px 9px 8px; border-radius: 3px; box-shadow: 0 8px 22px rgba(60,49,71,.20); margin: -7px; }
.pol-bild { width: 162px; }
.polaroid.s .pol-bild { width: 132px; }
.polaroid.m .pol-bild { width: 164px; }
.polaroid.l .pol-bild { width: 198px; }
.pol-bild img { width: 100%; height: auto; display: block; image-orientation: from-image; }
.polaroid figcaption { text-align: center; margin-top: 7px; }
.pol-name { display: block; font-family: 'Caveat', cursive; font-size: 1.45rem; color: #5b5165; line-height: 1.05; }
.pol-kat  { display: block; font-family: 'Times New Roman', Times, serif; font-size: 0.78rem; color: #9a8fa6; letter-spacing: .4px; margin-top: 1px; }
.pol-herz { width: 15px; height: 15px; display: inline-block; vertical-align: middle; }
@media (max-width: 560px) {
    .pol-wand { padding: 12px 0; }
    .polaroid { padding: 7px 7px 6px; margin: -6px; }
    .pol-bild { width: 116px; }
    .polaroid.s .pol-bild { width: 96px; }
    .polaroid.m .pol-bild { width: 118px; }
    .polaroid.l .pol-bild { width: 145px; }
    .pol-name { font-size: 1.05rem; }
    .pol-kat  { font-size: 0.66rem; }
    .pol-herz { width: 13px; height: 13px; }
}

/* ---------- Hinweis zur Polaroid-Collage ---------- */
.pol-hinweis { text-align: center; color: var(--muted); font-size: 0.85rem; font-style: italic; margin: 0 auto 10px; max-width: 460px; }

/* ---------- Download-Knopf ---------- */
.download-leiste { display: flex; justify-content: center; margin: -8px 0 20px; }
.download-knopf { display: inline-flex; align-items: center; gap: 9px; padding: 11px 24px; font-size: 0.95rem; }
.download-knopf svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl-form { display: none; }
.dl-hinweis { margin: 4px 0 0; font-size: 0.85rem; }

/* ---------- Auswahl-Modus (Bilder anhaken) ---------- */
.haken { display: none; position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.92); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.18); z-index: 3; }
.haken::after { content: "\2713"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; font-weight: 700; color: transparent; }
body.auswahl-modus .haken { display: block; }
body.auswahl-modus .kachel, body.auswahl-modus .kachel img { cursor: pointer; }
body.auswahl-modus .like, body.auswahl-modus .heic { pointer-events: none; }
body.auswahl-modus .huelle { padding-bottom: 130px; }
@media (max-width: 560px) { body.auswahl-modus .huelle { padding-bottom: 175px; } }
.kachel.gewaehlt { outline: 3px solid var(--lav-deep); outline-offset: -3px; }
.kachel.gewaehlt img { opacity: 0.82; }
.kachel.gewaehlt .haken { background: var(--lav-deep); }
.kachel.gewaehlt .haken::after { color: #fff; }

/* Leiste am unteren Rand während der Auswahl */
.auswahl-leiste { position: fixed; left: 0; right: 0; bottom: 0; z-index: 250; display: none; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; background: var(--karte); border-top: 1px solid var(--lav-line); box-shadow: 0 -6px 24px rgba(110,68,173,0.14); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
.auswahl-leiste.offen { display: flex; }
.auswahl-zahl { font-weight: 700; font-size: 0.9rem; color: var(--lav-deeper); margin-right: 4px; }
.auswahl-leiste .mini { padding: 10px 16px; font-size: 0.88rem; background: var(--lav-soft); color: var(--lav-deeper); box-shadow: none; }
.auswahl-leiste .mini.gut { background: var(--lav-deep); color: #fff; }
.auswahl-leiste .mini:disabled { opacity: 0.45; cursor: default; }

/* ---------- Download in der Großansicht ---------- */
.lightbox-dl { position: absolute; top: 18px; right: 74px; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,0.16); display: flex; align-items: center; justify-content: center; color: #fff; text-decoration: none; }
.lightbox-dl:hover { background: rgba(255,255,255,0.3); }
.lightbox-dl[hidden] { display: none; }
.lightbox-dl svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 560px) { .lightbox-dl { top: 14px; right: 62px; width: 38px; height: 38px; } }

/* ---------- Verwaltung: verborgene Fotos ---------- */
.kachel.ist-verborgen img { filter: grayscale(1); opacity: 0.5; }
.kachel.ist-verborgen::after {
    content: "verborgen"; position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%);
    text-align: center; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.5px;
    color: var(--lav-deeper); background: rgba(255,255,255,0.85); padding: 5px 0; pointer-events: none;
}

/* ============================================================
   Anpassung an Bildschirmgröße, Ausrichtung und Eingabeart
   ============================================================ */

/* Nie über den Rand hinaus */
img, svg, video { max-width: 100%; }
.huelle { overflow-wrap: break-word; }

/* Handy im Querformat: der Kopf darf nicht den halben Schirm fressen */
@media (orientation: landscape) and (max-height: 520px) {
    .huelle { padding-top: 8px; }
    .kopf { margin: 4px 0 10px; }
    .paar-bild { width: 76px; height: 76px; }
    .deko { max-width: 170px; }
    .sprig svg { width: clamp(56px, 12vw, 110px); }
    .logo { font-size: clamp(1.5rem, 4.5vw, 2.2rem); }
    .untertitel { font-size: 0.95rem; }
    .lightbox img { max-height: 74vh; }
    .lightbox p { display: none; }
}

/* Auf Touch-Geräten dürfen Knöpfe nicht kleiner als ein Daumen sein */
@media (hover: none) and (pointer: coarse) {
    .knopf, .mini, .textknopf, .abbrechen { min-height: 44px; }
    .like { min-width: 40px; min-height: 32px; }
    a, button { -webkit-tap-highlight-color: rgba(157, 111, 214, 0.25); }
    .kachel img { cursor: default; }
}

/* Wer Animationen reduziert haben möchte, bekommt keine */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important; scroll-behavior: auto !important;
    }
    .knopf:hover, .like:hover, .hochladen-knopf:hover { transform: none; }
    .pol-wand { transition: none; }
}

/* Verwaltung: die Aktionsknöpfe müssen auch auf schmalen Kacheln passen */
.admin-aktionen { flex-wrap: wrap; gap: 4px; }
.admin-aktionen .mini { font-size: clamp(0.68rem, 1.7vw, 0.8rem); padding: 6px 8px; }
@media (max-width: 560px) {
    .admin-aktionen { top: 5px; right: 5px; left: 5px; }
    .admin-aktionen .mini { padding: 5px 7px; }
}

/* Auswahl-Leiste: bei vielen Knöpfen sauber umbrechen statt überlaufen */
.auswahl-leiste { max-width: 100%; }
.auswahl-leiste > * { flex: 0 0 auto; }
@media (max-width: 560px) {
    .auswahl-leiste { gap: 6px; padding-left: 8px; padding-right: 8px; }
    .auswahl-leiste .mini { padding: 9px 12px; font-size: 0.84rem; }
    .auswahl-zahl { flex: 1 0 100%; text-align: center; margin: 0 0 2px; }
}

/* Im Auswahl-Modus stören die Knöpfe auf den Kacheln – der Haken sitzt an ihrer Stelle */
body.auswahl-modus .admin-aktionen { display: none; }

/* Hinweis, an wen man sich wenden kann */
.loesch-hinweis { max-width: 520px; margin: -8px auto 18px; font-size: 0.88rem; }
.loesch-hinweis strong { color: var(--lav-deeper); }

/* ============================================================
   Videos, Zoom, Download-Auswahl, Hochlade-Fortschritt
   ============================================================ */

/* Videos in den Kacheln */
.video-marke {
    position: absolute; top: 8px; left: 8px; z-index: 2; pointer-events: none;
    background: rgba(45, 35, 55, 0.72); color: #fff; font-size: 0.74rem; font-weight: 700;
    padding: 3px 8px; border-radius: 999px; letter-spacing: 0.3px;
}
.medien-platzhalter {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 120px;
    background: linear-gradient(135deg, var(--lav-soft), #e4d2fb); cursor: pointer; font-size: 2.2rem;
}
.kachel.m .medien-platzhalter { aspect-ratio: 4 / 3; height: auto; }

/* Großansicht: Bühne, Zoom, Video */
.lightbox { overflow: hidden; touch-action: none; }
.lb-buehne { display: flex; align-items: center; justify-content: center; max-width: 100%; }
#lightboxBild {
    touch-action: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
    transform-origin: center center; cursor: zoom-in; will-change: transform;
}
.lightbox.gezoomt #lightboxBild { cursor: grab; }
.lightbox.gezoomt #lightboxBild:active { cursor: grabbing; }
.lightbox.gezoomt #lightboxName { visibility: hidden; }
#lightboxVideo { max-width: 92vw; max-height: 82vh; border-radius: 10px; background: #000; touch-action: manipulation; }
@supports (height: 100dvh) { #lightboxVideo { max-height: 82dvh; } }
.lightbox-zu, .lb-pfeil, .lb-dl-wrap { z-index: 5; }
.lightbox p.lb-lade {
    position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 5;
    font-family: inherit; font-style: normal; font-size: 0.88rem; color: #fff;
    background: rgba(0, 0, 0, 0.5); padding: 4px 12px; border-radius: 999px;
}

/* Download-Knopf mit Auswahl in der Großansicht */
.lb-dl-wrap { position: absolute; top: 18px; right: 74px; }
.lb-dl-wrap .lightbox-dl { position: static; border: none; cursor: pointer; font: inherit; }
.lb-dl-menue {
    position: absolute; top: 50px; right: 0; min-width: 220px; display: flex; flex-direction: column;
    background: var(--karte); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); padding: 6px;
}
.lb-dl-menue a {
    display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px;
    color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.95rem;
}
.lb-dl-menue a small { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.lb-dl-menue a:hover, .lb-dl-menue a:focus-visible { background: var(--lav-soft); outline: none; }
@media (max-width: 560px) { .lb-dl-wrap { top: 14px; right: 62px; } }

/* Qualität im Download-Dialog */
.qualitaet { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 4px; }
.qualitaet label { position: relative; cursor: pointer; }
.qualitaet input { position: absolute; opacity: 0; pointer-events: none; }
.qualitaet span {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
    padding: 10px 8px; border: 2px solid var(--lav-line); border-radius: 12px; font-size: 0.92rem;
}
.qualitaet small { color: var(--muted); font-size: 0.76rem; }
.qualitaet input:checked + span { border-color: var(--lav-deep); background: var(--lav-soft); color: var(--lav-deeper); }
.qualitaet input:focus-visible + span { outline: 3px solid rgba(157, 111, 214, 0.35); }

/* Fortschritt beim Hochladen und in der Verwaltung */
.fortschritt { width: min(320px, 80vw); height: 8px; background: var(--lav-soft); border-radius: 999px; overflow: hidden; }
.fortschritt span { display: block; height: 100%; width: 0; background: var(--lav-deep); border-radius: 999px; transition: width 0.2s; }
.lade-detail { max-width: 90vw; white-space: pre-line; text-align: center; font-size: 0.9rem; color: #9a4b3f; margin: 0; }
.lade-overlay.mit-fehler .spinner, .lade-overlay.mit-fehler .fortschritt { display: none; }

.vorschau-status { background: var(--karte); border: 1px solid var(--lav-line); border-radius: 12px; padding: 12px 16px; margin: 0 0 20px; }
.vorschau-status p { margin: 0 0 8px; }
.vorschau-status .fortschritt { width: 100%; }
.vs-klein { color: var(--muted); font-size: 0.85rem; }
.vorschau-status .vs-technik { text-align: left; font-size: 0.78rem; margin: 8px 0 0; }
