/* ================================================================ Modus „Zappzarapp!“: die Chaos-Show
   Look: Fernsehabend auf dem Sofa – Nachtblau mit Röhrenflimmern und Zeilen, Testbild-Farbbalken, Bildschirm-
   Einblendungen (OSD) in „VT323“. Quizzly mit Fernbedienung. Gilt nur für Lobby, Zapping und Siegerehrung –
   jede Runde trägt den Look ihrer Show (body[data-mode] wechselt mit). Dazu: Zapping-Bildschirm (.screen.zap),
   Sender-Chip im Rundenintro (.ri-show) und am Handy (.zapv, .zpshow). */

body[data-mode="chaos"] {
  --ink: #111433;
  --ink-soft: #3b3f6b;
  --bg1: #05071a;
  --bg2: #17124a;
  --accent: #22d3ee;
  --pink: #ff3fa4;
  --cyan: #22d3ee;
  --osd: #7dffb0;
  --font-tv: 'VT323', 'JetBrains Mono', monospace;
  --chip-bg: rgba(4, 7, 28, 0.62);
  --chip-bd: rgba(165, 243, 252, 0.3);
  --bars: linear-gradient(90deg, #d8d8d8 0 14.3%, #e6d200 0 28.6%, #00c8d8 0 42.9%, #00b84a 0 57.2%, #d61fc4 0 71.5%, #d82020 0 85.8%, #2233d8 0);
}

/* ------------------------------------------------------------ Hintergrund: dunkles Wohnzimmer im Fernsehlicht */
body[data-mode="chaos"] .bg {
  background:
    radial-gradient(ellipse 70% 55% at 50% 110%, rgba(34, 211, 238, 0.28), transparent 70%),
    radial-gradient(ellipse 50% 40% at 0% 0%, rgba(214, 31, 196, 0.32), transparent 70%),
    radial-gradient(ellipse 45% 40% at 100% 10%, rgba(34, 51, 216, 0.4), transparent 70%),
    linear-gradient(170deg, var(--bg2), var(--bg1) 72%);
}
/* Bildzeilen und leichtes Röhrenflimmern */
body[data-mode="chaos"] .bg::before {
  inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 4px);
  animation: chaosFlicker 5s steps(1) infinite;
}
@keyframes chaosFlicker { 0%, 100% { opacity: 1; } 48% { opacity: 0.75; } 50% { opacity: 1; } 91% { opacity: 0.85; } }
/* Testbild-Farbbalken als schmale Leiste am unteren Rand */
body[data-mode="chaos"] .bg::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.45rem;
  background: var(--bars);
  opacity: 0.75;
}
body[data-mode="chaos"] .bg .blob { opacity: 0.18; }
body[data-mode="chaos"] .bg .blob.b1 { background: #d61fc4; }
body[data-mode="chaos"] .bg .blob.b2 { background: #22d3ee; }
body[data-mode="chaos"] .bg .blob.b3 { background: #2233d8; }

/* ------------------------------------------------------------ Schrift & Bedienelemente */
body[data-mode="chaos"] .logo { font-family: var(--font-tv); font-weight: 400; letter-spacing: 0.04em; }
body[data-mode="chaos"] .logo span { text-shadow: 0 0 0.25em currentColor, 0.04em 0 0 rgba(255, 0, 80, 0.6), -0.04em 0 0 rgba(0, 220, 255, 0.6); }
body[data-mode="chaos"] .logo span:nth-child(7n+1) { color: #f2f2f2 !important; }
body[data-mode="chaos"] .logo span:nth-child(7n+2) { color: #ffe600 !important; }
body[data-mode="chaos"] .logo span:nth-child(7n+3) { color: #22e6f5 !important; }
body[data-mode="chaos"] .logo span:nth-child(7n+4) { color: #2bff6e !important; }
body[data-mode="chaos"] .logo span:nth-child(7n+5) { color: #ff4fe6 !important; }
body[data-mode="chaos"] .logo span:nth-child(7n+6) { color: #ff4a4a !important; }
body[data-mode="chaos"] .logo span:nth-child(7n+7) { color: #6b7bff !important; }
body[data-mode="chaos"] .logo-sub, body[data-mode="chaos"] .editionbadge { font-family: var(--font-tv); letter-spacing: 0.12em; text-transform: uppercase; color: var(--osd); text-shadow: 0 0 8px rgba(125, 255, 176, 0.6); }
body[data-mode="chaos"] .insertcoin { font-family: var(--font-tv); font-size: 1.25rem; letter-spacing: 0.06em; color: var(--osd); animation: blink 1.4s steps(2) infinite; }
body[data-mode="chaos"] .seg { background: rgba(4, 7, 28, 0.75); border-color: rgba(165, 243, 252, 0.35); }
body[data-mode="chaos"] .seg button.on { background: var(--cyan); color: var(--ink); box-shadow: 0 0 12px rgba(34, 211, 238, 0.6); }
body[data-mode="chaos"] .lobby .btn.start { --c: var(--cyan); color: var(--ink); }
body.host[data-mode="chaos"] .lobby :is(.setgrp, .xrow) > label { color: #bdf4ff; }
body[data-mode="chaos"] .scores h1, body[data-mode="chaos"] .podium h1 { font-family: var(--font-tv); font-weight: 400; letter-spacing: 0.05em; }

/* ------------------------------------------------------------ Quizzly mit Fernbedienung */
body[data-mode="chaos"] .quizzly .qz-remote { display: inline; }
body[data-mode="chaos"] .quizzly .qz-beam { animation: chaosBeam 2.6s steps(1) infinite; }
@keyframes chaosBeam { 0%, 100% { opacity: 0; } 8%, 14%, 22% { opacity: 1; } 11%, 18% { opacity: 0; } }

/* ================================================================ Zapping (Phase „zap“, nur am großen Bildschirm) */
.screen.zap { padding: 1.1rem 2rem 7.4rem; gap: 0.6rem; }
.zp-head { flex: none; padding: 0 calc(var(--tbw) + 1.5rem) 0 0.4rem; min-width: 0; }
.zp-kick { font-family: 'VT323', monospace; font-size: 1.6rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.14em; text-transform: uppercase; color: #a5f3fc; text-shadow: 0 0 10px rgba(34, 211, 238, 0.6); animation: slideDown 0.5s var(--ease-out) both; }
.screen.zap.final .zp-kick { color: var(--gold); text-shadow: 0 0 12px rgba(255, 197, 61, 0.7); }
.zp-head h1 { font-family: 'VT323', monospace; font-weight: 400; font-size: clamp(2.4rem, 4.6vw, 5rem); line-height: 1; letter-spacing: 0.03em; white-space: nowrap; transform-origin: left center; text-shadow: 0 0 0.3em rgba(165, 243, 252, 0.45), 0.05em 0 0 rgba(255, 0, 80, 0.55), -0.05em 0 0 rgba(0, 220, 255, 0.55); animation: zpTurnOn 0.6s both; }
.zp-sub { min-height: 2.6rem; font-size: 1.3rem; font-weight: 700; line-height: 2.6rem; opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zp-who { display: inline-flex; align-items: center; gap: 0.5rem; margin-right: 0.3rem; padding: 0.15rem 0.9rem 0.15rem 0.2rem; vertical-align: middle; line-height: 1; border-radius: 999px; background: rgba(4, 7, 28, 0.6); border: 2px solid var(--pc, #fff); }
.zp-who b { font-family: var(--font-head); font-size: 1.35rem; }

/* Bühne: Größen-Container */
.zp-body { position: relative; flex: 1; min-height: 0; container-type: size; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3cqh; }

/* Sendersuchlauf: Röhrenfernseher mit Programmplätzen darunter */
.zp-tv { position: relative; height: min(72cqh, 62cqw); aspect-ratio: 4 / 3; padding: 2.6cqh; border-radius: 5cqh; background: linear-gradient(160deg, #3a3d4a, #17181f); border: 0.6cqh solid #0a0b10; box-shadow: 0 2.5cqh 6cqh rgba(0, 0, 0, 0.6), inset 0 0.5cqh 0 rgba(255, 255, 255, 0.12); animation: zpTurnOn 0.5s both; }
.zp-tv::before, .zp-tv::after { content: ''; position: absolute; bottom: 100%; left: 50%; width: 0.7cqh; height: 12cqh; background: #9aa3b5; border-radius: 1cqh; transform-origin: bottom; }
.zp-tv::before { transform: translateX(-50%) rotate(-28deg); }
.zp-tv::after { transform: translateX(-50%) rotate(26deg); }
.zp-scr { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 4cqh / 5cqh; background: #000; box-shadow: inset 0 0 4cqh rgba(0, 0, 0, 0.85); }
.zp-scr::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55)); }
.zp-ch { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2cqh; padding: 4cqh; text-align: center; color: #fff; }
.zp-ch .zp-p { display: none; }
.zp-ch .zp-ic { font-size: 15cqh; line-height: 1; filter: drop-shadow(0 0.8cqh 0 rgba(0, 0, 0, 0.35)); }
.zp-ch .zp-name { font-size: calc(6.4cqh * var(--fs, 1)); }
.zp-ch .zp-tag { font-size: 2.6cqh; }
.zp-ch.stop { animation: zpStop 0.5s var(--ease-back); }
.zp-noise { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.4 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 200px 200px, #555; }
.zp-noise.flick { animation: zpNoise 0.22s steps(4); }
@keyframes zpNoise { 0% { opacity: 1; background-position: 0 0; } 33% { opacity: 0.9; background-position: 60px 40px; } 66% { opacity: 0.5; background-position: -40px 90px; } 100% { opacity: 0; } }
@keyframes zpStop { 0% { transform: scale(1.12); filter: brightness(1.8); } 100% { transform: none; filter: none; } }
.zp-osd { position: absolute; top: 3cqh; right: 4cqh; z-index: 2; font-family: 'VT323', monospace; font-size: 8cqh; line-height: 1; color: #7dffb0; text-shadow: 0 0 1.2cqh rgba(125, 255, 176, 0.8), 0.3cqh 0.3cqh 0 #000; }
.zp-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2cqh; }
.zp-mini { position: relative; width: 10cqh; height: 7.5cqh; border-radius: 1.4cqh; display: grid; place-items: center; font-size: 3.8cqh; border: 0.3cqh solid rgba(255, 255, 255, 0.25); opacity: 0.5; transition: transform 0.12s, opacity 0.12s, box-shadow 0.12s; }
.zp-mini i { position: absolute; top: 0.2cqh; left: 0.7cqh; font: normal 2.2cqh 'VT323', monospace; color: #fff; text-shadow: 0 0 0.4cqh #000; }
.zp-mini.on { opacity: 1; border-color: #fff; transform: translateY(-0.8cqh) scale(1.12); box-shadow: 0 0 2cqh rgba(165, 243, 252, 0.8); }

/* Sendername in der Schrift seiner Show */
.zp-name { display: block; font-weight: 400; line-height: 1.05; text-shadow: 0 0.06em 0 rgba(0, 0, 0, 0.45); overflow-wrap: anywhere; }
.zp-tag { font-weight: 800; opacity: 0.92; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }

/* Abstimmung / Wahl des Letzten: drei Senderkarten */
.zp-cards { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2.6cqw; width: min(100%, 215cqh); height: 88cqh; }
.zp-card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqh; padding: 4cqh 2cqw 3cqh; border-radius: 3cqh; border: 0.5cqh solid rgba(255, 255, 255, 0.22); color: #fff; text-align: center; overflow: hidden; box-shadow: 0 1.2cqh 0 rgba(0, 0, 0, 0.4); cursor: default; transition: transform 0.25s var(--ease-back), opacity 0.3s, filter 0.3s, box-shadow 0.2s; animation: zpTurnOn 0.5s both; }
.zp-card:nth-child(2) { animation-delay: 0.12s; }
.zp-card:nth-child(3) { animation-delay: 0.24s; }
.zp-card .zp-p { position: absolute; top: 1.4cqh; left: 2cqh; font: 4.4cqh 'VT323', monospace; color: #7dffb0; text-shadow: 0 0 1cqh rgba(125, 255, 176, 0.7), 0.2cqh 0.2cqh 0 #000; }
.zp-card .zp-ic { font-size: 13cqh; line-height: 1; filter: drop-shadow(0 0.8cqh 0 rgba(0, 0, 0, 0.35)); }
.zp-card .zp-name { font-size: calc(5.4cqh * var(--fs, 1)); }
.zp-card .zp-tag { font-size: 2.5cqh; }
.zp-votes { min-height: 8cqh; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.6cqh; margin-top: auto; }
.zp-av { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4cqh; max-width: 100%; }
.zp-cnt { font: 3.6cqh 'VT323', monospace; letter-spacing: 0.04em; text-shadow: 0 0.2cqh 0 #000; }
.zp-mine { position: absolute; top: 1.4cqh; right: 1.6cqh; padding: 0.4cqh 1.4cqh; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 900; font-size: 2.3cqh; }
.screen.zap.canpick .zp-card { cursor: pointer; }
.screen.zap.canpick .zp-card:hover { transform: translateY(-1.2cqh); border-color: #fff; }
.zp-card.mine { border-color: #fff; box-shadow: 0 0 0 0.7cqh #22d3ee, 0 1.2cqh 0 rgba(0, 0, 0, 0.4); }
.zp-card.win { border-color: #fff; transform: scale(1.04); }
.zp-card.lose { opacity: 0.25; filter: grayscale(0.8); transform: scale(0.94); }

/* Ergebnis: der neue Sender „schaltet sich ein“ */
.zp-win { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(4, 6, 22, 0.6); animation: fadeIn 0.3s both; }
.zp-win[hidden] { display: none; }
.zp-winbox { display: flex; flex-direction: column; align-items: center; gap: 1.4cqh; max-width: 92cqw; padding: 5cqh 7cqw; border-radius: 4cqh; color: #fff; text-align: center; box-shadow: 0 0 0 1cqh rgba(255, 255, 255, 0.14), 0 3cqh 8cqh rgba(0, 0, 0, 0.6); animation: zpTurnOn 0.65s both; }
.zp-winbox .zp-wk { font: 4.6cqh 'VT323', monospace; letter-spacing: 0.12em; text-transform: uppercase; text-shadow: 0 0.2cqh 0 #000; }
.zp-winbox .zp-ic { font-size: 17cqh; line-height: 1; }
.zp-winbox .zp-name.big { font-size: calc(10cqh * var(--fs, 1)); }
.zp-winbox .zp-tag { font-size: 3cqh; }
.zp-winbox small { font-size: 2.8cqh; font-weight: 800; opacity: 0.92; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
@keyframes zpTurnOn { 0% { transform: scale(1, 0.01); filter: brightness(4); opacity: 0; } 35% { transform: scale(1, 0.02); filter: brightness(3); opacity: 1; } 70% { transform: scale(1, 1.04); } 100% { transform: none; filter: none; } }

/* Fuß: wer schon abgestimmt hat, Restzeit */
.zp-foot { flex: none; display: flex; align-items: center; gap: 1rem; min-height: 2.6rem; padding-left: 8rem; }
.zp-voters { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.zp-vp { position: relative; opacity: 0.4; filter: grayscale(0.8); transition: opacity 0.2s, filter 0.2s; }
.zp-vp.ok { opacity: 1; filter: none; }
.zp-vp i { position: absolute; right: -0.2rem; bottom: -0.2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; font-style: normal; font-weight: 900; font-size: 0.75rem; border: 2px solid var(--ink); }
.zp-status { font-weight: 800; white-space: nowrap; opacity: 0.85; }
.zp-time { flex: 1; height: 0.6rem; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.12); }
.zp-time i { display: block; height: 100%; background: linear-gradient(90deg, #22d3ee, #d61fc4); transform-origin: left; }
.screen.zap.done .zp-time i { background: rgba(255, 255, 255, 0.5); }

/* ------------------------------------------------------------ Rundenintro: aus welcher Show die Runde stammt */
.ri-show { flex: none; display: flex; align-items: center; gap: 0.45rem; height: var(--chip-h); padding: 0 1rem 0 0.8rem; margin-right: 0.6rem; border-radius: var(--chip-r); background: var(--chip-bg); border: 2px solid var(--chip-bd); font-weight: 800; font-size: 1.15rem; white-space: nowrap; animation: slideDown 0.5s 0.1s var(--ease-out) both; }
.ri-show i { font-style: normal; font-size: 1.4rem; }

/* ------------------------------------------------------------ Handy */
body.play .zpshow { margin-bottom: 0.6rem; font-weight: 800; }
body.play .zapv .zpflick { display: grid; place-items: center; width: 100%; height: 9rem; border-radius: 1.2rem; font-size: 4.5rem; border: 3px solid rgba(255, 255, 255, 0.25); transition: background 0.08s; }
body.play .zapv .vvopt { animation: zpTurnOn 0.45s both; }
body.play .zapv .vvopt:nth-child(2) { animation-delay: 0.08s; }
body.play .zapv .vvopt:nth-child(3) { animation-delay: 0.16s; }
body.play[data-mode="chaos"] .zapv h1, body.play[data-mode="chaos"] .zapv h2 { font-family: var(--font-tv); font-weight: 400; letter-spacing: 0.03em; font-size: 2.2rem; }
