/* Spiele (spiele.php, puzzle.php) */
.spiele-liste { display: grid; gap: 16px; max-width: 460px; margin-top: 24px; }
.spiele-karte { display: block; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); overflow: hidden; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-md); }
.spiele-karte:hover, .spiele-karte:focus-visible { box-shadow: var(--shadow-lg); }
.spiele-karte img { display: block; width: 100%; height: auto; }
.spiele-karte__text { display: block; padding: 16px 18px 18px; }
.spiele-karte__titel { display: block; font-size: 1.25rem; font-weight: 700; }
.spiele-karte__info { display: block; color: var(--muted); margin: 2px 0 12px; }

.puzzle-form { margin-top: 24px; }
.puzzle-form fieldset { border: 0; margin: 0 0 22px; padding: 0; }
.puzzle-form fieldset[hidden] { display: none; }
.puzzle-form legend, .puzzle-regler label { font-weight: 700; color: var(--ink); margin-bottom: 8px; padding: 0; }
.puzzle-motive { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.puzzle-motiv { position: relative; display: block; border: 3px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--surface); text-align: center; }
.puzzle-motiv:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 3px var(--gold); }
.puzzle-motiv:has(input:focus-visible) { outline: 3px solid var(--blue-deep); outline-offset: 3px; }
.puzzle-motiv input { position: absolute; opacity: 0; width: 100%; height: 100%; inset: 0; margin: 0; cursor: pointer; }
.puzzle-motiv img { display: block; width: 100%; height: auto; }
.puzzle-motiv span { display: block; padding: 6px 4px; font-size: .92rem; color: var(--ink); }
.puzzle-weltenwahl { display: flex; flex-wrap: wrap; gap: 8px; }
.puzzle-welt { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border: 2px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); color: var(--ink); }
.puzzle-welt:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.puzzle-welt input { width: 18px; height: 18px; accent-color: var(--blue); margin: 0; }
.puzzle-regler { margin-bottom: 22px; max-width: 520px; }
.puzzle-regler label { display: block; }
.puzzle-regler input { width: 100%; height: 32px; accent-color: var(--blue); }
.puzzle-skala { display: flex; justify-content: space-between; color: var(--muted); font-size: .92rem; }
.puzzle-los { min-height: 48px; font-size: 1.05rem; }

/* Während des Spiels: Kopfzeile läuft mit weg, damit das Feld die ganze Höhe bekommt */
body.puzzle-laeuft { overflow-anchor: none; }
body.puzzle-laeuft .site-header { position: static; }

body.puzzle-laeuft main.legal { padding: 0 0 24px; }
.legal .puzzle-spiel { max-width: 1680px; margin: 0 auto; padding: 8px 8px 16px; background: none; border: 0; border-radius: 0; }
.legal .puzzle-spiel p { margin: 0; }
.puzzle-leiste[hidden] { display: none; }
.puzzle-leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 2px 0 8px; }
.puzzle-stand { color: var(--ink); display: flex; gap: 12px; }
.puzzle-knoepfe { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.puzzle-knoepfe .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.puzzle-knoepfe .btn { min-height: 38px; padding: 6px 12px; font-size: .92rem; }
.puzzle-rahmen { position: relative; overflow: auto; border-radius: var(--radius); background: var(--blue-soft); }
.puzzle-feld { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.puzzle-brett { position: absolute; background: #fff; box-shadow: 0 0 0 2px var(--border-strong); border-radius: 3px; }
.puzzle-ganz { position: absolute; z-index: 100000; box-shadow: var(--shadow-lg); border-radius: 3px; }
.puzzle-ganz[hidden] { display: none; }
.puzzle-teil { position: absolute; left: 0; top: 0; margin: 0; padding: 0; border: 0; background: none; pointer-events: none; display: block; }
.puzzle-teil canvas { display: block; }
.puzzle-teil:focus { outline: none; }
.puzzle-teil:focus-visible canvas, .puzzle-teil.ist-gewaehlt canvas { filter: drop-shadow(0 0 2px #0E3B77) drop-shadow(0 0 4px #F5C518) drop-shadow(0 0 4px #F5C518); }
.puzzle-teil.rastet canvas { animation: puzzle-rasten .24s ease-out; }
@keyframes puzzle-rasten { 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

.puzzle-fertig { max-width: 720px; margin: 0 auto; text-align: center; padding: 8px 0 24px; }
.puzzle-fertig:focus { outline: none; }
.legal .puzzle-fertig h2 { font-size: 2rem; margin: 0 0 4px; }
.puzzle-fertig img { display: block; width: 100%; max-width: min(100%, 96vh); height: auto; margin: 14px auto; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.puzzle-fertig .puzzle-knoepfe { justify-content: center; margin: 0; }
.legal .puzzle-sterne { color: var(--gold); font-size: 2.2rem; line-height: 1; display: flex; justify-content: center; gap: 12px; }
.puzzle-sterne span { display: inline-block; animation: puzzle-stern .6s ease-out backwards; text-shadow: 0 0 1px #8a6a00; }
.puzzle-sterne span:nth-child(2) { animation-delay: .12s; }
.puzzle-sterne span:nth-child(3) { animation-delay: .24s; }
@keyframes puzzle-stern { from { transform: scale(0) rotate(-40deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .puzzle-teil.rastet canvas, .puzzle-sterne span { animation: none; }
}
@media (max-width: 560px) {
    .puzzle-motive { gap: 8px; }
    .puzzle-motiv span { font-size: .8rem; }
    .puzzle-knoepfe { margin-left: 0; }
    .puzzle-knoepfe .btn { padding: 6px 9px; font-size: .86rem; }
}

/* Flockenfänger (flockenfang.php); nutzt die Leiste und den Abschluss des Puzzles mit */
.flocken-erklaerung { margin-top: 20px; }
.flocken-steuerung { margin: 8px 0 0; padding-left: 20px; }
.puzzle-motive--zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 420px; }
.flocken-figur img { box-sizing: border-box; height: 190px; padding: 14px; object-fit: contain; background: #0E3B77; }
.flocken-spiel.laeuft { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.flocken-herzen { color: #b00d28; font-size: 1.25rem; line-height: 1; letter-spacing: 2px; }
.flocken-buehne { position: relative; margin: 0 auto; border-radius: var(--radius); overflow: hidden; line-height: 0; }
.flocken-buehne[hidden] { display: none; }
.flocken-feld { display: block; touch-action: none; }
.flocken-feld:focus { outline: none; }
.flocken-feld:focus-visible { outline: 4px solid #F5C518; outline-offset: -4px; }
.flocken-hinweis, .flocken-pause { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; line-height: 1.25; text-align: center; }
.flocken-hinweis { pointer-events: none; }
.flocken-hinweis[hidden], .flocken-pause[hidden] { display: none; }
.flocken-hinweis > div { padding: 14px 26px; border-radius: var(--radius-lg); background: #0E3B77; color: #fff; }
.flocken-hinweis strong { display: block; font-size: clamp(1.9rem, 8vw, 3.2rem); color: #FDE58A; }
.flocken-hinweis span { display: block; font-size: clamp(1rem, 4vw, 1.4rem); }
.flocken-pause { flex-direction: column; gap: 12px; background: rgba(5, 30, 70, .82); }
.flocken-pause .btn--ghost { background: #fff; color: #0E3B77; }
.flocken-wisch[hidden] { display: none; }
.legal .flocken-wisch { display: none; }
.flocken-ende-knoepfe .btn { min-height: 44px; }
.legal .flocken-spiel #flocken-summe, .legal .flocken-spiel #schneeball-summe, .legal .flocken-spiel #ski-summe { margin-top: 6px; color: var(--muted); }
.legal .flocken-spiel .puzzle-fertig { padding-top: 32px; }
.legal .flocken-spiel #flocken-ergebnis, .legal .flocken-spiel #schneeball-ergebnis, .legal .flocken-spiel #ski-ergebnis { margin: 6px 0 20px; font-size: 1.15rem; }
@media (pointer: coarse) and (orientation: portrait) {
    .legal .flocken-wisch { display: flex; align-items: center; justify-content: center; min-height: 110px; color: var(--muted); text-align: center; }
    .legal .flocken-wisch[hidden] { display: none; }
}

/* Winterreise (winterreise.php); nutzt Leiste, Bühne, Pause und Abschluss der anderen Spiele mit */
.wr-tafel { background: rgba(5, 30, 70, .86); padding: 16px; }
.legal .wr-tafel__text { color: #fff; font-size: clamp(1.2rem, 4vw, 1.8rem); font-weight: 700; max-width: 28ch; margin: 0 0 6px; }
.wr-tafel__knoepfe { display: flex; gap: 12px; }
.wr-tafel .btn, .wr-spiel .flocken-pause .btn { min-height: 48px; min-width: 120px; }
.wr-knoepfe { display: flex; justify-content: space-between; gap: 16px; max-width: 960px; margin: 10px auto 0; padding: 0 4px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.wr-knoepfe[hidden] { display: none; }
.wr-knoepfe__seite { display: flex; gap: 14px; }
.wr-knopf { width: 72px; height: 72px; border: 0; border-radius: 50%; background: #0E3B77; color: #fff; font-size: 1.8rem; line-height: 1; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.wr-knopf.gedrueckt { background: #1D5FB5; box-shadow: 0 0 0 4px #F5C518; }
.wr-knopf:focus-visible { outline: 4px solid #F5C518; outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
    .wr-knoepfe { display: none; }
}
@media (max-width: 380px) {
    .wr-knopf { width: 64px; height: 64px; }
    .wr-knoepfe__seite { gap: 10px; }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 560px) {
    .wr-spiel.laeuft .wr-knoepfe { position: fixed; left: 8px; right: 8px; bottom: 8px; max-width: none; margin: 0; pointer-events: none; z-index: 5; }
    .wr-spiel.laeuft .wr-knopf { pointer-events: auto; opacity: .72; width: 60px; height: 60px; }
}
