:root {
  --bg: #f7f3ee;
  --card: #fffdfa;
  --ink: #3b3027;
  --muted: #8a7b6c;
  --line: #e6ddd2;
  --accent: #6f7f6a;      /* Salbei */
  --accent-ink: #fff;
  --gold: #b89b6a;
  --danger: #a64b3c;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(59, 48, 39, .25);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.serif { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; }
.muted { color: var(--muted); }

.screen { min-height: 100dvh; }
.center { display: grid; place-items: center; padding: 24px; }
.card {
  width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; padding: 40px 28px 28px; text-align: center; box-shadow: var(--shadow);
}
.card h1 { font-size: 2.6rem; line-height: 1.1; margin: 4px 0 6px; }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; color: var(--muted); margin: 0; }
.subtitle { color: var(--gold); font-family: var(--serif); font-style: italic; font-size: 1.2rem; margin: 0; }
.subtitle:empty { display: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--gold); margin: 20px auto; max-width: 200px; }
.divider span { flex: 1; height: 1px; background: var(--line); }
.rings { font-size: 2.4rem; }
.hint { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }

input[type="text"] {
  width: 100%; font: inherit; font-size: 1.1rem; padding: 14px 16px; margin: 6px 0 14px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-align: center;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(111, 127, 106, .15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
  border: 0; border-radius: 999px; padding: 14px 22px; cursor: pointer; text-decoration: none; transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: rgba(255,255,255,.14); color: #fff; }
.btn.danger { background: rgba(166, 75, 60, .9); color: #fff; }
.btn.small { padding: 9px 16px; font-size: .9rem; }
.btn.wide { width: 100%; }

/* Kopf */
.top {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: calc(20px + env(safe-area-inset-top)) 18px 10px; max-width: 1200px; margin: 0 auto;
}
.top h1 { font-size: 2.1rem; line-height: 1.05; margin: 0; }
.hello { font: inherit; font-size: .9rem; background: var(--card); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.hello span { color: var(--muted); margin-left: 2px; }

.tabs { display: flex; gap: 6px; padding: 6px 18px 12px; max-width: 1200px; margin: 0 auto; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 75%, transparent); }
.tab { font: inherit; font-size: .92rem; font-weight: 500; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.count { opacity: .7; font-size: .82em; margin-left: 2px; }

/* Upload-Fortschritt */
.uploads { max-width: 1200px; margin: 0 auto; padding: 0 18px; display: grid; gap: 8px; }
.up { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 8px 8px; font-size: .88rem; }
.up img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--line); }
.up .bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.up .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up.done .bar i { background: var(--gold); }
.up.err { border-color: var(--danger); }
.up .st { color: var(--muted); white-space: nowrap; }
.up.err .st { color: var(--danger); }

/* Galerie */
.gallery { columns: 2 160px; column-gap: 8px; padding: 6px 12px 120px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 700px) { .gallery { columns: 3 220px; column-gap: 12px; padding-inline: 18px; } }
@media (min-width: 1100px) { .gallery { columns: 4 240px; } }
.tile { break-inside: avoid; margin: 0 0 8px; position: relative; border-radius: 12px; overflow: hidden; background: #ece4da; cursor: zoom-in; display: block; width: 100%; border: 0; padding: 0; }
@media (min-width: 700px) { .tile { margin-bottom: 12px; } }
.tile img { display: block; width: 100%; height: auto; opacity: 0; transition: opacity .4s; }
.tile img.loaded { opacity: 1; }
.tile .who {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 7px; font-size: .78rem; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(30, 22, 15, .6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile.new { animation: pop .5s ease; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 2.6rem; }
.empty .serif { font-size: 1.6rem; margin: 6px 0 0; }

/* Upload-Button */
.fab-wrap { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); pointer-events: none; background: linear-gradient(transparent, rgba(247, 243, 238, .95) 55%); }
.fab { pointer-events: auto; padding: 16px 28px; font-size: 1.05rem; box-shadow: 0 12px 28px -8px rgba(59, 48, 39, .45); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: #16110c; display: grid; grid-template-rows: 1fr auto; color: #fff; touch-action: pan-y; }
.lb-stage { display: grid; place-items: center; overflow: hidden; padding: calc(56px + env(safe-area-inset-top)) 8px 8px; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
.lb-meta { display: flex; flex-direction: column; font-size: .9rem; }
.lb-meta span { color: rgba(255,255,255,.6); font-size: .8rem; }
.lb-actions { display: flex; gap: 8px; }
.lb-btn { position: absolute; z-index: 2; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; display: grid; place-items: center; }
.lb-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; font-size: 1.1rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 2rem; line-height: 1; }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
@media (hover: none) { .lb-prev, .lb-next { display: none; } }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }
