/* ==========================================================================
   ScanTo — 3D-Spiele auf der Bühne (activities/engines-3d.js, 30.10.2026)
   Breite 3D-Welt, davor echte Scan-Knöpfe (≥ 96 px hoch × 120 px breit),
   kein Scrollen. Quer: Richtungen unter der Welt, Aktionen rechts daneben.
   Hochkant/schmal: alles untereinander.
   ========================================================================== */
.st3d { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 0; height: 100%; box-sizing: border-box; overflow: hidden; }
.st3d__prompt { flex: none; margin: 0; }
/* Polster rundum: der Fokusring (5 px, cvi 7 px) liegt außen am Knopf; .st3d schneidet
   sonst Knöpfe am unteren und rechten Rand an (Prüfung 31.10.2026: „Springen“) */
.st3d__haupt { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 156px; grid-template-rows: minmax(0, 1fr) auto; gap: 10px; padding: 0 9px 9px; box-sizing: border-box; }
.st3d__leiste { display: contents; }
.st3d__welt { grid-column: 1; grid-row: 1; position: relative; min-height: 140px; overflow: hidden; border-radius: 20px; background: #2a1b10; box-shadow: inset 0 0 0 3px #00000022; transition: box-shadow .25s; }
.st3d__welt canvas { border-radius: inherit; }
.st3d__richtungen { grid-column: 1; grid-row: 2; display: flex; gap: 10px; min-width: 0; }
.st3d__aktionen { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; min-height: 0; }

.screen-runner .st3d .kunst-knopf, .st3d .kunst-knopf { min-width: 120px; min-height: 96px; padding: 6px 8px; gap: 4px; box-sizing: border-box; }
.st3d__richtungen .kunst-knopf { flex: 1 1 120px; }
.st3d__aktionen .kunst-knopf { flex: 0 0 auto; width: 100%; }
.st3d .kunst-knopf .scan-card__label { font-size: 1rem; line-height: 1.15; text-align: center; }
.st3d .st3d__bild { width: 52px; height: 44px; flex: none; }
.st3d .st3d__bild--kugel { width: 44px; height: 44px; color: #7a1f17; --st3d-loch: #f6e7d2; }
.st3d__richtung[aria-pressed="true"] { box-shadow: inset 0 0 0 4px #b45309; background: #fff4e0; }
.st3d__werfen { background: #fff7ea; }
/* Gedimmt und gesperrt bleiben lesbar (Prüfung 31.10.2026: Deckkraft .32 bzw. .45 ergab
   hell 2,2:1 und 1,3:1). Gedimmt wie bei der Fahrt .82; der Fokus bleibt eindeutig
   (voller Ring + Schein, gedimmte Knöpfe ohne Ring). Gesperrt: volle Deckkraft,
   gestrichelter Rand, gedämpfte Schrift mit mindestens 4,5:1. */
.st3d .kunst-knopf.scan-dim { opacity: .82; }
.st3d .kunst-knopf:disabled { opacity: 1; color: #4a4a4a; background: #f2f2f2; border-style: dashed; border-color: #8a8a8a; box-shadow: none; }
.st3d .kunst-knopf:disabled .scan-card__label { color: #4a4a4a; }

/* Anzeigetafel oben links in der Welt (Text ist auch im Aufgabenband) */
.st3d__tafel { position: absolute; left: 12px; top: 12px; z-index: 4; display: grid; gap: 2px; padding: 8px 12px; border-radius: 12px;
  background: rgba(30, 18, 8, .72); color: #ffe9c4; font: 600 15px/1.25 "Atkinson Hyperlegible", system-ui, sans-serif; pointer-events: none; }
.st3d__tafel-zeile { display: flex; justify-content: space-between; gap: 14px; }
.st3d__tafel-zeile strong { color: #fff; font-size: 17px; }
.st3d__laden { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 3; color: #ffe9c4;
  font: 700 clamp(18px, 3vmin, 28px) "Atkinson Hyperlegible", system-ui, sans-serif; text-align: center; padding: 16px; }
.st3d__welt--jubel { animation: st3d-jubel .6s ease-out; }
@keyframes st3d-jubel { 0% { box-shadow: inset 0 0 0 3px #00000022; } 30% { box-shadow: inset 0 0 0 10px #ffc94d; } 100% { box-shadow: inset 0 0 0 3px #00000022; } }

/* schmal oder hochkant: untereinander, Richtungen dürfen umbrechen */
@media (max-width: 700px), (orientation: portrait) {
  .st3d__haupt { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; }
  .st3d__richtungen { grid-column: 1; grid-row: 2; flex-wrap: wrap; }
  .st3d__richtungen--5 .kunst-knopf { flex-basis: 30%; }
  .st3d__aktionen { grid-column: 1; grid-row: 3; flex-direction: row; flex-wrap: wrap; }
  .st3d__aktionen .kunst-knopf { flex: 1 1 120px; width: auto; }
}
/* niedrige Querformate: Bilder etwas kleiner, Knöpfe bleiben ≥ 96 px */
@media (max-height: 680px) and (orientation: landscape) {
  .st3d .st3d__bild { width: 44px; height: 36px; }
  .st3d__tafel { font-size: 13px; padding: 6px 10px; }
  .st3d__tafel-zeile strong { font-size: 15px; }
}

/* Wettrennen (activities/engines-rennen3d.js, 31.10.2026): breite Sprintbahn,
   darunter genau ein großer Knopf (H6, jeder Druck ein Sprung). */
.st3d--rennen .st3d__haupt { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.st3d--rennen .st3d__welt { background: #cfe9f6; }
.st3d--rennen.st3d--weltall .st3d__welt { background: #1a1640; }
.rennen3d__leiste { grid-column: 1; grid-row: 2; display: flex; justify-content: center; min-height: 0; }
.screen-runner .st3d .rennen3d__knopf, .st3d .rennen3d__knopf { flex: 0 1 380px; min-width: 240px; min-height: 120px; flex-direction: row; gap: 14px; }
.st3d .rennen3d__knopf svg { width: 52px; height: 52px; flex: none; }
.st3d .rennen3d__knopf .scan-card__label { font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-weight: 700; }
.st3d--rennen .st3d__prompt.rennen__ergebnis { font-weight: 700; }
@media (max-width: 700px), (orientation: portrait) {
  .st3d--rennen .st3d__haupt { grid-template-rows: minmax(0, 1fr) auto; }
  .rennen3d__leiste { grid-row: 2; }
  .screen-runner .st3d .rennen3d__knopf, .st3d .rennen3d__knopf { flex: 1 1 auto; min-width: 120px; }
}
@media (max-height: 680px) and (orientation: landscape) {
  .screen-runner .st3d .rennen3d__knopf, .st3d .rennen3d__knopf { min-height: 100px; }
}
[data-theme="cvi"] .st3d--rennen .st3d__welt { background: #000; }

/* Klar sehen (cvi) und Kontrast: Schwarz und Gelb */
[data-theme="cvi"] .st3d__welt { background: #000; box-shadow: inset 0 0 0 3px #ffe600; }
[data-theme="cvi"] .st3d__tafel { background: #000; color: #ffe600; border: 2px solid #ffe600; }
[data-theme="cvi"] .st3d__tafel-zeile strong { color: #ffe600; }
[data-theme="cvi"] .st3d__richtung[aria-pressed="true"] { background: #ffe600; color: #000; }
/* Label ohne eigenen Hintergrund: sonst steht beim gedrückten, gedimmten Knopf (#d9c200) ein
   gelber Kasten (#ffe600) um „Mitte“ (01.11.2026). */
[data-theme="cvi"] .st3d__richtung[aria-pressed="true"] .scan-card__label { background: transparent; color: #000; }
[data-theme="cvi"] .st3d__richtung[aria-pressed="true"] { box-shadow: inset 0 0 0 4px #000; }
[data-theme="cvi"] .st3d .st3d__bild--kugel { color: #ffe600; --st3d-loch: #000; }
[data-theme="cvi"] .st3d__werfen { background: #000; }
/* gedimmt = weiter klar lesbar (Gelb auf Schwarz, etwas zurückgenommen); Fokus bleibt 7-px-Ring + Schein */
[data-theme="cvi"] .st3d .scan-dim { opacity: 1; color: #d9c200; border-color: #9a8a00; }
[data-theme="cvi"] .st3d .scan-dim .scan-card__label { color: #d9c200; }
[data-theme="cvi"] .st3d .kunst-knopf:disabled { opacity: 1; background: #000; color: #d9c200; border-style: dashed; border-color: #9a8a00; }
[data-theme="cvi"] .st3d .kunst-knopf:disabled .scan-card__label { color: #d9c200; }
[data-theme="contrast"] .st3d .kunst-knopf:disabled,
[data-theme="contrast"] .st3d .kunst-knopf:disabled .scan-card__label { color: #333; }
[data-theme="contrast"] .st3d .kunst-knopf:disabled { border-color: #333; }
[data-theme="cvi"] .st3d .st3d__richtung[aria-pressed="true"].scan-dim { background: #d9c200; color: #000; }
[data-theme="cvi"] .st3d .st3d__richtung[aria-pressed="true"].scan-dim .scan-card__label { color: #000; }
[data-theme="contrast"] .st3d__richtung[aria-pressed="true"] { box-shadow: inset 0 0 0 5px currentColor; }

@media (prefers-reduced-motion: reduce) { .st3d__welt--jubel { animation: none; } .st3d__welt { transition: none; } }
[data-activity-animations="off"] .st3d__welt--jubel { animation: none; }
