/* Codequiz – Show-Styles
   Grundlage sind die Schulcomputer-Tokens (tokens.css): Schriften, Grundfarben,
   Formularelemente, Dialoge. Für das Show-Gefühl kommt eine eigene, buntere
   Palette dazu (--show-*). Kopfzeile, Fußbereich und Hell/Dunkel-Umschalter
   folgen dem Vorbild von elternsprechtag.eklassenzimmer.de. */

/* =========================================================
   Show-Palette
   ========================================================= */
:root {
  --show-pink: #ff4f8b;
  --show-pink-deep: #e0306f;
  --show-orange: #ffb23f;
  --show-teal: #14c7b4;
  --show-blue: #3a86ff;
  --show-violet: #8b5cf6;
  --show-yellow: #ffe066;
  --show-green: #16a34a;
  --show-red: #e11d48;
  --show-amber: #ea7a00;

  --stage-bg: #fff8ee;
  --stage-glow-1: rgba(255, 79, 139, 0.16);
  --stage-glow-2: rgba(58, 134, 255, 0.14);
  --stage-glow-3: rgba(255, 178, 63, 0.22);
  --dots: rgba(6, 56, 82, 0.11);
  --glass: rgba(255, 255, 255, 0.82);
  --lift: 0 10px 30px rgba(6, 56, 82, 0.14), 0 2px 6px rgba(6, 56, 82, 0.08);
  --stamp-bg: rgba(255, 255, 255, 0.94);
}
html[data-theme="dark"] {
  --stage-bg: #07142b;
  --stage-glow-1: rgba(139, 92, 246, 0.34);
  --stage-glow-2: rgba(255, 79, 139, 0.22);
  --stage-glow-3: rgba(20, 199, 180, 0.18);
  --dots: rgba(255, 255, 255, 0.08);
  --glass: rgba(9, 32, 54, 0.82);
  --lift: 0 14px 36px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  --stamp-bg: rgba(7, 20, 43, 0.94);
}

/* =========================================================
   Grundgerüst
   ========================================================= */
/* Die Seite scrollt ganz normal: Kopfzeile und Fußbereich laufen mit.
   min-height sorgt dafür, dass der Fußbereich bei wenig Inhalt unten steht. */
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  background-color: var(--stage-bg);
  background-image:
    radial-gradient(ellipse 60% 50% at 12% -8%, var(--stage-glow-1), transparent 70%),
    radial-gradient(ellipse 55% 45% at 92% -6%, var(--stage-glow-2), transparent 70%),
    radial-gradient(ellipse 70% 40% at 50% 112%, var(--stage-glow-3), transparent 70%),
    radial-gradient(circle, var(--dots) 1.5px, transparent 1.6px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 24px 24px;
  background-attachment: fixed;
}

#main { flex: 1; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.noscript { padding: var(--sc-space-6); text-align: center; font-weight: 700; }

/* Icons in Buttons (Heroicons v2, 24er-Outline-Set) */
.sc-btn .sc-icon { width: 20px; height: 20px; }
.sc-btn-sm .sc-icon { width: 16px; height: 16px; }
.tool-btn { width: 40px; height: 40px; }
.tool-btn .sc-icon { width: 22px; height: 22px; }

/* =========================================================
   Kopfzeile (nur in der Lobby)
   ========================================================= */
.app-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sc-space-4);
  padding: var(--sc-space-4) var(--sc-space-6);
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.brand { display: flex; align-items: center; gap: var(--sc-space-3); min-width: 0; }
.brand-title {
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: var(--sc-text-lg);
  color: var(--sc-color-heading);
  white-space: nowrap;
}

/* =========================================================
   Fußbereich (Vorbild: Elternsprechtag)
   ========================================================= */
.app-footer {
  flex-shrink: 0;
  padding: var(--sc-space-3) var(--sc-space-6);
  padding-bottom: calc(var(--sc-space-3) + env(safe-area-inset-bottom, 0px));
  text-align: center;
}
.brand-footer-link { display: inline-block; text-decoration: none; }
.brand-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sc-space-1);
  opacity: .7;
  transition: opacity .15s ease;
}
.brand-footer-link:hover .brand-footer { opacity: 1; }
.brand-footer > span:first-child { font-size: var(--sc-text-xs); color: var(--sc-color-text-muted); }
/* Logo als Hintergrundbild: Der Browser lädt nur die Variante, die zum
   Farbschema passt. Seitenverhältnis wie die SVG-Dateien (viewBox 3000 x 830). */
.brand-footer .brand-logo {
  display: block; height: 18px; aspect-ratio: 3000 / 830;
  background: url("../img/sc-logo-light.svg") center / contain no-repeat;
}
html[data-theme="dark"] .brand-footer .brand-logo { background-image: url("../img/sc-logo-dark.svg"); }
/* Während der Show nur eine schmale Zeile, damit die Bühne Platz hat. */
body.is-playing .app-footer {
  padding-top: var(--sc-space-2);
  padding-bottom: calc(var(--sc-space-2) + env(safe-area-inset-bottom, 0px));
}
body.is-playing .brand-footer { flex-direction: row; gap: var(--sc-space-2); }
body.is-playing .brand-footer .brand-logo { height: 15px; }

/* =========================================================
   Show-Buttons („Buzzer“)
   ========================================================= */
.buzzer {
  --b: var(--show-orange);
  --b-edge: #d58810;
  --b-ink: var(--sc-navy-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  font-family: var(--sc-font-body);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.1;
  padding: .85em 1.7em;
  border: 0;
  border-radius: var(--sc-radius-pill);
  background: var(--b);
  color: var(--b-ink);
  cursor: pointer;
  box-shadow: 0 6px 0 var(--b-edge), 0 12px 24px rgba(0, 0, 0, .18);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.buzzer:hover { filter: brightness(1.06); }
.buzzer:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--b-edge), 0 4px 10px rgba(0, 0, 0, .18); }
.buzzer:disabled { filter: grayscale(.7); opacity: .5; cursor: not-allowed; transform: none; }
.buzzer .sc-icon { width: 24px; height: 24px; }
.buzzer--teal { --b: var(--show-teal); --b-edge: #0a8f81; --b-ink: #032a26; }
.buzzer--pink { --b: var(--show-pink-deep); --b-edge: #a81d50; --b-ink: #fff; }
.buzzer--ghost {
  --b: var(--sc-color-surface);
  --b-edge: var(--sc-color-border);
  --b-ink: var(--sc-color-heading);
  box-shadow: inset 0 0 0 2px var(--sc-color-border), 0 4px 0 var(--b-edge);
}
.buzzer--ghost:active { box-shadow: inset 0 0 0 2px var(--sc-color-border), 0 1px 0 var(--b-edge); }
.buzzer--xl { font-size: 1.4rem; padding: .95em 2.2em; }
.buzzer:focus-visible { outline: 4px solid var(--sc-color-focus-ring); outline-offset: 4px; }
.kbd {
  display: inline-block;
  font-family: var(--sc-font-mono);
  font-size: .72em;
  font-weight: 700;
  padding: .1em .45em;
  border-radius: 6px;
  border: 1px solid currentColor;
  opacity: .6;
  margin-left: .2em;
}

/* =========================================================
   Lobby
   ========================================================= */
.screen-setup { padding: 0 var(--sc-space-4) var(--sc-space-8); }
.lobby {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sc-space-6);
}

.hero {
  display: flex;
  align-items: center;
  gap: var(--sc-space-6);
  padding: var(--sc-space-4) 0 var(--sc-space-2);
}
.hero-mascot {
  width: 150px; height: 150px; flex-shrink: 0;
  filter: drop-shadow(0 12px 18px rgba(6, 56, 82, .25));
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.hero-kicker {
  margin: 0;
  font-weight: 700;
  font-size: var(--sc-text-sm);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--show-pink-deep);
}
html[data-theme="dark"] .hero-kicker { color: var(--show-pink); }
.hero-title {
  margin: var(--sc-space-1) 0;
  font-size: clamp(3rem, 8vw, 5.2rem);
  line-height: 1;
  background: linear-gradient(95deg, var(--show-pink) 0%, var(--show-orange) 30%, var(--show-teal) 62%, var(--show-blue) 82%, var(--show-violet) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(6, 56, 82, .12));
}
.hero-sub { margin: 0; font-size: var(--sc-text-lg); color: var(--sc-color-text-muted); }

.resume {
  display: flex;
  align-items: center;
  gap: var(--sc-space-4);
  flex-wrap: wrap;
  padding: var(--sc-space-4) var(--sc-space-6);
  border-radius: var(--sc-radius-lg);
  background: linear-gradient(100deg, rgba(255, 79, 139, .16), rgba(255, 178, 63, .18));
  border: 2px solid var(--show-orange);
}
.resume-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--show-orange); color: var(--sc-navy-dark);
}
.resume-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; }
.resume-text strong { color: var(--sc-color-heading); }
.resume-text span { font-size: var(--sc-text-sm); color: var(--sc-color-text-muted); }
.resume-actions { display: flex; gap: var(--sc-space-2); flex-wrap: wrap; }

.panel {
  background: var(--sc-color-surface);
  border: 1px solid var(--sc-color-border);
  border-radius: var(--sc-radius-lg);
  box-shadow: var(--lift);
  padding: var(--sc-space-6);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: var(--sc-space-3);
  margin: 0;
  font-size: var(--sc-text-xl);
}
.step {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: var(--sc-text-lg);
  color: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}
.step-1 { background: var(--show-pink-deep); }
.step-2 { background: var(--show-orange); color: var(--sc-navy-dark); }
.step-3 { background: var(--show-teal); color: #032a26; }
.panel-sub { margin: var(--sc-space-2) 0 var(--sc-space-4); color: var(--sc-color-text-muted); }
.panel-sub strong { color: var(--sc-color-heading); }

.group-row { display: flex; gap: var(--sc-space-2); }
.group-row .sc-input { flex: 1; min-width: 0; font-size: var(--sc-text-lg); }

.chips { display: flex; flex-wrap: wrap; gap: var(--sc-space-2); margin-top: var(--sc-space-4); }
.chips:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sc-space-2);
  background: var(--team);
  color: var(--team-ink);
  border-radius: var(--sc-radius-pill);
  padding: 6px 6px 6px var(--sc-space-4);
  font-weight: 700;
  font-size: var(--sc-text-base);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .15);
}
.chip.is-new { animation: pop-in .35s cubic-bezier(.2, 1.4, .4, 1) both; }
.chip .sc-btn-icon { color: inherit; opacity: .8; }
.chip .sc-btn-icon:hover { opacity: 1; background: rgba(0, 0, 0, .12); }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sc-space-2);
}
.cat-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sc-space-3);
  padding: var(--sc-space-2) var(--sc-space-3);
  border-radius: var(--sc-radius-md);
  border: 2px solid var(--sc-color-border);
  background: var(--sc-color-surface-raised);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, opacity .15s ease;
}
.cat-tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cat-tile.is-on {
  border-color: var(--cat);
  background: color-mix(in srgb, var(--cat) 14%, var(--sc-color-surface-raised));
}
.cat-tile:not(.is-on) { opacity: .6; }
.cat-tile:not(.is-on) .cat-swatch { filter: grayscale(1); }
.cat-tile:has(input:focus-visible) { outline: 3px solid var(--sc-color-focus-ring); outline-offset: 2px; }
.cat-swatch {
  width: 30px; height: 40px; flex-shrink: 0;
  border-radius: 6px;
  background: var(--cat);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4), 0 3px 6px rgba(0, 0, 0, .2);
  transform: rotate(-6deg);
}
.cat-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* Lange Wörter wie „Verwirrungskarten“ dürfen notfalls trennen statt überzulaufen */
  overflow-wrap: break-word;
  hyphens: auto;
}
.cat-name { font-weight: 700; color: var(--sc-color-heading); }
.cat-sub { font-size: var(--sc-text-xs); line-height: 1.35; color: var(--sc-color-text-muted); }
.cat-count {
  margin-top: 2px;
  font-size: var(--sc-text-xs);
  font-weight: 700;
  color: var(--sc-color-heading);
  opacity: .7;
}
.cat-check {
  align-self: flex-start;
  margin-top: 2px;
  width: 24px; height: 24px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--sc-color-border);
  color: transparent;
}
.cat-check .sc-icon { width: 16px; height: 16px; stroke-width: 3; }
.cat-tile.is-on .cat-check { background: var(--cat); border-color: var(--cat); color: var(--cat-ink); }
.cat-actions { display: flex; gap: var(--sc-space-2); margin-top: var(--sc-space-4); }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sc-space-6); margin-top: var(--sc-space-4); }
.setting { border: 0; margin: 0; padding: 0; min-width: 0; }
.setting legend { margin-bottom: var(--sc-space-2); padding: 0; }
.field-note { margin: var(--sc-space-2) 0 0; font-size: var(--sc-text-xs); color: var(--sc-color-text-muted); }

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: var(--sc-radius-md);
  background: var(--sc-track-bg);
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block;
  padding: .5em 1em;
  border-radius: calc(var(--sc-radius-md) - 3px);
  font-weight: 700;
  font-size: var(--sc-text-sm);
  color: var(--sc-color-text-muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.segmented input:checked + span { background: var(--show-orange); color: var(--sc-navy-dark); box-shadow: 0 2px 0 #d58810; }
.segmented input:focus-visible + span { outline: 3px solid var(--sc-color-focus-ring); outline-offset: 1px; }

.end-row { display: flex; align-items: center; gap: var(--sc-space-2); margin-top: var(--sc-space-3); }
.end-value {
  width: 84px;
  text-align: center;
  font-family: var(--sc-font-display);
  font-size: var(--sc-text-lg);
}
.end-unit { font-weight: 700; color: var(--sc-color-heading); }

.toggles { display: flex; flex-wrap: wrap; gap: var(--sc-space-6); margin-top: var(--sc-space-6); }
.toggles .sc-checkbox { font-size: var(--sc-text-base); font-weight: 700; color: var(--sc-color-heading); }

.start-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sc-space-4);
  flex-wrap: wrap;
  padding: var(--sc-space-2) 0;
}
.start-hint { margin: 0; color: var(--sc-color-text-muted); font-weight: 700; }
.start-hint.is-ready { color: var(--show-green); }
html[data-theme="dark"] .start-hint.is-ready { color: #4ade80; }

.rules summary { font-weight: 700; cursor: pointer; color: var(--sc-color-heading); }
.rules ol { margin: var(--sc-space-3) 0 0; padding-left: var(--sc-space-6); }
.rules li + li { margin-top: var(--sc-space-2); }

/* =========================================================
   Spielleiste
   ========================================================= */
.gamebar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sc-space-3);
  padding: var(--sc-space-3) var(--sc-space-6);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--sc-color-border);
}
.round-badge {
  flex-shrink: 0;
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: var(--sc-text-base);
  color: #fff;
  padding: .35em .9em;
  border-radius: var(--sc-radius-pill);
  background: linear-gradient(100deg, var(--show-violet), var(--show-pink-deep));
  box-shadow: 0 3px 0 rgba(0, 0, 0, .18);
  white-space: nowrap;
}
.scoreboard { flex: 1; min-width: 0; display: flex; gap: var(--sc-space-3); flex-wrap: wrap; justify-content: center; }
.score-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sc-space-2);
  padding: 4px 5px 4px var(--sc-space-4);
  border-radius: var(--sc-radius-pill);
  background: var(--sc-color-surface);
  border: 3px solid var(--team);
  color: var(--sc-color-heading);
  font-weight: 700;
  white-space: nowrap;
  transition: transform .25s cubic-bezier(.2, 1.4, .4, 1), background .2s ease, color .2s ease, box-shadow .2s ease;
}
.score-pill .gscore {
  min-width: 1.9em;
  text-align: center;
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: var(--sc-text-lg);
  line-height: 1.5;
  border-radius: var(--sc-radius-pill);
  background: var(--team);
  color: var(--team-ink);
}
.score-pill.is-active, .score-pill.is-lottery {
  background: var(--team);
  color: var(--team-ink);
  transform: scale(1.08);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--team) 35%, transparent), 0 6px 18px rgba(0, 0, 0, .2);
}
.score-pill.is-active .gscore, .score-pill.is-lottery .gscore { background: rgba(255, 255, 255, .92); color: var(--sc-navy-dark); }
.score-pill.bump .gscore { animation: bump .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.6); } 100% { transform: scale(1); } }
.plus-one {
  position: absolute;
  right: 2px; top: -8px;
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: var(--sc-text-lg);
  color: var(--show-green);
  text-shadow: 0 2px 0 var(--sc-color-surface);
  pointer-events: none;
  animation: float-up 1.2s ease-out forwards;
}
@keyframes float-up { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-34px) scale(1.3); } }
.gamebar-tools { flex-shrink: 0; display: flex; align-items: center; gap: var(--sc-space-1); }

/* =========================================================
   Bühne
   ========================================================= */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-content: safe center;
  padding: var(--sc-space-6);
}
.stage-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  grid-template-areas: "turn turn" "main side";
  gap: var(--sc-space-6) var(--sc-space-8);
  align-items: center;
}
.stage-inner.is-wide { grid-template-columns: minmax(0, 1fr); grid-template-areas: "turn" "main"; }
.turn-row { grid-area: turn; display: flex; align-items: center; justify-content: center; gap: var(--sc-space-6); flex-wrap: wrap; }
.main-slot { grid-area: main; min-width: 0; display: flex; justify-content: center; }
.side-slot { grid-area: side; min-width: 0; display: flex; flex-direction: column; gap: var(--sc-space-4); }
.side-slot:empty { display: none; }
.timer-slot:empty { display: none; }

.turn-banner {
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.2vw, 2.4rem);
  line-height: 1.3;
  color: var(--sc-color-heading);
  text-align: center;
  text-wrap: balance;
}
.turn-banner.is-new { animation: slide-in .4s cubic-bezier(.2, 1.2, .4, 1) both; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
.team-tag {
  display: inline-block;
  padding: .02em .55em .1em;
  border-radius: var(--sc-radius-pill);
  background: var(--team);
  color: var(--team-ink);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .15);
  white-space: nowrap;
}

/* ---------- Timer ---------- */
.timer { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: var(--sc-color-surface); stroke: var(--sc-track-bg); stroke-width: 8; }
.timer-bar { fill: none; stroke: var(--show-teal); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s ease; }
.timer.is-half .timer-bar { stroke: var(--show-orange); }
.timer.is-warn .timer-bar { stroke: var(--show-red); }
.timer.is-warn .timer-face { animation: pulse .5s ease-in-out infinite alternate; }
.timer-face { position: absolute; inset: 0; display: grid; place-items: center; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.12); } }
.timer-num {
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--sc-color-heading);
}
.timer.is-warn .timer-num { color: var(--show-red); }
.timer-restart { position: absolute; right: -14px; bottom: -8px; width: 32px; height: 32px; background: var(--sc-color-surface); box-shadow: var(--sc-shadow-sm); }
.timer-restart .sc-icon { width: 16px; height: 16px; }

/* ---------- Karten ---------- */
.card {
  position: relative;
  width: 100%;
  max-width: 720px;
  min-height: 250px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sc-space-4);
  padding: var(--sc-space-6) var(--sc-space-8);
  border-radius: 26px;
  background-color: var(--card-color);
  background-image:
    linear-gradient(155deg, rgba(255, 255, 255, .32) 0%, rgba(255, 255, 255, 0) 42%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .07) 0 14px, transparent 14px 28px);
  color: var(--card-ink);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .28), var(--lift);
}
.card.is-new { animation: deal .65s cubic-bezier(.2, 1.1, .35, 1) both; }
@keyframes deal {
  0%   { opacity: 0; transform: perspective(1400px) translateY(-40px) rotateY(-95deg) scale(.85); }
  60%  { opacity: 1; transform: perspective(1400px) translateY(4px) rotateY(8deg) scale(1.02); }
  100% { transform: perspective(1400px) translateY(0) rotateY(0) scale(1); }
}
.card.is-wrong { animation: shake .5s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px) rotate(-1deg); }
  40% { transform: translateX(10px) rotate(1deg); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(4px); }
}
.card-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sc-space-2);
  font-size: var(--sc-text-sm);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.card-label .cat-pill {
  padding: .2em .7em;
  border-radius: var(--sc-radius-pill);
  background: rgba(255, 255, 255, .28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}
.card-code {
  margin: 0;
  font-family: var(--sc-font-mono);
  font-size: clamp(1.1rem, 2.1vw, 1.75rem);
  line-height: 1.55;
  white-space: pre-wrap;
  padding: var(--sc-space-4) var(--sc-space-6);
  border-radius: 16px;
  overflow-x: auto;
  background: color-mix(in srgb, var(--card-color) 12%, var(--sc-code-bg));
  color: var(--sc-code-text);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .12);
}
@supports not (background: color-mix(in srgb, red 10%, blue)) {
  .card-code { background: var(--sc-code-bg); }
}

/* Rückseite: der Stapel, von dem gezogen wird */
.deck {
  position: relative;
  width: 100%;
  max-width: 720px;
  min-height: 250px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: none;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.deck::before, .deck::after, .deck-face {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background-color: #0b3a57;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(255, 178, 63, .25), transparent 55%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .06) 0 12px, transparent 12px 24px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .06) 0 12px, transparent 12px 24px);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .14), var(--lift);
}
.deck::before { transform: translate(14px, 12px) rotate(2.5deg); opacity: .55; }
.deck::after { transform: translate(7px, 6px) rotate(1.2deg); opacity: .8; }
.deck-face {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sc-space-3);
  z-index: 1;
  transition: transform .2s ease;
}
.deck:hover .deck-face, .deck:focus-visible .deck-face { transform: translateY(-6px) rotate(-1deg); }
.deck:focus-visible { outline: none; }
.deck:focus-visible .deck-face { box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .14), 0 0 0 4px var(--sc-color-focus-ring), var(--lift); }
.deck-logo {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: #fff;
  padding: 8px;
  box-sizing: border-box;
  box-shadow: 0 0 0 6px var(--show-orange), 0 10px 20px rgba(0, 0, 0, .35);
}
.deck-title { font-family: var(--sc-font-display); font-weight: 700; font-size: 1.8rem; color: #fff; }
.deck-count { font-size: var(--sc-text-sm); font-weight: 700; color: rgba(255, 255, 255, .75); }

/* Stempel für das Ergebnis */
.stamp {
  position: absolute;
  top: 50%; left: 50%;
  z-index: 2;
  padding: .08em .45em .14em;
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: 1;
  white-space: nowrap;
  border: .1em solid currentColor;
  border-radius: .22em;
  background: var(--stamp-bg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
  transform: translate(-50%, -50%) rotate(-9deg);
  animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1) both;
  pointer-events: none;
}
.stamp--success { color: var(--show-green); }
.stamp--error { color: var(--show-red); }
.stamp--warning { color: var(--show-amber); }
html[data-theme="dark"] .stamp--success { color: #4ade80; }
html[data-theme="dark"] .stamp--error { color: #fb7185; }
html[data-theme="dark"] .stamp--warning { color: #fbbf24; }
@keyframes stamp {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(-20deg) scale(2.4); }
  to   { opacity: 1; transform: translate(-50%, -50%) rotate(-9deg) scale(1); }
}

/* ---------- Anzeigetafel für zahl ---------- */
.board {
  display: flex;
  align-items: stretch;
  gap: var(--sc-space-3);
  padding: var(--sc-space-3);
  border-radius: 22px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--sc-color-border);
  box-shadow: var(--lift);
}
.board-cell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--sc-space-3) var(--sc-space-2);
  border-radius: 16px;
  background: var(--sc-color-surface);
  border: 2px solid var(--sc-color-border);
}
.board-label {
  font-size: var(--sc-text-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sc-color-text-muted);
  white-space: nowrap;
}
.board-value {
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.1;
  color: var(--sc-color-heading);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  text-align: center;
}
.board-value.is-secret { color: var(--sc-color-text-muted); opacity: .6; }
.board-cell--after { border-color: var(--show-pink); }
.board-cell--after.is-revealed { background: var(--show-pink-deep); border-color: var(--show-pink-deep); }
.board-cell--after.is-revealed .board-label { color: rgba(255, 255, 255, .85); }
.board-cell--after.is-revealed .board-value { color: #fff; }
.board-cell--after.is-revealing .board-value { animation: reveal-pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes reveal-pop { from { transform: scale(.3) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.board-arrow { align-self: center; color: var(--sc-color-text-muted); }
.board-arrow .sc-icon { width: 28px; height: 28px; }
.board-eye { align-self: center; }
.board-eye.is-on { color: var(--show-orange); }

.trace {
  margin: 0;
  padding: var(--sc-space-3) var(--sc-space-4);
  border-radius: 16px;
  background: var(--sc-code-bg);
  color: var(--sc-code-text);
  font-family: var(--sc-font-mono);
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: var(--sc-shadow-sm);
}
.trace-rule { display: block; margin-top: var(--sc-space-1); font-family: var(--sc-font-body); font-size: var(--sc-text-sm); opacity: .75; }

.result {
  display: flex;
  align-items: center;
  gap: var(--sc-space-3);
  padding: var(--sc-space-3) var(--sc-space-4);
  border-radius: 16px;
  color: #fff;
  box-shadow: var(--lift);
}
.result.is-new { animation: slide-in .4s cubic-bezier(.2, 1.2, .4, 1) .15s both; }
.result .sc-icon { width: 30px; height: 30px; flex-shrink: 0; }
.result-body { display: flex; flex-direction: column; }
.result-title { font-family: var(--sc-font-display); font-weight: 700; font-size: var(--sc-text-lg); }
.result-text { font-size: var(--sc-text-sm); font-weight: 700; opacity: .95; }
.result--success { background: linear-gradient(100deg, #15803d, #16a34a); }
.result--error { background: linear-gradient(100deg, #be123c, #e11d48); }
.result--warning { background: linear-gradient(100deg, #c2410c, #ea7a00); }

/* ---------- Intro ---------- */
.intro {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sc-space-4);
  text-align: center;
}
.intro-label { margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--sc-color-text-muted); }
.intro-value {
  display: flex;
  align-items: center;
  gap: .35em;
  padding: var(--sc-space-4) var(--sc-space-8);
  border-radius: 28px;
  background: #0b3a57;
  color: #fff;
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .14), 0 0 0 6px var(--show-orange), var(--lift);
  animation: deal .7s cubic-bezier(.2, 1.1, .35, 1) .1s both;
}
.intro-value code { font-family: var(--sc-font-mono); font-size: .55em; color: var(--show-yellow); }
.intro-value strong { color: var(--show-orange); }
.intro-note { margin: 0; font-size: var(--sc-text-xl); font-weight: 700; color: var(--sc-color-heading); min-height: 1.6em; }

/* ---------- Finale ---------- */
.final {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sc-space-6);
}
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--sc-space-3);
  width: 100%;
}
.podium-place {
  flex: 0 1 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sc-space-2);
  min-width: 0;
  animation: rise .7s cubic-bezier(.2, 1.1, .35, 1) both;
}
.podium-place.rank-3 { animation-delay: .1s; }
.podium-place.rank-2 { animation-delay: .4s; }
.podium-place.rank-1 { animation-delay: .8s; }
@keyframes rise { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: translateY(0); } }
.podium-crown { color: var(--show-orange); height: 54px; }
.podium-crown .sc-icon { width: 54px; height: 54px; animation: bob 2.4s ease-in-out infinite; }
.podium-name {
  max-width: 100%;
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: var(--sc-text-lg);
  color: var(--sc-color-heading);
  text-align: center;
  overflow-wrap: anywhere;
}
.podium-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding-top: var(--sc-space-3);
  border-radius: 18px 18px 6px 6px;
  background-color: var(--team);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 60%);
  color: var(--team-ink);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .25), var(--lift);
}
.podium-rank { font-family: var(--sc-font-display); font-weight: 700; font-size: 2.4rem; line-height: 1; }
.podium-score { font-weight: 700; font-size: var(--sc-text-sm); }
.podium-place.rank-1 .podium-block { height: 170px; }
.podium-place.rank-2 .podium-block { height: 125px; }
.podium-place.rank-3 .podium-block { height: 90px; }
.final-title { margin: 0; text-align: center; font-size: clamp(2rem, 5vw, 3.2rem); }
.final-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sc-space-2); }
.stat {
  padding: .45em 1em;
  border-radius: var(--sc-radius-pill);
  background: var(--sc-color-surface);
  border: 1px solid var(--sc-color-border);
  font-weight: 700;
  font-size: var(--sc-text-sm);
  color: var(--sc-color-heading);
}
.final-rest { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: var(--sc-space-2); }
.final-rest li {
  display: flex; align-items: center; gap: var(--sc-space-3);
  padding: var(--sc-space-2) var(--sc-space-4);
  border-radius: var(--sc-radius-md);
  background: var(--sc-color-surface);
  border-left: 6px solid var(--team);
  font-weight: 700;
  color: var(--sc-color-heading);
}
.final-rest .rest-score { margin-left: auto; font-family: var(--sc-font-display); }
.history { width: 100%; }
.history summary { cursor: pointer; font-weight: 700; color: var(--sc-color-heading); display: flex; align-items: center; gap: var(--sc-space-2); }
.history summary .sc-icon { width: 18px; height: 18px; }
.history-list { list-style: none; margin: var(--sc-space-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.history-item {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sc-space-3);
  padding: var(--sc-space-2) var(--sc-space-3);
  border-radius: var(--sc-radius-sm);
  background: var(--sc-color-surface);
  font-size: var(--sc-text-sm);
}
.history-no { font-weight: 700; color: var(--sc-color-text-muted); min-width: 2ch; }
.history-swatch { width: 14px; height: 18px; border-radius: 3px; background: var(--cat); }
.history-team { font-weight: 700; color: var(--sc-color-heading); white-space: nowrap; }
.history-code { font-family: var(--sc-font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--sc-color-text-muted); }
.history-outcome { font-weight: 700; white-space: nowrap; }
.history-outcome.ok { color: var(--show-green); }
.history-outcome.fail { color: var(--show-red); }
.history-outcome.late { color: var(--show-amber); }
html[data-theme="dark"] .history-outcome.ok { color: #4ade80; }
html[data-theme="dark"] .history-outcome.fail { color: #fb7185; }
html[data-theme="dark"] .history-outcome.late { color: #fbbf24; }

/* =========================================================
   Steuerung
   ========================================================= */
.controls {
  position: sticky;
  bottom: 0;
  z-index: 5;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sc-space-4);
  padding: var(--sc-space-4) var(--sc-space-6) calc(var(--sc-space-4) + 6px);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--sc-color-border);
}
.guess {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--sc-space-3);
}
.guess-label { font-weight: 700; color: var(--sc-color-heading); }
.guess-input {
  width: 170px;
  text-align: center;
  font-family: var(--sc-font-display);
  font-weight: 700;
  font-size: 1.8rem;
  padding: .3em .5em;
  border-width: 3px;
  border-radius: var(--sc-radius-md);
}
.guess-input:focus { outline: none; border-color: var(--show-orange); box-shadow: 0 0 0 4px rgba(255, 178, 63, .3); }
.guess-input.is-invalid { border-color: var(--show-red); animation: shake .4s ease; }
.guess-error { width: 100%; margin: 0; text-align: center; font-size: var(--sc-text-sm); font-weight: 700; color: var(--show-red); }
.kbd-hint { width: 100%; margin: 0; text-align: center; font-size: var(--sc-text-xs); color: var(--sc-color-text-muted); }
@media (hover: none) { .kbd-hint, .kbd { display: none; } }

/* =========================================================
   Dialog & Konfetti
   ========================================================= */
.modal-overlay { position: fixed; inset: 0; z-index: 60; }
.modal-header { text-align: center; margin-bottom: var(--sc-space-4); }
.modal-header .sc-modal-icon { margin: 0 auto var(--sc-space-4); }
.modal-header h3 { margin: 0; }
#modal-slot .sc-modal-actions { flex-direction: column; margin-top: var(--sc-space-6); }
.confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

/* =========================================================
   Anpassungen
   ========================================================= */
/* Beamer / große Screens */
@media (min-width: 1400px) {
  .card, .deck { max-width: 800px; min-height: 290px; }
  .timer { width: 96px; height: 96px; }
  .timer-num { font-size: 2rem; }
}

/* Mittelgroß: Karte und Tafel untereinander */
@media (max-width: 1020px) {
  .stage-inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "turn" "main" "side"; gap: var(--sc-space-4); }
  .side-slot { width: 100%; max-width: 720px; justify-self: center; }
}

/* Handy */
@media (max-width: 720px) {
  .app-header { padding: var(--sc-space-3) var(--sc-space-4); }
  .hero { gap: var(--sc-space-3); }
  .hero-mascot { width: 84px; height: 84px; }
  .panel { padding: var(--sc-space-4); }
  .group-row { flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
  .start-bar .buzzer { width: 100%; }
  .gamebar { flex-wrap: wrap; padding: var(--sc-space-2) var(--sc-space-3); gap: var(--sc-space-2); }
  .scoreboard { order: 3; flex-basis: 100%; }
  .gamebar-tools { margin-left: auto; }
  #reset-btn .btn-text { display: none; }
  .stage { padding: var(--sc-space-4) var(--sc-space-3); }
  .card { padding: var(--sc-space-4); min-height: 0; border-radius: 20px; }
  .deck { min-height: 200px; }
  .card-code { padding: var(--sc-space-3); font-size: 1rem; }
  .timer { width: 64px; height: 64px; }
  .timer-num { font-size: 1.3rem; }
  .controls { padding: var(--sc-space-3); gap: var(--sc-space-2); }
  .controls > .buzzer { flex: 1 1 100%; }
  .buzzer { font-size: 1.05rem; padding: .8em 1.2em; }
  .podium-rank { font-size: 1.8rem; }
  .podium-place.rank-1 .podium-block { height: 130px; }
  .podium-place.rank-2 .podium-block { height: 95px; }
  .podium-place.rank-3 .podium-block { height: 70px; }
  .history-item { grid-template-columns: auto auto minmax(0, 1fr); }
  .history-code { grid-column: 1 / -1; }
}

/* Weniger Bewegung, wenn im System eingestellt */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
