:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --ok: #34c759;
  --bad: #ff3b30;
  --shadow: 0 2px 12px rgba(0, 0, 0, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --muted: #98989d;
    --line: #38383a;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

header {
  padding: 22px 16px 0;
  text-align: center;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--muted);
  font-size: 15px;
}
header b { color: var(--text); }

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 12px;
  text-align: center;
}
p.lead {
  color: var(--muted);
  font-size: 19px;
  margin: 0 0 36px;
  text-align: center;
}

.view { display: none; width: 100%; flex-direction: column; align-items: center; }
.view.on { display: flex; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Kacheln auf der Startseite */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }
.tile {
  appearance: none;
  border: 0;
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-align: left;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0, 0, 0, .10); }
.tile:active { transform: scale(.98); }
.tile .icon { width: 44px; height: 44px; color: var(--accent); margin-bottom: 10px; }
.tile .title { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.tile .sub { color: var(--muted); font-size: 15px; }
.tile[hidden] { display: none; }

/* Code-Eingabe */
.code {
  width: min(320px, 100%);
  font: 600 44px/1 -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  letter-spacing: .5em;
  text-indent: .5em;
  text-align: center;
  padding: 18px 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.code:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, .18); }
.code.bad { border-color: var(--bad); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.hint { min-height: 24px; margin: 14px 0 26px; color: var(--muted); font-size: 15px; text-align: center; }
.hint.bad { color: var(--bad); }

/* Knöpfe */
.btn {
  appearance: none;
  border: 0;
  border-radius: 980px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  padding: 14px 28px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.secondary { background: transparent; color: var(--accent); padding: 10px 16px; }
.btn.secondary:hover { text-decoration: underline; }
.btn.stop { background: var(--bad); }

.back { margin-top: 28px; }

/* Status */
.pulse {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok);
  margin: 8px auto 28px;
  box-shadow: 0 0 0 0 rgba(52, 199, 89, .5);
  animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 18px rgba(52, 199, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); } }
.spinner {
  width: 28px; height: 28px; margin: 6px auto 24px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.steps { color: var(--muted); font-size: 17px; line-height: 1.6; text-align: center; margin: 0 0 32px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; }
.steps li::before { content: counter(s) ". "; color: var(--text); font-weight: 600; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 24px; }
footer a { color: inherit; }

/* Techniker */
.bigcode { font: 700 clamp(64px, 14vw, 120px)/1 -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; letter-spacing: .12em; margin: 8px 0 18px; }
.stage { position: fixed; inset: 0; background: #000; display: none; }
.stage.on { display: block; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center;
  background: rgba(30, 30, 30, .72); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  color: #fff; padding: 8px 8px 8px 18px; border-radius: 980px; font-size: 15px;
  transition: opacity .3s ease;
}
.bar .btn { padding: 10px 18px; font-size: 15px; }
.bar .btn.ghost { background: rgba(255, 255, 255, .14); }
.stage.idle .bar { opacity: 0; }

/* Logo oben */
header.brand { padding: 28px 16px 0; display: flex; justify-content: center; align-items: center; gap: 10px; }
header.brand img { height: 22px; width: auto; max-width: 70vw; }
header.brand .tag { color: var(--muted); font-size: 13px; font-weight: 600; border: 1px solid var(--line); border-radius: 980px; padding: 2px 10px; }

/* Status beim Techniker */
.status { display: flex; align-items: center; gap: 10px; font-size: 17px; margin: 0 0 14px; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.status .dot.on { background: var(--ok); }

/* Download während der Freigabe */
.live-steps { margin: 22px 0 0; }
.btn.secondary.stop-link { margin-top: 26px; color: var(--bad); }
