html {
  scroll-padding-top: 80px;
}

body.modal-open {
  overflow: hidden;
}

/* ── Sternenhimmel ── */
.star-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: starPulse var(--duration) ease-in-out infinite alternate;
}

@keyframes starPulse {
  0%   { opacity: var(--min-opacity); }
  100% { opacity: var(--max-opacity); }
}

/* ── Abschnitte ── */
.detective-intro,
.story-panel,
.clues-section,
.quiz-section,
.result-section {
  width: 100%;
}

.detective-intro {
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}

.detective-lead {
  max-width: 720px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.section-head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.15;
}

.section-copy {
  margin: 10px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.mini-label {
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-panel,
.clues-section,
.quiz-section,
.result-section {
  margin-top: 0;
  padding-top: 24px;
}

/* ── Story-Text ── */
.story-text {
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  margin-top: 48px;
}

.story-text p {
  margin: 0 0 14px;
  max-width: none;
  color: var(--text);
  font-size: 1.04rem;
  line-height: 1.75;
}

.story-text p:last-child {
  margin-bottom: 0;
}

/* ── Fortschritts-Box ── */
.progress-box {
  min-width: 150px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.progress-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.progress-value {
  display: block;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: bold;
}

/* ── Hinweis-Grid ── */
.clue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.clues-section p {
  text-align: left !important;
  display: block !important;
  max-width: none !important;
}

.quiz-section p {
  text-align: left !important;
  display: block !important;
  max-width: none !important;
}

/* ── Hinweis-Karten ── */
.clue-card {
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 4px 16px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.clue-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.01));
  pointer-events: none;
  border-radius: 20px;
}

.clue-card:hover {
  transform: translateY(-3px);
  border-color: rgba(110,231,255,0.3);
  background: rgba(255,255,255,0.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 8px 24px rgba(0,0,0,0.3), 0 0 20px rgba(110,231,255,0.08);
}

.clue-card.found {
  background: rgba(110, 231, 255, 0.08);
  border-color: rgba(110, 231, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 0 16px rgba(110,231,255,0.1);
}

.clue-card.found .clue-status {
  color: #6ee7ff;
  text-shadow: 0 0 8px rgba(110,231,255,0.3);
}

/* ── Hinweis-Button ── */
.clue-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  position: relative;
  z-index: 1;
}

.clue-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.clue-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.clue-title {
  font-size: 1.08rem;
  font-weight: bold;
}

.clue-status {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ── Aktions-Buttons (groß) ── */
.detective-action-btn {
  min-height: 48px;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}

.detective-action-btn:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 30px rgba(139,92,246,0.3), inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ── Kleinere Buttons (Vorlesen, Schließen) ── */
.detective-small-btn {
  min-height: 44px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: background-color 250ms ease, border-color 250ms ease, box-shadow 250ms ease;
}

.detective-small-btn:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ── Vorlesen-Button aktiv ── */
.speak-btn.speaking {
  border-color: rgba(110,231,255,0.5) !important;
  background: rgba(110,231,255,0.12) !important;
  color: #6ee7ff !important;
  box-shadow: 0 0 16px rgba(110,231,255,0.15), inset 0 1px 0 rgba(255,255,255,0.06) !important;
}

/* ── Quiz-Fragen ── */
.detective-quiz-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.quiz-question {
  margin: 0;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 4px 16px rgba(0,0,0,0.2);
}

.quiz-question legend {
  padding: 0 8px;
  color: var(--text);
  font-weight: bold;
  margin-left: 6px;
}

.quiz-question label {
  display: block;
  margin-top: 14px;
  color: var(--text);
  line-height: 1.6;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: background-color 200ms ease, border-color 200ms ease;
}

.quiz-question label:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

.quiz-question input[type="radio"] {
  margin-right: 10px;
  accent-color: #6ee7ff;
}

/* ── Ergebnis-Box ── */
.result-box {
  padding: 22px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 4px 16px rgba(0,0,0,0.2);
  margin-top: 48px;
}

.result-box p {
  max-width: none;
  color: var(--text);
  line-height: 1.8;
}

.ending-panel {
  margin-top: 24px;
}

/* ── Modal ── */
.detective-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
}

.detective-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, 0.92);
}

.detective-modal-dialog {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.detective-modal-body {
  padding: 28px 24px 24px;
}

.detective-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.detective-modal-close:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(110,231,255,0.3);
  box-shadow: 0 0 12px rgba(110,231,255,0.1);
}

.detective-modal-text {
  margin-top: 18px;
}

/* ── Hinweis-Bild im Modal ── */
.clue-modal-image {
  display: block;
  max-height: 400px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.clue-modal-image.hidden {
  display: none !important;
}

.clue-modal-image:not(.hidden) + .detective-modal-text {
  margin-top: 12px;
}

.detective-modal-actions {
  justify-content: flex-start;
}

.detective-code {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(110,231,255,0.12);
  border: 1px solid rgba(110,231,255,0.35);
  color: var(--accent);
  font-weight: bold;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
}

.solve-wrap {
  text-align: center;
}

.solve-hint {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 420px;
}

/* ── Credit ── */
.detective-credit {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  text-align: center;
}

.detective-credit p {
  margin: 0 auto;
  max-width: 680px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
}

.detective-credit a {
  color: var(--accent);
  text-decoration: none;
}

.detective-credit a:hover {
  text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 800px) {
  .clue-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .section-head-stack-mobile {
    flex-direction: column;
  }

  .section-head {
    flex-direction: column;
  }

  .progress-box {
    width: 100%;
    text-align: left;
  }
}

@media (max-width: 600px) {
  .story-text,
  .quiz-question,
  .result-box,
  .detective-modal-body {
    padding: 18px;
    border-radius: 16px;
  }

  .clue-toggle {
    padding: 16px;
  }

  .clue-icon {
    width: 44px;
    height: 44px;
    font-size: 1.25rem;
  }

  .clue-title {
    font-size: 1rem;
  }


  .detective-modal-close {
    top: 10px;
    right: 10px;
  }

  .clue-modal-image {
    max-height: 280px;
  }
}
