/* ==========================================================================
   ScanTo — Wählen per Scannen: Taster-Fassungen von GazeTo-Aktivitäten (14.11.2026)
   Motor: activities/engines-taster-wahl.js. Präfix .twahl / .twahl-*.
   Die Scan-Felder bewegen sich nie über transform (den setzt der Scan-Rahmen,
   .scan-focus scale) — bewegt werden nur Kinder (Figur, Becher, Bild).
   ========================================================================== */
.scan-stage.twahl { position: relative; height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 10px;
  box-sizing: border-box; padding: 12px; border-radius: 24px; overflow: hidden;
  background: #cfe6f2 center / cover no-repeat; }
.screen-runner .scan-stage.twahl { height: 100%; }
.twahl__aufgabe { align-self: center; max-width: min(92%, 760px); min-height: 1.4em; padding: 8px 22px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.94); color: #17324d; font-weight: 800; font-size: clamp(18px, 2.3vw, 28px); line-height: 1.25;
  text-align: center; box-shadow: 0 4px 14px rgba(20, 40, 60, 0.18); flex: none; }
.twahl__aufgabe:empty { visibility: hidden; }
.twahl__fortschritt.scan-progress { position: absolute; right: 16px; bottom: 12px; margin: 0; padding: 4px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.9); color: #17324d; font-weight: 800; font-size: 16px; z-index: 5; pointer-events: none; }
.twahl button { font: inherit; color: inherit; cursor: pointer; padding: 0; min-width: 120px; min-height: 96px; box-sizing: border-box; }
.twahl .scan-dim { opacity: 0.74; }
.twahl-figur { height: 100%; width: auto; flex: none; background-repeat: no-repeat; pointer-events: none; }
.twahl-figur--gespiegelt { transform: scaleX(-1); }
.twahl--feier .twahl__aufgabe { background: #ffe066; animation: twahl-feier 0.9s ease-in-out 2; }
@keyframes twahl-feier { 50% { transform: scale(1.08); } }

/* Funken (dekorativ) */
.twahl-funke { position: absolute; left: 50%; top: 45%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  pointer-events: none; z-index: 6; animation: twahl-funke 0.9s ease-out forwards; }
@keyframes twahl-funke { from { transform: rotate(var(--w)) translateY(0) scale(1); opacity: 1; }
  to { transform: rotate(var(--w)) translateY(-150px) scale(0.4); opacity: 0; } }

/* ── 1) Zwei Seiten ─────────────────────────────────────────────────────── */
.twahl-seiten { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.twahl-seite { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: stretch;
  border: 4px solid #ffffff; border-radius: 24px; background: #8fb8cf center / cover no-repeat;
  box-shadow: 0 8px 20px rgba(20, 40, 60, 0.22); transition: filter 0.5s, opacity 0.5s; }
.twahl-seite__figuren { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: space-around; padding: 4%; }
.twahl-seite__bild { width: 28%; max-height: 62%; object-fit: contain; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35)); }
.twahl-seite__name { align-self: center; margin: 0 0 14px; padding: 6px 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.92);
  color: #17324d; font-weight: 800; font-size: clamp(18px, 2.2vw, 26px); }
.twahl-seite.ist-ruhig { filter: grayscale(0.75) brightness(0.62); }
.twahl-seite.ist-lebendig { border-color: #ffe066; }
.twahl-seite.ist-lebendig .twahl-seite__bild { animation: twahl-huepfen 0.75s ease-in-out infinite; }
.twahl-seite--tanzen.ist-lebendig .twahl-seite__bild { animation-name: twahl-tanzen; }
.twahl-seite--schwimmen.ist-lebendig .twahl-seite__bild { animation-name: twahl-schwimmen; animation-duration: 1.3s; }
.twahl-seite--schweben.ist-lebendig .twahl-seite__bild { animation-name: twahl-schweben; animation-duration: 1.5s; }
.twahl-seite.ist-lebendig .twahl-seite__bild--1 { animation-delay: 0.18s; }
.twahl-seite.ist-lebendig .twahl-seite__bild--2 { animation-delay: 0.36s; }
@keyframes twahl-huepfen { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-22%) scale(1.05); } }
@keyframes twahl-tanzen { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) scale(1.08); } 75% { transform: rotate(14deg) scale(1.08); } }
@keyframes twahl-schwimmen { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(16%) rotate(4deg); } }
@keyframes twahl-schweben { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-14%) scale(1.1); } }
@media (orientation: portrait) {
  .twahl-seite__figuren { flex-direction: column; justify-content: space-evenly; }
  .twahl-seite__bild { width: 58%; max-height: 27%; }
}

/* ── 2) Hin und her ─────────────────────────────────────────────────────── */
.twahl-hin { position: relative; flex: 1; min-height: 0; transition: opacity 0.45s; }
.twahl-hin.ist-wechsel { opacity: 0; }
.twahl-hin__tier { position: absolute; display: flex; align-items: center; justify-content: center; overflow: visible;
  border: 4px solid rgba(255, 255, 255, 0.85); border-radius: 28px; background: rgba(255, 255, 255, 0.28);
  transition: opacity 0.4s, filter 0.4s, background 0.4s; }
.twahl-hin__tier .twahl-figur { height: 80%; max-width: 92%; position: relative; z-index: 1; }
.twahl-hin__licht { position: absolute; inset: -6%; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 236, 120, 0.95), rgba(255, 214, 0, 0.45) 55%, rgba(255, 214, 0, 0) 100%);
  transition: opacity 0.4s; }
.twahl-hin__tier.ist-dran { background: rgba(255, 249, 214, 0.55); border-color: #ffd400; }
.twahl-hin__tier.ist-dran .twahl-hin__licht { opacity: 1; animation: twahl-puls 1.8s ease-in-out infinite; }
.twahl-hin__tier.ist-ruhig { opacity: 0.6; filter: saturate(0.4); }
.twahl-hin__tier.ist-hopp .twahl-figur { animation: twahl-hopp 0.55s ease-in-out 2; }
@keyframes twahl-puls { 50% { transform: scale(1.06); } }
@keyframes twahl-hopp { 50% { translate: 0 -16%; } }

/* ── 3) Mein Monster wächst ─────────────────────────────────────────────── */
.twahl-monster__leckereien { flex: 0 0 auto; height: 34%; min-height: 120px; display: flex; justify-content: center; gap: 18px; }
.twahl-monster__leckerei { flex: 1 1 0; max-width: 270px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 4px solid #ffffff; border-radius: 24px; background: rgba(255, 253, 246, 0.95); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.12), 0 10px 18px rgba(30, 40, 60, 0.18); }
.twahl-monster__bild { flex: 1; min-height: 0; max-height: 74%; max-width: 86%; object-fit: contain; }
.twahl-monster__wort { font-weight: 800; font-size: clamp(16px, 1.8vw, 22px); color: #17324d; padding-bottom: 6px; }
.twahl-monster__platz { position: relative; flex: 1; min-height: 0; }
.twahl-monster__halter { position: absolute; left: 50%; bottom: 4%; height: 58%; display: flex; justify-content: center; transform: translateX(-50%); }
.twahl-monster__halter--1 { height: 74%; }
.twahl-monster__halter--2 { height: 92%; }
.twahl-monster__halter.ist-wachsen { animation: twahl-wachsen 0.9s ease-out; }
@keyframes twahl-wachsen { 0% { scale: 0.75; } 60% { scale: 1.08; } 100% { scale: 1; } }
.twahl-monster__leiste { position: absolute; right: 16px; top: 10px; display: flex; gap: 10px; padding: 8px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.88); }
.twahl-monster__punkt { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #4a7d4a; background: transparent; box-sizing: border-box; }
.twahl-monster__punkt.ist-voll { background: #6cc04a; }
.twahl-monster__flug { position: absolute; z-index: 20; object-fit: contain; pointer-events: none; }

/* ── 4) Wo ist es hin? (Becher) ─────────────────────────────────────────── */
.twahl-becher { position: relative; flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; gap: 5%;
  border-radius: 22px; background: linear-gradient(to bottom, transparent 0, transparent 58%, #b07a48 58%, #8e5b31 100%); }
.twahl-becher__platz { position: relative; width: 30%; max-width: 300px; height: 58%; max-height: 380px; margin-top: 8%; overflow: visible;
  border: 4px solid transparent; border-radius: 26px; background: rgba(255, 255, 255, 0.18); }
.twahl-becher--3 .twahl-becher__platz { width: 26%; }
.twahl-becher__tier { position: absolute; left: 0; right: 0; bottom: 5%; height: 46%; display: flex; justify-content: center; visibility: hidden; }
.twahl-becher__platz.ist-zeigen .twahl-becher__tier { visibility: visible; }
.twahl-becher__becher { position: absolute; left: 6%; right: 6%; bottom: 2%; height: 74%; z-index: 2; transition: transform 0.55s ease-in-out;
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.3)); }
.twahl--ruhig .twahl-becher__becher { transition-duration: 0.8s; }
.twahl-becher__becher svg { width: 100%; height: 100%; display: block; }
.twahl-becher__platz.ist-auf .twahl-becher__becher { transform: translateY(-48%); }

/* ── 5) Wo versteckt sich das Tier? ─────────────────────────────────────── */
.twahl--versteck { background: #bfefff url("../assets/img/tiere/bauernhof/grund-sky.webp") repeat-x top / auto 100%; }
.twahl-versteck { position: relative; flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: space-evenly; padding: 0 2% 5%;
  background: url("../assets/img/tiere/bauernhof/grund-repeating-foreground.webp") repeat-x bottom / auto 46%; }

.twahl-versteck__platz { position: relative; width: 29%; max-width: 340px; height: 56%; overflow: visible;
  border: 4px solid transparent; border-radius: 24px; background: rgba(255, 255, 255, 0.16); }
.twahl-versteck--4 .twahl-versteck__platz { width: 22%; }
.twahl-versteck__bild { position: absolute; left: 3%; right: 3%; bottom: 2%; width: 94%; height: 90%; object-fit: contain; object-position: center bottom;
  z-index: 2; pointer-events: none; }
.twahl-versteck__tier { position: absolute; z-index: 1; opacity: 0; display: flex; justify-content: center; pointer-events: none;
  transition: transform 0.6s ease-out, opacity 0.35s; }
.twahl-versteck__tier .twahl-figur { height: 100%; }
.twahl-versteck__platz--seite .twahl-versteck__tier .twahl-figur { transform: scaleX(-1); }
.twahl-versteck__platz.ist-lugt .twahl-versteck__tier { opacity: 1; transform: translate(var(--lugen-x, 0), var(--lugen-y, 0)); }
.twahl-versteck__platz.ist-raus .twahl-versteck__tier { opacity: 1; z-index: 3; transform: translate(var(--raus-x, 0), var(--raus-y, 0)) scale(1.1); transition-duration: 0.5s; }
.twahl-versteck__platz.ist-hilfe { background: radial-gradient(ellipse 75% 50% at 50% 70%, rgba(255, 236, 120, 0.85), rgba(255, 214, 0, 0)); }
.twahl-versteck__platz.ist-wackeln .twahl-versteck__bild { animation: twahl-wackeln 0.75s ease-in-out; transform-origin: 50% 100%; }
@keyframes twahl-wackeln { 20% { transform: rotate(-4deg); } 45% { transform: rotate(3.5deg); } 70% { transform: rotate(-2deg); } }

/* ── Ruhige Bewegung ────────────────────────────────────────────────────── */
.twahl--ruhig .twahl-seite.ist-lebendig .twahl-seite__bild { animation-duration: 1.8s; }
.twahl--ruhig .twahl-hin__tier.ist-dran .twahl-hin__licht { animation: none; }
.twahl--ruhig .twahl-funke { display: none; }
@media (prefers-reduced-motion: reduce) {
  .twahl-seite.ist-lebendig .twahl-seite__bild, .twahl-hin__tier.ist-hopp .twahl-figur, .twahl-hin__licht, .twahl-versteck__platz.ist-wackeln .twahl-versteck__bild { animation: none !important; }
}

/* ── CVI-Fassung: schwarzer Grund, keine Landschaft, gelbe Ränder ───────── */
.twahl--cvi, .twahl--cvi.twahl--versteck { background: #000 !important; }
.twahl--cvi .twahl__aufgabe, .twahl--cvi .twahl__fortschritt.scan-progress { background: #000; color: #fff; border: 2px solid #fff; box-shadow: none; }
.twahl--cvi .twahl-seite { background: #000 !important; border-color: #fff; box-shadow: none; }
.twahl--cvi .twahl-seite__name { background: #000; color: #fff; border: 2px solid #fff; }
.twahl--cvi .twahl-seite__bild { filter: drop-shadow(0 0 6px #ffe600); }
.twahl--cvi .twahl-seite.ist-lebendig { border-color: #ffe600; }
.twahl--cvi .twahl-seite.ist-ruhig { filter: brightness(0.35); }
.twahl--cvi .twahl-hin__tier { background: #000; border-color: #fff; }
.twahl--cvi .twahl-hin__tier.ist-dran { border-color: #ffe600; border-width: 6px; }
.twahl--cvi .twahl-hin__tier .twahl-figur, .twahl--cvi .twahl-becher__tier .twahl-figur, .twahl--cvi .twahl-versteck__tier .twahl-figur { filter: drop-shadow(0 0 6px #ffe600) drop-shadow(0 0 2px #ffe600); }
/* Audit 14.11.2026 (Hin und her, CVI): das leuchtende Tier wirkte unter dem gelben Glanz verdeckt —
   gelber Verlauf hinter einem gelben Tier, dazu gedimmt, solange der Rahmen beim anderen Tier stand,
   und das andere Tier glühte ebenfalls. Jetzt: Licht als Leuchtkranz AUSSEN um die Karte, innen
   Schwarz (volles Tier), das leuchtende Tier wird nie gedimmt, das andere glüht nicht und tritt zurück. */
.twahl--cvi .twahl-hin__licht { display: none; }
.twahl--cvi .twahl-hin__tier.ist-dran { box-shadow: 0 0 0 4px #000, 0 0 34px 10px rgba(255, 230, 0, 0.85); }
.twahl--cvi .twahl-hin__tier.ist-dran .twahl-figur { filter: drop-shadow(0 0 3px #fff); }
/* nur das Tier tritt zurück, nicht die Karte: sonst würde auch der Scan-Rahmen darauf blass */
.twahl--cvi .twahl-hin__tier.ist-ruhig { opacity: 1; filter: none; }
.twahl--cvi .twahl-hin__tier.ist-ruhig .twahl-figur { filter: none; opacity: 0.45; }
.twahl-hin__tier.ist-dran.scan-dim { opacity: 1; }
.twahl--cvi .twahl-monster__leckerei { background: #000; border-color: #ffe600; border-width: 6px; box-shadow: none; }
.twahl--cvi .twahl-monster__wort { color: #fff; }
.twahl--cvi .twahl-monster__leiste { background: #000; border: 2px solid #fff; }
.twahl--cvi .twahl-monster__punkt { border-color: #fff; }
.twahl--cvi .twahl-monster__punkt.ist-voll { background: #ffe600; border-color: #ffe600; }
.twahl--cvi .twahl-monster__halter .twahl-figur { filter: drop-shadow(0 0 8px #ffe600); }
.twahl--cvi .twahl-becher { background: none; }
.twahl--cvi .twahl-becher__platz, .twahl--cvi .twahl-versteck__platz { background: #000; border-color: #fff; }
.twahl--cvi .twahl-becher__becher { filter: none; }
.twahl--cvi .twahl-versteck { background: none; }
.twahl--cvi .twahl-versteck__bild { filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff); }
.twahl--cvi .twahl-versteck__platz.ist-hilfe { background: #000; border-color: #ffe600; }

/* Hochformat (am Ende, damit es die Grundregeln überschreibt) */
@media (orientation: portrait) {
  .twahl-versteck { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 42%; align-content: end; justify-items: center; gap: 3% 4%;
    background-size: auto 62%; }
  .twahl-versteck__platz, .twahl-versteck--4 .twahl-versteck__platz { width: 100%; height: 100%; max-width: none; }
  .twahl-versteck--3 .twahl-versteck__platz:first-child { grid-column: 1 / -1; width: 56%; }
  .twahl-becher__platz { width: 42%; height: 46%; }
  .twahl-becher--3 .twahl-becher__platz { width: 31%; }
}