/* =====================================================================
   lab - werkzeuge/wuerfel/app.css
   Würfel & Zufall: Reiter, Würfelfläche mit Augen (D6) und Zahlenplättchen,
   Münze und Zähler. Ruhiger Werkzeugkasten-Look (AGENTS.md §5.4):
     - Alle Klassen mit Prefix .lab_ (hier .lab_wu_ fuer Würfel)
     - Keine harten Farben, nur Variablen aus css/colors.css
     - Animationen nur als kurze Rückmeldung; ohne Bewegung bei
       prefers-reduced-motion sofort das Endergebnis.
   ===================================================================== */

/* ---------- Modus-Reiter ---------- */
.lab_wu_reiter {
  display: inline-flex;
  gap: 0.25rem;
  margin: 1.1rem 0 1rem;
  padding: 0.3rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 12px;
  box-shadow: var(--lab-shadow-1);
}

.lab_wu_reiter [role="tab"] {
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--blk-color);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
}

.lab_wu_reiter [role="tab"]:hover {
  background: var(--alt-div-hover-color);
}

.lab_wu_reiter [role="tab"][aria-selected="true"] {
  background: var(--bt-color);
  color: var(--bt-f-color);
}

/* ---------- Karte ---------- */
.lab_wu_karte {
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 14px;
  padding: 1.25rem 1.3rem 1.3rem;
  box-shadow: var(--lab-shadow-1);
  max-width: 48rem;
}

.lab_wu_frage {
  font-size: 1.05rem;
  margin: 0 0 0.9rem;
}

.lab_wu_gruppe {
  margin-bottom: 1rem;
}

.lab_wu_gruppe h3,
.lab_wu_verlaufblock h3 {
  font-family: var(--lab-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey600-color);
  margin: 0 0 0.55rem;
}

/* ---------- Auswahl-Chips ---------- */
.lab_wu_chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.lab_wu_chips .lab_btn {
  font-family: var(--lab-mono);
  min-width: 3.4rem;
}

/* Der aktive Würfel trägt aria-pressed - die Optik hängt nur daran,
   damit Zustand und Aussehen nicht auseinanderlaufen können. */
.lab_wu_chips .lab_btn[aria-pressed="true"] {
  background: var(--bt-color);
  color: var(--bt-f-color);
  border-color: var(--bt-color);
}

.lab_wu_eigen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
  font-size: 0.9rem;
  color: var(--grey600-color);
}

.lab_wu_eigen input {
  max-width: 9rem;
}

/* ---------- Anzahl-Schrittsteller ---------- */
.lab_wu_schritt {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.lab_wu_schritt .lab_btn {
  font-size: 1.2rem;
  line-height: 1;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
}

.lab_wu_schrittwert {
  font-family: var(--lab-mono);
  font-weight: 700;
  min-width: 5.5rem;
  text-align: center;
}

/* ---------- Knopfzeile ---------- */
.lab_wu_knopfzeile {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.4rem;
}

.lab_wu_knopfzeile_mitte {
  justify-content: center;
  text-align: center;
}

.lab_wu_wurfknopf {
  font-size: 1.05rem;
  padding: 0.7rem 2.2rem;
}

.lab_wu_tastenhinweis {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
}

.lab_wu_tastenhinweis kbd {
  font-family: var(--lab-mono);
  font-size: 0.78rem;
  background: var(--div-color);
  border: var(--lab-border);
  border-radius: 5px;
  padding: 0.05rem 0.32rem;
}

/* ---------- Ergebnisfläche: Würfel ---------- */
.lab_wu_ergebnis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  min-height: 6.5rem;
  align-items: center;
  margin-top: 0.8rem;
  padding: 1rem;
  background: var(--div-color);
  border: var(--lab-border);
  border-radius: 12px;
}

.lab_wu_wuerfel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 5.6rem;
  padding: 0.6rem 0.4rem 0.55rem;
  background: var(--ct-color);
  border: var(--lab-border);
  border-radius: 14px;
  box-shadow: var(--lab-shadow-1);
}

.lab_wu_augen,
.lab_wu_form {
  width: 3.4rem;
  height: 3.4rem;
}

/* Würfelkorpus: helle Füllung, Kontur in Textfarbe (beide Modi). */
.lab_wu_korpus {
  fill: var(--div-color);
  stroke: var(--blk-color);
  stroke-width: 2.6;
  stroke-linejoin: round;
}

/* Feine Gravurlinie innerhalb der Würfelform. */
.lab_wu_gravur {
  fill: none;
  stroke: var(--grey600-color);
  stroke-width: 1.1;
  stroke-linejoin: round;
  opacity: 0.75;
}

/* Feine Innenprägung (D60 und eigene Seitenzahlen). */
.lab_wu_praegung {
  fill: none;
  stroke: var(--grey600-color);
  stroke-width: 1.2;
  stroke-dasharray: 0.5 3.4;
  stroke-linecap: round;
  opacity: 0.8;
}

.lab_wu_augen circle {
  fill: var(--blk-color);
}

.lab_wu_formzahl {
  font-family: var(--lab-mono);
  font-size: 1.35rem;
  font-weight: 700;
  fill: var(--blk-color);
}

/* Zwei- und dreistellige Augen (D60, D100) kleiner setzen, sonst
   ragen sie aus der Kontur. */
.lab_wu_formzahl[data-stellen="2"] { font-size: 1.05rem; }
.lab_wu_formzahl[data-stellen="3"] { font-size: 0.85rem; }

.lab_wu_zahl {
  font-family: var(--lab-mono);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
}

.lab_wu_typ {
  font-family: var(--lab-mono);
  font-size: 0.72rem;
  color: var(--grey600-color);
}

.lab_wu_summe {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0.7rem 0 0;
}

.lab_wu_summe:empty {
  display: none;
}

/* Wurf-Rückmeldung: kurzes Aufblitzen, kein Gehopse. */
.lab_wu_wuerfel.is_frisch {
  animation: lab_wu_blitz 0.18s ease-out;
}

@keyframes lab_wu_blitz {
  from { transform: scale(0.94); }
  to { transform: scale(1); }
}

/* ---------- Verlauf ---------- */
.lab_wu_verlaufblock {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: var(--lab-border);
}

.lab_wu_kopfzeile {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.lab_wu_verlauf {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.lab_wu_verlauf li {
  font-family: var(--lab-mono);
  font-size: 0.88rem;
  background: var(--div-color);
  border: var(--lab-border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
}

.lab_wu_verlauf:empty::after {
  content: "Noch keine Würfe - das Ergebnis jedes Wurfs landet hier.";
  display: block;
  font-family: var(--lab-font);
  font-size: 0.88rem;
  color: var(--grey600-color);
}

/* ---------- Auswertung ---------- */
.lab_wu_statistik {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: var(--lab-border);
}

/* [hidden] muss auch hier greifen - sonst zeigt die Regel nichts. */
.lab_wu_statistik[hidden] {
  display: none;
}

.lab_wu_statistikzeile {
  font-family: var(--lab-mono);
  font-size: 0.88rem;
  margin: 0.55rem 0 0;
}

.lab_wu_statistikhinweis {
  font-size: 0.82rem;
  margin: 0.6rem 0 0;
}

.lab_wu_balken {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.7rem;
}

.lab_wu_balken_zeile {
  display: grid;
  grid-template-columns: 2.2rem 1fr 2.6rem;
  align-items: center;
  gap: 0.5rem;
}

.lab_wu_balken_zahl {
  font-family: var(--lab-mono);
  font-size: 0.82rem;
  color: var(--grey600-color);
  text-align: right;
}

.lab_wu_balken_spur {
  height: 0.7rem;
  background: var(--div-color);
  border: var(--lab-border);
  border-radius: 4px;
  overflow: hidden;
}

.lab_wu_balken_spur i {
  display: block;
  height: 100%;
  background: var(--bt-color);
}

.lab_wu_balken_anzahl {
  font-family: var(--lab-mono);
  font-size: 0.78rem;
  color: var(--grey600-color);
}

/* ---------- Formular: Zufallszahl ---------- */
.lab_wu_formular {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.7rem;
  align-items: end;
}

.lab_wu_formular label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--grey600-color);
}

.lab_wu_haekchen {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  color: var(--blk-color) !important;
  padding-bottom: 0.55rem;
}

.lab_wu_haekchen input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--bt-color);
}

.lab_wu_zahlen .lab_wu_zahl {
  font-size: 2.2rem;
}

.lab_wu_zahlen .lab_wu_wuerfel {
  border-top: 3px solid var(--bt-color);
}

.lab_wu_meldung:empty {
  display: none;
}

.lab_wu_meldung {
  margin: 0.6rem 0 0;
}

/* ---------- Münze ---------- */
.lab_wu_muenzbuehne {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  margin: 0.4rem 0 0.6rem;
}

.lab_wu_muenzrand {
  fill: var(--ct-color);
  stroke: var(--bt-color);
  stroke-width: 3;
}

/* Perlenkranz der Prägung: gepunkteter Ring. */
.lab_wu_muenzpunkt {
  fill: none;
  stroke: var(--bt-color);
  stroke-width: 2.2;
  stroke-dasharray: 0.5 5.1;
  stroke-linecap: round;
  opacity: 0.65;
}

.lab_wu_muenzring {
  fill: none;
  stroke: var(--bt-color);
  stroke-width: 1.4;
  opacity: 0.55;
}

.lab_wu_muenzbuchstabe {
  font-family: var(--lab-serif);
  font-size: 2.6rem;
  font-weight: 700;
  fill: var(--grey600-color);
}

/* Münzprägung: Profil und Sterne als Silhouette, Zahl in Serifenschrift. */
.lab_wu_profil {
  fill: var(--blk-color);
}

.lab_wu_profildetail {
  fill: none;
  stroke: var(--ct-color);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.lab_wu_muenzzahl {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.9rem;
  font-weight: 700;
  fill: var(--blk-color);
}

.lab_wu_muenzwort {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  min-height: 1.8em;
}

/* Kurzes Drehen beim Werfen (fällt ohne Bewegung weg, siehe unten). */
.lab_wu_muenz.is_wurf {
  animation: lab_wu_dreh 0.5s ease-in-out;
}

@keyframes lab_wu_dreh {
  from { transform: rotateY(0); }
  to { transform: rotateY(720deg); }
}

.lab_wu_stand {
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.lab_wu_stand > div {
  background: var(--div-color);
  border: var(--lab-border);
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  text-align: center;
}

.lab_wu_stand dt {
  color: var(--grey600-color);
  font-size: 0.82rem;
}

.lab_wu_stand dd {
  margin: 0;
  font-family: var(--lab-mono);
  font-size: 1.4rem;
  font-weight: 700;
}

/* ---------- Kleine Schirme ---------- */
@media (max-width: 30rem) {
  .lab_wu_karte {
    padding: 1rem 1rem 1.1rem;
  }
  .lab_wu_stand {
    grid-template-columns: 1fr;
  }
}

/* ---------- Weniger Bewegung: alles sofort, ohne Drehung ---------- */
@media (prefers-reduced-motion: reduce) {
  .lab_wu_muenz.is_wurf,
  .lab_wu_wuerfel.is_frisch {
    animation: none;
  }
}
