:root {
  --bg: #0f1115; --card: #181b22; --fg: #f4f5f7; --muted: #9aa3b2; --accent: #22c55e; --accent2: #16a34a;
  --danger: #ef4444; --line: #262a33; --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#app { min-height: 100%; max-width: 480px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.screen { display: none; flex-direction: column; gap: 14px; min-height: calc(100vh - 40px); }
.screen.active { display: flex; }
.screen.center { justify-content: center; align-items: center; text-align: center; }
h1 { font-size: 28px; margin: 8px 0 4px; }
h2 { font-size: 22px; margin: 4px 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.hero { text-align: center; margin-top: 10vh; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; }
.avatar { width: 96px; height: 96px; border-radius: 50%; background: linear-gradient(135deg, #22c55e, #0ea5e9);
  display: grid; place-items: center; font-size: 44px; font-weight: 700; color: #fff; }
.pill { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 15px; }
.pill.frei { background: #14532d; color: #86efac; }
.pill.besetzt { background: #713f12; color: #fde68a; }
.pill.offline { background: #27272a; color: #a1a1aa; }
.btn { border: 0; border-radius: var(--radius); padding: 16px 20px; font-size: 18px; font-weight: 600; cursor: pointer; color: #fff; background: #2a2f3a; }
.btn.primary { background: var(--accent); color: #04120a; }
.btn.primary:active { background: var(--accent2); }
.btn.big { width: 100%; padding: 20px; font-size: 20px; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 14px; color: var(--muted); }
input[type=text] { width: 100%; padding: 16px; font-size: 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.check { display: flex; gap: 12px; align-items: flex-start; background: var(--card); padding: 14px; border-radius: 14px; border: 1px solid var(--line); }
.check input { width: 26px; height: 26px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--accent); }
.error { color: #fca5a5; font-size: 15px; min-height: 1em; }
.cam-wrap { position: relative; width: 100%; aspect-ratio: 3/4; border-radius: var(--radius); overflow: hidden; background: #000; }
.cam-wrap video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; font-weight: 800; color: #fff; text-shadow: 0 2px 12px #000; pointer-events: none; }
.overlay.listen { background: radial-gradient(circle, transparent 55%, rgba(34,197,94,.35)); }
.ringing-anim { position: relative; width: 120px; height: 120px; margin-bottom: 20px; }
.ringing-anim div { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--accent); animation: ring 1.8s infinite ease-out; opacity: 0; }
.ringing-anim div:nth-child(2) { animation-delay: .6s; } .ringing-anim div:nth-child(3) { animation-delay: 1.2s; }
@keyframes ring { 0% { transform: scale(.3); opacity: 1; } 100% { transform: scale(1.2); opacity: 0; } }
.call { position: fixed; inset: 0; min-height: 100vh; padding: 0; max-width: none; background: #000; display: none; }
.call.active { display: block; }
#remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#local { position: absolute; right: 14px; top: calc(14px + env(safe-area-inset-top)); width: 28vw; max-width: 140px; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.6); transform: scaleX(-1); }
.call-top { position: absolute; left: 14px; top: calc(14px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.5); padding: 8px 12px; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
#btn-hangup { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(28px + env(safe-area-inset-bottom)); padding: 18px 36px; border-radius: 999px; font-size: 18px; }
.bar { width: 100%; height: 10px; background: var(--card); border-radius: 999px; overflow: hidden; margin: 12px 0 8px; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.notify { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.notify.done { border-color: #14532d; text-align: center; }
.notify .check { background: transparent; border: 0; padding: 0; color: var(--muted); }
.notify .check input { width: 22px; height: 22px; }
input[type=email] { width: 100%; padding: 16px; font-size: 19px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.offline-mode .hero { flex: 0 0 auto; margin-top: 4vh; }
.offline-mode #btn-call, .offline-mode #rec-hint { display: none; }
