:root {
  --brand: #930027;
  --brand-2: #50504f;
  --bg: #f5f4f3;
  --fg: #2b2b2a;
  --muted: #6b6b69;
  --card: #ffffff;
  --ok: #15803d;
  --warn: #c2410c;
  --err: #b91c1c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "DejaVu Sans", sans-serif;
}
body { display: flex; flex-direction: column; min-height: 100vh; }
body.loading main { visibility: hidden; }
body.mode-kiosk { cursor: none; user-select: none; overflow: hidden; height: 100vh; }

.brandbar {
  height: 84px; flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 4vw; background: var(--card);
  border-bottom: 4px solid var(--brand); box-shadow: 0 2px 12px #0000000d;
}
.brandbar img { height: 48px; width: auto; }
.mode-kiosk .brandbar { height: 96px; }
.mode-kiosk .brandbar img { height: 56px; }

.status { display: flex; align-items: center; gap: .5em; font-size: .9rem; color: var(--muted); }
.status .dot { width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; }
.status.ok .dot { background: var(--ok); }
.status.warn .dot { background: var(--warn); }
.status.error .dot { background: var(--err); }
.status .dot.beat { animation: beat .6s ease-out; }
@keyframes beat { 0% { box-shadow: 0 0 0 0 currentColor; transform: scale(1.3); } 100% { box-shadow: 0 0 0 8px transparent; transform: scale(1); } }

main { flex: 1; display: flex; }
.screen {
  display: none; flex: 1;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 4vh 16px;
}
.screen.active { display: flex; animation: fade .3s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: clamp(1.8rem, 6vw, 4rem); margin: .2em 0; font-weight: 700; letter-spacing: -.01em; }
.hint { color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.5rem); max-width: 40ch; margin: .4em auto 0; }
.eyebrow { color: var(--brand); font-size: clamp(1.1rem, 2.5vw, 1.7rem); margin: 0; }

.badge-icon { width: clamp(96px, 18vw, 200px); height: auto; color: var(--brand); }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.08); opacity: 1; } }

.card {
  background: var(--card); border-radius: 20px; padding: 32px 28px;
  box-shadow: 0 8px 30px #0000000f; border-top: 6px solid var(--brand);
}
.form { width: 100%; max-width: 420px; text-align: left; display: flex; flex-direction: column; }
.h-form { font-size: clamp(1.5rem, 3.2vw, 2rem); margin: 0 0 .6em; }
.form label { font-weight: 600; margin: .8em 0 .3em; }
.form input {
  font: inherit; font-size: 1.4rem; padding: .6em .7em; border-radius: 10px;
  border: 2px solid #d6d3d1; background: #fff; color: var(--fg); width: 100%;
  font-family: ui-monospace, "DejaVu Sans Mono", monospace; letter-spacing: .08em;
}
.form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px #93002722; }
.form button {
  margin-top: 1.2em; font: inherit; font-size: 1.2rem; font-weight: 700;
  padding: .8em; border: 0; border-radius: 10px; background: var(--brand); color: #fff; cursor: pointer;
}
.form button:hover { filter: brightness(1.08); }
.error { color: var(--err); min-height: 1.3em; margin: .8em 0 0; font-weight: 600; }

.spinner { width: 72px; height: 72px; border-radius: 50%; border: 7px solid #e7e5e4; border-top-color: var(--brand); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.check, .cross { width: clamp(96px, 16vw, 160px); height: auto; fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.check { stroke: var(--ok); }
.cross { stroke: var(--err); }
.check circle, .cross circle { stroke-dasharray: 160; stroke-dashoffset: 160; animation: draw .5s ease-out forwards; }
.check path, .cross path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw .4s .4s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.footbar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4vw; background: var(--card); border-top: 1px solid #0000000f;
  color: var(--muted); font-size: .9rem;
}


/* ---------- Wallet-Anmeldung ---------- */
.wallet { width: 100%; max-width: 620px; text-align: center; }
.wallet .lead { color: var(--muted); font-size: 1.1rem; margin: 0 0 1.2em; }
.qr-wrap { display: flex; gap: 28px; align-items: center; justify-content: center; text-align: left; }
.qr { width: 240px; height: 240px; flex: none; display: grid; place-items: center;
      background: #fff; border-radius: 12px; padding: 8px; box-shadow: 0 0 0 1px #0000001a; }
.qr svg { width: 100%; height: 100%; display: block; }
.scr-fetched .qr, #scr-wallet.fetched .qr { opacity: .25; transition: opacity .3s; }
.steps { margin: 0; padding-left: 1.3em; line-height: 1.9; font-size: 1.05rem; }
.button {
  display: block; text-decoration: none; text-align: center; font-size: 1.2rem; font-weight: 700;
  padding: .9em; border-radius: 10px; background: var(--brand); color: #fff; margin: .4em 0;
}
.button.disabled { opacity: .5; pointer-events: none; }
.wallet-state { min-height: 1.4em; margin: 1em 0 .2em; font-weight: 600; color: var(--brand-2); }
#scr-wallet.fetched .wallet-state { color: var(--brand); }
.wallet-links { display: flex; flex-wrap: wrap; gap: .4em 1.2em; justify-content: center; }
button.link, .form button.link {
  background: none; border: 0; padding: .3em 0; margin: .6em 0 0; color: var(--brand);
  font: inherit; font-size: .95rem; font-weight: 600; text-decoration: underline; cursor: pointer;
}
.spinner.small { width: 48px; height: 48px; border-width: 5px; }
.is-desktop .only-mobile { display: none; }
.is-mobile .only-desktop { display: none; }
.is-mobile.qr-forced .only-desktop { display: flex; }
.is-mobile.qr-forced #wallet-btn, .is-mobile.qr-forced #show-qr { display: none; }
.is-mobile .qr-wrap { flex-direction: column; }
[hidden] { display: none !important; }

/* ---------- Datenschutz / Support ---------- */
.doc-page main.doc { display: block; padding: 32px 16px 48px; }
.doc article { max-width: 760px; margin: 0 auto; background: var(--card); border-radius: 16px;
  padding: 28px 32px; box-shadow: 0 8px 30px #0000000f; border-top: 6px solid var(--brand); line-height: 1.6; }
.doc h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0 0 .2em; }
.doc h2 { font-size: 1.15rem; color: var(--brand); margin: 1.6em 0 .4em; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li { margin: .3em 0; }
.doc dt { font-weight: 700; margin-top: .8em; }
.doc dd { margin: .2em 0 0; color: var(--muted); }
.doc a, .footbar a { color: var(--brand); }
.doc-meta { color: var(--muted); margin: 0 0 1em; }
.doc-note { margin-top: 2em; font-size: .9rem; color: var(--muted); }
.footbar .legal-links { font-size: .85rem; }
.mode-kiosk .only-public { display: none; }
@media (max-width: 520px) { .doc article { padding: 20px 18px; } }

@media (prefers-color-scheme: dark) {
  body.mode-public { --bg: #1c1b1a; --fg: #f5f4f3; --muted: #a8a29e; --card: #292524; }
  body.mode-public .form input { background: #1c1b1a; border-color: #44403c; }
  body.mode-public .brandbar img { background: #fff; border-radius: 6px; padding: 4px; }
  body.mode-public .doc a, body.mode-public .footbar a, body.mode-public .doc h2 { color: #f2a7bb; }
}

@media (max-width: 520px) {
  .brandbar { height: 64px; }
  .brandbar img { height: 30px; }
  .status #status-text { display: none; }
  .card { padding: 24px 20px; }
  .qr-wrap { flex-direction: column; }
}
