:root {
  --bg-deep: #0b3d4a;
  --bg-mid: #1a6b7a;
  --bg-light: #7ec8c4;
  --sand: #f3efe4;
  --ink: #1c2b2f;
  --muted: #4a6066;
  --card: #fffdf8;
  --accent: #e8a838;
  --accent-deep: #c47a12;
  --lumi: #6ef0c8;
  --crystal: #7ad7ff;
  --danger-soft: #d98b5b;
  --shadow: 0 12px 40px rgba(11, 61, 74, 0.22);
  --radius: 20px;
  --font: "Trebuchet MS", "Segoe UI", "Avenir Next", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg-deep);
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

.app-shell.is-booting {
  visibility: hidden;
  pointer-events: none;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 35%, #1a6b7acc 0%, transparent 60%),
    linear-gradient(165deg, #0b3d4a 0%, #1a6b7a 50%, #2f8f8a 100%);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.splash.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-lumi {
  position: relative;
  width: 110px;
  height: 110px;
}

.splash-lumi-core {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffffff, var(--lumi) 45%, #2aa889 100%);
  box-shadow: 0 0 28px #6ef0c8cc;
  animation: splash-pulse 1.6s ease-in-out infinite;
}

.splash-lumi-core::before {
  content: "";
  position: absolute;
  width: 28%;
  height: 28%;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #0b3d4a;
  box-shadow: -10px 8px 0 #0b3d4a;
}

.splash-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(110, 240, 200, 0.35);
  animation: splash-ring 1.8s ease-out infinite;
}

@keyframes splash-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes splash-ring {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.splash-title {
  margin: 8px 0 0;
  color: var(--sand);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.splash-sub {
  margin: 0;
  color: rgba(243, 239, 228, 0.85);
  font-weight: 700;
}

.splash-bar {
  width: min(220px, 60vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  margin-top: 6px;
}

.splash-bar-fill {
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ffe08a);
  transition: width 0.25s ease;
}

.sky {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, #3aa8b8 0%, transparent 55%),
    radial-gradient(ellipse 70% 45% at 90% 0%, #e8a83855 0%, transparent 50%),
    linear-gradient(165deg, #0b3d4a 0%, #1a6b7a 45%, #2f8f8a 100%);
  z-index: -1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sand);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-mark {
  color: var(--accent);
  font-size: 1.25rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chip {
  border: 1px solid rgba(243, 239, 228, 0.35);
  background: rgba(255, 253, 248, 0.12);
  color: var(--sand);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 40px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.progress {
  min-width: 110px;
  color: var(--sand);
  font-size: 0.85rem;
  font-weight: 700;
}

.progress-track {
  margin-top: 4px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 14%;
  background: linear-gradient(90deg, var(--accent), #ffe08a);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.stage {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}

.narration-text {
  margin: 0;
  font-size: clamp(1.2rem, 3.4vw, 1.65rem);
  line-height: 1.45;
  font-weight: 700;
}

.narration-actions,
.program-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  min-height: 48px;
  padding: 0 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(180deg, #f0b84a, var(--accent-deep));
  color: #1c1a12;
  box-shadow: 0 6px 0 #8f5a0c;
}

.btn.secondary {
  background: #1a6b7a;
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 2px solid #d5ddd8;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.play {
  display: grid;
  gap: 16px;
}

@media (min-width: 840px) {
  .play {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
}

.play-grid-wrap,
.program-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.mission-title {
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 6px;
  color: var(--bg-deep);
}

.play-instruction {
  margin: 0 0 10px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--muted);
  font-size: 1rem;
}

.play-speak-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.play-speak-row .btn.primary {
  margin-left: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  aspect-ratio: 1;
  max-width: 420px;
  margin: 0 auto;
}

.cell {
  position: relative;
  border-radius: 12px;
  background: linear-gradient(160deg, #e7f3ef, #cfe4de);
  border: 1px solid #b7d0c8;
  overflow: hidden;
}

.cell.goal::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 30% 70% 55% 45%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, var(--crystal) 40%, #3a8fd4 100%);
  box-shadow: 0 0 16px #7ad7ffaa;
  animation: shimmer 2.4s ease-in-out infinite;
}

@keyframes shimmer {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.08) rotate(8deg);
  }
}

.lumi {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffffff, var(--lumi) 45%, #2aa889 100%);
  box-shadow: 0 0 18px #6ef0c8cc;
  transition: transform 0.28s ease;
  z-index: 2;
}

.lumi::before {
  content: "";
  position: absolute;
  width: 28%;
  height: 28%;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #0b3d4a;
  box-shadow: -10px 8px 0 #0b3d4a;
}

.lumi.face-0 {
  transform: rotate(0deg);
}
.lumi.face-1 {
  transform: rotate(90deg);
}
.lumi.face-2 {
  transform: rotate(180deg);
}
.lumi.face-3 {
  transform: rotate(-90deg);
}

.lumi.hop {
  animation: hop-lift 0.45s ease;
}

@keyframes hop-lift {
  0%,
  100% {
    top: 18%;
    bottom: 18%;
  }
  40% {
    top: 4%;
    bottom: 32%;
  }
}

.run-feedback {
  min-height: 3.2em;
  margin: 12px 0 0;
  font-weight: 700;
  line-height: 1.35;
  color: var(--muted);
}

.run-feedback.success {
  color: #1f7a5c;
}

.run-feedback.hint {
  color: var(--danger-soft);
}

.panel-heading {
  margin: 0 0 8px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.program {
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: #f4f7f5;
  border: 2px dashed #c5d5cf;
}

.program:empty::before {
  content: "Tippe auf Befehle unten…";
  color: #8aa09a;
  font-weight: 700;
  padding: 8px;
}

.cmd {
  border: none;
  border-radius: 14px;
  min-height: 52px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  color: #14343a;
  background: #d7efe8;
  box-shadow: 0 3px 0 #8fb8ad;
}

.cmd[data-kind="forward"] {
  background: #c8f0d8;
}
.cmd[data-kind="left"] {
  background: #cfe4ff;
}
.cmd[data-kind="right"] {
  background: #ffe2b8;
}
.cmd[data-kind="jump"] {
  background: #f0d2ff;
}

.palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.palette .cmd {
  min-height: 56px;
  font-size: 0.98rem;
}

.code-view {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #16343c;
  color: #b8f5d8;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-x: auto;
}

.closing {
  text-align: center;
  padding: 28px 22px;
}

.closing h1 {
  margin: 8px 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.closing-lead {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
}

.stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 2.4rem;
  color: var(--accent);
  animation: pop 0.8s ease;
}

@keyframes pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.reflect {
  text-align: left;
  max-width: 420px;
  margin: 18px auto;
  padding-left: 1.2em;
  font-size: 1.05rem;
  line-height: 1.55;
  font-weight: 700;
}

.closing-hint {
  color: var(--muted);
  margin-bottom: 18px;
}

.hidden {
  display: none !important;
}

.running .btn.primary {
  pointer-events: none;
}
