/* ============================================================
   TOURPLANER PWA – Stylesheet
   Basiert auf dem Schorlepark-Piraten Design-System.
   Mobile-First · Kindgerecht · Modern
   CSS Custom Properties (Farben) werden per JS aus der API-Response gesetzt.
   ============================================================ */

/* ========== 1. CUSTOM PROPERTIES ========== */
:root {
  /* Brand Colors */
  --c-primary:        #2D6837;
  --c-primary-dark:   #1E4D27;
  --c-primary-glow:   rgba(45, 104, 55, .18);

  --c-secondary:      #5D9BBA;
  --c-secondary-dark: #4A7F9A;
  --c-secondary-glow: rgba(93, 155, 186, .15);

  --c-accent:         #F4C430;
  --c-accent-dark:    #DAB02A;
  --c-accent-glow:    rgba(244, 196, 48, .20);

  /* Surfaces */
  --bg-page:          #FAF5E8;
  --bg-card:          #FFFDF5;
  --bg-card-alt:      #F5F0E0;
  --bg-glass:         rgba(255, 253, 245, .88);

  /* Typography */
  --ink:              #3D2E22;
  --ink-soft:         #7A6555;
  --ink-faint:        #B5A08A;
  --ink-on-dark:      #FFF8EC;

  /* Status */
  --c-ok:             #66A832;
  --c-ok-dark:        #4D8524;
  --c-ok-glow:        rgba(102, 168, 50, .18);
  --c-err:            #D32F2F;
  --c-err-glow:       rgba(211, 47, 47, .12);

  /* Borders & Shadows */
  --border:           #E8DFC8;
  --shadow-xs:        0 1px 3px rgba(61,46,34,.06);
  --shadow-sm:        0 2px 8px rgba(61,46,34,.08);
  --shadow-md:        0 4px 20px rgba(61,46,34,.10);
  --shadow-lg:        0 8px 40px rgba(61,46,34,.14);
  --shadow-btn:       0 3px 0;
  /* Legacy aliases */
  --shadow:           0 2px 8px rgba(61,46,34,.08);
  --radius:           12px;
  --radius-lg:        20px;

  /* Radii */
  --r-xs:   8px;
  --r-sm:   14px;
  --r-md:   20px;
  --r-lg:   28px;
  --r-full: 100px;

  /* Spacing (4-point grid) */
  --sp-1:  .25rem;   /* 4px  */
  --sp-2:  .5rem;    /* 8px  */
  --sp-3:  .75rem;   /* 12px */
  --sp-4:  1rem;     /* 16px */
  --sp-5:  1.25rem;  /* 20px */
  --sp-6:  1.5rem;   /* 24px */
  --sp-8:  2rem;     /* 32px */
  --sp-10: 2.5rem;   /* 40px */
  --sp-12: 3rem;     /* 48px */

  /* Transitions */
  --ease-out: cubic-bezier(.22,1,.36,1);
  --t-fast:   150ms var(--ease-out);
  --t-norm:   280ms var(--ease-out);
  --t-slow:   450ms var(--ease-out);
  --transition: all 0.2s ease; /* legacy alias */

  /* Safe-area (iOS notch) */
  --sa-top:    env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);

  /* Timeline height – set by JS when visible */
  --timeline-h: 0px;

  /* Layout */
  --max-width: 480px;
}

/* ========== 2. RESET & BASE ========== */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--timeline-h) + 16px);
  overflow-x: hidden;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-page);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Subtle paper grain */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: -1;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-primary); }

/* ========== 3. TYPOGRAPHY ========== */
h1, h2, h3, h4 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}
h1 { font-size: 1.75rem; color: var(--c-primary); }
h2 { font-size: 1.35rem; margin-bottom: var(--sp-3); }
h3 { font-size: 1.15rem; margin-bottom: var(--sp-2); }
p  { margin-bottom: var(--sp-4); }
p:last-child { margin-bottom: 0; }
strong { font-weight: 700; }

.text-muted, .text-muted  { color: var(--ink-soft); }
.text-center, .centered   { text-align: center; }
.text-sm    { font-size: .85rem; }
.text-bold  { font-weight: 700; }
.text-lg    { font-size: 1.1rem; }

/* Spacing utilities */
.mb-sm  { margin-bottom: var(--sp-3); }
.mb-md  { margin-bottom: var(--sp-5); }
.mb-lg  { margin-bottom: var(--sp-8); }
.mt-sm  { margin-top: var(--sp-3); }
.mt-md  { margin-top: var(--sp-5); }
.mt-lg  { margin-top: var(--sp-8); }

.hidden { display: none !important; }

/* Link styling */
.link-primary {
  color: var(--c-primary);
  text-decoration: underline;
  font-weight: 600;
}
.link-secondary {
  color: var(--c-secondary);
  text-decoration: underline;
}

/* ========== 4. LAYOUT ========== */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-4) calc(var(--sp-8) + var(--sa-bottom));
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}
.app-container.with-timeline {
  padding-top: calc(68px + var(--sa-top) + var(--sp-6));
}

.screen-content {
  padding: var(--sp-5) 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

/* ========== 5. SCREEN TRANSITIONS ========== */
.screen {
  display: block;
  animation: screenIn .35s var(--ease-out) both;
}
.screen.hidden { display: none !important; }

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

/* ========== 6. BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .3px;
  padding: .875rem 1.75rem;
  min-height: 54px;
  border: none;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  width: 100%;
}
.btn:focus-visible {
  outline: 3px solid var(--c-accent);
  outline-offset: 3px;
}
.btn:active { transform: translateY(3px) scale(.98); }

.btn-primary {
  background: var(--c-primary);
  color: var(--ink-on-dark);
  box-shadow: var(--shadow-btn) var(--c-primary-dark), var(--shadow-sm);
}
.btn-primary:hover  { filter: brightness(1.06); }
.btn-primary:active { box-shadow: 0 0 0 var(--c-primary-dark); }

.btn-secondary {
  background: transparent;
  color: var(--c-secondary);
  border: 2.5px solid var(--c-secondary);
  box-shadow: var(--shadow-btn) var(--c-secondary-dark);
}
.btn-secondary:hover  { background: var(--c-secondary); color: white; }
.btn-secondary:active { box-shadow: 0 0 0 var(--c-secondary-dark); }

.btn-success {
  background: var(--c-ok);
  color: var(--ink-on-dark);
  box-shadow: var(--shadow-btn) var(--c-ok-dark), var(--shadow-sm);
}
.btn-success:hover  { filter: brightness(1.06); }
.btn-success:active { box-shadow: 0 0 0 var(--c-ok-dark); }

.btn-accent {
  background: linear-gradient(135deg, var(--c-accent), #FFE066);
  color: var(--ink);
  box-shadow: var(--shadow-btn) var(--c-accent-dark), var(--shadow-sm);
}
.btn-accent:hover  { filter: brightness(1.04); }
.btn-accent:active { box-shadow: 0 0 0 var(--c-accent-dark); }

.btn-block { width: 100%; }
.btn-sm    { font-size: .9rem; padding: .6rem 1.2rem; min-height: 44px; }
.btn-large { padding: 1rem 2rem; font-size: 1.125rem; }

/* ========== 7. CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
}
.card-story { position: relative; }
.card-story::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
  pointer-events: none;
}
.card-faq {
  background: linear-gradient(135deg, #F5F7FA, #EDE8DA);
}
.card-ticket-cta {
  background: linear-gradient(135deg, var(--c-accent), #FFE066);
  border: 2.5px solid var(--c-primary);
  text-align: center;
}
.card-secret {
  background: linear-gradient(to bottom, #F5E6D3, #EDE0CC);
  border: 2.5px solid #8B7355;
}
.card-secret .riddle-text {
  font-size: 1.3rem;
  font-family: 'Fredoka', sans-serif;
  line-height: 1.8;
}
.card-return {
  background: linear-gradient(135deg, #F5F7FA, #EDE8DA);
}
.card-instagram {
  background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  color: white;
  text-align: center;
}
.card-instagram h3,
.card-instagram p { color: white; }
.card-instagram .btn {
  background: white;
  color: #bc1888;
  font-weight: 700;
  border: none;
}

/* ========== 8. START / LANDING SCREEN ========== */
.start-hero { text-align: center; margin-bottom: var(--sp-2); }

.hero-image {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-md);
}

/* Logo / Header (reference structure) */
.app-header {
  text-align: center;
  margin-bottom: var(--sp-6);
  padding-top: var(--sp-4);
}
.logo {
  display: inline-block;
  animation: float 4s ease-in-out infinite;
  will-change: transform;
}
.logo-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--c-primary);
  text-shadow: 2px 2px 0 var(--c-accent), 4px 4px 0 rgba(61,46,34,.12);
  line-height: 1.15;
}
.logo-subtitle {
  font-family: 'Nunito', sans-serif;
  font-size: .9rem;
  color: var(--ink-soft);
  margin-top: var(--sp-2);
}

/* Tour title (dynamic, API-driven) */
.tour-title {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.75rem, 6vw, 2.75rem);
  color: var(--c-primary);
  text-shadow: 2px 2px 0 var(--c-accent), 4px 4px 0 rgba(61,46,34,.12);
  line-height: 1.15;
  margin-bottom: var(--sp-2);
}
.tour-subtitle { font-size: 1.0625rem; color: var(--ink-soft); margin-top: .25rem; }

/* Generic screen titles */
.screen-title {
  font-family: 'Fredoka', sans-serif;
  color: var(--c-primary);
  font-size: 1.35rem;
  margin-bottom: var(--sp-2);
}
.screen-intro { color: var(--ink-soft); }

.start-description { line-height: 1.7; }
.intro-text        { line-height: 1.7; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-4px); }
}

/* ========== 9. IMAGES ========== */
/* Story image with bleed */
.story-image {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin: var(--sp-5) calc(var(--sp-4) * -1);
}
.story-image img {
  width: 100%; height: auto;
  display: block;
  cursor: zoom-in;
}
.story-image figcaption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: var(--sp-6) var(--sp-4) var(--sp-3);
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  text-align: center;
}

/* Generic images */
.map-image, .station-image, .chars-image {
  width: 100%;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
.image-caption {
  color: var(--ink-soft);
  font-size: .875rem;
  text-align: center;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  cursor: zoom-out;
  animation: screenIn .2s ease both;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 90dvh;
  border-radius: var(--r-md);
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  object-fit: contain;
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: calc(var(--sa-top) + var(--sp-3));
  right: var(--sp-4);
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: 1.2rem;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  touch-action: manipulation;
}
.lightbox-close:hover { background: rgba(255,255,255,.35); }

/* Rotation helpers */
.rotate-1 { transform: rotate(-.8deg); }
.rotate-2 { transform: rotate(.6deg); }
.rotate-3 { transform: rotate(-.5deg); }
.rotate-4 { transform: rotate(.8deg); }
.rotate-5 { transform: rotate(-.6deg); }

/* ========== 10. FEATURE LIST ========== */
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: .75rem;
}
/* Shared feature-item base */
.feature-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
}
/* Grid variant overrides */
.features-grid .feature-item {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem .75rem;
}
.feature-icon {
  font-size: 1.6rem;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: white;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.features-grid .feature-icon {
  display: block;
  font-size: 1.75rem;
  width: auto; height: auto;
  background: none;
  box-shadow: none;
  margin-bottom: .25rem;
}
.feature-text  { flex: 1; min-width: 0; }
.feature-title { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: .95rem; }
.feature-desc  { font-size: .85rem; color: var(--ink-soft); margin: 0; }

/* ========== 11. FAQ ========== */
.faq-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.faq-item {
  background: white;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  transition: box-shadow var(--t-fast);
}
.faq-item[open] {
  box-shadow: var(--shadow-sm);
}
.faq-question,
.faq-item summary {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.faq-question::-webkit-details-marker,
.faq-item summary::-webkit-details-marker { display: none; }
.faq-question::after,
.faq-item summary::after {
  content: '▸';
  margin-left: auto;
  font-size: .8rem;
  color: var(--c-primary);
  transition: transform var(--t-fast);
  flex-shrink: 0;
}
.faq-item[open] .faq-question::after,
.faq-item[open] summary::after { transform: rotate(90deg); }
.faq-answer,
.faq-item p {
  padding: 0 var(--sp-4) var(--sp-4);
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.6;
  margin: 0;
}

/* ========== 12. INFO BOX ========== */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  background: var(--c-primary-glow);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: var(--sp-2) 0;
}
.info-box-icon    { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.info-box-content { flex: 1; }
.info-box-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--c-primary);
  margin-bottom: var(--sp-1);
  font-size: .95rem;
}

/* Location info block */
.location-info {
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-xs);
}

/* ========== 13. DIALOG BUBBLES ========== */
/* Reference wrapper */
.dialog {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
}
/* Both reference inner & new outer wrapper */
.dialog-bubble {
  flex: 1;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
/* When nested inside reference .dialog */
.dialog .dialog-bubble { flex: 1; }

.dialog-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2.5px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.dialog-content { flex: 1; }
.dialog-speaker {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--c-primary);
  margin-bottom: var(--sp-1);
  font-size: .95rem;
}
.dialog-text { line-height: 1.6; }

.dialogs-container { display: flex; flex-direction: column; gap: var(--sp-4); }

/* Audio play button */
.btn-audio-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  border: 2px solid var(--c-primary);
  background: transparent;
  color: var(--c-primary);
  cursor: pointer;
  font-size: .75rem;
  flex-shrink: 0;
  transition: var(--transition);
  margin-bottom: .375rem;
  padding: 0;
  width: auto;
}
.btn-audio-play:hover  { background: var(--c-primary); color: #fff; }
.btn-audio-play.playing { background: var(--c-primary); color: #fff; }

/* ========== 14. CHARACTER CARDS ========== */
.characters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 1rem;
}
.character-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  text-align: center;
  box-shadow: var(--shadow-xs);
}
.character-avatar,
.char-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto var(--sp-2);
  border: 2.5px solid var(--border);
}
.characters-grid .char-avatar { width: 80px; height: 80px; }
.char-desc   { font-size: .8125rem; color: var(--ink-soft); margin-top: .375rem; }
.chars-intro { line-height: 1.7; }
.chars-outro {
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  border: 1.5px solid var(--border);
}
.outro-speaker { font-weight: 700; color: var(--c-primary); font-size: .875rem; margin-bottom: .25rem; }

/* Character inner layout (reference) */
.card .character-card-inner { display: flex; align-items: center; gap: 1rem; }
.card .character-card-inner .character-card-text { flex: 1; }

/* ========== 15. QUIZ ========== */
.quiz-container {
  margin-top: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.quiz-container.hidden { display: none; }

.quiz-question {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--c-primary);
  margin-bottom: var(--sp-5);
  text-align: center;
  line-height: 1.4;
}
.quiz-note {
  font-size: .88rem;
  color: var(--ink-soft);
  background: rgba(0,0,0,.04);
  border-left: 3px solid var(--c-primary);
  border-radius: 0 6px 6px 0;
  padding: var(--sp-2) var(--sp-3);
  margin-top: calc(-1 * var(--sp-3));
  margin-bottom: var(--sp-4);
  line-height: 1.5;
  text-align: left;
}

/* Multiple choice – both naming conventions */
.quiz-options, .mc-options {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.quiz-option, .mc-option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--bg-card);
  border: 2.5px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  min-height: 58px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
  font-size: 1.05rem;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
  width: 100%;
  font-family: 'Nunito', sans-serif;
}
.quiz-option:hover, .mc-option:hover  { border-color: var(--c-primary); background: var(--bg-card-alt); }
.quiz-option:active, .mc-option:active { transform: scale(.97); }
.quiz-option.correct, .mc-option.correct {
  border-color: var(--c-ok);
  background: var(--c-ok-glow);
  animation: bumpIn .4s var(--ease-out);
}
.quiz-option.incorrect, .mc-option.incorrect {
  border-color: var(--c-err);
  background: var(--c-err-glow);
  animation: shake .35s var(--ease-out);
}
.quiz-option-letter {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--c-secondary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.quiz-option.correct .quiz-option-letter   { background: var(--c-ok); }
.quiz-option.incorrect .quiz-option-letter  { background: var(--c-err); }

/* Text input quiz */
.quiz-input, .quiz-text-input {
  width: 100%;
  height: 54px;
  padding: var(--sp-3) var(--sp-4);
  font-family: 'Nunito', sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--bg-card);
  border: 2.5px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.quiz-input:focus, .quiz-text-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 4px var(--c-primary-glow);
}
.quiz-input.correct, .quiz-text-input.correct {
  border-color: var(--c-ok);
  background: var(--c-ok-glow);
}
.quiz-input.incorrect, .quiz-text-input.incorrect {
  border-color: var(--c-err);
  background: var(--c-err-glow);
}

/* Yes/No */
.quiz-yesno { display: flex; gap: var(--sp-3); }
.quiz-yesno .btn { flex: 1; }

/* Hint */
.quiz-hint summary {
  cursor: pointer;
  font-size: .9rem;
  color: var(--c-secondary);
  user-select: none;
  font-weight: 600;
}
.quiz-hint p {
  margin-top: .5rem;
  padding: .75rem;
  background: var(--bg-card);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
}

.hint-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: 'Nunito', sans-serif;
  font-size: .9rem;
  cursor: pointer;
  padding: var(--sp-2);
  transition: color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.hint-btn:active { color: var(--c-primary); }
.hint-box {
  display: none;
  background: var(--c-accent-glow);
  border: 2px solid var(--c-accent);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-3);
  font-size: .9rem;
}
.hint-box.visible { display: block; }

@keyframes bumpIn {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ========== 16. FEEDBACK ========== */
.feedback, .quiz-feedback {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  margin: var(--sp-4) 0;
  animation: bumpIn .45s var(--ease-out);
}
.feedback-success, .quiz-feedback.success {
  background: var(--c-ok-glow);
  border: 2px solid var(--c-ok);
}
.feedback-error, .quiz-feedback.error {
  background: var(--c-err-glow);
  border: 2px solid var(--c-err);
}
.feedback-title,
.quiz-feedback h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: var(--sp-2);
}
.quiz-feedback h3 { font-size: 1rem; }
.feedback-success .feedback-title,
.quiz-feedback.success h3 { color: var(--c-ok); }
.feedback-error .feedback-title,
.quiz-feedback.error h3   { color: var(--c-err); }

/* Generic error text */
.error-text { color: var(--c-err); font-size: .875rem; }

/* ========== 17. DIRECTIONS ========== */
.directions {
  background: var(--c-primary-glow);
  border: 2px dashed var(--c-primary);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: var(--sp-5) 0;
}
.directions-title {
  font-family: 'Fredoka', sans-serif;
  color: var(--c-primary);
  font-size: 1.05rem;
  margin-bottom: var(--sp-3);
}
.directions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.directions-list li { position: relative; padding-left: 1.8rem; line-height: 1.5; }
.directions-list li::before { content: '🚶'; position: absolute; left: 0; top: 0; font-size: 1rem; }
.direction-hint { display: block; margin-top: var(--sp-2); width: 100%; }
.direction-hint summary {
  cursor: pointer;
  color: var(--c-primary);
  font-size: .9rem;
  font-weight: 600;
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}
.direction-hint summary::-webkit-details-marker { display: none; }
.direction-hint img { display: block; margin-top: var(--sp-2); max-width: 100%; border-radius: var(--r-sm); }

/* New PWA alias */
.directions-container {
  background: var(--c-primary-glow);
  border: 2px dashed var(--c-primary);
  border-radius: var(--r-md);
  padding: var(--sp-4);
}
.directions-container ol { padding-left: 1.25rem; }
.directions-container li { margin-bottom: var(--sp-2); }

/* ========== 18. STATION ========== */
.station-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.station-number {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.station-title    { font-size: 1.25rem; color: var(--ink); margin: 0; line-height: 1.2; }
.station-location { font-size: .85rem; color: var(--ink-soft); margin: var(--sp-1) 0 0; }
.station-actions  { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); }
.extra-content    { display: flex; flex-direction: column; gap: var(--sp-3); }
.html-block       { line-height: 1.65; }
.reveal-container { }

/* ========== 19. BACK NAVIGATION ========== */
.back-nav { margin-bottom: var(--sp-3); }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: 'Nunito', sans-serif;
  font-size: .9rem;
  font-weight: 600;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.back-btn:active {
  background: var(--c-primary-glow);
  color: var(--c-primary);
  transform: scale(.95);
}

/* ========== 20. TICKET INPUT ========== */
/* Reference: 3 small fields with separators */
.ticket-code-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: var(--sp-6) 0 var(--sp-4);
}
.ticket-separator {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink-faint);
}
/* Shared ticket input style */
.ticket-input {
  text-align: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--ink);
  background: var(--bg-card);
  border: 2.5px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  /* New PWA: full width single input */
  width: 100%; height: 56px;
  padding: var(--sp-3) var(--sp-4);
  text-transform: uppercase;
}
/* Reference: 3-field layout */
.ticket-code-input .ticket-input {
  width: 76px; height: 54px;
  padding: 0;
}
.ticket-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 4px var(--c-primary-glow);
}
.ticket-input::placeholder { color: var(--ink-faint); letter-spacing: 2px; }
.ticket-input-group { display: flex; flex-direction: column; gap: var(--sp-2); }

/* AGB / Opt-in */
.opt-in-label {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-5);
  background: var(--c-accent-glow);
  border: 2px solid var(--c-accent);
  border-radius: var(--r-md);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
  position: relative;
}
.opt-in-label:has(.opt-in-checkbox:checked) {
  background: var(--c-ok-glow);
  border-color: var(--c-ok);
}
.opt-in-checkbox {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
  pointer-events: none;
}
.opt-in-checkmark {
  width: 26px; height: 26px;
  min-width: 26px;
  border-radius: var(--r-xs);
  border: 2.5px solid var(--border);
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast);
  margin-top: 1px;
}
.opt-in-checkmark::after {
  content: '';
  width: 7px; height: 13px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--t-fast);
}
.opt-in-checkbox:checked ~ .opt-in-checkmark { background: var(--c-ok); border-color: var(--c-ok); }
.opt-in-checkbox:checked ~ .opt-in-checkmark::after { transform: rotate(45deg) scale(1); }
.opt-in-checkbox:focus-visible ~ .opt-in-checkmark { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.opt-in-text { font-size: .9rem; line-height: 1.45; color: var(--ink); }

/* Leaderboard opt-in (new PWA) */
.leaderboard-optin { padding: var(--sp-4) 0; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  font-size: .95rem;
}

/* ========== 21. NAME INPUT ========== */
.input-label {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--c-primary);
  margin-bottom: var(--sp-3);
  font-size: 1rem;
}
.team-names-list  { display: flex; flex-direction: column; gap: var(--sp-3); }
.team-name-row    { display: flex; align-items: center; gap: var(--sp-3); }
.team-name-number {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--c-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}
.team-name-row .quiz-input { flex: 1; height: 48px; font-size: 1rem; }

.name-input, .cert-name-input {
  width: 100%;
  padding: .875rem 1rem;
  border: 2.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--ink);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}
.name-input:focus, .cert-name-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 4px var(--c-primary-glow);
}
.names-form, .player-names-container { display: flex; flex-direction: column; gap: var(--sp-3); }

/* Privacy note */
.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: .8rem;
  color: var(--ink-soft);
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  background: var(--bg-page);
  border-radius: var(--r-sm);
  line-height: 1.5;
}
.privacy-note > span { flex-shrink: 0; }
.privacy-note p { margin: 0; }

/* ========== 22. LOADING SPINNER ========== */
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto var(--sp-3);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 23. TIMELINE NAVIGATION ========== */
.timeline-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  z-index: 998;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-top: var(--sa-top);
}
.timeline-nav::-webkit-scrollbar { display: none; }
.timeline-track {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: var(--sp-2) var(--sp-3);
  min-width: 100%;
  width: max-content;
  margin: 0 auto;
  justify-content: center;
}
.timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--sp-1) var(--sp-2);
  min-width: 42px;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.timeline-item::after {
  content: '';
  position: absolute;
  top: 50%; right: calc(-.35rem - 1px);
  width: calc(.35rem + 2px);
  height: 2px;
  background: var(--border);
  transform: translateY(-4px);
}
.timeline-item:last-child::after { display: none; }
.timeline-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  line-height: 1;
  font-weight: 700;
  color: var(--ink-soft);
  transition: all var(--t-fast);
}
.timeline-label {
  font-size: .6rem;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.timeline-item.active .timeline-dot {
  background: var(--c-accent);
  border-color: var(--c-accent-dark);
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--c-accent-glow);
  transform: scale(1.1);
}
.timeline-item.active .timeline-label  { color: var(--c-accent-dark); }
.timeline-item.completed .timeline-dot { background: var(--c-ok); border-color: var(--c-ok); color: white; }
.timeline-item.completed .timeline-label { color: var(--c-ok); }
.timeline-item.completed::after { background: var(--c-ok); }
.timeline-item:disabled { cursor: default; opacity: .4; }

/* ========== 24. MAP BUTTON & OVERLAY ========== */
.map-button {
  position: fixed;
  bottom: calc(16px + var(--sa-bottom)); right: 16px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent), #F4A430);
  border: 2.5px solid var(--c-accent-dark);
  box-shadow: var(--shadow-md);
  font-size: 1.6rem;
  cursor: pointer;
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-fast);
  animation: float 3.5s ease-in-out infinite;
}
.map-button:active { transform: scale(.9); animation: none; }
.map-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.map-overlay.active { display: flex; }
.map-container {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  max-height: 90dvh;
  background: var(--bg-card);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-6) var(--sp-4) calc(var(--sp-6) + var(--sa-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideUp .35s var(--ease-out);
  overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.map-close {
  position: absolute;
  top: var(--sp-3); right: var(--sp-3);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--c-primary);
  color: white;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-fast);
  z-index: 1;
  width: 36px;
}
.map-close:active { transform: scale(.9) rotate(90deg); }
.map-title   { text-align: center; color: var(--c-primary); margin-bottom: var(--sp-4); font-size: 1.25rem; }
.map-caption { text-align: center; color: var(--ink-soft); font-size: .85rem; margin-top: var(--sp-3); margin-bottom: 0; }

/* ========== 25. FINALE & CELEBRATION ========== */
.celebration {
  text-align: center;
  padding: var(--sp-8) 0 var(--sp-4);
}
.celebration-title {
  font-size: 1.75rem;
  color: var(--c-accent);
  text-shadow: 2px 2px 0 var(--c-primary);
  animation: pulse 1.5s ease infinite;
  margin-bottom: var(--sp-4);
}
.secret-code {
  display: inline-block;
  background: linear-gradient(135deg, var(--c-accent), #FFE066);
  color: var(--ink);
  font-family: 'Fredoka', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-lg);
  box-shadow: 0 3px 0 var(--c-accent-dark), var(--shadow-sm);
  margin: var(--sp-4) 0;
}
.secret-code-block { text-align: center; }
.thank-you-block   { text-align: center; }
.signoff           { color: var(--ink-soft); font-style: italic; }

.confetti-container {
  position: fixed; inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1000;
}
.confetti {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 2px;
  animation: confetti-fall 3s ease-out forwards;
}
@keyframes confetti-fall {
  from { transform: translateY(-100%) rotate(0deg); opacity: 1; }
  to   { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.03); }
}

/* Return directions */
.return-directions {
  background: linear-gradient(135deg, #F5F7FA, #EDE8DA);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  border: 1.5px solid var(--border);
}
.return-directions ol { padding-left: 1.5rem; }
.return-directions li { margin-bottom: var(--sp-2); }

/* Social / Instagram section */
.social-section {
  text-align: center;
  padding: var(--sp-5);
  background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  border-radius: var(--r-lg);
  color: white;
}
.social-section p { color: white; }
.social-section .btn { background: white; color: #bc1888; font-weight: 700; border: none; }

/* ========== 26. CERTIFICATE ========== */
.certificate-section { display: flex; flex-direction: column; gap: var(--sp-3); }
.cert-team-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.cert-team-row, .cert-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-page);
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
}
.cert-team-member-name { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: .95rem; }

/* ========== 27. FOOTER ========== */
.app-footer {
  margin-top: var(--sp-10);
  padding: var(--sp-6) var(--sp-4);
  border-top: 1.5px solid var(--border);
  text-align: center;
}
.footer-brand {
  font-family: 'Fredoka', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: var(--sp-2);
}
.footer-tagline { font-size: .82rem; color: var(--ink-soft); line-height: 1.7; margin: 0; }
.footer-link { color: var(--c-primary); text-decoration: none; font-weight: 600; }
.footer-link:active { text-decoration: underline; }

.brand-footer { text-align: center; margin-top: var(--sp-4); }

/* ========== 28. PRELOAD OVERLAY ========== */
.preload-overlay {
  position: fixed; inset: 0;
  background: var(--bg-page);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .4s ease;
}
.preload-overlay.fade-out { opacity: 0; pointer-events: none; }
.preload-content {
  text-align: center;
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.preload-content h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.65rem;
  color: var(--c-primary);
  margin-bottom: var(--sp-3);
}
.preload-content p { color: var(--ink-soft); margin-bottom: var(--sp-4); }
.preload-bar {
  width: 200px; height: 6px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
  margin: 0 auto var(--sp-3);
}
.preload-fill {
  width: 0; height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  border-radius: var(--r-full);
  transition: width .5s ease;
}
.emoji-large { font-size: 3rem; line-height: 1; }

/* ========== 29. OFFLINE BANNER ========== */
.offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: linear-gradient(135deg, #FF9800, #F57C00);
  color: white;
  text-align: center;
  padding: var(--sp-2) var(--sp-3);
  font-family: 'Fredoka', sans-serif;
  font-size: .85rem;
  font-weight: 600;
  z-index: 1001;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  animation: slideDown .3s var(--ease-out);
  padding-top: calc(var(--sp-2) + var(--sa-top));
}
@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

/* ========== 30. DU / IHR PERSONALISIERUNG ========== */
body.ticket-einzel .form-ihr { display: none; }
body.ticket-familie .form-du { display: none; }


/* ---- Karte ---- */
.map-image { width: 100%; border-radius: var(--radius-lg); }

/* ---- Finale ---- */
.secret-code-block.hidden { display: none; }
.secret-code {
  font-family: 'Fredoka', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-primary);
  letter-spacing: 0.15em;
  text-align: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  border: 2px dashed var(--c-primary);
}

.thank-you-block.hidden { display: none; }
.signoff {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.125rem;
  color: var(--c-primary);
}

.certificate-section { }

.cert-name-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.cert-name-input {
  padding: 0.75rem;
  border: 2px solid var(--c-secondary);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--ink);
  outline: none;
}
.cert-name-input:focus { border-color: var(--c-primary); }

.return-directions.hidden { display: none; }
.return-directions ol { padding-left: 1.25rem; }
.return-directions li { margin-bottom: 0.25rem; }

.social-section.hidden { display: none; }

/* ---- Leaderboard ---- */
.leaderboard-optin.hidden { display: none; }
.checkbox-label { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--c-primary); }

/* ---- Utility ---- */
.hidden { display: none !important; }
.html-block { line-height: 1.7; }

figure { margin: 0; }
figcaption { font-size: 0.875rem; color: var(--ink-soft); text-align: center; margin-top: 0.375rem; }
