/* Operation Weltpokal – Geburtstags-Quest.
   Look: Nachtflug. Ruhiges Navy, eine Akzentfarbe pro Land, Reise-Motive
   (Reisepass, Bordkarte, Einreisestempel, Ticket) statt Deko-Rauschen.
   Abschnitte: 1. Tokens & Themes  2. Kopf  3. Reisepass  4. Bühne
   5. Bausteine  6. Start, Bordkarte & Stempel  7. Missionen  8. Finale  9. Mobil */

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

:root {
  --bg: #0a0e1c;
  --surface: #11172a;
  --surface-2: #182038;
  --surface-3: #212a47;
  --ink: #eef1fa;
  --ink-dim: #9aa3bf;
  --ink-faint: #69728f;
  --line: rgb(255 255 255 / 8%);
  --line-strong: rgb(255 255 255 / 14%);
  --accent: #6cc4ff;
  --accent-2: #ffd35c;
  --on-accent: #07101f;
  --good: #3ddc97;
  --warn: #ffb65c;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 0 rgb(255 255 255 / 4%) inset, 0 24px 48px -20px rgb(0 0 0 / 60%);
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "DM Mono", ui-monospace, Menlo, monospace;
  --ease-pop: cubic-bezier(.2, 1.4, .4, 1);
}

body[data-country="uruguay"]     { --accent: #6cc4ff; --accent-2: #ffd35c; }
body[data-country="argentinien"] { --accent: #8ccfff; --accent-2: #f6c453; }
body[data-country="brasilien"]   { --accent: #33d17a; --accent-2: #ffd83d; }
body[data-country="italien"]     { --accent: #5b9bff; --accent-2: #ff6b6b; }
body[data-country="deutschland"] { --accent: #ffcf3f; --accent-2: #ff5a5a; }
body[data-country="frankreich"]  { --accent: #8c9dff; --accent-2: #ff6d9a; }
body[data-country="finale"]      { --accent: #ffd166; --accent-2: #ff7ab8; }

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

body {
  margin: 0;
  font: 16px/1.55 var(--font-body);
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Ein einzelner Lichtschein in Landesfarbe plus feines Punktraster. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 78% -12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(700px 420px at -8% 18%, color-mix(in srgb, var(--accent-2) 7%, transparent), transparent 70%);
  transition: background 800ms ease;
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 5%) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000, transparent 75%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.08;
  margin: 0 0 .4em;
  letter-spacing: -.02em;
  font-weight: 800;
}
h1 { font-size: clamp(1.7rem, 4.6vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 3.6vw, 1.8rem); }
p { margin: 0 0 .8em; text-wrap: pretty; }
h1, h2, .hero-sub { text-wrap: balance; }
strong { font-weight: 700; color: var(--ink); }
a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-faint);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgb(10 14 28 / 72%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand-mark {
  width: 30px;
  height: 30px;
  padding: 5px;
  border-radius: 9px;
  color: var(--on-accent);
  background: var(--accent);
  transition: background 600ms ease;
}

.here {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: .88rem;
  font-weight: 500;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55vw;
}
.here-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.here strong { color: var(--ink); font-weight: 700; }

.icon-btn {
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex: none;
  transition: transform 120ms ease, background 150ms ease;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="false"] { color: var(--ink-faint); }

.topbar-rail {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
}
.topbar-rail b {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 700ms var(--ease-pop), background 600ms ease;
}

/* ---------- 3. Reisepass (Karte & Fortschritt) ---------- */

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

.mappanel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.passport-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 10px;
}
.passport-count { font-weight: 700; font-size: .95rem; }
.progress-pct {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--accent);
}
.progress-rail {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-rail i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 700ms var(--ease-pop);
}

#worldmap {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  border: 1px solid var(--line);
}
.map-ocean { fill: #0d1325; }
.map-dot { fill: rgb(255 255 255 / 7%); }
.land { fill: #1f2a48; stroke: #2e3b62; stroke-width: .8; stroke-linejoin: round; }

.pin-dot { fill: #3a4468; stroke: #0d1325; 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); }
.pulse { fill: none; }
.pin[data-state="current"] .pulse {
  fill: var(--accent);
  animation: pulse 1.8s ease-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes pulse {
  from { transform: scale(.6); opacity: .6; }
  to { transform: scale(3); opacity: 0; }
}
.pin-label {
  font: 600 8px var(--font-body);
  fill: #8f98b8;
  paint-order: stroke;
  stroke: #0d1325;
  stroke-width: 2.6px;
}
.pin[data-state="current"] .pin-label { fill: var(--ink); }
.pin-check { font-size: 5px; fill: #06281a; font-weight: 800; }
.flightpath { stroke: var(--accent-2); opacity: 0; transition: opacity 300ms ease; }
.flightpath.on { opacity: .9; }
.traveller-halo { fill: var(--accent-2); opacity: .25; }

/* Stationsliste als Zeitleiste */
.stamps {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.stamps li {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--ink-faint);
}
/* Verbindungslinie zwischen den Punkten */
.stamps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 23px;
  top: 34px;
  bottom: -10px;
  width: 2px;
  background: var(--line-strong);
}
.stamps li.done:not(:last-child)::after { background: color-mix(in srgb, var(--good) 55%, transparent); }
.st-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  font-size: .9rem;
}
.st-text { display: grid; line-height: 1.2; min-width: 0; }
.st-name { font-weight: 700; font-size: .92rem; }
.st-sub { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-state {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.stamps li.done { color: var(--ink-dim); }
.stamps li.done .st-node { background: color-mix(in srgb, var(--good) 18%, var(--surface)); border-color: color-mix(in srgb, var(--good) 60%, transparent); }
.stamps li.done .st-state { color: var(--good); font-size: .95rem; }
.stamps li.current {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.stamps li.current .st-node { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.stamps li.current .st-sub { color: var(--ink-dim); }
.stamps li.current .st-state { color: var(--accent); }

.linky {
  background: none;
  border: 0;
  color: var(--accent);
  font: 600 .88rem var(--font-body);
  cursor: pointer;
  padding: 8px 0;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
.linky:hover { text-decoration-color: currentColor; }
.linky.subtle { color: var(--ink-faint); margin-top: 10px; font-size: .8rem; }
.linky.subtle:hover { color: var(--ink-dim); }

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

.stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3.4vw, 40px);
  box-shadow: var(--shadow);
  min-height: 62vh;
  outline: none;
  animation: fadeUp 380ms ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

.mission-head { margin-bottom: 26px; }
.mission-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.mission-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--accent);
}
.mission-meta-text { display: grid; gap: 2px; }
.mission-country { font-weight: 700; font-size: .95rem; }
.mission-country small { color: var(--ink-faint); font-weight: 500; font-size: .85rem; }
.mission-head h1 { max-width: 22ch; }
.mission-intro { color: var(--ink-dim); max-width: 62ch; font-size: 1.05rem; margin: 0; }

/* Die erste Regel-Zeile jeder Station wird zum „Briefing“. */
.mission-body > div > p.rules:first-child {
  margin: 0 0 4px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  color: var(--ink-dim);
  max-width: 72ch;
}

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

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 13px 24px;
  font: 700 1.02rem var(--font-body);
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 0 rgb(255 255 255 / 35%) inset, 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 120ms ease, filter 150ms ease, background 600ms ease;
  min-height: 52px;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.big { font-size: 1.1rem; padding: 16px 32px; min-height: 58px; }
.btn.block { width: 100%; }
.btn.ghost {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong) inset;
}
.btn.ghost:hover { background: var(--surface-3); filter: none; }
.btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; filter: none; }

.hint, .fact {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 20px 0 0;
  max-width: 72ch;
  animation: rise 320ms var(--ease-pop);
}
.hint span:first-child, .fact span:first-child {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.05rem;
}
.hint { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.hint span:first-child { background: color-mix(in srgb, var(--warn) 20%, transparent); }
.fact { background: color-mix(in srgb, var(--good) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--good) 32%, transparent); }
.fact span:first-child { background: color-mix(in srgb, var(--good) 18%, transparent); }
.hint p, .fact p { margin: 0; align-self: center; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.hidden { display: none !important; }

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

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 500;
  box-shadow: 0 20px 40px rgb(0 0 0 / 50%);
  max-width: min(92vw, 520px);
  text-align: center;
  animation: rise 240ms ease;
}

/* ---------- 6. Start, Bordkarte & Einreisestempel ---------- */

.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: clamp(8px, 4vh, 40px) 0;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .92rem;
  padding: 7px 16px 7px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-2) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  color: var(--accent-2);
}
.hero-badge span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-2) 22%, transparent);
}
.hero-title {
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  line-height: .98;
  letter-spacing: -.04em;
  margin: 22px 0 16px;
}
.hero-title span { color: var(--accent); display: block; }
.hero-sub { color: var(--ink-dim); max-width: 44ch; margin: 0 auto 28px; font-size: 1.1rem; }
.hero-note { color: var(--ink-faint); font-size: .88rem; margin: 18px 0 0; }

/* Route: sechs Stationen auf einer gestrichelten Fluglinie */
.route {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: min(100%, 680px);
  margin: 0 0 32px;
  padding: 0;
  position: relative;
}
.route::before {
  content: "";
  position: absolute;
  left: calc(100% / 12);
  right: calc(100% / 12);
  top: 27px;
  border-top: 2px dashed var(--line-strong);
}
.route li { display: grid; justify-items: center; gap: 8px; position: relative; }
.route-flag {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.6rem;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  transition: transform 200ms var(--ease-pop);
}
.route li:hover .route-flag { transform: translateY(-4px); }
.route-name { font-size: .82rem; font-weight: 700; }
.route-num { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-faint); margin-top: -6px; }

/* Bordkarte zwischen zwei Stationen */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgb(5 8 18 / 78%);
  backdrop-filter: blur(10px);
  animation: fadeIn 240ms ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.pass {
  width: min(100%, 440px);
  background: #f5f2ea;
  color: #151a2b;
  border-radius: 22px;
  padding: 22px 24px 24px;
  box-shadow: 0 40px 80px -20px rgb(0 0 0 / 70%);
  border-top: 6px solid var(--accent);
  animation: passIn 520ms var(--ease-pop);
  --pass-dim: #6b6f7d;
}
@keyframes passIn { from { opacity: 0; transform: translateY(40px) rotate(-3deg) scale(.96); } }
.pass-top {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--pass-dim);
  padding-bottom: 14px;
  border-bottom: 1px solid rgb(0 0 0 / 10%);
}
.pass-brand { color: #151a2b; }
.pass-route {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px 0 8px;
}
.pass-city { display: grid; }
.pass-city.to { text-align: right; }
.pass-code {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
}
.pass-label { font-size: .78rem; color: var(--pass-dim); }
.pass-line {
  position: relative;
  height: 2px;
  background-image: linear-gradient(90deg, #151a2b 50%, transparent 50%);
  background-size: 8px 2px;
  opacity: .35;
}
.pass-line span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -54%);
  background: #f5f2ea;
  padding: 0 6px;
  font-size: 1.1rem;
  opacity: 1;
}
.pass-main {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
}
.overlay-flag { font-size: 3.2rem; line-height: 1; animation: wave 2.8s ease-in-out infinite; }
@keyframes wave {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}
.pass h2 { margin: 0 0 2px; color: #151a2b; }
.overlay-titles { margin: 0; color: var(--pass-dim); font-size: .85rem; }
.pass-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 12px;
  margin: 0 0 18px;
}
.pass-grid div { display: grid; gap: 2px; }
.pass-grid dt {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pass-dim);
}
.pass-grid dd { margin: 0; font-weight: 700; font-size: .98rem; }
/* Abreiß-Kante mit ausgestanzten Halbkreisen */
.pass-tear {
  position: relative;
  margin: 0 -24px 16px;
  border-top: 2px dashed rgb(0 0 0 / 14%);
}
.pass-tear::before, .pass-tear::after {
  content: "";
  position: absolute;
  top: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgb(5 8 18);
}
.pass-tear::before { left: -11px; }
.pass-tear::after { right: -11px; }
.overlay-fact { color: #3b4050; font-size: .95rem; margin: 0 0 20px; }
.overlay-fact .eyebrow { color: var(--pass-dim); margin-bottom: 4px; }
.pass .btn { --accent: #151a2b; color: #f5f2ea; box-shadow: none; }

/* Einreisestempel nach einer gelösten Station */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  background: rgb(5 8 18 / 55%);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.stamp {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 240px;
  padding: 20px 30px 22px;
  border-radius: 20px;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 8%, var(--surface));
  border: 3px solid currentColor;
  outline: 1.5px solid currentColor;
  outline-offset: 5px;
  text-align: center;
  transform: rotate(-6deg);
  animation: stamp 560ms var(--ease-pop);
  box-shadow: 0 30px 60px rgb(0 0 0 / 50%);
}
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.8) rotate(-14deg); }
  60% { opacity: 1; transform: scale(.95) rotate(-4deg); }
  100% { transform: scale(1) rotate(-6deg); }
}
.stamp-top { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; }
.stamp-flag { font-size: 2.8rem; margin: 6px 0 2px; }
.stamp-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.05;
}
.stamp-sub { color: var(--ink-dim); font-weight: 500; font-size: .92rem; }

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

/* Station 1 – Memory */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-width: 580px;
}
.card {
  aspect-ratio: 3 / 4;
  border: 0;
  padding: 0;
  background: none;
  perspective: 900px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 460ms var(--ease-pop);
  border-radius: 14px;
}
.card:hover .card-inner { transform: translateY(-3px); }
.card.up .card-inner, .card.matched .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  border-radius: 14px;
  backface-visibility: hidden;
  padding: 8px;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.15;
  overflow: hidden;
  word-break: break-word;
}
.card-back {
  background:
    radial-gradient(circle at 50% 50%, transparent 21%, color-mix(in srgb, var(--accent) 30%, transparent) 21.5% 23%, transparent 23.5%),
    linear-gradient(90deg, transparent calc(50% - 1px), color-mix(in srgb, var(--accent) 30%, transparent) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    var(--surface-2);
  border: 1px solid var(--line-strong);
  font-size: 1.3rem;
  transition: border-color 200ms ease;
}
.card:hover .card-back { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.card-front {
  transform: rotateY(180deg);
  background: #f7f8fc;
  color: #151a2b;
  border: 1px solid #fff;
}
.card-front .big { font-size: 2rem; }
.card.matched { cursor: default; }
.card.matched .card-front { background: #dcf8ea; box-shadow: 0 0 0 2px var(--good) inset; }
.card.wrong .card-front { background: #ffe4e8; }
.memory-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--ink-dim);
  margin: 20px 0 16px;
}
.memory-meta strong { color: var(--accent); font-family: var(--font-mono); font-weight: 500; }

/* Zähler-Zeilen („Aufgestellt: 3 / 11“) */
.pitch-wrap > p:not(.rules) { margin: 0; color: var(--ink-dim); }
.pitch-wrap > p:not(.rules) strong { color: var(--accent); font-family: var(--font-mono); font-weight: 500; }

/* Station 2 – Bauen */
.build-wrap { display: grid; gap: 18px; justify-items: start; }
.build-wrap > .rules:first-child, .build-wrap > .btn { justify-self: stretch; }
.build-wrap > .btn { max-width: 440px; }
.build-grid {
  display: grid;
  gap: 5px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    #0d1325;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 10px;
  width: min(100%, 440px);
  touch-action: none;
}
.build-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px dashed rgb(255 255 255 / 12%);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  position: relative;
  transition: background 150ms ease, border-color 150ms ease;
}
.build-cell:not([data-platform]):hover { background: rgb(255 255 255 / 4%); }
.build-cell.drop-hover {
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}
.build-cell[data-platform] {
  border: 1px solid #56618a;
  background: repeating-linear-gradient(45deg, #3a4468 0 6px, #313a5a 6px 12px);
}
.build-cell[data-platform="goal"]::after { content: "🚩"; font-size: 1.5rem; }
.piece {
  position: absolute;
  inset: 2px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: .72rem;
  color: #2a1a05;
  font-weight: 800;
  cursor: pointer;
  animation: popIn 220ms var(--ease-pop);
}
@keyframes popIn { from { opacity: 0; transform: scale(.7); } }
.piece[data-type="floor"] { background: linear-gradient(180deg, #f3bd72, #cf8f3d); box-shadow: 0 -3px 0 #a86e25 inset; }
.piece[data-type="wall"] { background: linear-gradient(180deg, #e2cfa9, #b39670); box-shadow: 0 -3px 0 #8d7250 inset; }
.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, .mats { display: flex; flex-wrap: wrap; gap: 10px; }
.inv-item, .mat {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 10px 16px 10px 12px;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  touch-action: none;
  min-height: 52px;
  transition: transform 140ms ease, border-color 150ms ease, background 150ms ease;
}
.inv-item:hover, .mat:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.inv-item:active, .mat:active { transform: scale(.96); }
.inv-item[data-left="0"], .mat[data-left="0"] { opacity: .35; cursor: not-allowed; }
.inv-left, .mat-left {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .8rem;
  color: var(--ink-dim);
}
.mat-left { order: 3; margin-left: 2px; }
.inv-item .swatch { width: 24px; height: 24px; border-radius: 6px; }
.inv-item[data-type="floor"] .swatch { background: linear-gradient(180deg, #f3bd72, #cf8f3d); }
.inv-item[data-type="wall"] .swatch { background: linear-gradient(180deg, #e2cfa9, #b39670); }
.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, .pcard.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.drag-ghost {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  opacity: .95;
  transform: translate(-50%, -50%) scale(1.06) rotate(-3deg);
  box-shadow: 0 20px 40px rgb(0 0 0 / 50%);
}

/* Station 3 – Aufstellung */
.pitch-wrap { display: grid; gap: 16px; align-items: start; }
.pitch {
  position: relative;
  aspect-ratio: 3 / 4;
  width: min(100%, 460px);
  border-radius: 16px;
  background:
    repeating-linear-gradient(180deg, rgb(255 255 255 / 4.5%) 0 10%, transparent 10% 20%),
    linear-gradient(180deg, #1f9a57, #137042);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 12%) inset, var(--shadow);
  touch-action: none;
  overflow: hidden;
}
/* Mittellinie + Strafräume als Rahmenlinien */
.pitch::before {
  content: "";
  position: absolute;
  inset: 4%;
  border: 2px solid rgb(255 255 255 / 40%);
  border-radius: 4px;
  background:
    linear-gradient(rgb(255 255 255 / 40%), rgb(255 255 255 / 40%)) center / 100% 2px no-repeat,
    linear-gradient(rgb(255 255 255 / 40%), rgb(255 255 255 / 40%)) 50% 0 / 2px 0 no-repeat;
  pointer-events: none;
}
.pitch::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid rgb(255 255 255 / 40%);
  border-radius: 50%;
  pointer-events: none;
}
.slot {
  position: absolute;
  z-index: 1;
  width: 20%;
  transform: translate(-50%, -50%);
  aspect-ratio: 3 / 4;
  border: 2px dashed rgb(255 255 255 / 55%);
  border-radius: 12px;
  display: grid;
  place-content: center;
  text-align: center;
  font-size: .62rem;
  font-weight: 700;
  color: #fff;
  padding: 3px;
  background: rgb(0 0 0 / 18%);
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}
.slot.drop-hover {
  border-color: #fff;
  background: rgb(255 255 255 / 25%);
  transform: translate(-50%, -50%) scale(1.06);
}
.slot.filled {
  border: 0;
  background: #fff;
  color: #151a2b;
  box-shadow: 0 6px 14px rgb(0 0 0 / 30%);
  animation: popIn 260ms var(--ease-pop);
  cursor: default;
}
.slot .slot-name { font-size: .7rem; font-weight: 800; line-height: 1.1; }
.slot .prole { font-size: .9rem; }
/* Leere Position: nur ein zartes Plus als Ablage-Hinweis, kein Positionsname. */
.slot:not(.filled)::after {
  content: "+";
  font-family: var(--font-display);
  font-size: 1.4rem;
  line-height: 1;
  color: rgb(255 255 255 / 55%);
}
.slot:not(.filled):hover::after, .slot.drop-hover::after { color: #fff; }
.bench { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; align-content: start; }
/* Sammelkarten im Sticker-Look: weiß mit farbigem Kopfband */
.pcard {
  display: grid;
  gap: 1px;
  justify-items: center;
  border: 1px solid transparent;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent) 0 6px, #f7f8fc 6px);
  color: #151a2b;
  padding: 12px 10px 9px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  font-size: .78rem;
  text-align: center;
  box-shadow: 0 8px 18px -8px rgb(0 0 0 / 60%);
  transition: transform 140ms ease;
}
.pcard:hover { transform: translateY(-3px); }
.pcard.selected { color: #151a2b; background: linear-gradient(180deg, var(--accent) 0 6px, #eef6ff 6px); }
.pcard .pflag { font-size: 1.15rem; }
.pcard .pname { font-weight: 800; font-size: .86rem; }
.pcard .prole { color: #6b7390; font-size: .7rem; font-weight: 600; }
.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 (bewusst im Minecraft-Look) */
.craft-wrap { display: grid; gap: 20px; justify-items: start; }
.craft-wrap > .rules:first-child { justify-self: stretch; }
.bench-frame {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: #c6c6c6;
  border: 4px solid;
  border-color: #fff #555 #555 #fff;
  border-radius: 6px;
  padding: 16px 20px;
  box-shadow: 0 0 0 3px #1b1b1b, var(--shadow);
  image-rendering: pixelated;
}
.craft-grid { display: grid; grid-template-columns: repeat(3, 64px); gap: 4px; touch-action: none; }
.craft-cell, .craft-out {
  display: grid;
  place-items: center;
  background: #8b8b8b;
  border: 3px solid;
  border-color: #373737 #fff #fff #373737;
}
.craft-cell {
  width: 64px;
  height: 64px;
  font-size: 1.8rem;
  cursor: pointer;
}
.craft-cell:hover { background: #9d9d9d; }
.craft-cell.drop-hover { background: #b3d38a; }
.craft-cell.ghost { opacity: .45; }
.craft-arrow { font-size: 2rem; color: #555; font-weight: 800; }
.craft-out { width: 80px; height: 80px; font-size: 2.4rem; }
.craft-out.pop { animation: pop 620ms var(--ease-pop); }
@keyframes pop { 40% { transform: scale(1.45) rotate(-10deg); } }
.craft-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* Station 5 – Porsche */
.porsche-wrap { display: grid; gap: 14px; justify-items: center; }
.porsche-wrap > .rules:first-child { justify-self: stretch; }
.porsche-stage {
  width: min(100%, 620px);
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 118%, #c3cbd9, #4a5260 72%);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line-strong), var(--shadow);
}
.porsche-stage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.porsche-stage svg { width: 88%; height: auto; }
.photo-credit { color: var(--ink-faint); font-size: .72rem; margin: 0; text-align: center; }
.photo-credit a { color: inherit; }
.model-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sharpness {
  width: min(100%, 620px);
  height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
  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; }
.cipher-wrap > .rules:first-child { justify-self: stretch; }
.cipher-wrap > p:not(.rules) { margin: 6px 0 0; color: var(--ink-dim); }
.cipher-wrap > p:not(.rules) strong { font-family: var(--font-mono); font-weight: 500; letter-spacing: .12em; color: var(--accent-2); }
.wheel {
  width: min(100%, 380px);
  touch-action: none;
  cursor: grab;
  user-select: none;
  filter: drop-shadow(0 18px 30px rgb(0 0 0 / 50%));
}
.wheel:active { cursor: grabbing; }
.wheel text { font: 700 13px var(--font-body); }
.wheel-outer { fill: #151c33; stroke: #2a3558; }
.wheel-inner { fill: #eef1fa; stroke: #c5cde3; }
.wheel-hub { fill: #0d1325; stroke: #2a3558; }
.wheel-pointer { fill: var(--accent-2); }
.shift-readout { fill: var(--accent-2); font-family: var(--font-mono) !important; }
.ring-outer text { fill: #c8cfe6; }
.ring-inner text { fill: #151a2b; }
.cipher-readout {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.cipher-readout div {
  display: grid;
  gap: 0;
  justify-items: center;
  min-width: 42px;
  padding: 8px 6px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
}
.cipher-readout .from { color: var(--ink-faint); font: 500 .7rem var(--font-mono); }
.cipher-readout .to {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
}
.cipher-readout.solved div { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.cipher-readout.solved .to { color: var(--good); }
.shift-label { color: var(--ink-faint); font-size: .88rem; margin: 0; }

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

.finale { display: grid; justify-items: center; text-align: center; padding: 3vh 0; }
.finale .eyebrow { margin-bottom: 10px; color: var(--accent); }
.finale-title { font-size: clamp(2rem, 6.4vw, 3.4rem); letter-spacing: -.04em; line-height: 1; }
.finale .hero-sub { margin-bottom: 18px; }
.decrypt {
  font-family: var(--font-mono);
  font-size: .95rem;
  letter-spacing: .06em;
  color: var(--accent);
  min-height: 1.6em;
  margin: 8px 0 14px;
}
.passport-final { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 12px; }
.passport-final span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 1.4rem;
  background: color-mix(in srgb, var(--good) 12%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--good) 45%, transparent);
  animation: popIn 400ms var(--ease-pop) both;
}
.passport-final span:nth-child(2) { animation-delay: .08s; }
.passport-final span:nth-child(3) { animation-delay: .16s; }
.passport-final span:nth-child(4) { animation-delay: .24s; }
.passport-final span:nth-child(5) { animation-delay: .32s; }
.passport-final span:nth-child(6) { animation-delay: .4s; }

/* Das Geschenk als Ticket */
.gift {
  position: relative;
  display: grid;
  gap: 10px;
  justify-items: center;
  width: min(100%, 480px);
  margin: 6px auto 18px;
  padding: 26px 26px 24px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 0 62%, var(--surface) 13px, transparent 14px),
    radial-gradient(circle at 100% 62%, var(--surface) 13px, transparent 14px),
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, var(--surface-2)), color-mix(in srgb, var(--accent-2) 18%, var(--surface-2)));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 30px 60px -24px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: passIn 600ms var(--ease-pop);
}
.gift-icon { font-size: 2.6rem; line-height: 1; }
.gift-label { font-weight: 700; color: var(--ink); }
.code-box {
  width: 100%;
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 5vw, 1.7rem);
  font-weight: 500;
  letter-spacing: .12em;
  word-break: break-all;
  color: var(--ink);
  background: rgb(5 8 18 / 55%);
  border: 1px dashed rgb(255 255 255 / 25%);
  border-radius: 12px;
  padding: 16px 18px;
  user-select: all;
}
.finale > .btn + .rules { margin-top: 14px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

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

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

@media (min-width: 1100px) {
  /* Platz neben dem Rasen nutzen: Karten-Bank rechts daneben. */
  .pitch-wrap { grid-template-columns: minmax(300px, 460px) minmax(0, 1fr); }
  .pitch-wrap > p { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .brand { font-size: 1rem; }
  .brand-mark { width: 28px; height: 28px; }
  .here { padding: 6px 12px 6px 9px; font-size: .84rem; max-width: 56vw; }
  .here-label, .brand-long { display: none; }
  .route { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 18px; }
  .route::before { display: none; }
  .st-name { display: none; }
  .stamps li { padding: 6px 0; }
  .mission-num { font-size: 2rem; }
  .pass { padding: 18px 18px 20px; }
  .pass-tear { margin: 0 -18px 16px; }
  .pass-code { font-size: 2.1rem; }
}

@media (max-width: 899px) {
  /* Auf dem Handy zuerst die Mission, der Reisepass darunter. */
  .layout { display: flex; flex-direction: column; padding: 14px 12px 32px; gap: 14px; }
  .stage { order: 1; min-height: 0; }
  .mappanel { order: 2; padding: 14px; }
  .topbar-rail { display: block; }
  .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; }
  .card-front .big { font-size: 1.6rem; }
  /* Reisepass kompakt: sechs Stationen nebeneinander */
  .stamps { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .stamps li { grid-template-columns: 1fr; justify-items: center; gap: 4px; padding: 8px 2px; text-align: center; }
  .stamps li::after, .st-sub, .st-state { display: none; }
  .st-node { width: 36px; height: 36px; font-size: 1.1rem; }
  .st-name { font-size: .64rem; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stamps li:not(.current) .st-name { color: var(--ink-faint); }
  .stamps li.done .st-node::after {
    content: "✓";
    position: absolute;
    right: -3px;
    bottom: -3px;
    display: grid;
    place-items: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    font-size: .6rem;
    font-weight: 800;
    color: #06281a;
    background: var(--good);
  }
}

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