:root {
  --bg: #140c1e; --bg2: #1f1330; --line: #3a2457; --text: #f4eaff; --muted: #b9a5d6;
  --orange: #ff8a00; --orange2: #ff5e00; --red: #ff4d6d; --green: #4ade80;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5;
}
body.spooky {
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(255,138,0,.25), transparent 60%),
    radial-gradient(600px 400px at 90% 100%, rgba(120,60,200,.25), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}
h1 { font-size: clamp(2rem, 7vw, 3.6rem); line-height: 1.1; margin: .3em 0; }
h1 em { color: var(--orange); font-style: normal; text-shadow: 0 0 24px rgba(255,138,0,.6); }
a { color: var(--orange); }

.hero { position: relative; min-height: 88vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 48px 16px 80px; z-index: 1; }
.eyebrow { letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-size: .85rem; margin: 0; }
.lead { font-size: clamp(1rem, 2.6vw, 1.25rem); color: var(--muted); max-width: 34em; margin: 1em 0 1.8em; }
.small-lead { font-size: 1rem; margin-top: 0; }
.small { color: var(--muted); font-size: .9rem; max-width: 30em; }
.moon { position: absolute; top: 6vh; right: 8vw; width: clamp(70px, 14vw, 140px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6d6, #ffd36b 60%, #e0a030); box-shadow: 0 0 80px rgba(255,211,107,.45); opacity: .9; }

.btn { display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 700; text-decoration: none;
  color: #1a0f00; background: linear-gradient(135deg, var(--orange), var(--orange2)); padding: 14px 26px; border-radius: 999px;
  box-shadow: 0 8px 28px rgba(255,94,0,.35); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 12px 34px rgba(255,94,0,.5); }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: var(--red); color: #fff; box-shadow: none; }
.btn.small { padding: 7px 14px; font-size: .85rem; }

.ground { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; font-size: clamp(28px, 6vw, 52px);
  opacity: .9; pointer-events: none; padding: 0 8px; z-index: 0; }
.bats { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bats span { position: absolute; font-size: 28px; animation: fly 16s linear infinite; opacity: .7; }
.bats span:nth-child(1) { top: 14%; animation-delay: 0s; }
.bats span:nth-child(2) { top: 30%; animation-delay: -6s; font-size: 22px; }
.bats span:nth-child(3) { top: 8%;  animation-delay: -11s; font-size: 34px; }
@keyframes fly { from { transform: translateX(-10vw) translateY(0); } 50% { transform: translateX(50vw) translateY(30px); } to { transform: translateX(110vw) translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .bats span { animation: none; display: none; } .btn { transition: none; } }

.card-wrap { position: relative; z-index: 1; max-width: 460px; margin: 0 auto; padding: 32px 16px 120px; }
.card-wrap.center { text-align: center; }
.card-wrap h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
.big { font-size: 72px; }
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; color: var(--muted); }
.form { display: grid; gap: 16px; margin-top: 16px; }
.field { display: grid; gap: 6px; }
.field span { font-size: .9rem; color: var(--muted); }
input, select { width: 100%; font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; }
input:focus, select:focus { border-color: var(--orange); }
.field.invalid input { border-color: var(--red); }
.field small { color: var(--red); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.alert { padding: 12px 16px; border-radius: 12px; margin: 12px 0; border: 1px solid var(--line); background: var(--bg2); }
.alert.error { border-color: var(--red); color: #ffd0d8; }
.alert.ok { border-color: var(--green); color: #d1ffe2; }
.ticket .qr { background: #fff; display: inline-block; padding: 16px; border-radius: 16px; margin: 16px 0; }
.ticket .qr img { display: block; max-width: 100%; height: auto; }
.ticket .btn { margin: 6px 0; }

/* Admin */
body.admin { background: var(--bg); }
.topbar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--bg2); }
.topbar h1 { font-size: 1.4rem; margin: 0; }
.stats { display: flex; gap: 16px; flex: 1; color: var(--muted); flex-wrap: wrap; }
.stats b { color: var(--orange); font-size: 1.2rem; }
.admin-main { padding: 16px 24px 60px; max-width: none; width: 100%; margin: 0 auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.filters input { flex: 1 1 220px; width: auto; } .filters select { width: auto; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 1000px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--bg2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 6px; }
.actions .btn:last-child { margin-right: 0; }
.badge { padding: 3px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: .8rem; display: inline-block; }
.badge.ok { border-color: var(--green); color: var(--green); }
.badge small { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px; }
dialog { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 24px; max-width: min(440px, 92vw); width: 100%; }
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
code { background: var(--bg); padding: 2px 6px; border-radius: 6px; }

/* Scanner (Handy-optimiert) */
[hidden] { display: none !important; }
body.scan-app { position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%); display: flex; flex-direction: column; overflow: hidden; background: var(--bg);
  padding-top: env(safe-area-inset-top); -webkit-tap-highlight-color: transparent; }
.s-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.s-title { font-weight: 800; font-size: 1.1rem; }
.counter { flex: 1; text-align: center; font-weight: 700; color: var(--orange); font-size: 1rem; }
.icon-btn { width: 44px; height: 44px; font-size: 1.3rem; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.s-main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 12px; }
.s-cam { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.video-box { position: relative; flex: 1; min-height: 0; background: #000; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.video-box video { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s, filter .2s; }
.video-box .frame { position: absolute; top: 50%; left: 50%; width: min(68%, 300px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 4px solid var(--orange); border-radius: 22px; box-shadow: 0 0 0 999px rgba(0,0,0,.4); pointer-events: none; transition: border-color .2s; }
.video-box.cooling video { opacity: .35; filter: grayscale(1); }
.video-box.cooling .frame { border-color: #64748b; }
.cam-status { position: absolute; left: 12px; right: 12px; bottom: 12px; text-align: center; background: rgba(0,0,0,.65); border-radius: 999px; padding: 10px 14px; font-weight: 600; font-size: .95rem; }
.torch { position: absolute; top: 12px; right: 12px; width: 52px; height: 52px; font-size: 1.5rem; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); cursor: pointer; }
.torch.on { background: var(--orange); }
.btn.big { display: block; width: 100%; padding: 18px; font-size: 1.15rem; }
.s-search { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.s-search input { font-size: 18px; padding: 16px; }
.center-text { text-align: center; margin: 14px auto; }
.results { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 12px; }
.result { display: grid; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.result.done { border-color: var(--green); }
.r-name { font-size: 1.25rem; font-weight: 800; }
.r-meta { color: var(--muted); font-size: .9rem; }
.r-state { color: var(--muted); font-size: 1rem; }
.r-state.ok { color: var(--green); font-weight: 700; }
.r-btn { width: 100%; margin-top: 6px; padding: 16px; font-size: 1.1rem; }
.s-nav { display: grid; grid-template-columns: repeat(3, 1fr); flex-shrink: 0; background: var(--bg2); border-top: 1px solid var(--line);
  padding-bottom: max(env(safe-area-inset-bottom), 6px); }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; font: inherit; font-weight: 700; font-size: .85rem;
  color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.nav-btn span { font-size: 1.5rem; }
.nav-btn.active { color: var(--orange); box-shadow: inset 0 3px 0 var(--orange); }
.overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; cursor: pointer; color: #fff; }
.overlay.ok { background: #15a34a; }
.overlay.already { background: #d97706; }
.overlay.invalid { background: #dc2626; }
.overlay.undone { background: #475569; }
.ov-icon { font-size: clamp(90px, 28vw, 170px); font-weight: 800; line-height: 1; }
.ov-title { font-size: clamp(1.4rem, 6vw, 2rem); font-weight: 800; letter-spacing: .04em; margin-top: 8px; }
.ov-name { font-size: clamp(2.2rem, 10vw, 3.6rem); font-weight: 800; margin: 14px 0; word-break: break-word; line-height: 1.1; }
.ov-sub { font-size: clamp(1.1rem, 5vw, 1.6rem); }
.ov-undo { margin-top: 26px; font: inherit; font-weight: 700; font-size: 1.05rem; color: #fff; background: rgba(0,0,0,.3); border: 2px solid rgba(255,255,255,.75); border-radius: 999px; padding: 14px 24px; cursor: pointer; }
.ov-tap { margin-top: 26px; opacity: .8; font-size: .9rem; }

/* Rechtstexte */
.legal { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 32px 16px 80px; }
.legal h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
.legal h2 { margin-top: 1.8em; font-size: 1.25rem; color: var(--orange); }
.legal h3 { margin-top: 1.4em; font-size: 1.05rem; }
.legal p, .legal li { color: #e3d5f5; }
.legal .meta { color: var(--muted); }
.legal-page .ground, .legal-page .bats { display: none; }

/* Cookie-Hinweis */
.cookie-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200; max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px; background: var(--bg2); border: 1px solid var(--orange); border-radius: 16px;
  padding: 14px 16px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.cookie-banner p { margin: 0; font-size: .9rem; color: var(--text); }
.cookie-banner .btn { flex-shrink: 0; }
@media (max-width: 520px) { .cookie-banner { flex-direction: column; align-items: stretch; text-align: left; } }

/* Hervorgehobene (importierte) Eintraege */
tr.hl td { background: rgba(255,138,0,.14); }
tr.hl td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
.hl-badge { border-color: var(--orange); color: var(--orange); margin-left: 4px; }

/* Ticketseite */
.ticket-img { display: block; width: 100%; max-width: 340px; height: auto; margin: 8px auto 12px; border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.ticket .btn { display: block; max-width: 340px; margin: 10px auto; }

body.scan-app { touch-action: manipulation; -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
body.scan-app input { -webkit-user-select: text; user-select: text; }

/* Auschecken */
.mode-chip { position: absolute; top: 12px; left: 12px; background: var(--orange); color: #1a0f00; font-weight: 800; font-size: .8rem; letter-spacing: .06em; padding: 8px 12px; border-radius: 999px; }
.video-box.mode-out .frame { border-color: #818cf8; }
.video-box.mode-out .mode-chip { background: #818cf8; color: #12123a; }
.video-box.cooling .frame { border-color: #64748b; }
.nav-btn.active.out { color: #a5b4fc; box-shadow: inset 0 3px 0 #818cf8; }
.nav-btn { padding: 10px 4px; }
.overlay.out { background: #4f46e5; }
.overlay.notin { background: #dc2626; }
.btn.out { background: linear-gradient(135deg, #818cf8, #6366f1); color: #fff; box-shadow: none; }
.r-state.out { color: #a5b4fc; font-weight: 700; }
.result.gone { border-color: #818cf8; }
.r-btns { display: grid; gap: 8px; }
.r-btns .r-btn { margin-top: 0; }

/* Tabs oben (unten abgeschnittene Leisten vermeiden) */
.s-nav { border-top: 0; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.nav-btn { flex-direction: row; justify-content: center; gap: 6px; padding: 12px 4px; font-size: .9rem; }
.nav-btn span { font-size: 1.15rem; }
.nav-btn.active { box-shadow: inset 0 -3px 0 var(--orange); }
.nav-btn.active.out { box-shadow: inset 0 -3px 0 #818cf8; }
.s-main { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
.cam-status { top: 64px; bottom: auto; left: 12px; right: 12px; }
.cam-start { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: auto; padding: 16px 24px; z-index: 3; }

/* Status-Badges (Admin) */
.status-stack { display: grid; gap: 6px; justify-items: start; }
.badge { display: inline-flex; flex-direction: column; gap: 1px; white-space: nowrap; line-height: 1.25; padding: 6px 12px; border-radius: 10px; font-size: .85rem; }
.badge b { font-weight: 700; }
.badge small { font-size: .75rem; opacity: .8; color: inherit; }
.badge.ok { background: rgba(74,222,128,.12); border: 1px solid rgba(74,222,128,.55); color: #86efac; }
.badge.in { background: rgba(255,138,0,.12); border: 1px solid rgba(255,138,0,.55); color: #ffb454; }
.badge.out { background: rgba(129,140,248,.12); border: 1px solid rgba(129,140,248,.55); color: #a5b4fc; }
.badge.wait { background: var(--bg2); border: 1px solid var(--line); color: var(--muted); }
.badge.hl-badge { display: inline-block; flex-direction: row; padding: 2px 10px; border-radius: 999px; font-size: .75rem; background: transparent; margin-left: 6px; }
.result .badge { white-space: normal; }

.table-wrap th, .table-wrap td { padding: 12px 16px; }
