:root {
    --bg: #0f0f0f;
    --fg: #f2f2f2;
    --muted: #999;
    --akzent: #e63946;
    --karte: #1c1c1c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }

/* --- Galerie-Seite: heller Hintergrund (Share-Link) --- */
.galerie-body {
    background: #fff;
    color: #111;
}
.galerie-body .galerie-kopf { border-bottom-color: #e5e5e5; }
.galerie-body .auswahl-info { color: #777; }

/* --- Galerie-Kopf --- */
.galerie-kopf {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #2a2a2a;
}
.galerie-kopf h1 { margin: 0; font-weight: 400; letter-spacing: .04em; }
.aktionen { display: flex; gap: .75rem; }

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: .6rem 1.1rem;
    background: var(--akzent);
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: .9rem;
    cursor: pointer;
}
.btn-sekundaer { background: #333; }

/* --- Foto-Grid (Masonry: Hoch- und Querformat behalten ihr Seitenverhaeltnis) --- */
.grid {
    column-width: 280px;
    column-gap: 6px;
    padding: 6px;
}
.kachel {
    position: relative;
    margin: 0 0 6px;
    overflow: hidden;
    background: #f0f0f0;
    break-inside: avoid;
}
.kachel img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .3s ease;
}
.kachel:hover img { transform: scale(1.04); }

.herz, .dl {
    position: absolute;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s, color .2s;
    text-decoration: none;
    font-size: 1rem;
}
.kachel:hover .herz, .kachel:hover .dl { opacity: 1; }
.herz { top: 8px; right: 8px; }
.herz.aktiv { opacity: 1; color: var(--akzent); }
.dl { top: 8px; left: 8px; }

/* --- Zentrierte Karten (Login/Passwort/Fehler) --- */
.zentriert {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.karte {
    background: var(--karte);
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 360px;
}
.karte h1 { margin-top: 0; font-weight: 400; }
.karte input[type="password"],
.karte input[type="text"] {
    width: 100%;
    padding: .7rem;
    margin: .5rem 0 1rem;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    color: var(--fg);
}
.fehler { color: var(--akzent); }

/* --- Admin --- */
.admin { padding: 2rem; max-width: 900px; margin: 0 auto; }
.admin h1 { font-weight: 400; }
.formular { display: flex; flex-direction: column; gap: .5rem; }
.formular label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
.formular input {
    padding: .6rem;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    color: var(--fg);
    margin-top: .25rem;
}
table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
th, td { text-align: left; padding: .6rem; border-bottom: 1px solid #2a2a2a; font-size: .9rem; }
th { color: var(--muted); font-weight: 500; }
.dateiliste { columns: 2; font-family: monospace; font-size: .85rem; color: var(--muted); }

/* --- Erweiterungen: Admin-Verwaltung, Logout, Ablauf --- */
.admin-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.admin .karte { max-width: none; margin-bottom: 1.5rem; }
.inline-form { margin: 0; display: inline; }
.btn-mini {
    padding: .2rem .5rem;
    margin-left: .5rem;
    font-size: .75rem;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
.btn-loeschen { background: #b00020; }
.karte.gefahr { border: 1px solid #b00020; }
tr.abgelaufen td { color: var(--muted); text-decoration: line-through; }
.checkbox { flex-direction: row !important; align-items: center; gap: .4rem; color: var(--fg) !important; }
.checkbox input { width: auto; margin: 0; }
.auswahl-info { width: 100%; margin: .5rem 0 0; color: var(--muted); font-size: .85rem; }

/* Eingereichte Auswahl: Herzen sind gesperrt */
.herz[disabled] { cursor: default; }
.kachel:hover .herz[disabled]:not(.aktiv) { opacity: .4; }
