/* Wartezeitvertreib – gemeinsames Design aller Spiele (Farben und Bausteine wie im Wegeplaner) */
:root {
  --bg: #eef0e8;
  --surface: #fffdf7;
  --ink: #17324d;
  --muted: #526474;
  --accent: #e16a45;
  --accent-dark: #a63c22;
  --goal: #f1c453;
  --path: #dce9ef;
  --line: #b8c1bd;
  --good: #2b806b;
  --bad: #b3261e;
  --water: #1f78c8;
  --on: #f1c453;
  font-family: ui-rounded, "Arial Rounded MT Bold", "Aptos", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: radial-gradient(circle at 20% 0%, #fff 0, transparent 34rem), var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.65rem, 7vw, 2.2rem); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin-bottom: 12px; font-size: 1.6rem; line-height: 1.1; letter-spacing: -.03em; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 60; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; }
.app-shell { width: min(100%, 560px); min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) 18px calc(24px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; font-size: 1.24rem; font-weight: 900; }
.brand-mark { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 13px; background: var(--ink); color: #fff; font-size: 1.5rem; }
.brand-mark svg { width: 26px; height: 26px; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: grid; place-items: center; flex: 0 0 52px; width: 52px; height: 52px; border: 2px solid var(--line); border-radius: 17px; background: var(--surface); font-size: 1.45rem; font-weight: 900; box-shadow: 0 4px 12px rgba(23,50,77,.07); cursor: pointer; }
.hub-back { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 8px 16px; border: 2px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--ink); font-weight: 900; text-decoration: none; box-shadow: 0 4px 12px rgba(23,50,77,.07); }
.eyebrow { margin: 0 0 5px; color: var(--accent-dark); font-size: .77rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.lead { margin: 6px 2px 20px; color: var(--muted); font-size: 1.08rem; line-height: 1.5; font-weight: 700; }

/* Menü-Kacheln */
.tiles { display: grid; gap: 14px; margin: 0 0 22px; padding: 0; list-style: none; }
.game-tile { display: flex; align-items: center; gap: 16px; min-height: 96px; padding: 14px 16px; border: 3px solid var(--ink); border-radius: 22px; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 6px 0 color-mix(in srgb, var(--ink) 24%, transparent); }
.game-tile:active { transform: translateY(3px); box-shadow: 0 3px 0 color-mix(in srgb, var(--ink) 24%, transparent); }
.tile-icon { display: grid; place-items: center; flex: 0 0 68px; width: 68px; height: 68px; border-radius: 18px; background: var(--ink); color: #fff; }
.tile-icon svg { width: 48px; height: 48px; }
.game-tile h2 { margin: 0 0 3px; font-size: 1.3rem; }
.game-tile p { margin: 0; color: var(--muted); font-size: .98rem; line-height: 1.35; font-weight: 700; }
.tile-arrow { margin-left: auto; font-size: 1.8rem; font-weight: 900; color: var(--accent-dark); }

/* Buttons */
.primary-button { width: 100%; min-height: 63px; padding: 13px 20px; border: 0; border-radius: 19px; background: var(--accent); color: #fff; font-size: 1.12rem; font-weight: 900; box-shadow: 0 7px 0 var(--accent-dark); cursor: pointer; }
.primary-button:active { transform: translateY(3px); box-shadow: 0 4px 0 var(--accent-dark); }
.primary-button:disabled { opacity: .42; box-shadow: none; cursor: default; }
.secondary-button { width: 100%; min-height: 55px; margin-top: 9px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); font-weight: 850; cursor: pointer; }
.secondary-button:disabled { opacity: .42; cursor: default; }
.text-button { min-height: 50px; margin-top: 14px; padding: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 800; text-decoration: underline; cursor: pointer; }
.home-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; margin-top: 18px; padding: 12px 18px; border: 3px solid var(--ink); border-radius: 18px; background: var(--surface); color: var(--ink); font-weight: 900; cursor: pointer; }
.home-button span { font-size: 1.35rem; }
.home-button:disabled { opacity: .65; cursor: default; }
.toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 0; }
.toolbar button { min-height: 58px; padding: 9px 10px; border: 3px solid var(--ink); border-radius: 17px; background: var(--surface); color: var(--ink); font-size: .98rem; font-weight: 900; cursor: pointer; }
.toolbar button:active { transform: translateY(2px); }
.toolbar button:disabled { opacity: .4; cursor: default; }
.toolbar .wide { grid-column: 1 / -1; }

/* Schwierigkeit wählen */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 14px; padding: 0; border: 0; }
.seg legend { margin-bottom: 8px; font-size: .8rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.seg button { min-height: 56px; padding: 8px 6px; border: 3px solid var(--ink); border-radius: 16px; background: var(--surface); color: var(--ink); font-size: 1rem; font-weight: 900; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg legend { grid-column: 1 / -1; margin-bottom: 0; }

/* Spielbereich */
.game-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 8px 2px 14px; }
.game-head .chip { flex: 0 0 auto; padding: 8px 13px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); font-weight: 900; font-size: .95rem; }
.task-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 19px; background: rgba(255,253,247,.82); }
.task-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 14px; background: var(--goal); color: #172b3c; font-size: 1.6rem; font-weight: 900; }
.task-card p { margin: 0; color: var(--ink); line-height: 1.35; font-weight: 750; font-size: 1.05rem; }
.status-line { min-height: 28px; margin: 14px 4px 0; text-align: center; font-size: 1.05rem; font-weight: 850; line-height: 1.4; color: var(--muted); }
.status-line.good { color: var(--good); }
.status-line.bad { color: var(--bad); }
body.theme-high .status-line.good { color: #7dff9a; }
body.theme-high .status-line.bad { color: #ff8a80; }
.win-card { margin-top: 16px; padding: 18px; border: 3px solid var(--good); border-radius: 20px; background: color-mix(in srgb, var(--good) 14%, var(--surface)); text-align: center; }
.win-card strong { display: block; margin-bottom: 4px; font-size: 1.35rem; }
.win-card p { margin: 0 0 12px; color: var(--muted); font-weight: 700; }

/* Antwort-Tasten (Zahlenreihen, Was passt nicht dazu) */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 0; }
.answer-btn { display: grid; place-items: center; min-height: 92px; padding: 10px; border: 4px solid var(--ink); border-radius: 22px; background: var(--surface); color: var(--ink); font-size: 2.1rem; font-weight: 950; line-height: 1.1; box-shadow: 0 6px 0 color-mix(in srgb, var(--ink) 26%, transparent); cursor: pointer; }
.answer-btn:active { transform: translateY(3px); }
.answer-btn.right { background: var(--good); border-color: var(--good); color: #fff; }
.answer-btn.wrong { background: #fff2ef; border-color: var(--bad); color: var(--bad); }
.answer-btn:disabled { cursor: default; }
.answer-btn:disabled:not(.right):not(.wrong) { opacity: .5; }
.answer-btn small { display: block; margin-top: 4px; font-size: .78rem; font-weight: 800; }

/* Dialoge */
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible + span { outline: 5px solid #2b85d3; outline-offset: 4px; }
.modal { width: min(calc(100% - 28px), 500px); max-height: calc(100dvh - 28px); padding: 0; border: 0; border-radius: 27px; background: var(--surface); color: var(--ink); box-shadow: 0 28px 70px rgba(4,20,32,.34); }
.modal::backdrop { background: rgba(6,19,29,.66); backdrop-filter: blur(4px); }
.modal-content { padding: 29px 25px calc(25px + env(safe-area-inset-bottom)); text-align: center; }
.modal-content > p:not(.eyebrow) { color: var(--muted); font-size: 1.06rem; line-height: 1.52; }
.settings-content { text-align: left; }
.modal-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-heading h2 { margin: 0; }
.close-button { font-size: 2rem; line-height: 1; }
fieldset { margin: 0 0 19px; padding: 0; border: 0; }
legend { margin-bottom: 8px; font-size: .8rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.choice { display: flex; align-items: center; min-height: 55px; margin-top: 8px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 15px; cursor: pointer; }
.choice input { width: 24px; height: 24px; margin: 0 13px 0 0; accent-color: var(--accent-dark); }
.choice span { font-weight: 800; }
.setting-note { margin: 8px 2px 0; color: var(--muted); font-size: .92rem; line-height: 1.45; }

/* Teilen, Fußzeile */
.share-card { margin-top: 20px; padding: 18px; border: 2px solid var(--line); border-radius: 20px; background: var(--surface); }
.share-card h2 { margin: 0 0 6px; font-size: 1.2rem; }
.share-card p { margin: 0 0 14px; color: var(--muted); font-size: .94rem; font-weight: 700; }
.share-actions { display: grid; grid-template-columns: 1fr; gap: 11px; }
.share-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 11px 16px; border: 3px solid var(--ink); border-radius: 17px; color: var(--ink); font-size: 1rem; font-weight: 950; text-align: center; text-decoration: none; }
.share-button span { font-size: 1.3rem; line-height: 1; }
.email-share { background: #eef6fb; }
.whatsapp-share { border-color: #176f42; background: #dff8e9; color: #0d5b34; }
.legal-footer { margin-top: 34px; padding: 24px 8px 8px; border-top: 2px solid var(--line); color: var(--muted); text-align: center; font-size: .88rem; line-height: 1.55; }
.legal-footer nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px; }
.legal-footer a { min-height: 44px; padding: 8px 4px; color: var(--ink); font-weight: 850; text-decoration: underline; }
.legal-footer nav a { display: inline-flex; align-items: center; }
.legal-footer p { margin: 9px 0 0; }
.legal-footer p a { display: inline; min-height: 0; padding: 0; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: 22px; width: max-content; max-width: calc(100% - 30px); padding: 13px 17px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 850; transform: translate(-50%, 130%); opacity: 0; transition: .24s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Themen und Schriftgröße (wie im Wegeplaner) */
body.theme-high { --bg:#000; --surface:#101010; --ink:#ffd900; --muted:#fff; --accent:#fff; --accent-dark:#ffd900; --goal:#ffd900; --path:#252525; --line:#ffd900; --good:#7dff9a; --bad:#ff8a80; --water:#4db3ff; --on:#ffd900; color-scheme:dark; }
body.theme-high .primary-button { color:#000; }
body.theme-high .brand-mark, body.theme-high .tile-icon { color:#000; }
body.theme-high .share-card, body.theme-high .share-button { border-color:#ffd900; background:#000; color:#fff; }
body.theme-high .answer-btn.right { color:#000; }
body.theme-high .answer-btn.wrong { background:#000; }
body.theme-high .win-card { background:#101010; }
body.theme-light { --bg:#fff; --surface:#fff; --ink:#111; --muted:#333; --accent:#c44023; --accent-dark:#8c210d; --goal:#ffd34e; --path:#e4eef4; --line:#555; --good:#1b6b3a; --bad:#a3140d; --water:#0b5cad; }
body.scale-extra { font-size:112.5%; }
body.scale-extra .app-shell { padding-left:12px; padding-right:12px; }
@media (max-width:370px) { .app-shell{padding-left:11px;padding-right:11px} .answer-btn{font-size:1.8rem;min-height:84px} .game-tile{gap:12px} .tile-icon{flex-basis:58px;width:58px;height:58px} }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important} }

/* Fragenrunde (Zahlenreihen, Was passt nicht dazu) */
.answers.five .answer-btn:last-child { grid-column: 1 / -1; }
.q-card { margin-top: 14px; padding: 18px 14px; border: 3px solid var(--ink); border-radius: 22px; background: var(--surface); text-align: center; }
.q-card .q-label { margin: 0 0 12px; color: var(--muted); font-size: 1rem; font-weight: 800; }
.seq { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seq b { display: grid; place-items: center; min-height: 74px; padding: 4px; border: 3px solid var(--line); border-radius: 18px; background: var(--path); color: var(--ink); font-size: 2rem; font-weight: 950; letter-spacing: -.02em; }
.seq b.ask { border: 4px dashed var(--accent-dark); background: var(--goal); color: #172b3c; }
.shape-svg { width: 56px; height: 56px; }
.answer-btn .shape-svg { width: 62px; height: 62px; }
.answer-btn .cap { display: block; margin-top: 2px; font-size: .78rem; font-weight: 850; color: inherit; }
.answer-btn.shape { gap: 0; padding: 8px 4px; }
@media (max-width:370px) { .seq b { font-size: 1.7rem; min-height: 66px; } }

/* Gedächtnismodus-Schalter auf der Startseite */
.memory-card { margin: 0 0 20px; padding: 18px; border: 3px solid var(--ink); border-radius: 22px; background: var(--surface); }
.memory-card h2 { margin: 0 0 6px; font-size: 1.35rem; }
.memory-card > p:not(.eyebrow):not(.memory-state) { margin: 0 0 14px; color: var(--muted); font-size: 1rem; line-height: 1.45; font-weight: 700; }
.memory-card .seg { margin: 0 0 12px; }
.memory-card .seg button { min-height: 64px; font-size: 1.25rem; }
.memory-state { margin: 0; text-align: center; color: var(--muted); font-size: 1rem; line-height: 1.4; font-weight: 850; }
.memory-state.on { color: var(--good); }
body.theme-high .memory-card { border-color: #ffd900; background: #000; color: #fff; }
body.theme-high .memory-state.on { color: #7dff9a; }
