:root {
  --pink: #ff6b9d;
  --turquoise: #2dd4bf;
  --yellow: #fcd34d;
  --orange: #fb923c;
  --purple: #a78bfa;
  --indigo: #6366f1;
  --green: #059669;
  --rose: #e11d48;
  --bg-nav: #f8fafc;
  --text: #1e293b;
  --text-muted: #64748b;
  --white: #ffffff;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  --font-display: "Baloo 2", cursive;
  --font-body: "Nunito", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-nav);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100dvh;
}

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ─── Startbildschirm ─── */
.screen-start {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 3rem;
  background: linear-gradient(
    135deg,
    var(--pink) 0%,
    var(--purple) 35%,
    var(--turquoise) 70%,
    var(--yellow) 100%
  );
  overflow: hidden;
}

.start-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 420px;
}

.start-kicker {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.start-number-wrap {
  margin: 0.5rem auto 1rem;
}

.start-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--white);
  color: var(--pink);
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  animation: wobble 3s ease-in-out infinite;
}

.start-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  color: var(--white);
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 1rem;
}

.start-intro {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.start-tips {
  list-style: none;
  text-align: left;
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.75rem;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.6;
}

.start-tips li + li {
  margin-top: 0.35rem;
}

.balloons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.balloon {
  position: absolute;
  font-size: 2.5rem;
  animation: float 4s ease-in-out infinite;
}

.balloon-1 { top: 8%; left: 10%; animation-delay: 0s; }
.balloon-2 { top: 15%; right: 12%; animation-delay: 0.8s; font-size: 2rem; }
.balloon-3 { bottom: 25%; left: 8%; animation-delay: 1.5s; font-size: 1.8rem; }
.balloon-4 { bottom: 20%; right: 10%; animation-delay: 2.2s; }

.streamers {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: repeating-linear-gradient(
    90deg,
    var(--orange) 0 20px,
    var(--yellow) 20px 40px,
    var(--turquoise) 40px 60px,
    var(--pink) 60px 80px
  );
  opacity: 0.6;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 1rem 2rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  min-height: 52px;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}

.btn-start {
  background: var(--white);
  color: var(--pink);
  font-family: var(--font-display);
  font-size: 1.35rem;
  padding: 1.1rem 2.5rem;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.2);
}

.btn-start.pulse {
  animation: pulse 2s ease-in-out infinite;
}

.btn-primary {
  background: var(--indigo);
  color: var(--white);
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--white);
  color: var(--indigo);
  border: 2px solid var(--indigo);
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
}

.btn-option {
  background: var(--white);
  color: var(--text);
  border: 2px solid #e2e8f0;
  width: 100%;
  border-radius: var(--radius);
  font-size: 1.15rem;
  padding: 1rem;
  margin-bottom: 0.6rem;
}

.btn-option:hover,
.btn-option:focus {
  border-color: var(--indigo);
  background: #eef2ff;
}

.btn-reset {
  margin-top: 2rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ─── Navigation ─── */
.screen-nav {
  background: var(--bg-nav);
  padding: 0 0 1.5rem;
}

.nav-header {
  padding: 1rem 1.25rem 0.75rem;
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
}

.progress-wrap {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--indigo), var(--turquoise));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.nav-opening-tip {
  margin-top: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #fffbeb;
  border-left: 3px solid var(--orange);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  color: #92400e;
  line-height: 1.4;
}

.nav-route-note {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.nav-heading-note {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--indigo);
  font-weight: 600;
}

.nav-progress {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--indigo);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-target-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text);
  margin: 0.25rem 0;
}

.nav-hint {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.map-container {
  height: 42vh;
  min-height: 220px;
  width: 100%;
  z-index: 0;
  position: relative;
}

.nav-stats,
.arrived-banner,
.fallback-panel,
.gps-status {
  position: relative;
  z-index: 2;
}

.nav-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text);
}

.stat-subvalue {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.direction-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.direction-arrow {
  font-size: 2rem;
  line-height: 1;
  color: var(--indigo);
  display: inline-block;
  transition: transform 0.4s ease;
}

.arrived-banner {
  margin: 0 1.25rem 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 2px solid var(--green);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideUp 0.4s ease;
}

.arrived-banner.hidden {
  display: none;
}

.arrived-icon {
  font-size: 1.8rem;
}

.arrived-banner p {
  font-weight: 700;
  color: #065f46;
  font-size: 1rem;
}

.fallback-panel {
  margin: 0 1.25rem;
  background: var(--white);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  border: 1px solid #e2e8f0;
}

.fallback-panel summary {
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
}

.fallback-content {
  padding-top: 0.75rem;
}

.fallback-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.fallback-code-wrap label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.fallback-code-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.fallback-code-row .quiz-input {
  flex: 1;
}

.gps-status {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem 0;
}

/* ─── Quiz ─── */
.screen-quiz {
  background: var(--bg-nav);
  padding: 1.25rem;
  align-items: stretch;
}

.quiz-header {
  margin-bottom: 1.25rem;
}

.quiz-station-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--indigo);
  text-transform: uppercase;
}

.quiz-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-top: 0.25rem;
}

.quiz-container {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  flex: 1;
  margin-bottom: 1rem;
}

.quiz-question {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.quiz-input {
  width: 100%;
  font-size: 1.2rem;
  padding: 1rem 1.1rem;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius);
  font-family: var(--font-body);
  background: #f8fafc;
}

.quiz-input:focus {
  outline: none;
  border-color: var(--indigo);
  background: var(--white);
}

.quiz-options {
  display: flex;
  flex-direction: column;
}

.photo-quiz-wrap {
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.photo-quiz-img {
  width: 100%;
  display: block;
  filter: blur(6px) grayscale(30%);
  transform: scale(1.05);
}

.quiz-feedback {
  text-align: center;
  font-weight: 700;
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.quiz-feedback.error {
  background: #fef2f2;
  color: #b91c1c;
}

.quiz-feedback.hidden {
  display: none;
}

.screen-quiz .btn-primary {
  margin-bottom: 1rem;
}

.screen-quiz .btn-primary.hidden {
  display: none;
}

.screen-quiz .fallback-panel {
  margin: 0;
}

/* ─── Belohnung ─── */
.screen-reward {
  background: linear-gradient(180deg, #eef2ff 0%, var(--bg-nav) 40%);
  padding: 1.5rem 1.25rem;
  align-items: center;
  justify-content: center;
}

.reward-content {
  max-width: 440px;
  width: 100%;
  text-align: center;
}

.reward-kicker {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--indigo);
  margin-bottom: 0.25rem;
}

.reward-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 1.25rem;
}

.reward-figure {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.reward-figure img {
  width: 100%;
  display: block;
  aspect-ratio: 4/3;
  object-fit: cover;
}

.reward-figure figcaption {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
}

.reward-audio-wrap {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  text-align: left;
}

.reward-audio-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.reward-audio-wrap audio {
  width: 100%;
}

/* ─── Finale ─── */
.screen-finale {
  background: linear-gradient(
    160deg,
    var(--pink) 0%,
    var(--purple) 40%,
    var(--turquoise) 100%
  );
  padding: 2rem 1.25rem 3rem;
  align-items: center;
}

.finale-content {
  max-width: 480px;
  width: 100%;
  text-align: center;
}

.finale-balloons {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

.finale-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  color: var(--white);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 0.75rem;
}

.finale-text {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.finale-album {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.album-item {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: slideUp 0.5s ease both;
}

.album-item img {
  width: 100%;
  display: block;
  aspect-ratio: 16/10;
  object-fit: cover;
}

.album-item figcaption {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: left;
}

.screen-finale .btn-reset {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ─── Animations ─── */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}

@keyframes wobble {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.2); }
  50% { transform: scale(1.04); box-shadow: 0 8px 36px rgba(0, 0, 0, 0.25); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden {
  display: none !important;
}

/* Leaflet station markers */
.station-marker-icon {
  background: none;
  border: none;
}

.station-marker-icon span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font-body);
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Dev panel */
.dev-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.95);
  color: white;
  padding: 0.75rem 1rem 1rem;
  font-size: 0.85rem;
  border-top: 2px solid #f59e0b;
}

.dev-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: #fbbf24;
}

.dev-actions,
.dev-nudge-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.dev-nudge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin: 0.5rem 0;
}

.btn-dev,
.btn-dev-sm {
  background: #334155;
  color: white;
  border: 1px solid #64748b;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  min-height: auto;
}

.btn-dev-sm {
  width: 40px;
  height: 36px;
  padding: 0;
}

.dev-select-label {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.78rem;
}

.dev-select {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.4rem;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
}

.dev-mode .screen-nav.active {
  padding-bottom: 10rem;
}

@media (min-width: 480px) {
  .nav-stats {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }

  .fallback-panel {
    max-width: 480px;
    margin: 0 auto;
  }
}
