/* Gemeinsames Aussehen: Vollbild für den Beamer, verspielt, Scratch-nah.
   Jede Seite setzt --farbe, --farbe-dunkel und --farbe-soft am body. */
@font-face { font-family: "Fredoka"; src: url("lib/fredoka.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
:root {
  --paper: #F8F6F1;
  --punkt: #E2DCCF;
  --surface: #FFFFFF;
  --sunk: #F3F0EA;
  --ink: #1F2230;
  --muted: #646778;
  --line: #E6E1D6;
  --accent: #A3222F;
  --ok: #2E8B57;
  --ok-dunkel: #1F6B41;
  --ok-soft: #E2F4E9;
  --nein: #D14334;
  --nein-soft: #FDE8E4;
  --farbe: #855CD6;
  --farbe-dunkel: #6B44BF;
  --farbe-soft: #EFE8FC;
  --rund: "Fredoka", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --schatten: 0 5px 0 rgba(31, 34, 48, .06), 0 14px 30px rgba(31, 34, 48, .08);
  --schatten-klein: 0 3px 0 rgba(31, 34, 48, .07), 0 6px 14px rgba(31, 34, 48, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background-color: var(--paper);
  background-image: radial-gradient(var(--punkt) 1.3px, transparent 1.4px);
  background-size: 24px 24px;
  color: var(--ink); font: 18px/1.45 var(--body); -webkit-font-smoothing: antialiased;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--farbe); outline-offset: 3px; }
.sym { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
h1, h2, h3, .rund { font-family: var(--rund); font-weight: 600; letter-spacing: 0; }

/* Kopfleiste in der Farbe der Station */
.leiste {
  display: flex; align-items: center; gap: 10px 18px; padding: 10px 20px; flex-wrap: wrap;
  background: var(--farbe); color: #fff; box-shadow: 0 4px 0 var(--farbe-dunkel);
  position: relative; z-index: 3;
}
.heim {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 11px; border-radius: 999px; background: rgba(255, 255, 255, .95);
  color: var(--ink); text-decoration: none; font: 600 16px var(--rund); white-space: nowrap; box-shadow: 0 3px 0 rgba(0, 0, 0, .15);
}
.heim:hover { background: #fff; transform: translateY(-1px); }
.leiste .titel { display: inline-flex; align-items: center; gap: 10px; font: 600 21px var(--rund); }
.st-nr { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--farbe-dunkel); font: 700 17px var(--rund); }
.fortschritt { display: flex; gap: 6px; list-style: none; margin: 0 0 0 auto; padding: 0; counter-reset: s; }
.fortschritt li { counter-increment: s; display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 4px; border-radius: 999px; font: 500 14px var(--rund); color: rgba(255, 255, 255, .85); }
.fortschritt li::before { content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, .25); font-weight: 700; }
.fortschritt li.erledigt::before { content: ""; background: rgba(255, 255, 255, .9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%232E8B57' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat; }
.fortschritt li.jetzt { background: rgba(255, 255, 255, .95); color: var(--ink); font-weight: 600; }
.fortschritt li.jetzt::before { background: var(--farbe); color: #fff; }

/* Vollbild-Inhalt */
.station { min-height: 0; width: 100%; max-width: 1800px; margin: 0 auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.aufgabe { flex: none; display: flex; align-items: baseline; gap: 6px 18px; flex-wrap: wrap; }
.aufgabe h1 { margin: 0; font-size: clamp(26px, 2.2vw + 10px, 40px); line-height: 1.1; }
.aufgabe .auftrag { margin: 0; font-size: clamp(17px, .8vw + 9px, 22px); color: var(--muted); }
.karte { background: var(--surface); border-radius: 22px; padding: 16px; min-width: 0; min-height: 0; box-shadow: var(--schatten); border: 3px solid var(--farbe-soft); }
.etikett { margin: 0 0 8px; font: 600 14px var(--rund); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* Auswahlantworten */
.optionen { display: grid; gap: 10px; }
.option {
  appearance: none; display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 3px solid var(--line); border-radius: 18px; padding: 10px 14px; font-size: clamp(16px, .6vw + 10px, 21px); line-height: 1.3;
  box-shadow: 0 4px 0 var(--line); transition: transform .12s, border-color .12s, background .12s;
}
.option:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--farbe); box-shadow: 0 6px 0 var(--farbe-soft); }
.option .bst { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--farbe-soft); color: var(--farbe-dunkel); font: 700 17px var(--rund); }
.option[aria-checked="true"] { border-color: var(--farbe); background: var(--farbe-soft); box-shadow: 0 4px 0 var(--farbe); }
.option[aria-checked="true"] .bst { background: var(--farbe); color: #fff; }
.option.richtig { border-color: var(--ok); background: var(--ok-soft); box-shadow: 0 4px 0 var(--ok); }
.option.richtig .bst { background: var(--ok); color: #fff; }
.option.falsch { border-color: var(--nein); background: var(--nein-soft); box-shadow: 0 4px 0 var(--nein); }
.option.falsch .bst { background: var(--nein); color: #fff; }
.option:disabled { cursor: default; }
.rueckmeldung { margin-top: 12px; border-radius: 16px; padding: 10px 14px; font-size: clamp(16px, .5vw + 10px, 20px); }
.rueckmeldung:empty { display: none; }
.rueckmeldung.gut { background: var(--ok-soft); color: var(--ok-dunkel); }
.rueckmeldung.schlecht { background: var(--nein-soft); color: #9A2B20; }
.rueckmeldung b { display: block; font-family: var(--rund); font-weight: 600; font-size: 1.1em; }
.rueckmeldung.neutral { background: var(--sunk); color: var(--muted); }

/* Knöpfe */
.knopf {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0;
  background: var(--surface); color: var(--ink); border-radius: 999px; padding: 10px 22px; font: 600 18px var(--rund); cursor: pointer;
  box-shadow: inset 0 0 0 3px var(--line), 0 4px 0 var(--line); text-decoration: none; transition: transform .08s;
}
.knopf:hover:not(:disabled) { transform: translateY(-1px); }
.knopf:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 0 0 3px var(--line), 0 1px 0 var(--line); }
.knopf.primaer { background: var(--farbe); color: #fff; box-shadow: 0 4px 0 var(--farbe-dunkel); }
.knopf.primaer:active:not(:disabled) { box-shadow: 0 1px 0 var(--farbe-dunkel); }
.knopf.primaer:disabled { background: var(--line); color: var(--muted); box-shadow: 0 4px 0 #D6D0C3; cursor: default; }
.knopf.leise { background: none; box-shadow: none; color: var(--muted); padding: 8px 12px; }
.knopf.leise:hover { color: var(--ink); }

/* Scratch-Steuerung: grüne Flagge und Stoppschild */
.scratch-leiste { display: flex; align-items: center; gap: 8px; }
.flagge, .stopp {
  appearance: none; width: 48px; height: 44px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer;
  transition: background .12s, transform .08s;
}
.flagge:hover:not(:disabled), .stopp:hover { background: rgba(76, 151, 255, .14); }
.flagge.aktiv { background: rgba(76, 151, 255, .22); }
.flagge:disabled { opacity: .3; cursor: default; }
.flagge svg, .stopp svg { width: 34px; height: 34px; }
.flagge.lockt:not(:disabled) svg { animation: winken 1.2s ease-in-out infinite; transform-origin: 20% 90%; }
@keyframes winken { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-10deg) scale(1.08); } }

/* Abschluss */
.geschafft { text-align: center; }
.geschafft .medaille { width: 96px; height: 96px; margin: 0 auto 6px; display: block; animation: hops .6s ease-out; }
@keyframes hops { 0% { transform: scale(.3) rotate(-20deg); } 70% { transform: scale(1.12) rotate(6deg); } 100% { transform: scale(1); } }
.geschafft h2 { margin: 0 0 6px; font-size: clamp(26px, 2vw + 12px, 40px); }
.geschafft .knoepfe { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

/* Fussleiste */
.fuss {
  display: flex; align-items: center; gap: 14px; padding: 10px 22px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96); box-shadow: 0 -4px 0 rgba(31, 34, 48, .04); position: relative; z-index: 3;
}
.fuss .hinweis { flex: 1; text-align: center; font: 500 17px var(--rund); color: var(--muted); }
.fuss .knopf.primaer { min-width: 150px; }
.konfetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* Kleine Bildschirme: scrollen erlaubt */
@media (max-width: 900px), (max-height: 560px) {
  body { height: auto; min-height: 100vh; min-height: 100dvh; overflow: auto; }
  .station { overflow: visible; padding: 12px; }
  .fuss { position: sticky; bottom: 0; }
}
@media (max-width: 720px) {
  .leiste { padding: 8px 12px; }
  .leiste .titel { font-size: 18px; }
  .fortschritt { width: 100%; margin: 0; }
  .fortschritt li { flex: 1 1 0; padding: 3px; justify-content: center; font-size: 0; }
  .fortschritt li.jetzt { font-size: 13px; padding-right: 10px; flex: 2 1 0; }
  .karte { border-radius: 18px; padding: 12px; }
  .fuss { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .fuss .hinweis { font-size: 14px; }
  .fuss .knopf { padding: 10px 16px; }
  .fuss .knopf.primaer { min-width: 0; }
}
