/* Pico-Labyrinth — Aquarell-Look der Schatzfinder Akademie */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --creme: #fdf6e3;
  --creme-tief: #f6ead0;
  --wald: #2e5339;
  --wald-hell: #4a7a58;
  --gold: #d9a441;
  --gold-hell: #ffe9b0;
  --rot: #c0392b;
  --tinte: #3b2f23;
  --schatten: 0 6px 18px rgba(59, 47, 35, 0.18);
}

html, body { height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--tinte);
  background:
    radial-gradient(1200px 600px at 20% -10%, #fff8e6 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 110%, #f0e2c4 0%, transparent 55%),
    var(--creme);
  min-height: 100dvh;
  overscroll-behavior: none;
  touch-action: manipulation;
}

#app { max-width: 900px; margin: 0 auto; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Kopf ---------- */
.kopf { display: flex; align-items: center; gap: 12px; padding: 6px 0 10px; }
.kopf__titel { font-family: 'Alegreya', serif; font-size: clamp(22px, 5vw, 32px); font-weight: 800; color: var(--wald); flex: 1; text-align: center; }
.kopf__zurueck, .kopf__mute {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--wald);
  background: #fff; color: var(--wald); font-size: 20px; display: grid; place-items: center;
  text-decoration: none; cursor: pointer; box-shadow: var(--schatten); flex-shrink: 0;
}
.kopf__zurueck:active, .kopf__mute:active { transform: scale(0.92); }

/* ---------- Screens ---------- */
#screen { flex: 1; display: flex; flex-direction: column; }
.mitte { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 6px 0 24px; }
.mitte > * { max-width: 100%; }
.mitte h2 { font-family: 'Alegreya', serif; font-size: clamp(26px, 6vw, 40px); color: var(--wald); }
.mitte p { font-size: 16px; max-width: 46ch; line-height: 1.5; }
.start__bild { width: min(40vw, 200px); border-radius: 24px; box-shadow: var(--schatten); border: 4px solid #fff; transform: rotate(2deg); }

.stufen { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; width: 100%; }
.btn {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 17px;
  border: none; border-radius: 999px; padding: 14px 26px; cursor: pointer;
  background: var(--wald); color: var(--gold-hell); box-shadow: var(--schatten);
  transition: transform 0.12s ease;
}
.btn:active { transform: scale(0.94); }
.btn--gold { background: linear-gradient(145deg, #e7b653, var(--gold)); color: #4a3a12; }
.btn--zart { background: #fff; color: var(--wald); border: 2px solid var(--wald); }
.btn small { display: block; font-weight: 700; font-size: 12px; opacity: 0.85; }
.stufe-best { font-size: 13px; color: #7a6a52; margin-top: 4px; }

/* Trenner + Druck-Bereich auf dem Startscreen */
.druckbox {
  margin-top: 6px; padding: 16px 18px; border-radius: 20px;
  background: #fff; border: 2px dashed var(--gold); max-width: 480px;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.druckbox h3 { font-family: 'Alegreya', serif; color: var(--wald); font-size: 20px; }
.druckbox p { font-size: 14px; }

/* ---------- Spiel ---------- */
.leiste { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding-bottom: 8px; }
.leiste__chip {
  background: #fff; border: 2px solid var(--creme-tief); border-radius: 999px;
  padding: 6px 14px; font-weight: 800; font-size: 14px; color: var(--wald);
  box-shadow: 0 3px 8px rgba(59,47,35,0.08);
}
.leiste__chip b { color: var(--gold); }

.brett-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 0; }
canvas.brett {
  width: min(100%, 70dvh, 560px);
  height: auto; aspect-ratio: 1;
  border-radius: 18px; box-shadow: var(--schatten);
  background: #fff;
  touch-action: none; /* Wischgesten gehören dem Spiel, nicht dem Scrollen */
}

/* Steuerkreuz */
.kreuz {
  display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 52px);
  gap: 6px; justify-content: center; padding-bottom: 4px;
}
.kreuz button {
  border: 2px solid var(--wald); border-radius: 14px; background: #fff;
  font-size: 22px; color: var(--wald); cursor: pointer; box-shadow: 0 3px 8px rgba(59,47,35,0.12);
  display: grid; place-items: center; font-weight: 900;
}
.kreuz button:active { background: var(--gold-hell); transform: scale(0.94); }
.kreuz .k-hoch { grid-column: 2; grid-row: 1; }
.kreuz .k-links { grid-column: 1; grid-row: 2; }
.kreuz .k-runter { grid-column: 2; grid-row: 2; }
.kreuz .k-rechts { grid-column: 3; grid-row: 2; }
.kreuz-tipp { text-align: center; font-size: 12px; color: #8a7a60; padding-bottom: 6px; }

@media (min-width: 700px) {
  .kreuz { display: none; } /* am Desktop reichen die Pfeiltasten */
  .kreuz-tipp::before { content: 'Steuere Pico mit den Pfeiltasten! '; }
}

/* ---------- Sprechblase / Sieg / Konfetti (wie im Memory) ---------- */
.blase {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #fff; border: 2px solid var(--gold); border-radius: 16px;
  padding: 10px 18px; font-weight: 800; color: var(--wald); font-size: 15px;
  box-shadow: var(--schatten); max-width: 90vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 50;
}
.blase.zeigen { opacity: 1; transform: translateX(-50%) translateY(-6px); }

.sterne { font-size: clamp(38px, 10vw, 60px); letter-spacing: 6px; }
.sieg__werte { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.rekord { color: var(--rot); font-weight: 900; }

.konfetti {
  position: fixed; width: 10px; height: 14px; top: -20px; z-index: 60;
  pointer-events: none; border-radius: 3px;
  animation: fallen linear forwards;
}
@keyframes fallen {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.6; }
}

@media (max-width: 480px) {
  #app { padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); }
}
