/* Word Search Studio — Papier und Textmarker. */

@font-face { font-family: "Atkinson Next"; src: url(fonts/atkinson-next-latin.woff2) format("woff2"); font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Next"; src: url(fonts/atkinson-next-latin-ext.woff2) format("woff2"); font-weight: 400 800; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bricolage"; src: url(fonts/bricolage-latin.woff2) format("woff2"); font-weight: 500 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage"; src: url(fonts/bricolage-latin-ext.woff2) format("woff2"); font-weight: 500 800; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --font-ui: "Atkinson Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-grid: "Atkinson Next", system-ui, sans-serif;
  --font-display: "Bricolage", "Atkinson Next", system-ui, sans-serif;

  --bg: #f4efe4;
  --dot: #d9d0bd;
  --card: #fffdf8;
  --sheet: #ffffff;
  --ink: #1d1b17;
  --muted: #676157;
  --line: #e4dccb;
  --line-strong: #cbbfa6;
  --accent: #d9432a;
  --accent-soft: #fde4dc;
  --on-accent: #ffffff;
  --focus: #2459d8;
  --shape-fill: #f6f1e6;
  --m1: #ffd84d; --m2: #ff8fc7; --m3: #8ee68a; --m4: #7cc8ff; --m5: #ffb35c; --m6: #c8a2ff;
  --mark-opacity: .62;
  --mark-blend: multiply;
  --shadow: 0 1px 0 rgb(60 45 20 / .06), 0 12px 30px -12px rgb(60 45 20 / .22);
  --radius: 16px;
  --ease-spring: cubic-bezier(.2, .9, .25, 1.25);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light dark;
}
/* Dunkel: per Systemeinstellung (außer „Hell“ gewählt) oder per Schalter. Beide Blöcke gleich halten (scripts/test.mjs prüft das). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15161a;
    --dot: #2a2c33;
    --card: #1d1f24;
    --sheet: #23252b;
    --ink: #f1ede4;
    --muted: #a6a094;
    --line: #34363e;
    --line-strong: #4a4d57;
    --accent: #ff6b4f;
    --accent-soft: #3a211b;
    --on-accent: #1a0f0b;
    --focus: #8fb0ff;
    --shape-fill: #2a2d34;
    --mark-opacity: .5;
    --mark-blend: screen;
    --shadow: 0 1px 0 rgb(0 0 0 / .3), 0 16px 40px -16px rgb(0 0 0 / .7);
  }
}
:root[data-theme="dark"] {
  --bg: #15161a;
  --dot: #2a2c33;
  --card: #1d1f24;
  --sheet: #23252b;
  --ink: #f1ede4;
  --muted: #a6a094;
  --line: #34363e;
  --line-strong: #4a4d57;
  --accent: #ff6b4f;
  --accent-soft: #3a211b;
  --on-accent: #1a0f0b;
  --focus: #8fb0ff;
  --shape-fill: #2a2d34;
  --mark-opacity: .5;
  --mark-blend: screen;
  --shadow: 0 1px 0 rgb(0 0 0 / .3), 0 16px 40px -16px rgb(0 0 0 / .7);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1.0625rem/1.55 var(--font-ui);
  color: var(--ink);
  background: var(--bg) radial-gradient(var(--dot) 1px, transparent 1.3px) 0 0 / 22px 22px;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.12; letter-spacing: -.015em; }
button, input, textarea, select { font: inherit; color: inherit; }
svg { display: block; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* Kopf */
.top { display: flex; align-items: center; gap: 24px; padding: 14px clamp(16px, 4vw, 40px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 800 1.15rem/1 var(--font-display); letter-spacing: -.02em; }
.logo-mark { width: 34px; height: 34px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.top-tools { display: flex; align-items: center; gap: 8px; }
.lang-switch { display: flex; border: 1.5px solid var(--line); border-radius: 999px; padding: 2px; background: var(--card); }
.lang-switch a, .lang-switch span { font: 700 .8rem/1 var(--font-ui); letter-spacing: .06em; padding: 7px 10px; border-radius: 999px; text-decoration: none; color: var(--muted); }
.lang-switch a:hover { color: var(--ink); }
.lang-switch .lang-cur { background: var(--ink); color: var(--bg); }
.theme-btn { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; transition: transform .3s var(--ease-spring), border-color .15s; }
.theme-btn:hover { border-color: var(--ink); transform: rotate(-12deg); }
.theme-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; transition: opacity .25s, transform .4s var(--ease-spring); }
.theme-btn .fill { fill: currentColor; stroke: none; }
.theme-btn svg { opacity: 0; transform: scale(.4) rotate(-90deg); }
:root:not([data-theme-choice]) .ic-auto, [data-theme-choice="auto"] .ic-auto, [data-theme-choice="light"] .ic-light, [data-theme-choice="dark"] .ic-dark { opacity: 1; transform: none; }
.nav a { text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); transition: background .2s, color .2s; }
.nav a:hover { color: var(--ink); background: var(--card); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); }

/* Werkstatt */
.studio { padding: 8px clamp(16px, 4vw, 40px) 48px; max-width: 1400px; margin: 0 auto; }
.studio-head { max-width: 760px; margin: 12px 0 28px; }
.studio-head h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; margin: 0 0 12px; width: fit-content; max-width: 100%; }
.studio-head h1::after { content: ""; display: block; width: calc(100% + .2em); height: .32em; margin-top: -.42em; margin-left: -.1em; background: var(--m1); opacity: .75; border-radius: 99px; mix-blend-mode: var(--mark-blend); position: relative; z-index: -1; transform-origin: left; animation: swipe .9s .25s var(--ease-out) both; }
.lede { font-size: 1.15rem; color: var(--muted); margin: 0; max-width: 62ch; }
@keyframes swipe { from { transform: scaleX(0); } }

.studio-body { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: start; }

.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 18px; box-shadow: var(--shadow); position: sticky; top: 16px; }
.field { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field legend, .field-row > label { font-weight: 700; font-size: .95rem; padding: 0; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.count { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { font-size: .85rem; color: var(--muted); margin: 0; }
input[type="text"], textarea {
  width: 100%; border: 1.5px solid var(--line-strong); background: var(--sheet); border-radius: 10px; padding: 10px 12px; font-size: 1rem;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 9.5em; line-height: 1.45; }
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m1) 70%, transparent); }

.chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line-strong); background: var(--sheet); border-radius: 999px; padding: 5px 12px 5px 9px; font-weight: 700; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: transform .15s var(--ease-spring), border-color .15s; }
.chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip:hover { border-color: var(--ink); transform: translateY(-1px); }

.segs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg input, .shape input { position: absolute; opacity: 0; pointer-events: none; }
.seg-box { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s, transform .2s var(--ease-spring); height: 100%; }
.seg-box svg { grid-row: span 2; width: 26px; height: 26px; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; fill: none; transition: stroke .2s; }
.seg-box svg circle { fill: var(--muted); stroke: none; transition: fill .2s; }
.seg-box b { font-size: .95rem; line-height: 1.2; }
.seg-box small { font-size: .75rem; color: var(--muted); line-height: 1.25; }
.seg:hover .seg-box { border-color: var(--line-strong); }
.seg input:checked + .seg-box { border-color: var(--ink); background: color-mix(in srgb, var(--m1) 22%, var(--sheet)); }
.seg input:checked + .seg-box svg { stroke: var(--accent); }
.seg input:checked + .seg-box svg circle { fill: var(--accent); }
.seg input:focus-visible + .seg-box, .shape input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg:active .seg-box, .shape:active span { transform: scale(.97); }

.shapes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.shape span { display: grid; justify-items: center; gap: 3px; padding: 8px 2px 6px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s, transform .2s var(--ease-spring); }
.shape svg { width: 26px; height: 26px; fill: var(--muted); transition: fill .2s, transform .35s var(--ease-spring); }
.shape small { font-size: .7rem; color: var(--muted); }
.shape:hover span { border-color: var(--line-strong); }
.shape:hover svg { transform: scale(1.08); }
.shape input:checked + span { border-color: var(--ink); background: color-mix(in srgb, var(--m2) 18%, var(--sheet)); }
.shape input:checked + span svg { fill: var(--accent); transform: scale(1.1); }

.range-row { display: flex; align-items: center; gap: 12px; }
input[type="range"] { flex: 1; accent-color: var(--accent); }
input[type="range"]:disabled { opacity: .45; }
output { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 5.5ch; text-align: right; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .95rem; }
.check.small { font-size: .85rem; font-weight: 600; }
.check input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.inline { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.inline legend { width: 100%; margin-bottom: 4px; }

.more { border-top: 1.5px dashed var(--line); padding-top: 14px; gap: 14px; }
.more summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .25s var(--ease-spring); }
.more[open] summary::before { transform: rotate(45deg); }
.more[open] > :not(summary) { animation: unfold .35s var(--ease-out) both; }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px); } }

.warnings:empty { display: none; }
.warnings { display: grid; gap: 8px; }
.warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: .9rem; border-left: 4px solid var(--accent); animation: unfold .3s var(--ease-out) both; }

/* Bühne mit Blatt */
.stage { display: grid; gap: 16px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar-gap { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--card); font-weight: 700; cursor: pointer; transition: transform .2s var(--ease-spring), background .15s, border-color .15s; white-space: nowrap; }
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-1px); border-color: var(--ink); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ghost { background: transparent; }
#b-play svg { fill: currentColor; stroke: none; }
#b-shuffle.spin svg { animation: spin .6s var(--ease-spring); }
@keyframes spin { to { transform: rotate(180deg); } }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; padding: 6px 4px; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--line-strong); position: relative; margin: 0; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--sheet); transition: transform .3s var(--ease-spring); box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

.paper-wrap { container-type: inline-size; }
.sheet {
  --pad: 6.5cqi;
  width: min(100%, 760px); margin: 0 auto; aspect-ratio: 8.5 / 11;
  background: var(--sheet); border-radius: 6px; box-shadow: var(--shadow), 0 0 0 1px var(--line);
  padding: var(--pad); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; gap: 2.4cqi;
  position: relative; overflow: hidden;
  font-size: clamp(9px, 2cqi, 16px);
}
.sheet[data-paper="a4"] { aspect-ratio: 210 / 297; }
.sheet-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .4em 2em; border-bottom: 2px solid var(--ink); padding-bottom: .6em; }
.sheet-title { margin: 0; font-size: 2.3em; font-weight: 800; line-height: 1.05; overflow-wrap: anywhere; }
.sheet-name { display: flex; gap: 1.6em; margin: 0; color: var(--muted); font-size: .95em; }
.sheet-name span { min-width: 9em; border-bottom: 1px solid var(--line-strong); padding-right: 1em; }
.sheet-grid { min-height: 0; display: flex; align-items: center; justify-content: center; }
.sheet-grid svg { width: 100%; height: 100%; max-height: 100%; overflow: visible; }
.sheet-bank h3 { font: 700 .85em/1 var(--font-ui); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 .7em; }
.bank { list-style: none; margin: 0; padding: 0; columns: 4 8em; column-gap: 1.6em; font-weight: 600; font-size: 1.05em; }
.bank li { break-inside: avoid; padding: .12em 0; position: relative; width: fit-content; transition: color .3s; }
.bank li::after { content: ""; position: absolute; left: -.1em; right: -.1em; top: 55%; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease-out); }
.bank li.found { color: var(--muted); }
.bank li.found::after { transform: scaleX(1); }
.bank-hidden { margin: 0; font-weight: 600; }
.sheet-secret { margin: .9em 0 0; font-size: .95em; }
.secret-line { display: flex; flex-wrap: wrap; gap: .35em; margin-top: .5em; }
.secret-line i { width: 1.1em; height: 1.3em; border-bottom: 1.5px solid var(--ink); }
.sheet-credit { margin: 0; font-size: .75em; color: var(--muted); text-align: right; align-self: end; }
.sheet-key { display: none; }

/* Gitter */
.ws-grid { font-family: var(--font-grid); }
.ws-shape rect { fill: var(--shape-fill); stroke: var(--line); stroke-width: 1; }
.ws-letters text { fill: var(--ink); font-weight: 700; text-anchor: middle; dominant-baseline: central; transform-box: fill-box; transform-origin: 50% 50%; user-select: none; -webkit-user-select: none; }
.ws-letters text.in { animation: drop .55s var(--ease-spring) both; animation-delay: calc(var(--d) * 16ms); }
@keyframes drop { from { opacity: 0; transform: translateY(-40%) scale(.55); } }
.ws-mark { stroke-linecap: round; opacity: var(--mark-opacity); mix-blend-mode: var(--mark-blend); stroke-dasharray: var(--len); }
.ws-mark.draw { animation: draw .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes draw { from { stroke-dashoffset: var(--len); } }

/* Ideen-Dialog */
.ideas { border: 0; padding: 0; background: transparent; width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px); color: var(--ink); }
.ideas::backdrop { background: rgb(20 16 10 / .45); backdrop-filter: blur(3px); }
.ideas[open] { animation: pop .35s var(--ease-spring); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.ideas-inner { background: var(--card); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); display: grid; gap: 12px; max-height: calc(100vh - 48px); overflow: auto; }
.ideas header { display: flex; align-items: center; justify-content: space-between; }
.ideas h2 { margin: 0; font-size: 1.5rem; }
.close { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 50%; }
.close svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ideas-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.idea { text-align: left; border: 1.5px solid var(--line); background: var(--sheet); border-radius: 14px; padding: 12px 14px; cursor: pointer; transition: transform .2s var(--ease-spring), border-color .15s; display: grid; gap: 4px; }
.idea:hover { border-color: var(--ink); transform: translateY(-2px); }
.idea b { font-family: var(--font-display); font-size: 1.05rem; }
.idea span { font-size: .8rem; color: var(--muted); line-height: 1.35; }
.idea .soon { color: var(--accent); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); opacity: 0; visibility: hidden; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; transition: transform .4s var(--ease-spring), opacity .2s, visibility 0s .4s; pointer-events: none; z-index: 20; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform .4s var(--ease-spring), opacity .2s; }

/* Ratgeber */
.guide { max-width: 820px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 64px; }
.guide h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 48px 0 18px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 44px 1fr; column-gap: 14px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font: 800 1.3rem/1 var(--font-display); background: var(--m1); color: #1d1b17; }
.steps h3, .feats h3 { margin: 4px 0 4px; font-size: 1.15rem; }
.steps p, .feats p { margin: 0; color: var(--muted); }
.feats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.feats li { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.feats li:nth-child(6n+1) { border-top: 5px solid var(--m1); }
.feats li:nth-child(6n+2) { border-top: 5px solid var(--m2); }
.feats li:nth-child(6n+3) { border-top: 5px solid var(--m3); }
.feats li:nth-child(6n+4) { border-top: 5px solid var(--m4); }
.feats li:nth-child(6n+5) { border-top: 5px solid var(--m5); }
.faq details { border-bottom: 1.5px solid var(--line); padding: 14px 0; }
.faq summary { font-weight: 700; cursor: pointer; font-size: 1.05rem; }
.faq p { margin: 10px 0 0; color: var(--muted); }

/* Fuß */
.foot { border-top: 1.5px solid var(--line); padding: 28px clamp(16px, 4vw, 40px); background: var(--card); }
.foot-cols { display: flex; flex-wrap: wrap; gap: 24px 64px; max-width: 1400px; margin: 0 auto; }
.foot h2 { font: 700 .8rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 10px; }
.foot-cols a { display: flex; align-items: center; gap: 6px; text-decoration: none; padding: 4px 0; }
.foot-cols a:hover { text-decoration: underline; }
.ext { width: 12px; height: 12px; }
.foot-note { max-width: 1400px; margin: 20px auto 0; color: var(--muted); font-size: .85rem; }

/* Schmal */
@media (max-width: 999px) {
  .studio-body { grid-template-columns: 1fr; }
  .panel { position: static; }
  .toolbar { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); padding: 10px 0; margin: 0 -4px; order: 2; }
  .stage { gap: 12px; }
}
@media (max-width: 560px) {
  .top { gap: 10px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .top-tools { margin-left: auto; }
  .nav a { padding: 6px 10px; font-size: .9rem; }
  .brand span { display: none; }
  .toolbar .btn span { display: none; }
  .toolbar .btn { padding: 10px 13px; }
  .toolbar .btn.primary span { display: inline; }
  .shapes { grid-template-columns: repeat(5, 1fr); }
  .shape small { display: none; }
  .sheet { --pad: 5cqi; font-size: clamp(8px, 2.6cqi, 14px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* Druck: nur das Blatt (und das Lösungsblatt), immer hell. */
@media print {
  :root, :root[data-theme] { --sheet: #fff; --ink: #000; --muted: #444; --line: #bbb; --line-strong: #888; --shape-fill: #f3f3f3; --mark-blend: multiply; --mark-opacity: .55; }
  body { background: #fff; display: block; }
  .top, .studio-head, .panel, .toolbar, .guide, .foot, .toast, .ideas, .skip { display: none !important; }
  .studio, .studio-body, .stage, .paper-wrap { display: block; padding: 0; margin: 0; max-width: none; }
  .sheet { width: 100%; height: 100vh; aspect-ratio: auto; box-shadow: none; border-radius: 0; padding: 0; font-size: 12.5pt; break-after: page; }
  .sheet-key.on { display: grid; }
  .ws-letters text { animation: none !important; }
  .ws-mark { animation: none !important; }
}

/* Spielen */
.play { padding: 8px clamp(16px, 4vw, 40px) 40px; max-width: 1400px; margin: 0 auto; }
.play-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin: 8px 0 20px; }
.kicker { margin: 0 0 4px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }
.play-head h1 { margin: 0; font-size: clamp(1.9rem, 4.5vw, 3rem); }
.play-stats { display: flex; gap: 18px; margin: 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.play-stats time { font-weight: 700; min-width: 4ch; }
.play-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: clamp(20px, 3vw, 40px); align-items: start; }
.board { background: var(--sheet); border-radius: var(--radius); box-shadow: var(--shadow), 0 0 0 1px var(--line); padding: clamp(10px, 2.5vw, 28px); touch-action: none; user-select: none; -webkit-user-select: none; display: flex; justify-content: center; cursor: crosshair; }
.board svg { width: 100%; height: auto; max-height: calc(100svh - 190px); }
.board-empty { color: var(--muted); padding: 60px 0; }
.ws-sel { stroke: var(--m4); opacity: .5; mix-blend-mode: var(--mark-blend); pointer-events: none; }
.ws-sel.live { stroke: var(--m4); }
.ws-sel.miss { animation: miss .36s ease-out forwards; }
@keyframes miss { 30% { stroke: var(--accent); } to { opacity: 0; stroke: var(--accent); } }
.ws-letters text.pending { fill: var(--accent); font-weight: 800; }
.ws-letters text.kbd { paint-order: stroke; stroke: var(--m1); stroke-width: 10px; stroke-linejoin: round; }
.board:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.play-side { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 14px; position: sticky; top: 16px; }
.side-h { font: 700 .85rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0; }
.play-side .bank { columns: 2 7em; font-size: 1.05rem; }
.play-actions { display: flex; flex-wrap: wrap; gap: 8px; }
a.btn { text-decoration: none; }
.done { position: fixed; inset: 0; display: grid; place-items: center; background: rgb(20 16 10 / .4); backdrop-filter: blur(3px); z-index: 30; padding: 16px; }
.done[hidden] { display: none; }
.done-card { background: var(--card); border-radius: 22px; padding: 28px; max-width: 440px; box-shadow: var(--shadow); text-align: center; display: grid; gap: 10px; justify-items: center; animation: pop .45s var(--ease-spring); }
.done-card h2 { margin: 0; font-size: 2rem; }
.done-card p { margin: 0 0 8px; color: var(--muted); }
@media (max-width: 860px) {
  .play-body { grid-template-columns: 1fr; }
  .play-side { position: static; }
  .board svg { max-height: none; }
}

/* Solver */
textarea.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .18em; text-transform: uppercase; }
textarea.mono::placeholder { text-transform: none; letter-spacing: .1em; }
.solve-status { margin: 0; font-weight: 700; font-size: 1.1rem; min-height: 1.5em; }
.solve-board { cursor: default; touch-action: auto; }
.solve-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.solve-list button, .solve-list span { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px 6px 8px; font-weight: 700; cursor: pointer; }
.solve-list span { cursor: default; }
.solve-list button:hover { border-color: var(--ink); }
.solve-list i { width: 14px; height: 14px; border-radius: 50%; }
.solve-list .missing span { border-style: dashed; color: var(--muted); }
.solve-list .missing i { border: 2px solid var(--accent); }
.solve-list small { font-weight: 400; color: var(--muted); }

/* Druckvorlagen */
.printables .kicker a { text-decoration: none; }
.printables .kicker a:hover { text-decoration: underline; }
.pcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; align-items: start; }
.pcard { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.pcard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pcard-head h2 { margin: 0; font-size: 1.4rem; }
.pcard-head p { margin: 0; color: var(--muted); font-size: .85rem; text-align: right; }
.pcard-sheet { container-type: inline-size; }
.sheet-mini { width: 100%; box-shadow: 0 0 0 1px var(--line); }
.sheet-key-print { display: none; }
.pcard-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pcard-actions .btn { padding: 8px 13px; font-size: .92rem; }
.pwords { max-width: 820px; margin: 40px 0 0; }
.pwords h2, .more-h { font-size: 1.5rem; margin: 0 0 10px; }
.pwords p { color: var(--muted); margin: 0 0 14px; }
.pwords-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--card); border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 14px 16px; color: var(--ink) !important; }
.more-h { margin-top: 48px; }
.tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tcards-coll { margin-bottom: 28px; }
.tcards-coll .tcard { border-width: 2px; border-color: var(--line-strong); }
.tcard { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; text-decoration: none; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px; transition: transform .2s var(--ease-spring), border-color .15s; }
.tcard:hover { transform: translateY(-2px); border-color: var(--ink); }
.thumb { width: 72px; height: 72px; background: var(--sheet); border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.thumb-letters text { fill: var(--ink); font-family: var(--font-grid); font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.thumb .ws-mark { opacity: var(--mark-opacity); }
.tcard-text { display: grid; gap: 2px; }
.tcard b { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.2; }
.tcard small { color: var(--muted); }
.tcard .soon { color: var(--accent); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
@media print {
  body[data-print] .studio-head, body[data-print] .pwords, body[data-print] .more-h, body[data-print] .tcards, body[data-print] .pcard-head, body[data-print] .pcard-actions { display: none !important; }
  body[data-print] .pcard:not(.printing) { display: none !important; }
  body[data-print] .pcards, body[data-print] .pcard, body[data-print] .pcard-sheet { display: block; border: 0; padding: 0; box-shadow: none; background: none; }
  body[data-print] .pcard.printing .sheet-key-print { display: grid; }
}

/* Rechtliches */
.legal { max-width: 760px; margin: 0 auto; padding: 16px clamp(16px, 4vw, 40px) 64px; overflow-wrap: anywhere; }
.legal h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 12px 0 18px; }
.legal h2 { font-size: 1.3rem; margin: 30px 0 8px; }
.legal h3 { font-size: 1.1rem; margin: 22px 0 6px; }
.legal p { margin: 0 0 12px; }
.legal-de { margin-top: 56px !important; padding-top: 24px; border-top: 1.5px solid var(--line); }
.notfound { text-align: center; padding-top: 64px; }
.notfound .play-actions { justify-content: center; }

/* Foto-Eingabe */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.photo-drop { display: grid; gap: 8px; padding: 14px; border: 2px dashed var(--line-strong); border-radius: 14px; background: color-mix(in srgb, var(--m4) 10%, var(--card)); transition: border-color .2s, background .2s; }
.photo-btn { justify-self: start; cursor: pointer; }
.photo-btn svg { fill: none; }
#s-photo:focus-visible + .hint, .photo-btn:has(+ #s-photo:focus-visible) { outline: 3px solid var(--focus); }
.photo-status:empty { display: none; }
.photo-status { margin: 0; font-weight: 700; font-size: .92rem; }
.photo-drop.busy .photo-status::before { content: ""; display: inline-block; width: .9em; height: .9em; margin-right: .5em; vertical-align: -.1em; border-radius: 50%; border: 2.5px solid var(--line-strong); border-top-color: var(--accent); animation: turn .8s linear infinite; }
@keyframes turn { to { transform: rotate(1turn); } }
.panel.dragging .photo-drop { border-color: var(--accent); background: var(--accent-soft); }
.ws-letters text.unsure { fill: var(--accent); paint-order: stroke; stroke: color-mix(in srgb, var(--accent) 22%, transparent); stroke-width: 14px; stroke-linejoin: round; }

/* Übersicht der Druckvorlagen: Filter und Rätselkarten */
.filters { display: grid; gap: 10px; margin: 8px 0 18px; position: sticky; top: 0; z-index: 4; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); padding: 10px 0; }
.frow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flabel { font: 700 .78rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); min-width: 7.5em; }
.fchip { border: 1.5px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 6px 13px; font-weight: 700; font-size: .9rem; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .2s var(--ease-spring); }
.fchip:hover { border-color: var(--ink); transform: translateY(-1px); }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fcount { margin: 0; color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.pzgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.pz { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; text-decoration: none; background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 9px; transition: transform .2s var(--ease-spring), border-color .15s; }
.pz:hover { transform: translateY(-2px); border-color: var(--ink); }
.pz[hidden] { display: none; }
.pz.pop { animation: tilein .38s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 18ms); }
@keyframes tilein { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.pz .thumb { width: 64px; height: 64px; }
.pz-text { display: grid; gap: 5px; min-width: 0; }
.pz b { font-family: var(--font-display); font-size: 1rem; line-height: 1.2; overflow-wrap: anywhere; }
.pz-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pz-meta small { color: var(--muted); font-size: .75rem; }
.lvl { font: 700 .7rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; border-radius: 999px; color: #1d1b17; }
.lvl-easy { background: var(--m3); }
.lvl-medium { background: var(--m1); }
.lvl-hard { background: var(--m2); }
.fempty { margin: 20px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fempty[hidden] { display: none; }
@media (max-width: 560px) {
  .flabel { min-width: 100%; }
  .filters { position: static; }
}
.ideas-h { grid-column: 1 / -1; margin: 10px 0 0; font: 700 .8rem/1 var(--font-ui); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
