/* ============================================================
   levels.css – Rätselstufen, größere Varianten der alten Rätsel
   und die Kapitel 5–7 (Keksküche, Garten, Sternwarte)
   ============================================================ */

/* ---------- Stufenwahl beim Neustart ---------- */
.level-pick { border: 2px dashed #e8d5cd; border-radius: 16px; margin: 14px 0 0; padding: 10px 12px 12px; }
.level-pick legend { font-weight: 800; padding: 0 6px; }
.level-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 8px; }
.level-btn {
  font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 14px; border: 3px solid #e8d5cd; background: #fff; cursor: pointer; color: var(--ink);
}
.level-btn .level-nr { font-size: 1.4rem; font-weight: 900; }
.level-btn .level-name { font-size: .8rem; font-weight: 700; }
.level-btn[aria-checked="true"] { border-color: var(--rose-deep); background: #fde4ea; box-shadow: 0 0 0 3px #fbd0d8; }
.level-btn[disabled] { opacity: .5; cursor: not-allowed; }
.level-btn:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.level-up { font-weight: 800; background: #fff3c4; border-radius: 14px; padding: 10px 12px; }

/* ---------- Größere Varianten alter Rätsel ---------- */
.pipes-grid.pipes-n4 { grid-template-columns: repeat(4, 70px); grid-template-rows: repeat(4, 70px); }
.pipes-n4 .pipe-svg { width: 70px; height: 70px; }
.seq-n6 .slot, .seq-n7 .slot { width: 46px; height: 46px; }
.seq-n8 .slot { width: 40px; height: 40px; }
.seq-n6 .slot svg, .seq-n7 .slot svg, .seq-n8 .slot svg { width: 32px; height: 32px; }
.seq-n6, .seq-n7, .seq-n8 { gap: 6px; flex-wrap: wrap; }

/* ---------- Zahlenfeld ---------- */
.numpad { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 12px auto 0; }
.np-display {
  min-width: 140px; text-align: center; font-size: 2rem; font-weight: 900; padding: 4px 16px;
  border-radius: 14px; background: #fff; border: 3px solid #c58a5a; letter-spacing: 2px;
}
.np-display.empty { color: #c9a37a; }
.np-keys { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; }
.np-key {
  font: inherit; font-size: 1.5rem; font-weight: 900; height: 56px; border-radius: 14px; cursor: pointer;
  border: 2px solid #e8d5cd; background: #fff; color: var(--ink); box-shadow: 0 3px 0 #e8d5cd;
}
.np-key:active { transform: translateY(2px); box-shadow: 0 1px 0 #e8d5cd; }
.np-key:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.np-ok { background: var(--mint); font-size: 1.1rem; }
.np-del { background: #fde4ea; }
.numpad.disabled .np-key { opacity: .45; cursor: default; }

/* ---------- Kapitel 5: Keksküche ---------- */
.recipe-card { background: #fff8e6; border: 3px solid #d9c4a8; border-radius: 16px; padding: 14px 18px; transform: rotate(-1deg); }
.recipe-card h3 { margin: 0 0 8px; color: #8c5a3a; }
.recipe-card h3 small { font-weight: 600; color: var(--ink-soft); font-size: .8rem; }
.recipe-card li { margin: 6px 0; font-size: 1.1rem; }
.recipe-note { font-style: italic; color: #7b3c52; margin: 10px 0 0; }

.scale-view { text-align: center; }
.scale-machine { display: inline-flex; flex-direction: column; align-items: center; margin: 4px auto 10px; }
.scale-bowl {
  min-width: 260px; min-height: 74px; display: flex; justify-content: center; align-items: flex-end; flex-wrap: wrap; gap: 2px;
  border-radius: 0 0 140px 140px; background: #dfe9f5; border: 4px solid #9fb5cf; padding: 6px 18px 10px;
}
.bag-mini svg { width: 40px; height: 46px; display: block; }
.bowl-empty { color: #9fb5cf; font-weight: 700; align-self: center; }
.scale-body { width: 190px; padding: 10px; background: #a9d9e8; border: 4px solid #5b8fb0; border-radius: 12px 12px 20px 20px; margin-top: -2px; }
.scale-display { display: block; background: #2f3b45; color: #8fe0a0; font-family: monospace; font-size: 1.6rem; font-weight: 900; border-radius: 8px; padding: 4px; }
.scale-display.hint-mode { font-size: 1.1rem; }
.scale-machine.solved .scale-bowl { border-color: #5e8f5a; box-shadow: 0 0 0 4px var(--mint); }
.bag-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.bag-btn { padding: 4px; border-radius: 14px; border: 3px solid transparent; background: #fff; cursor: pointer; }
.bag-btn svg { width: 62px; height: 72px; display: block; }
.bag-btn.on { border-color: #5b8fb0; background: #e6f1f5; opacity: .55; }
.bag-btn:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }

.pantry-view { text-align: center; }
.bolts { display: flex; justify-content: center; gap: 10px; margin-bottom: 10px; }
.bolt { width: 46px; height: 18px; border-radius: 9px; background: #d9a441; border: 2px solid #8c5a3a; transition: background .3s, transform .3s; }
.bolt.open { background: #8fcf8a; transform: translateX(10px); }
.problem-card { background: #fff; border: 3px solid #e8d5cd; border-radius: 16px; padding: 12px 16px; font-size: 1.2rem; font-weight: 700; min-height: 90px; }
.problem-card p { margin: 6px 0 0; line-height: 1.45; }
.problem-nr { display: block; font-size: .85rem; color: var(--ink-soft); }
.pantry-open svg { width: 70px; height: 70px; }

.oven-view { text-align: center; }
.oven-clock { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; background: #2f3b45; border-radius: 14px; padding: 12px; color: #ffd166; font-family: monospace; font-size: 1.6rem; font-weight: 900; }
.oven-num.gap { min-width: 56px; border-bottom: 4px dashed #ffd166; }
.oven-num.gap.filled { border-bottom-style: solid; color: #8fe0a0; }
.oven-sep { color: #8c8c99; }
.oven-window { margin: 12px auto; width: min(320px, 100%); height: 96px; border-radius: 16px; background: #2f2a33; border: 8px solid #8c8c99; display: grid; place-items: center; transition: background .6s; }
.oven-view.baking .oven-window, .oven-view.baked .oven-window { background: linear-gradient(#ffd98a, #f4a261); }
.oven-view.baking .dough { animation: breathe 1s ease-in-out infinite; }
.oven-tray { display: flex; gap: 8px; align-items: center; }
.dough { display: block; width: 120px; height: 26px; border-radius: 50%; background: #f3d3a0; }
.cookie { display: inline-block; width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f0c88f, #c58a5a); border: 2px solid #a8703f; }
.cookie.fortune {
  width: 46px; height: 40px; border-radius: 50% 50% 40% 40%; cursor: pointer; background: radial-gradient(circle at 50% 30%, #ffe3a3, #e0a53a);
  border: 3px solid #b5782a; animation: twinkle 1.6s ease-in-out infinite; padding: 0;
}
.cookie.fortune.opened { animation: none; clip-path: polygon(0 0, 45% 0, 50% 40%, 55% 0, 100% 0, 100% 100%, 0 100%); cursor: default; }
.cookie.fortune:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

/* ---------- Kapitel 6: Garten ---------- */
.word-progress { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.wp { font-weight: 900; letter-spacing: 2px; padding: 2px 10px; border-radius: 10px; background: #f1e6df; color: var(--ink-soft); }
.wp.done { background: var(--mint); color: #3d6b3a; }
.wp.now { background: #fff3c4; color: var(--ink); }
.beds-view { text-align: center; }
.beds-task { font-weight: 700; margin: 0 0 6px; }
.beds-emoji { font-size: 2.6rem; line-height: 1.2; }
.word-slots { display: flex; justify-content: center; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.slot-btn {
  font: inherit; width: 48px; height: 54px; display: grid; place-items: center; font-size: 1.6rem; font-weight: 900;
  border-radius: 12px; border: 3px dashed #b58a3a; background: #fff; color: var(--ink);
}
.slot-btn.filled { border-style: solid; background: #fff8e6; cursor: pointer; }
.slot-btn.ok { border-color: #5e8f5a; background: var(--mint); }
.letter-pool { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.letter-btn {
  font: inherit; width: 52px; height: 56px; font-size: 1.6rem; font-weight: 900; cursor: pointer; color: #5a4030;
  border-radius: 12px; border: 3px solid #b58a3a; background: #f4e3c1; box-shadow: 0 4px 0 #b58a3a;
}
.letter-btn[disabled] { opacity: .25; box-shadow: none; cursor: default; }
.letter-btn:focus-visible, .slot-btn:focus-visible, .abc-key:focus-visible, .riddle-btn:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.beds-done svg { width: 80px; height: 80px; }

.raven-view { text-align: center; }
.raven-head { display: flex; align-items: center; gap: 10px; text-align: left; }
.raven-head svg { width: 110px; flex: none; }
.raven-bubble { position: relative; background: #fff; border: 3px solid #4a4358; border-radius: 18px; padding: 10px 14px; font-size: 1.1rem; font-weight: 700; line-height: 1.45; }
.riddle-nr { display: block; font-size: .8rem; color: var(--ink-soft); }
.riddle-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.riddle-btn {
  font: inherit; font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 10px; justify-content: center;
  padding: 10px; border-radius: 16px; border: 3px solid #e8d5cd; background: #fff; cursor: pointer; color: var(--ink);
}
.riddle-btn.wrong { opacity: .4; text-decoration: line-through; }
.riddle-emoji { font-size: 1.8rem; }

.sign-view, .shed-view, .decoder-view { text-align: center; }
.sign-board { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; background: #fff8e6; border: 4px solid #8c5a3a; border-radius: 14px; padding: 12px; margin: 8px 0; }
.sign-board.small { padding: 6px; }
.code-cell { min-width: 44px; padding: 4px 6px; font-size: 1.7rem; font-weight: 900; color: #7b3c52; border-bottom: 3px solid #e0c6b5; }
.sign-board.small .code-cell { font-size: 1.3rem; min-width: 36px; }
.decoder-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.decoder-abc { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dec-cell { display: flex; flex-direction: column; align-items: center; background: #fff; border: 2px solid #e8d5cd; border-radius: 10px; padding: 4px; }
.dec-cell b { font-size: 1.3rem; color: #7b3c52; }
.dec-cell i { font-style: normal; font-weight: 900; color: #4a6fa5; }
.decoder-rule { font-weight: 700; }
.decoder-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; margin-top: 6px; }
.decoder-strip span { width: 28px; padding: 3px 0; background: #fff; border: 2px solid #e8d5cd; border-radius: 6px; font-weight: 900; }
.decoder-inline { margin-top: 12px; text-align: left; }
.decoder-inline summary { cursor: pointer; font-weight: 800; }
.lock-slots .slot-btn { width: 44px; height: 50px; }
.abc-keys { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; max-width: 420px; margin: 0 auto; }
.abc-key {
  font: inherit; font-weight: 900; font-size: 1.15rem; height: 44px; border-radius: 10px; cursor: pointer;
  border: 2px solid #e8d5cd; background: #fff; color: var(--ink); box-shadow: 0 2px 0 #e8d5cd;
}
.abc-del { background: #fde4ea; grid-column: span 2; }

/* ---------- Kapitel 7: Sternwarte ---------- */
.chart-view, .mobile-view, .wall-view, .scope-view { text-align: center; }
.star-chart { width: min(520px, 100%); height: auto; display: block; margin: 0 auto; border-radius: 12px; }
.star-btn { cursor: pointer; outline: none; }
.star-btn .star-shape { transition: fill .2s; }
.star-btn:hover .star-shape { fill: #fff3b0; }
.star-btn:focus-visible circle { fill: rgba(59, 125, 216, .45); }
.star-btn.lit .star-shape { fill: #ffd166; }
.star-chart.solved .star-btn.lit .star-shape { animation: twinkle 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

.paper-note { background: #fff8e6; border: 2px solid #d9c4a8; border-radius: 12px; padding: 10px 14px; text-align: left; }
.paper-note ul { margin: 6px 0 0; padding-left: 20px; }
.paper-note li { margin: 3px 0; }
.planet-row { display: flex; justify-content: center; gap: 8px; margin-top: 12px; border-top: 8px solid #8c5a3a; border-radius: 4px; padding-top: 0; }
.planet-btn {
  font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; background: transparent; border: 3px solid transparent;
  border-radius: 14px; padding: 0 6px 6px; cursor: pointer; color: var(--ink);
}
.planet-btn:nth-child(even) .planet-string { height: 44px; }
.planet-string { width: 2px; height: 20px; background: #5a4b57; }
.planet-ball { position: relative; width: 56px; height: 56px; border-radius: 50%; box-shadow: inset -8px -8px 0 rgba(0, 0, 0, .12); }
.planet-ball .ring { position: absolute; left: -12px; right: -12px; top: 22px; height: 12px; border: 3px solid #c9a37a; border-radius: 50%; }
.planet-name { font-weight: 800; font-size: .9rem; }
.planet-btn.selected { border-color: var(--focus); background: #e8f0fb; }
.planet-btn:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.planet-row.solved .planet-ball { box-shadow: 0 0 16px #fff3b0, inset -8px -8px 0 rgba(0, 0, 0, .12); }

.num-wall { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0; }
.brick-row { display: flex; gap: 4px; }
.brick {
  font: inherit; width: 64px; height: 44px; display: grid; place-items: center; font-size: 1.3rem; font-weight: 900;
  background: #e9c49a; border: 3px solid #8c5a3a; border-radius: 6px; color: #4a3020;
}
.brick-open { background: #fff; border-style: dashed; cursor: pointer; }
.brick-open.selected { border-style: solid; border-color: var(--focus); box-shadow: 0 0 0 3px #bcd3f3; }
.brick-open.wrong { border-color: #c0392b; background: #fde4ea; }
.brick-open:focus-visible { outline: 4px solid var(--focus); outline-offset: 2px; }
.brick-solved { background: var(--mint); }
.num-wall.solved .brick { border-color: #5e8f5a; }
#wall-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wall-body { display: flex; flex-direction: column; align-items: center; }
/* Die Zahl erscheint direkt im ausgewählten Stein – die extra Anzeige spart hier nur Platz weg. */
.wall-view .np-display { display: none; }
.wall-view .numpad { margin-top: 6px; }
.wall-view .frame-hint { margin-top: 0; }
/* Breite, aber niedrige Bildschirme (Laptop, Tablet quer, Handy quer): Mauer und Zahlenfeld nebeneinander */
@media (min-width: 701px) and (max-height: 920px) {
  .wall-body { flex-direction: row; justify-content: center; align-items: center; gap: 28px; }
  .wall-view .num-wall { margin: 0; }
}
@media (min-width: 701px) and (max-height: 520px) {
  .wall-view .brick { height: 36px; font-size: 1.1rem; }
  .wall-view .np-key { height: 42px; font-size: 1.25rem; }
  .wall-view .np-keys { gap: 6px; }
}

.scope-sky { display: grid; place-items: center; margin-bottom: 10px; }
.scope-circle { position: relative; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(#3a3f6e, #1e2244); border: 10px solid #4a6fa5; overflow: hidden; }
.scope-circle i { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; animation: twinkle 2s ease-in-out infinite; }
.aim-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.shooting-star { position: absolute; left: 10%; top: 10%; width: 140px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, rgba(255, 251, 230, 0), #fffbe6); transform: rotate(18deg); animation: shoot 2.4s ease-in-out infinite; }
@keyframes shoot { 0% { transform: translate(0, 0) rotate(18deg); opacity: 0; } 15% { opacity: 1; } 60% { transform: translate(320px, 100px) rotate(18deg); opacity: 0; } 100% { opacity: 0; } }

/* Szenen-Feinheiten */
.scene-garden .raven { animation: bob 1.6s ease-in-out infinite alternate; transform-box: fill-box; }

@media (max-width: 700px) {
  .level-buttons { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pipes-grid.pipes-n4 { grid-template-columns: repeat(4, 58px); grid-template-rows: repeat(4, 58px); }
  .pipes-n4 .pipe-svg { width: 58px; height: 58px; }
  .np-keys { grid-template-columns: repeat(3, 56px); }
  .riddle-options { grid-template-columns: 1fr; }
  .abc-keys { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .brick { width: 52px; }
  .wall-view .brick { width: 50px; height: 38px; font-size: 1.15rem; border-width: 2px; }
  .num-wall, .brick-row { gap: 3px; }
  .wall-view .np-keys { gap: 6px; }
  .wall-view .np-key { height: 46px; font-size: 1.3rem; }
  #wall-controls { gap: 8px; }
  .planet-ball { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .shooting-star, .cookie.fortune, .scene-garden .raven, .scope-circle i, .star-chart.solved .star-btn.lit .star-shape, .oven-view.baking .dough { animation: none !important; }
}

/* Finale der Sternwarte: Baumhaus-Boden statt Dachboden */
.modal-finale-tower .finale-art { background: linear-gradient(#232647, #4a4f7d 62%, #b57a4c 62%); }
.pipe-exit { font-size: .66rem; }
