:root {
  --bg: #0f0f12; --bg-2: #1a1a20; --ink: #f4f1ea; --ink-dim: #a7a39a;
  --accent: rgb(89 135 255); --accent-ink: #fff; --danger: #ff6b5e; --line: #2c2c35;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { overflow-x: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.view { min-height: 100vh; min-height: 100dvh; padding: calc(28px + var(--safe-t)) 24px calc(40px + var(--safe-b)); max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; animation: fade .35s ease; }
.view.center { align-items: center; justify-content: center; text-align: center; position: relative; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Buttons */
.btn { font: inherit; font-weight: 700; font-size: 17px; color: var(--ink); background: #2b2b34; border: 0; border-radius: 999px; padding: 14px 28px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s ease; }
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px -10px rgb(89 135 255 / .6); }
.btn-secondary { background: #2b2b34; }
.btn-ghost { background: transparent; color: var(--ink-dim); border: 2px solid #34343e; }
.btn-danger { background: transparent; color: var(--danger); border: 2px solid #4a2a27; }
.btn-close { background: #8a3a3a; color: #fff; }
.btn.small { padding: 10px 20px; font-size: 15px; }
.btn.xl { padding: 20px 44px; font-size: 22px; }
.icon-btn { width: 64px; height: 64px; border-radius: 50%; border: 2px solid #ffffff40; background: #00000088; color: #fff; font-size: 38px; line-height: 1; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 2px solid #34343e; border-radius: 999px; color: var(--ink-dim); font-weight: 700; font-size: 15px; }
.pill.live { color: var(--accent); border-color: #2b3a66; }
.pill.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.err { color: var(--danger); min-height: 1.4em; font-size: 16px; }
.hint { color: var(--ink-dim); font-size: 14px; line-height: 1.5; }
.empty { color: var(--ink-dim); font-size: 19px; text-align: center; margin: 40px 0; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; }

/* Einwahl */
.hero { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.logo { width: 76px; height: 76px; border-radius: 22px; background: var(--accent); display: grid; place-items: center; box-shadow: 0 16px 40px -14px rgb(89 135 255 / .7); }
.logo svg { width: 42px; height: 42px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hero h1 { font-size: clamp(34px, 8vw, 56px); font-weight: 800; letter-spacing: -.01em; }
.lead { color: var(--ink-dim); font-size: 18px; line-height: 1.5; }
.join-form { width: 100%; display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.join-form input { font: inherit; font-size: 28px; font-weight: 700; text-align: center; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); background: #101015; border: 2px solid #34343e; border-radius: 18px; padding: 18px; outline: none; width: 100%; }
.join-form input[type=password] { letter-spacing: .04em; text-transform: none; font-size: 22px; }
.join-form input:focus { border-color: var(--accent); }
.admin-link { position: absolute; bottom: calc(18px + var(--safe-b)); left: 0; right: 0; text-align: center; color: #5b5a55; font-size: 13px; text-decoration: none; }

/* Kopf */
.g-head { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; justify-content: space-between; }
.kicker { color: var(--accent); font-weight: 700; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; min-height: 1em; }
.g-title h1 { font-size: clamp(30px, 6vw, 54px); font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.sub { color: var(--ink-dim); font-size: 19px; margin-top: 4px; }
.g-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.g-meta { display: flex; gap: 10px; flex-wrap: wrap; }

/* Galerie */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-content: start; }
.item { padding: 0; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; overflow: hidden; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; position: relative; }
.item img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.item:focus-visible { outline: 3px solid var(--accent); }
.item .tag { position: absolute; left: 8px; top: 8px; background: #000a; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.item.new { animation: pop .6s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* Foto groß */
.lb { position: fixed; inset: 0; z-index: 60; background: #000e; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); }
.lb > img { flex: 1; min-height: 0; max-width: 100%; max-width: min(1100px, 100%); object-fit: contain; border-radius: 6px; background: #fff; }
.lb-info { color: var(--ink-dim); font-size: 15px; text-align: center; }
.lb-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.nav { position: absolute; top: 45%; z-index: 2; }
.nav.prev { left: 10px; } .nav.next { right: 10px; }

/* Admin */
.ev-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.ev { background: var(--bg-2); border: 2px solid var(--line); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.ev h3 { font-size: 22px; font-weight: 800; }
.ev .meta { color: var(--ink-dim); font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ev .code { font-size: 26px; font-weight: 800; color: var(--accent); }
.ev .row { margin-top: 4px; }
.chip { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; border: 2px solid #2b3a66; color: var(--accent); }
.chip.off { border-color: #4a2a27; color: var(--danger); }

/* Fenster */
.modal { position: fixed; inset: 0; background: #000c; backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 20px; z-index: 50; overflow-y: auto; }
.modal-card { background: var(--bg-2); border: 2px solid var(--line); border-radius: 28px; padding: 26px; max-width: 920px; width: 100%; display: flex; flex-direction: column; gap: 16px; margin: auto; }
.modal-card h2 { font-size: 26px; font-weight: 800; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
fieldset { border: 1.5px solid #30303a; border-radius: 16px; padding: 14px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
legend { padding: 0 8px; color: var(--accent); font-weight: 800; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-dim); font-size: 15px; }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--ink); font-size: 16px; }
label.check small { color: var(--ink-dim); font-size: 13px; font-weight: 400; }
input[type=text], input[type=password], input[type=email] { font: inherit; color: var(--ink); background: #101015; border: 2px solid #34343e; border-radius: 12px; padding: 12px 14px; font-size: 16px; width: 100%; outline: none; }
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus { border-color: var(--accent); }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin-top: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.qr { width: 180px; height: 180px; image-rendering: pixelated; border-radius: 10px; align-self: center; }

/* Hochladen / Hinweise */
.up-panel { position: fixed; left: 16px; right: 16px; bottom: calc(16px + var(--safe-b)); max-width: 460px; margin: 0 auto; z-index: 70; background: var(--bg-2); border: 2px solid var(--line); border-radius: 18px; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 20px 50px -20px #000; }
.bar { height: 10px; border-radius: 99px; background: #101015; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); background: #fff; color: #111; font-weight: 700; padding: 14px 24px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .cols { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .view { padding-left: 16px; padding-right: 16px; }
  .g-actions .btn { padding: 12px 18px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .view, .item.new, .pill.live i { animation: none; } }

/* Diashow */
.ss { position: fixed; inset: 0; z-index: 90; background: #000; }
.ss-stage { position: absolute; inset: 0; }
.ss-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .9s ease; background: transparent; }
.ss-stage img.on { opacity: 1; }
.ss-prog { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: #ffffff1a; z-index: 3; }
.ss-prog i { display: block; height: 100%; width: 0; background: var(--accent); }
.ss-ui { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: space-between; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); opacity: 0; pointer-events: none; transition: opacity .3s; background: linear-gradient(#000a, transparent 22%, transparent 70%, #000b); }
.ss-ui.show { opacity: 1; pointer-events: auto; }
.ss-top, .ss-bottom { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.ss-top { justify-content: flex-start; }
.ss-bottom { margin-top: 8px; }
.ss-caption { text-align: center; color: #fff; font-weight: 600; min-height: 1.4em; text-shadow: 0 1px 6px #000; }
.icon-btn.big { width: 76px; height: 76px; font-size: 28px; background: var(--accent); border-color: var(--accent); }
.ss-panel { align-self: center; width: min(460px, 100%); background: #1a1a20ee; border: 2px solid var(--line); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(10px); margin-bottom: 8px; }
.ss-panel select { font: inherit; color: var(--ink); background: #101015; border: 2px solid #34343e; border-radius: 12px; padding: 12px 14px; font-size: 16px; width: 100%; }
.ss-panel input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.ss-panel b { color: var(--accent); }
select { font: inherit; color: var(--ink); background: #101015; border: 2px solid #34343e; border-radius: 12px; padding: 12px 14px; font-size: 16px; width: 100%; }

/* ---------- V4: Kundenbereich, Feed, Interaktionen ---------- */
.join-form input.txt, .join-form input#invName { letter-spacing: 0; text-transform: none; font-size: 20px; }
.join-form input[readonly] { opacity: .7; }
.admin-link a { color: inherit; text-decoration: none; }
.admin-link a:hover { color: var(--ink-dim); }
.hint { color: var(--ink-dim); font-size: 14px; line-height: 1.5; }
.seg { display: inline-flex; border: 2px solid #34343e; border-radius: 999px; overflow: hidden; }
.seg button { font: inherit; font-weight: 700; font-size: 15px; color: var(--ink-dim); background: transparent; border: 0; padding: 8px 18px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
.pill.me { cursor: pointer; background: transparent; font: inherit; font-weight: 700; font-size: 15px; }
.center-modal { align-items: center; }
.invite-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; }
.people { display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; background: #101015; border: 1.5px solid #30303a; border-radius: 12px; padding: 8px 12px; font-size: 15px; }
.person .who { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.person small { color: var(--ink-dim); display: block; }
.person button { font: inherit; font-size: 13px; font-weight: 700; color: var(--danger); background: transparent; border: 1.5px solid #4a2a27; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1.5px solid #2b3a66; color: var(--accent); font-size: 12px; font-weight: 700; }
.chip.off { border-color: #4a2a27; color: var(--danger); }

/* Feed */
.feed { display: flex; flex-direction: column; gap: 22px; width: 100%; max-width: 560px; margin: 0 auto; }
.post { background: var(--bg-2); border: 2px solid var(--line); border-radius: 20px; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--ink-dim); font-size: 14px; font-weight: 600; }
.post-head b { color: var(--ink); }
.post-head .grow { flex: 1; }
.post-head button { font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-dim); background: transparent; border: 1.5px solid #34343e; border-radius: 999px; padding: 5px 12px; cursor: pointer; text-decoration: none; }
.post-head button.del { color: var(--danger); border-color: #4a2a27; }
.post-img { display: block; width: 100%; background: #fff; cursor: pointer; border: 0; padding: 0; }
.post-img img { display: block; width: 100%; height: auto; min-height: 160px; }
.feed-more { height: 40px; }

.soc { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px; }
.soc-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.soc button { font: inherit; cursor: pointer; }
.sb { display: inline-flex; align-items: center; gap: 6px; background: #101015; color: var(--ink); border: 1.5px solid #34343e; border-radius: 999px; padding: 6px 12px; font-size: 15px; font-weight: 700; line-height: 1.2; }
.sb.on { border-color: var(--accent); background: #1b2442; }
.sb .heart { font-size: 17px; }
.sb.pick { color: var(--ink-dim); }
.picker { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: #101015; border: 1.5px solid #34343e; border-radius: 16px; }
.picker button { background: transparent; border: 0; font-size: 26px; padding: 4px 6px; border-radius: 10px; line-height: 1.1; }
.picker button.on { background: #1b2442; }
.liked-by { color: var(--ink-dim); font-size: 13px; }
.cmts { display: flex; flex-direction: column; gap: 8px; }
.cmt { font-size: 15px; line-height: 1.4; display: flex; gap: 8px; align-items: flex-start; }
.cmt .t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cmt b { font-weight: 800; }
.cmt .x { background: transparent; border: 0; color: var(--ink-dim); font-size: 14px; padding: 0 4px; }
.cmt-form { display: flex; gap: 8px; }
.cmt-form input { flex: 1; min-width: 0; }
.cmt-form .btn { padding: 8px 16px; font-size: 15px; }
.soc-off { color: var(--ink-dim); font-size: 13px; }
.lb-social { width: 100%; max-width: 640px; max-height: 38vh; overflow-y: auto; background: #000a; border: 1.5px solid #ffffff22; border-radius: 16px; }
.lb-social:empty { display: none; }
@media (max-width: 760px) { .invite-row { grid-template-columns: 1fr; } .feed { max-width: 100%; } }
.post-head a { font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-dim); border: 1.5px solid #34343e; border-radius: 999px; padding: 5px 12px; text-decoration: none; }
#invResult { display: flex; flex-direction: column; gap: 10px; }
