* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: #2b2418;
  color: #3e2c1d;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font-family: inherit; border: none; cursor: pointer; }

#app { position: relative; max-width: 520px; margin: 0 auto; height: 100dvh; overflow: hidden; background: #fbf5e9; }
#screen { position: absolute; inset: 0; overflow: hidden; }
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 999; }

.hidden { display: none !important; }

h1, h2, h3 { font-family: 'Alegreya', serif; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: linear-gradient(120deg, #c96f3a, #f98410, #d2700d);
  color: #fff7ea;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 17px;
  box-shadow: 0 6px 16px rgba(201, 111, 58, 0.4);
  min-height: 48px;
  min-width: 48px;
  transition: transform 0.12s;
}
.btn:active { transform: scale(0.94); }
.btn--gold { background: linear-gradient(120deg, #e8b54a, #ffd97a, #d9a22e); color: #4a3423; }
.btn--ghost { background: rgba(62, 44, 29, 0.08); color: #6b5137; box-shadow: none; }
.btn--gross { font-size: 20px; padding: 18px 34px; }

/* ---------- Mute ---------- */
.mute-btn {
  position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; z-index: 60;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 252, 244, 0.85); font-size: 20px;
  box-shadow: 0 4px 12px rgba(90, 59, 34, 0.2);
}

/* ---------- Schatzkarte (Hub) ---------- */
.map-wrap { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.map-inner { position: relative; width: 100%; }
.map-inner img.map-bg { width: 100%; display: block; }
.map-node {
  position: absolute; transform: translate(-50%, -50%);
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; border: 3px solid #fff9ec;
  background: radial-gradient(circle at 35% 30%, #fffbe8, #f2e2c4);
  box-shadow: 0 4px 14px rgba(60, 40, 20, 0.35);
  z-index: 3; padding: 0;
}
.map-node .num {
  position: absolute; bottom: -6px; right: -6px;
  background: #3e2c1d; color: #ffe9b0; font-size: 12px; font-weight: 900;
  width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff9ec;
}
.map-node--done { background: radial-gradient(circle at 35% 30%, #ffe9a8, #e8b54a); box-shadow: 0 0 22px 6px rgba(232, 181, 74, 0.65); }
.map-node--next { animation: nodePulse 1.4s ease-in-out infinite; }
.map-node--locked { filter: grayscale(1); opacity: 0.45; }
.map-node--locked::after { content: '🔒'; position: absolute; font-size: 15px; top: -4px; left: -4px; }
@keyframes nodePulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(249, 132, 16, 0.55); }
  50% { transform: translate(-50%, -50%) scale(1.12); box-shadow: 0 0 0 16px rgba(249, 132, 16, 0); }
}
.map-title {
  position: sticky; top: 0; z-index: 5; text-align: center;
  padding: 14px 60px 10px;
  background: linear-gradient(to bottom, rgba(43, 36, 24, 0.85), rgba(43, 36, 24, 0));
  color: #ffe9b0; font-family: 'Alegreya', serif; font-size: 22px; font-weight: 800;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); pointer-events: none;
}

/* ---------- Schlüsselbund ---------- */
.keyring {
  position: absolute; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 50; display: flex; gap: 4px; justify-content: center; align-items: center;
  background: rgba(43, 36, 24, 0.88); backdrop-filter: blur(8px);
  border-radius: 16px; padding: 8px 10px; min-height: 48px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.key-slot {
  width: 34px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: rgba(255, 249, 236, 0.08); border: 1px dashed rgba(232, 181, 74, 0.35);
}
.key-slot--filled { border-style: solid; background: rgba(232, 181, 74, 0.18); box-shadow: 0 0 10px rgba(232, 181, 74, 0.4) inset; }
.key-slot--heart { border-color: #ff8fa3; background: rgba(255, 143, 163, 0.15); }

.fly-key { position: fixed; z-index: 1000; font-size: 34px; transition: all 1.4s cubic-bezier(0.2, 0.7, 0.3, 1.1); pointer-events: none; filter: drop-shadow(0 0 12px #ffd97a); }

/* ---------- Pico ---------- */
.pico-companion { position: absolute; left: 6px; bottom: 64px; z-index: 55; width: 88px; pointer-events: none; }
.pico-companion img { width: 100%; display: block; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3)); animation: picoBob 3.5s ease-in-out infinite; }
@keyframes picoBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.pico-bubble {
  position: absolute; left: 70px; bottom: 60px; width: max-content; max-width: 230px;
  background: #fffcf4; border: 2px solid #e8b54a; border-radius: 14px 14px 14px 3px;
  padding: 9px 13px; font-size: 14.5px; font-weight: 700; line-height: 1.35; color: #4a3423;
  box-shadow: 0 6px 18px rgba(60, 40, 20, 0.25); animation: bubblePop 0.25s ease both;
}
@keyframes bubblePop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Stations-Layout ---------- */
.station { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
/* Links und rechts Platz lassen für die schwebenden Rund-Buttons (Karte/Mute) */
.station-head { padding: max(14px, env(safe-area-inset-top)) 70px 8px 70px; min-height: 62px; }
.station-head h2 { font-size: 21px; color: #3e2c1d; }
.station-head .sub { font-size: 13px; color: #8a6a4c; font-weight: 700; }
.station-body { flex: 1; position: relative; overflow: hidden; }
.back-btn {
  position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; z-index: 60;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 252, 244, 0.85); font-size: 20px;
  box-shadow: 0 4px 12px rgba(90, 59, 34, 0.2);
}

/* ---------- Karten (Swipe) ---------- */
.swipe-card {
  position: absolute; left: 50%; top: 42%; width: min(78vw, 320px); aspect-ratio: 3/4;
  transform: translate(-50%, -50%);
  background: #fffcf4; border-radius: 20px; border: 3px solid #e8d5b5;
  box-shadow: 0 14px 34px rgba(60, 40, 20, 0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center; touch-action: none;
}
.swipe-card .emoji { font-size: 64px; }
.swipe-card .text { font-size: 18px; font-weight: 800; color: #4a3423; }
.swipe-card--glow { animation: cardGlow 0.9s ease both; }
@keyframes cardGlow { 50% { box-shadow: 0 0 46px 18px rgba(255, 215, 120, 0.9); } }
.shake { animation: shakeX 0.4s ease both !important; }
@keyframes shakeX { 0%, 100% { margin-left: 0; } 25% { margin-left: -12px; } 50% { margin-left: 10px; } 75% { margin-left: -6px; } }

/* ---------- Stempel ---------- */
.stamp {
  position: absolute; left: 50%; top: 40%; z-index: 200;
  transform: translate(-50%, -50%) rotate(-12deg) scale(3);
  border: 5px solid #d33; color: #d33; border-radius: 10px;
  padding: 10px 16px; font-weight: 900; font-size: 20px; text-align: center;
  text-transform: uppercase; background: rgba(255, 255, 255, 0.82);
  opacity: 0; pointer-events: none; max-width: 84vw;
}
.stamp--in { animation: stampIn 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes stampIn { from { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(3); } to { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); } }

/* ---------- Konfetti / Partikel ---------- */
.confetto { position: fixed; width: 10px; height: 14px; z-index: 998; pointer-events: none; }
.sparkle { position: absolute; pointer-events: none; font-size: 18px; animation: sparkleUp 1s ease-out both; z-index: 20; }
@keyframes sparkleUp { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-70px) scale(0.4); } }

/* ---------- Overlay / Dialog ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 150;
  background: rgba(30, 22, 12, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  animation: fadeIn 0.3s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  background: #fffcf4; border-radius: 22px; padding: 24px 20px;
  max-width: 340px; width: 100%; text-align: center;
  display: flex; flex-direction: column; gap: 14px; align-items: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: bubblePop 0.3s ease both;
  max-height: 86dvh; overflow-y: auto;
}
.dialog h3 { font-size: 22px; color: #3e2c1d; }
.dialog p { margin: 0; font-size: 15.5px; font-weight: 700; color: #6b5137; line-height: 1.45; }
.dialog img.char { width: 110px; border-radius: 16px; }

/* ---------- Ad-Screen (Werbesimulator) ---------- */
.tv-frame { position: absolute; inset: 10px 10px 14px; border-radius: 26px; background: #1a140c; padding: 14px 12px 52px; box-shadow: 0 0 0 6px #3a2d1c, 0 18px 40px rgba(0,0,0,0.5); display: flex; flex-direction: column; }
.tv-screen { flex: 1; position: relative; border-radius: 12px; overflow: hidden; background: #fff; }
.tv-bar { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 18px; align-items: center; }
.tv-knob { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #6b5137, #3a2d1c); border: 2px solid #8a6a4c; }
.ad { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; overflow: hidden; }
.ad h3 { font-size: 24px; line-height: 1.1; }
.buy-btn {
  background: linear-gradient(120deg, #ff3355, #ff8410); color: #fff;
  font-size: 19px; font-weight: 900; padding: 14px 26px; border-radius: 14px;
  animation: buyPulse 0.8s ease-in-out infinite; box-shadow: 0 6px 20px rgba(255, 51, 85, 0.5);
}
@keyframes buyPulse { 0%, 100% { transform: scale(1) rotate(-1deg); } 50% { transform: scale(1.09) rotate(1deg); } }
.wobble { animation: adWobble 0.15s linear infinite; }
@keyframes adWobble { 0%,100% { transform: translate(0,0); } 25% { transform: translate(2px,-2px); } 75% { transform: translate(-2px,2px); } }

/* ---------- Trick-Album ---------- */
.album-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; width: 100%; }
.trick-card {
  border-radius: 12px; padding: 8px 6px; text-align: center; font-size: 11px; font-weight: 800;
  background: linear-gradient(160deg, #fff3d6, #ffe3a6); border: 2px solid #e8b54a; color: #6b4a1f;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}
.trick-card .emoji { font-size: 26px; }
.trick-card--locked { filter: grayscale(1); opacity: 0.4; }

/* ---------- Diverses ---------- */
.grid44 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: min(92vw, 380px); margin: 0 auto; }
.cell { aspect-ratio: 1; border-radius: 10px; background: rgba(126, 148, 89, 0.25); border: 2px dashed rgba(90, 110, 60, 0.4); display: flex; align-items: center; justify-content: center; font-size: 30px; min-height: 48px; }
.cell--filled { border-style: solid; background: #f2e8d2; }
.toolbar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 10px; }
.tool { min-width: 52px; min-height: 52px; border-radius: 12px; background: #fffcf4; border: 2px solid #e8d5b5; font-size: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tool--sel { border-color: #f98410; box-shadow: 0 0 0 3px rgba(249, 132, 16, 0.35); }
.pick-sel { outline: 3px solid #f98410; outline-offset: 2px; border-radius: 12px; }

.center-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; height: 100%; padding: 20px; text-align: center; }

.progress-dots { display: flex; gap: 6px; justify-content: center; }
.pdot { width: 10px; height: 10px; border-radius: 50%; background: rgba(62, 44, 29, 0.2); }
.pdot--on { background: #f98410; }

.urkunde { background: #fffcf4; border: 6px double #e8b54a; border-radius: 14px; padding: 18px; width: 100%; text-align: center; }
.urkunde h3 { font-size: 20px; }
.urkunde ol { text-align: left; font-size: 12.5px; font-weight: 700; color: #6b5137; padding-left: 18px; margin: 8px 0; }
