:root {
  --bg: #f7f1e8;
  --card: #fffdf9;
  --ink: #2f2a25;
  --muted: #7a6f64;
  --line: #e6dccd;
  --accent: #b5543a;
  --accent-ink: #ffffff;
  --accent-soft: #f3ddd3;
  --ok: #3f7a4a;
  --danger: #a33a2a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1a17;
    --card: #282420;
    --ink: #f1ebe3;
    --muted: #b0a597;
    --line: #3b352f;
    --accent: #e07a5c;
    --accent-ink: #1d1a17;
    --accent-soft: #3d2a23;
    --ok: #7fc08a;
    --danger: #ef8a78;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.banner {
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 15px;
  text-align: center;
  padding: 8px 16px;
}

.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.who {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; font-size: 15px; color: var(--muted);
}
.who strong { color: var(--ink); }

.view { max-width: 960px; margin: 0 auto; padding: 20px 16px 120px; }

/* Einstiegsseiten */
.center { max-width: 440px; margin: 6vh auto 0; text-align: center; }
.hero { font-size: 64px; line-height: 1; margin-bottom: 8px; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 22px; margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 24px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; text-align: left;
}
.label { display: block; font-weight: 600; margin: 0 0 8px; }
input[type=text], input[type=password], textarea {
  width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--bg);
  outline: none; font-size: 18px;
}
input:focus, textarea:focus { border-color: var(--accent); }
.code-input { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-size: 24px !important; }
.error { color: var(--danger); min-height: 1.5em; margin: 8px 0 0; font-size: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 999px;
  border: 0; background: var(--accent); color: var(--accent-ink);
  font-weight: 650; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; margin-top: 14px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost.danger { color: var(--danger); }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: 16px; }

.names { display: grid; gap: 10px; margin-bottom: 18px; }
.name-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border-radius: 14px; cursor: pointer; text-align: left;
  background: var(--card); border: 1.5px solid var(--line); font-size: 19px; font-weight: 600;
}
.name-btn:hover { border-color: var(--accent); }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
  background: var(--accent-soft); color: var(--accent);
}
.divider { color: var(--muted); font-size: 15px; margin: 8px 0 14px; text-align: center; }

/* Hauptseite */
.upload-zone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 2px dashed var(--accent); border-radius: var(--radius);
  background: var(--card); padding: 28px 16px; text-align: center; cursor: pointer;
}
.upload-zone.drag { background: var(--accent-soft); }
.upload-zone .big { font-size: 22px; font-weight: 700; color: var(--accent); }
.upload-zone .hint { color: var(--muted); font-size: 15px; }
.upload-zone input { display: none; }

.progress { margin-top: 14px; }
.bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress .txt { font-size: 15px; color: var(--muted); margin-top: 6px; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  margin: 26px 0 14px;
}
.tabs { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tabs button {
  border: 0; background: none; padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 16px; color: var(--muted);
}
.tabs button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { color: var(--muted); font-size: 15px; margin: -4px 0 14px; }

.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.tile {
  position: relative; border: 0; padding: 0; cursor: pointer; text-align: left;
  background: var(--card); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.tile .ph { aspect-ratio: 1 / 1; width: 100%; object-fit: cover; display: block; background: var(--line); }
.tile .cap { padding: 8px 10px 4px; font-size: 15px; line-height: 1.35; min-height: 2.7em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .cap.empty { color: var(--accent); font-weight: 600; }
.tile .by { padding: 0 10px 10px; font-size: 13px; color: var(--muted); }

.empty-state { text-align: center; color: var(--muted); padding: 40px 16px; }

/* Bearbeiten */
.sheet {
  position: fixed; inset: 0; z-index: 20; background: rgba(20, 14, 8, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-panel {
  position: relative; width: 100%; max-width: 640px; max-height: 94vh; overflow: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 22px; padding: 22px; }
}
.close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--bg); font-size: 26px; line-height: 1; cursor: pointer; z-index: 1;
}
.ed-img { width: 100%; max-height: 46vh; object-fit: contain; border-radius: 12px; background: #111; display: block; }
.ed-meta { color: var(--muted); font-size: 14px; margin: 8px 0 14px; }
.ed-status { font-size: 14px; color: var(--muted); margin: 6px 0 12px; min-height: 1.4em; }
.ed-status.ok { color: var(--ok); }
.ed-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ed-actions .btn { flex: 1 1 220px; }

/* Vorschau */
.preview {
  position: fixed; inset: 0; z-index: 30; background: #000;
  display: flex; align-items: center; justify-content: center;
}
.preview img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.pv-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 60px 6vw calc(36px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: #fff; text-align: center;
  font: 500 clamp(22px, 3.4vw, 44px)/1.3 Georgia, "Times New Roman", serif;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.pv-caption:empty { display: none; }
.pv-nav, .pv-close {
  position: absolute; border: 0; cursor: pointer; color: #fff;
  background: rgba(255,255,255,.14); border-radius: 50%;
  width: 52px; height: 52px; font-size: 34px; line-height: 1;
}
.pv-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.pv-next { right: 12px; top: 50%; transform: translateY(-50%); }
.pv-close { top: calc(12px + env(safe-area-inset-top)); right: 12px; font-size: 30px; }
.pv-count { position: absolute; top: calc(22px + env(safe-area-inset-top)); left: 16px; color: rgba(255,255,255,.7); font-size: 15px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 40; font-size: 16px; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ZIP-Dialog */
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 8px 0 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.sw { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.sw.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.sw-custom { position: relative; overflow: hidden; display: grid; place-items: center; font-size: 20px; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.zip-prev { display: block; width: 100%; max-height: 42vh; object-fit: contain; border-radius: 10px; background: var(--bg); }
.hint { color: var(--muted); font-size: 15px; margin: 12px 0 0; }
