/* Operation Weltpokal – Geburtstags-Quest.
   Look: Arcade bei Nacht. Kräftige Farben, dicke Buttons, viel Feier.
   Abschnitte: 1. Basis & Themes  2. Kopf  3. Karte & Fortschritt  4. Bühne
   5. Bausteine  6. Start & Feier  7. Missionen  8. Finale  9. Mobil */

/* ---------- 1. Basis & Landes-Themes ---------- */

:root {
  --bg: #130a2c;
  --bg-2: #1d1046;
  --panel: linear-gradient(165deg, #2a1a5e, #1a0f3f);
  --panel-solid: #241552;
  --panel-2: #32206e;
  --ink: #f6f2ff;
  --ink-dim: #b7abdd;
  --line: rgb(255 255 255 / 14%);
  --accent: #58c6ff;
  --accent-2: #ffd93d;
  --good: #3ddc84;
  --warn: #ffb347;
  --bad: #ff6b81;
  --radius: 22px;
  --shadow: 0 18px 44px rgb(8 4 25 / 55%);
  --glow: 0 0 34px rgb(88 198 255 / 35%);
  --font-display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-body: Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sky: radial-gradient(circle at 15% 0%, rgb(88 198 255 / 30%), transparent 55%);
}

body[data-country="uruguay"] {
  --accent: #58c6ff; --accent-2: #ffd93d;
  --sky: radial-gradient(circle at 85% -5%, rgb(255 217 61 / 30%), transparent 55%), radial-gradient(circle at 10% 10%, rgb(88 198 255 / 32%), transparent 55%);
}
body[data-country="argentinien"] {
  --accent: #79c8ff; --accent-2: #ffffff;
  --sky: linear-gradient(180deg, rgb(121 200 255 / 28%), transparent 45%), radial-gradient(circle at 80% 5%, rgb(255 255 255 / 18%), transparent 45%);
}
body[data-country="brasilien"] {
  --accent: #2fe07a; --accent-2: #ffe23d;
  --sky: radial-gradient(circle at 12% 0%, rgb(255 226 61 / 30%), transparent 50%), radial-gradient(circle at 80% 15%, rgb(47 224 122 / 32%), transparent 55%);
}
body[data-country="italien"] {
  --accent: #46d47f; --accent-2: #ff6b6b;
  --sky: linear-gradient(120deg, rgb(70 212 127 / 26%), transparent 40%), radial-gradient(circle at 85% 0%, rgb(255 107 107 / 26%), transparent 50%);
}
body[data-country="deutschland"] {
  --accent: #ffc93c; --accent-2: #ff5d5d;
  --sky: linear-gradient(180deg, rgb(255 201 60 / 26%), transparent 45%), radial-gradient(circle at 20% 10%, rgb(255 93 93 / 24%), transparent 50%);
}
body[data-country="frankreich"] {
  --accent: #7f9bff; --accent-2: #ff5d8f;
  --sky: radial-gradient(circle at 50% -10%, rgb(127 155 255 / 34%), transparent 55%), radial-gradient(circle at 90% 20%, rgb(255 93 143 / 26%), transparent 50%);
}
body[data-country="finale"] {
  --accent: #ffd166; --accent-2: #ff7ab8;
  --sky: radial-gradient(circle at 50% -5%, rgb(255 209 102 / 38%), transparent 55%), radial-gradient(circle at 15% 25%, rgb(255 122 184 / 30%), transparent 50%);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font: 16px/1.55 var(--font-body);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--sky), linear-gradient(180deg, var(--bg-2), var(--bg) 60%);
  transition: background 700ms ease;
  pointer-events: none;
  z-index: 0;
}

/* Langsam schwebende Deko im Hintergrund */
.sparkles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.sparkles span {
  position: absolute;
  font-size: 2.4rem;
  opacity: .12;
  animation: float 16s ease-in-out infinite;
}
.sparkles span:nth-child(1) { left: 6%; top: 22%; animation-delay: 0s; }
.sparkles span:nth-child(2) { left: 88%; top: 14%; animation-delay: -3s; font-size: 3rem; }
.sparkles span:nth-child(3) { left: 78%; top: 68%; animation-delay: -6s; }
.sparkles span:nth-child(4) { left: 14%; top: 76%; animation-delay: -9s; }
.sparkles span:nth-child(5) { left: 46%; top: 88%; animation-delay: -12s; font-size: 2.8rem; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-26px) rotate(8deg); }
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  margin: 0 0 .4em;
  letter-spacing: .2px;
}
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 3.8vw, 1.8rem); font-weight: 800; }
p { margin: 0 0 .8em; }
strong { font-weight: 800; }

/* ---------- 2. Kopfzeile ---------- */

.topbar-rail {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 4px;
  background: rgb(0 0 0 / 35%);
}
.topbar-rail b {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px var(--accent);
  transition: width 700ms cubic-bezier(.2, 1.2, .4, 1);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px max(12px, env(safe-area-inset-left)) 10px 12px;
  background: rgb(19 10 44 / 82%);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: .4px;
  white-space: nowrap;
  background: linear-gradient(95deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-ball {
  display: inline-block;
  -webkit-text-fill-color: initial;
  color: initial;
  animation: spin 7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.here {
  margin-left: auto;
  padding: 7px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--panel-solid);
  font-size: .9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55vw;
}
.here strong { color: var(--accent-2); }

.icon-btn {
  border: 2px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  border-radius: 14px;
  width: 44px;
  height: 44px;
  font-size: 1.15rem;
  cursor: pointer;
  flex: none;
  transition: transform 120ms ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn[aria-pressed="false"] { opacity: .45; }

/* ---------- 3. Karte & Fortschritt ---------- */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  padding: 16px;
  max-width: 1220px;
  margin: 0 auto;
}

.mappanel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.quest-progress { margin-bottom: 12px; }
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .85rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.progress-pct { color: var(--accent-2); font-family: var(--font-display); }
.progress-rail {
  height: 12px;
  border-radius: 99px;
  background: rgb(0 0 0 / 35%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-rail i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px var(--accent);
  transition: width 700ms cubic-bezier(.2, 1.2, .4, 1);
}

#worldmap {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  border: 1px solid var(--line);
}
.land { transition: fill 600ms ease; }

.pin-dot { fill: #8a7fb5; stroke: #130a2c; stroke-width: 1.2; transition: fill 300ms ease; }
.pin[data-state="done"] .pin-dot { fill: var(--good); }
.pin[data-state="current"] .pin-dot { fill: var(--accent-2); }
.pin[data-state="current"] .pulse {
  fill: var(--accent-2);
  opacity: .4;
  animation: pulse 1.6s ease-out infinite;
  transform-origin: center;
}
@keyframes pulse {
  from { transform: scale(.6); opacity: .55; }
  to { transform: scale(2.8); opacity: 0; }
}
.pin-label {
  font-size: 8.5px;
  font-weight: 700;
  fill: #efe9ff;
  paint-order: stroke;
  stroke: #130a2c;
  stroke-width: 2.4px;
}
.pin-check { font-size: 7px; }
.flightpath { opacity: 0; transition: opacity 300ms ease; }
.flightpath.on { opacity: .9; }

.stamps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
}
.stamps li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .8rem;
  font-weight: 700;
  padding: 5px 10px;
  border: 2px dashed var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
}
.stamps li.done {
  border-style: solid;
  border-color: var(--good);
  background: rgb(61 220 132 / 16%);
  color: var(--ink);
}
.stamps li.current {
  border-color: var(--accent-2);
  color: var(--accent-2);
  animation: nudge 2.2s ease-in-out infinite;
}
@keyframes nudge {
  0%, 92%, 100% { transform: translateY(0); }
  96% { transform: translateY(-3px); }
}

.linky {
  margin-top: 12px;
  background: none;
  border: 0;
  color: var(--ink-dim);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
}
.linky:hover { color: var(--ink); }

/* ---------- 4. Bühne ---------- */

.stage {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 30px);
  box-shadow: var(--shadow);
  min-height: 62vh;
  outline: none;
}

.mission-head { border-bottom: 2px dashed var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.mission-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #1a1030;
  background: linear-gradient(95deg, var(--accent), var(--accent-2));
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.mission-intro { color: var(--ink-dim); max-width: 60ch; font-size: 1.02rem; }

/* ---------- 5. Bausteine ---------- */

.btn {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 14px 24px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: #1a1030;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000));
  cursor: pointer;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--accent) 45%, #000), 0 14px 26px rgb(0 0 0 / 35%);
  transition: transform 100ms ease, box-shadow 100ms ease, filter 120ms ease;
  min-height: 52px;
}
.btn:hover { filter: brightness(1.07); }
.btn:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 45%, #000), 0 6px 14px rgb(0 0 0 / 35%);
}
.btn.big { font-size: 1.2rem; padding: 16px 32px; }
.btn.ghost {
  background: var(--panel-2);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: 0 5px 0 rgb(0 0 0 / 35%);
}
.btn.ghost:active { box-shadow: 0 1px 0 rgb(0 0 0 / 35%); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

.hint, .fact {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: 18px;
  padding: 14px 16px;
  margin: 16px 0;
  font-weight: 600;
  animation: rise 280ms cubic-bezier(.2, 1.3, .4, 1);
}
.hint {
  background: rgb(255 179 71 / 16%);
  border: 2px solid rgb(255 179 71 / 45%);
}
.fact {
  background: rgb(61 220 132 / 14%);
  border: 2px solid rgb(61 220 132 / 40%);
}
.hint span:first-child, .fact span:first-child { font-size: 1.3rem; line-height: 1.2; }
.hint p, .fact p { margin: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.hint.hidden, .fact.hidden { display: none; }

.hidden { display: none !important; }

.rules { color: var(--ink-dim); font-size: .95rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
  box-shadow: var(--shadow);
  max-width: min(92vw, 520px);
  text-align: center;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(10 5 26 / 84%);
  backdrop-filter: blur(8px);
}
.overlay-card {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 26px;
  padding: 30px 26px;
  text-align: center;
  max-width: 470px;
  box-shadow: var(--shadow), var(--glow);
  animation: popIn 420ms cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes popIn { from { opacity: 0; transform: scale(.85) translateY(12px); } }
.overlay-flag { font-size: 3.8rem; animation: wave 2.6s ease-in-out infinite; }
@keyframes wave {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}
.overlay-kicker {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  color: var(--accent-2);
  margin-bottom: 2px;
}
.overlay-mission { color: var(--accent-2); font-weight: 800; }
.overlay-fact { color: var(--ink-dim); }

/* ---------- 6. Start & Feier ---------- */

.hero { text-align: center; padding: 4vh 0 3vh; }
.hero-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  padding: 8px 18px;
  border-radius: 999px;
  color: #1a1030;
  background: linear-gradient(95deg, var(--accent-2), var(--accent));
  box-shadow: 0 8px 22px rgb(0 0 0 / 35%);
  animation: nudge 3s ease-in-out infinite;
}
.hero-cake { font-size: 3.6rem; display: block; margin: 14px 0 4px; animation: float 5s ease-in-out infinite; }
.hero-title {
  font-size: clamp(1.9rem, 6.5vw, 3rem);
  background: linear-gradient(95deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: .2em;
}
.hero-sub { color: var(--ink-dim); max-width: 46ch; margin: 0 auto 1.2em; font-size: 1.05rem; }
.hero-cta { margin: 6px 0 14px; }
.hero-note { color: var(--ink-dim); font-size: .9rem; }

.stop-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px auto 26px;
  max-width: 640px;
}
.stop-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--panel-2);
  font-weight: 700;
  font-size: .92rem;
  transition: transform 180ms ease;
}
.stop-card:hover { transform: translateY(-3px) rotate(-1.5deg); }
.stop-card .num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #1a1030;
  font-family: var(--font-display);
  font-size: .82rem;
  font-weight: 800;
}
.stop-card .flag { font-size: 1.2rem; }

.celebrate {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  background: rgb(10 5 26 / 55%);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.celebrate-card {
  text-align: center;
  padding: 26px 34px;
  border-radius: 28px;
  background: var(--panel);
  border: 3px solid var(--accent-2);
  box-shadow: var(--shadow), 0 0 50px color-mix(in srgb, var(--accent-2) 45%, transparent);
  animation: stamp 560ms cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.7) rotate(-9deg); }
  60% { opacity: 1; transform: scale(.94) rotate(2deg); }
  100% { transform: scale(1) rotate(-2deg); }
}
.celebrate-badge { font-size: 3.4rem; }
.celebrate-title {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 800;
  background: linear-gradient(95deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.celebrate-sub { color: var(--ink-dim); font-weight: 700; }

/* ---------- 7. Missionen ---------- */

/* Station 1 – Memory */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
}
.card {
  aspect-ratio: 3 / 4;
  border: 0;
  padding: 0;
  background: none;
  perspective: 800px;
  cursor: pointer;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 420ms cubic-bezier(.3, 1.4, .4, 1);
  border-radius: 16px;
}
.card:hover .card-inner { transform: translateY(-4px); }
.card.up .card-inner, .card.matched .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  text-align: center;
  border-radius: 16px;
  backface-visibility: hidden;
  padding: 6px;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.15;
  border: 2px solid var(--line);
  overflow: hidden;
  word-break: break-word;
}
.card-back {
  background:
    repeating-linear-gradient(45deg, rgb(255 255 255 / 6%) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, var(--panel-2), #1a0f3f);
  font-size: 1.8rem;
  box-shadow: inset 0 0 20px rgb(0 0 0 / 35%);
}
.card-front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #ffffff, #dfe7fb);
  color: #1a1030;
}
.card-front .big { font-size: 1.9rem; }
.card.matched { cursor: default; }
.card.matched .card-front {
  background: linear-gradient(180deg, #d9fbe7, #a6f0c6);
  border-color: var(--good);
}
.card.wrong .card-front { background: linear-gradient(180deg, #ffe1e6, #ffc0cb); }
.memory-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--ink-dim);
  font-weight: 700;
  margin: 16px 0;
}
.memory-meta strong { color: var(--accent-2); font-size: 1.1rem; }

/* Station 2 – Bauen */
.build-wrap { display: grid; gap: 16px; }
.build-grid {
  display: grid;
  gap: 5px;
  background: linear-gradient(180deg, #1d1146, #150c33);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  width: min(100%, 430px);
  touch-action: none;
}
.build-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px dashed rgb(183 171 221 / 30%);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  position: relative;
  background: rgb(255 255 255 / 4%);
}
.build-cell.drop-hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}
.build-cell[data-platform] {
  border: 2px solid #9a8fc4;
  background: repeating-linear-gradient(45deg, #5b4f86 0 7px, #4a3f70 7px 14px);
}
.build-cell[data-platform="goal"]::after { content: "🚩"; font-size: 1.5rem; }
.piece {
  position: absolute;
  inset: 3px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: .72rem;
  color: #2a1a05;
  font-weight: 800;
  cursor: grab;
  animation: popIn 220ms cubic-bezier(.2, 1.5, .4, 1);
}
.piece[data-type="floor"] { background: linear-gradient(180deg, #f0b567, #c98937); }
.piece[data-type="wall"] { background: linear-gradient(180deg, #ddc59d, #ab8f66); }
.piece[data-type="ramp"] {
  background: linear-gradient(to top left, #7ee08d 49%, transparent 49%);
  border: 2px solid #56c46c;
  color: #0b2010;
}
.figure {
  position: absolute;
  font-size: 1.5rem;
  transition: left 320ms ease, top 320ms ease;
  pointer-events: none;
  z-index: 3;
  transform: translate(-50%, -60%);
}
.inventory { display: flex; flex-wrap: wrap; gap: 10px; }
.inv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  background: var(--panel-2);
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  touch-action: none;
  min-height: 52px;
  transition: transform 140ms ease;
}
.inv-item:active { transform: scale(.96); }
.inv-item[data-left="0"] { opacity: .3; cursor: not-allowed; }
.inv-item .swatch { width: 24px; height: 24px; border-radius: 6px; }
.inv-item[data-type="floor"] .swatch { background: linear-gradient(180deg, #f0b567, #c98937); }
.inv-item[data-type="wall"] .swatch { background: linear-gradient(180deg, #ddc59d, #ab8f66); }
.inv-item[data-type="ramp"] .swatch { background: linear-gradient(to top left, #7ee08d 49%, transparent 49%); border: 2px solid #56c46c; }
.inv-item.selected, .mat.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent);
}
.drag-ghost {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  opacity: .92;
  transform: translate(-50%, -50%) scale(1.08) rotate(-3deg);
}

/* Station 3 – Aufstellung */
.pitch-wrap { display: grid; gap: 16px; }
.pitch {
  position: relative;
  aspect-ratio: 3 / 4;
  width: min(100%, 470px);
  border-radius: 18px;
  background:
    repeating-linear-gradient(180deg, rgb(255 255 255 / 5%) 0 24px, transparent 24px 48px),
    linear-gradient(180deg, #24a05a, #14713c);
  border: 3px solid rgb(255 255 255 / 55%);
  box-shadow: var(--shadow);
  touch-action: none;
}
.pitch::before {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  border-top: 3px solid rgb(255 255 255 / 45%);
}
.pitch::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid rgb(255 255 255 / 45%);
  border-radius: 50%;
}
.slot {
  position: absolute;
  width: 21%;
  transform: translate(-50%, -50%);
  aspect-ratio: 3 / 4;
  border: 3px dashed rgb(255 255 255 / 60%);
  border-radius: 14px;
  display: grid;
  place-content: center;
  text-align: center;
  font-size: .62rem;
  font-weight: 700;
  color: rgb(255 255 255 / 90%);
  padding: 3px;
  background: rgb(0 0 0 / 20%);
}
.slot.drop-hover {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 30%, transparent);
  transform: translate(-50%, -50%) scale(1.06);
}
.slot.filled {
  border-style: solid;
  border-color: #ffffff;
  background: linear-gradient(180deg, rgb(61 220 132 / 45%), rgb(20 113 60 / 60%));
}
.slot .slot-name { font-size: .72rem; font-weight: 800; }
.bench { display: flex; flex-wrap: wrap; gap: 10px; }
.pcard {
  display: grid;
  gap: 2px;
  justify-items: center;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #dfe7fb);
  color: #1a1030;
  padding: 10px 12px;
  min-width: 98px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  font-size: .78rem;
  text-align: center;
  box-shadow: 0 5px 0 rgb(0 0 0 / 28%);
  transition: transform 140ms ease;
}
.pcard:hover { transform: translateY(-3px) rotate(-1.5deg); }
.pcard .pflag { font-size: 1.2rem; }
.pcard .pname { font-weight: 800; font-size: .88rem; }
.pcard .prole { color: #55618a; font-size: .72rem; font-weight: 700; }
.pcard.placed { display: none; }
.pcard.shake { animation: shake 440ms ease; }
@keyframes shake {
  25% { transform: translateX(-7px) rotate(-3deg); }
  50% { transform: translateX(7px) rotate(3deg); }
  75% { transform: translateX(-4px); }
}

/* Station 4 – Crafting */
.craft-wrap { display: grid; gap: 18px; justify-items: start; }
.bench-frame {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #6b4f33, #42301e);
  border: 4px solid #8f7150;
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.craft-grid { display: grid; grid-template-columns: repeat(3, 64px); gap: 6px; touch-action: none; }
.craft-cell {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: #9a9a9a;
  border: 4px solid #7d7d7d;
  border-top-color: #b5b5b5;
  border-left-color: #b5b5b5;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  cursor: pointer;
}
.craft-cell.drop-hover { background: #bcd49a; }
.craft-cell.ghost { opacity: .45; }
.craft-arrow { font-size: 1.8rem; color: #ffe0b2; }
.craft-out {
  width: 78px;
  height: 78px;
  border-radius: 10px;
  background: #9a9a9a;
  border: 4px solid #7d7d7d;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
}
.craft-out.pop { animation: pop 620ms cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { 40% { transform: scale(1.45) rotate(-10deg); } }
.mats { display: flex; gap: 10px; flex-wrap: wrap; }
.mat {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  background: var(--panel-2);
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  touch-action: none;
  min-height: 52px;
  transition: transform 140ms ease;
}
.mat:active { transform: scale(.96); }
.mat[data-left="0"] { opacity: .3; }

/* Station 5 – Porsche */
.porsche-wrap { display: grid; gap: 16px; justify-items: center; }
.porsche-stage {
  width: min(100%, 540px);
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 118%, #c3cbd9, #4a5260 72%);
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid var(--line);
  box-shadow: var(--shadow);
}
.porsche-stage svg { width: 88%; height: auto; filter: blur(18px); opacity: .6; }
.model-buttons { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.sharpness {
  width: min(100%, 540px);
  height: 10px;
  border-radius: 99px;
  background: rgb(0 0 0 / 35%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.sharpness i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Station 6 – Cipher */
.cipher-wrap { display: grid; gap: 16px; justify-items: center; }
.wheel {
  width: min(100%, 380px);
  touch-action: none;
  cursor: grab;
  user-select: none;
  filter: drop-shadow(0 12px 24px rgb(0 0 0 / 45%));
}
.wheel:active { cursor: grabbing; }
.wheel text { font: 800 13px var(--font-body); }
.ring-outer text { fill: #efe9ff; }
.ring-inner text { fill: #1a1030; }
.cipher-readout {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.cipher-readout div {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-width: 38px;
  padding: 8px 6px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.cipher-readout .from { color: var(--ink-dim); font-size: .72rem; font-weight: 700; }
.cipher-readout .to {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent-2);
}
.cipher-readout.solved div { border-color: var(--good); background: rgb(61 220 132 / 20%); }
.cipher-readout.solved .to { color: var(--good); }
.shift-label { color: var(--ink-dim); font-weight: 700; }

/* ---------- 8. Finale ---------- */

.finale { text-align: center; padding: 3vh 0; }
.finale-title {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  background: linear-gradient(95deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.decrypt {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--accent);
  min-height: 2em;
}
.gift {
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: min(100%, 470px);
  margin: 10px auto 20px;
  padding: 24px 28px;
  border-radius: 26px;
  border: 3px dashed var(--accent-2);
  background: linear-gradient(180deg, rgb(255 209 102 / 18%), rgb(255 122 184 / 12%));
  box-shadow: var(--shadow);
  animation: popIn 500ms cubic-bezier(.2, 1.5, .4, 1);
}
.gift-label { font-weight: 800; color: var(--ink-dim); }
.code-box {
  font-family: ui-monospace, Menlo, monospace;
  font-size: clamp(1.15rem, 5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: .1em;
  word-break: break-all;
  color: var(--ink);
  background: rgb(0 0 0 / 30%);
  border-radius: 14px;
  padding: 14px 18px;
}
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
.passport-final { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 16px 0; }
.passport-final span {
  font-size: 1.8rem;
  animation: nudge 3s ease-in-out infinite;
}
.passport-final span:nth-child(2) { animation-delay: .2s; }
.passport-final span:nth-child(3) { animation-delay: .4s; }
.passport-final span:nth-child(4) { animation-delay: .6s; }
.passport-final span:nth-child(5) { animation-delay: .8s; }
.passport-final span:nth-child(6) { animation-delay: 1s; }

/* ---------- 9. Mobil / Desktop ---------- */

@media (min-width: 900px) {
  .layout { grid-template-columns: 290px minmax(0, 1fr); align-items: start; }
  .mappanel { position: sticky; top: 78px; }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; padding-left: 10px; }
  .brand { font-size: 1rem; }
  .here { padding: 5px 10px; font-size: .82rem; max-width: 56vw; }
  .here-label, .brand-long { display: none; }
  .sparkles span { font-size: 1.8rem; opacity: .1; }
}

@media (max-width: 899px) {
  /* Auf dem Handy zuerst die Mission, die Karte darunter. */
  .layout { display: flex; flex-direction: column; }
  .stage { order: 1; }
  .mappanel { order: 2; padding: 12px; }
  .topbar-rail { display: block; }
  .stamps li { font-size: .74rem; padding: 4px 8px; }
  .craft-grid { grid-template-columns: repeat(3, 56px); }
  .craft-cell { width: 56px; height: 56px; font-size: 1.55rem; }
  .memory-grid { gap: 8px; }
  .card-face { font-size: .7rem; }
  .celebrate-card { padding: 22px 26px; }
  .celebrate-title { font-size: 1.7rem; }
}

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