/* Spielerseite (Handy der Mitspieler): große Tasten, kein Textfeld außer dem Code */
:root {
  color-scheme: dark;
  --bg: #0e1016;
  --panel: #171b25;
  --panel-2: #1d2230;
  --border: #2b3244;
  --text: #e9ecf3;
  --muted: #8d96a9;
  --accent: #8b5cf6;
  --ok: #22c55e;
  --warn: #f5a524;
  --danger: #f04452;
  --pc: #8b5cf6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.pad { min-height: 100%; display: flex; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); gap: 10px; max-width: 560px; margin: 0 auto; }

/* ---------- Anmeldung ---------- */
.pd-login { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; text-align: center; }
.pd-logo { font-size: 54px; line-height: 1; }
.pd-login h1 { margin: 0; font-size: 28px; }
.pd-login p { margin: 0; color: var(--muted); }
.pd-code { width: 100%; max-width: 280px; margin: 0 auto; font: 700 56px/1 ui-monospace, 'SFMono-Regular', Consolas, monospace; letter-spacing: 0.35em; text-indent: 0.35em; text-align: center; text-transform: lowercase; padding: 14px 0; background: var(--panel); color: var(--text); border: 2px solid var(--border); border-radius: 18px; outline: none; }
.pd-code:focus { border-color: var(--accent); }
.pd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 56px; padding: 0 22px; border: 0; border-radius: 16px; background: var(--accent); color: #fff; font-weight: 700; font-size: 19px; cursor: pointer; }
.pd-btn:disabled { opacity: 0.45; }
.pd-btn.ghost { background: var(--panel-2); color: var(--text); }
.pd-err { color: #ff8a94; font-weight: 600; min-height: 1.4em; }
.pd-help { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; color: var(--text); }
.pd-help h2 { margin: 0 0 6px; font-size: 17px; }
.pd-help ol { margin: 0; padding-left: 20px; }
.pd-help li { margin: 4px 0; }

/* ---------- Kopfzeile ---------- */
.pd-top { display: flex; align-items: center; gap: 10px; }
.pd-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 14px; background: var(--panel); border-left: 6px solid var(--pc); }
.pd-me b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-score { margin-left: auto; font: 800 24px/1 system-ui; }
.pd-net { font-size: 12px; color: var(--muted); text-align: right; min-width: 52px; }
.pd-net .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); margin-right: 4px; }
.pd-net.off .dot { background: var(--danger); }
.pd-self { position: relative; width: 74px; height: 98px; border-radius: 12px; overflow: hidden; background: #000; flex: none; border: 2px solid var(--border); }
.pd-self video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.pd-self .pd-flags { position: absolute; left: 2px; right: 2px; bottom: 2px; display: flex; justify-content: space-between; font-size: 13px; }
.pd-self .pd-flags span { background: rgba(0, 0, 0, 0.65); border-radius: 6px; padding: 0 4px; }
.pd-self.cam-off video { visibility: hidden; }
.pd-self.cam-off::after { content: '📷✕'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.pd-level { position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: rgba(255, 255, 255, 0.12); }
.pd-level i { position: absolute; left: 0; bottom: 0; width: 100%; background: var(--ok); height: 0; transition: height 0.1s; }

.pd-banner { padding: 10px 12px; border-radius: 12px; background: rgba(240, 68, 82, 0.16); border: 1px solid rgba(240, 68, 82, 0.5); font-weight: 600; }
.pd-banner.info { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.45); }

/* ---------- Live-Stream vom Regie-Server ---------- */
/* Auf dem Handy so groß, dass darunter noch Tasten bzw. Buzzer passen (ein Handy muss reichen) */
.pd-stream-wrap { display: flex; flex-direction: column; align-items: center; }
.pd-stream-wrap.is-off { display: none; }
.pd-stream { position: relative; width: min(100%, calc(32svh * 16 / 9)); aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; }
.pd-stream canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.pd-stream[data-state='playing'] .pd-stream-msg { display: none; }
.pd-stream-hide { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 14px; cursor: pointer; }
.pd-stream-show { border: 1px dashed var(--border); background: transparent; color: var(--muted); border-radius: 12px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.pd-stream-show[hidden], .pd-stream[hidden] { display: none; }
/* Zuschauer-Ansicht (Mitmach-Seite ohne Code): Stream groß */
.pd-watch-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; }
.pd-live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25); }
.pad > .pd-stream-wrap:nth-child(2) .pd-stream { width: min(100%, calc(56svh * 16 / 9)); }
.pd-join { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); text-align: center; }
.pd-join h2 { margin: 0; font-size: 20px; }
.pd-join p { margin: 0; color: var(--muted); font-size: 14px; }
.pd-join-row { display: flex; gap: 10px; justify-content: center; align-items: stretch; flex-wrap: wrap; }
.pd-code.small { font-size: 34px; max-width: 170px; padding: 8px 0; margin: 0; }
/* Mit Stream: Tasten und Buzzer kompakter */
.pad.with-stream .pd-buzz { width: min(56vw, 34svh, 260px); font-size: 36px; }
.pad.with-stream .pd-key.big { min-height: 76px; font-size: 26px; }
.pad.with-stream .pd-keys.cols-7 .pd-key { min-height: 52px; }
.pad.with-stream .pd-prompt { font-size: 18px; }
.pad.with-stream .pd-stage { gap: 8px; }
/* Eingebettet (Mitmach-Script): weniger Rand */
body.embed .pad { padding: 8px; gap: 8px; }
.pd-stream .pd-stream-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; text-align: center; padding: 10px; }
.pd-stream .pd-unmute { position: absolute; right: 8px; bottom: 8px; min-height: 40px; font-size: 15px; }

/* ---------- Spielbereich ---------- */
.pd-stage { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.pd-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.pd-prompt { font-size: 21px; font-weight: 700; line-height: 1.3; }
.pd-info { font: 700 26px/1.3 ui-monospace, Consolas, monospace; letter-spacing: 0.12em; text-align: center; word-break: break-word; }
.pd-hint { color: var(--muted); text-align: center; font-weight: 600; }
.pd-hint.go { color: var(--ok); font-size: 19px; }
.pd-wait { flex: 1; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 18px; }
.pd-board { display: grid; gap: 6px; }
.pd-board .row { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: var(--panel); border-left: 5px solid var(--c, var(--accent)); }

.pd-keys { display: grid; gap: 10px; }
.pd-keys.cols-2 { grid-template-columns: repeat(2, 1fr); }
.pd-keys.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pd-keys.cols-4 { grid-template-columns: repeat(4, 1fr); }
.pd-keys.cols-5 { grid-template-columns: repeat(5, 1fr); }
.pd-keys.cols-6 { grid-template-columns: repeat(6, 1fr); }
.pd-keys.cols-7 { grid-template-columns: repeat(7, 1fr); }
.pd-key { min-height: 64px; border: 0; border-radius: 14px; background: var(--panel-2); font-weight: 800; font-size: 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; cursor: pointer; transition: transform 0.06s, background 0.15s; }
.pd-key:active:not(:disabled) { transform: scale(0.95); background: var(--accent); }
.pd-key:disabled { opacity: 0.32; }
.pd-key.picked { background: var(--accent); opacity: 1; box-shadow: 0 0 0 3px #fff inset; }
.pd-key .txt { font-size: 15px; font-weight: 600; line-height: 1.25; }
.pd-key.wide { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 10px 16px; text-align: left; min-height: 72px; }
.pd-key.wide .lbl { font-size: 26px; width: 34px; flex: none; }
.pd-key.up { background: #15803d; }
.pd-key.down { background: #b91c1c; }
.pd-key.big { min-height: 110px; font-size: 30px; }
.pd-keys.cols-7 .pd-key { min-height: 120px; font-size: 22px; }
.pd-keys.letters .pd-key { min-height: 52px; font-size: 20px; }
.pd-key.mark-1 { color: #60a5fa; }
.pd-key.mark-2 { color: #f87171; }

.pd-number { font: 800 44px/1 ui-monospace, Consolas, monospace; text-align: center; padding: 14px; background: var(--panel); border-radius: 14px; min-height: 76px; }
.pd-number small { font-size: 18px; color: var(--muted); }

/* ---------- Buzzer ---------- */
.pd-buzz-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.pd-buzz { width: min(78vw, 340px); aspect-ratio: 1; border-radius: 50%; border: 0; font: 900 44px/1 system-ui; color: #fff; background: radial-gradient(circle at 35% 30%, #ff6b78, #d9122a 60%, #8d0a1b); box-shadow: 0 14px 0 #6b0814, 0 20px 40px rgba(0, 0, 0, 0.5); cursor: pointer; transition: transform 0.05s, box-shadow 0.05s; }
.pd-buzz:active:not(:disabled) { transform: translateY(10px); box-shadow: 0 4px 0 #6b0814, 0 8px 20px rgba(0, 0, 0, 0.5); }
.pd-buzz:disabled { filter: grayscale(0.9) brightness(0.55); }
.pd-buzz.pressed { animation: pd-pulse 0.6s infinite alternate; }
.pd-buzz.won { background: radial-gradient(circle at 35% 30%, #6ee7a0, #16a34a 60%, #0b5a28); box-shadow: 0 14px 0 #084a20; filter: none; }
@keyframes pd-pulse { to { filter: brightness(1.35); } }
.pd-buzz-msg { font-size: 24px; font-weight: 800; text-align: center; min-height: 1.4em; }
.pd-buzz-msg.ok { color: var(--ok); }
.pd-buzz-msg.bad { color: #ff8a94; }

.pd-toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: #000; border: 1px solid var(--border); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 10; max-width: 90vw; }

/* 4 gewinnt: Mini-Spielfeld */
.pd-c4 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; padding: 8px; border-radius: 14px; background: #1e3a8a; }
.pd-c4 i { aspect-ratio: 1; border-radius: 50%; background: var(--bg); }
.pd-c4 i.on { background: var(--c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.3); }
.pd-key.face:disabled { opacity: 1; background: var(--panel); font-size: 30px; }
.pd-keys.cols-7 .pd-key { min-height: 64px; }
.pd-stream[hidden], .pd-unmute[hidden] { display: none; }
.pd-stream video.ls-obs-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.pd-stream canvas[hidden], .pd-stream video[hidden] { display: none; }
/* Pausen-Animation (Leuchtschild), solange nicht gesendet wird – siehe public/shared/idle-teaser.js */
.idle-teaser { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; pointer-events: none; overflow: hidden; }
.idle-teaser.is-on { opacity: 1; }
.pd-stream.idle .pd-stream-msg { display: none; }
.pd-stream .pd-unmute, .pd-stream .pd-stream-hide { z-index: 2; }
