/* ===========================================================
   STEFFS GEWUERZ-MULTIVERSUM
   Mobile-first. Dunkel. Pro Welt eine Akzentfarbe.
   =========================================================== */

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

:root {
  --bg:        #07080d;
  --bg-soft:   #0e1018;
  --card:      #12141d;
  --card-2:    #171a25;
  --line:      #262a38;
  --text:      #eef0f6;
  --muted:     #9aa1b4;
  --accent:    #a6ff2e;
  --accent-dim: rgba(166, 255, 46, .16);
  --radius:    16px;
  --shadow:    0 10px 34px rgba(0, 0, 0, .55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

/* --- Welt-Themes ---------------------------------------- */
[data-theme="rick"]      { --accent: #a6ff2e; --accent-dim: rgba(166,255, 46,.16); }
[data-theme="tmnt"]      { --accent: #3ec46d; --accent-dim: rgba( 62,196,109,.16); }
[data-theme="spongebob"] { --accent: #ffd21f; --accent-dim: rgba(255,210, 31,.16); }
[data-theme="avatar"]    { --accent: #ff4a1f; --accent-dim: rgba(255, 74, 31,.16); }
[data-theme="lotr"]      { --accent: #d9b45a; --accent-dim: rgba(217,180, 90,.16); }
[data-theme="starwars"]  { --accent: #4db8ff; --accent-dim: rgba( 77,184,255,.16); }
[data-theme="garfield"]  { --accent: #ffa030; --accent-dim: rgba(255,160, 48,.16); }
[data-theme="finale"]    { --accent: #ffd24a; --accent-dim: rgba(255,210, 74,.16); }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Sanfter Akzent-Schimmer im Hintergrund, wechselt mit der Welt */
body::before {
  content: "";
  position: fixed;
  inset: -30% -30% auto -30%;
  height: 70vh;
  background: radial-gradient(60% 60% at 50% 0%, var(--accent-dim), transparent 70%);
  pointer-events: none;
  z-index: 0;
  transition: background .6s ease;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(112px + env(safe-area-inset-bottom));
}

/* ===== Kopfzeile mit Gewuerz-Fortschritt ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  background: linear-gradient(to bottom, var(--bg) 62%, transparent);
}

.spices { display: flex; gap: 6px; flex: 1; }

.spice {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  transition: background .35s ease, box-shadow .35s ease;
}
.spice.earned { background: var(--accent); box-shadow: 0 0 10px var(--accent-dim); }

.counter {
  font: 600 12px/1 var(--mono);
  color: var(--muted);
  letter-spacing: .04em;
  white-space: nowrap;
}

.iconbtn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  width: 34px; height: 34px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  display: grid; place-items: center;
  flex: none;
}
.iconbtn:active { transform: scale(.94); }

/* Waehrend vorgelesen wird, atmet der Lautsprecher -- so ist auf einen
   Blick klar, woher der Ton kommt und wo man ihn abstellt. */
.iconbtn.speaking {
  color: var(--accent);
  border-color: var(--accent);
  animation: speaking 1.6s ease-in-out infinite;
}
@keyframes speaking {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .iconbtn.speaking { animation: none; }
}

/* ===== Weltbild auf eigenem Bildschirm =================== */
/* Bricht bewusst aus dem 16px-Rand der App aus: ein Querformat-Bild kann
   auf einem hochkant gehaltenen Handy nie höher werden als seine Breite
   erlaubt, also holen wir wenigstens die volle Breite raus. */
.imageonly {
  min-height: calc(100dvh - 215px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 0 -16px;
}

/* Ort als Titel über dem Bild. Steht im gepolsterten Bereich, während das
   Bild selbst randlos darunter läuft. */
.imagehead {
  text-align: center;
  padding: 0 16px;
}
.imagehead .eyebrow { margin-bottom: 10px; }
.imagehead h1 {
  font-size: clamp(24px, 7vw, 34px);
  margin: 0;
}

.bigimg {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background:
    radial-gradient(80% 90% at 50% 20%, var(--accent-dim), transparent 65%),
    linear-gradient(160deg, var(--card-2), var(--bg-soft));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.hero-emoji { font-size: 26vw; opacity: .3; filter: saturate(.7); }
@media (min-width: 520px) { .hero-emoji { font-size: 130px; } }

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.hero-img.is-missing { display: none; }

/* Kein Abdunkeln mehr nötig: unter dem Bild steht kein Text, der lesbar
   bleiben müsste. Das Bild wird ungetrübt gezeigt. */

/* ===== Titel ============================================= */
.eyebrow {
  font: 700 11px/1 var(--mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

h1 {
  margin: 0 0 4px;
  font-size: clamp(28px, 8vw, 40px);
  line-height: 1.06;
  letter-spacing: -.02em;
  font-weight: 800;
}

.place { margin: 0 0 22px; color: var(--muted); font-size: 15px; }

/* ===== Story ============================================= */
.story p { margin: 0 0 14px; }
.story p:first-child { font-size: 19px; font-weight: 600; }

/* ===== Karten & Bloecke ================================== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 22px 0;
  box-shadow: var(--shadow);
}

.card > h2 {
  margin: 0 0 14px;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.blocks > *:first-child { margin-top: 0; }
.blocks > *:last-child  { margin-bottom: 0; }
.blocks p { margin: 0 0 12px; }

.blocks h3 {
  margin: 22px 0 10px;
  font: 700 12px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.needs {
  display: flex; gap: 10px;
  align-items: flex-start;
  background: var(--card-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 15px;
}
.needs-label {
  font: 700 10px/1.6 var(--mono);
  letter-spacing: .14em;
  color: var(--muted);
  flex: none;
}
.needs ul { margin: 0; padding-left: 0; list-style: none; }

.blocks ul { margin: 0 0 14px; padding-left: 20px; }
.blocks li { margin-bottom: 5px; }

.check { list-style: none; padding: 0 !important; margin: 0 0 14px; }
.check li {
  display: flex; gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--card-2);
  border-radius: 10px;
  margin-bottom: 7px;
}
.check li::before {
  content: "";
  flex: none;
  width: 18px; height: 18px;
  margin-top: 3px;
  border: 2px solid var(--accent);
  border-radius: 5px;
}

.cmd {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card-2);
  margin-bottom: 8px;
  border-left: 3px solid var(--accent);
}
.cmd-n {
  font: 800 15px/1.25 var(--font);
  letter-spacing: .01em;
  flex: none;
  min-width: 38%;
}
.cmd-d { font-size: 14px; color: var(--muted); }

.shout {
  margin: 16px 0;
  padding: 18px 14px;
  text-align: center;
  border-radius: 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: clamp(19px, 6vw, 26px);
  font-weight: 900;
  letter-spacing: .01em;
  line-height: 1.15;
  text-transform: uppercase;
}

.quote {
  margin: 14px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--line);
  color: var(--text);
  font-style: italic;
  font-size: 16px;
}

.keys { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.keys span {
  padding: 8px 14px;
  border-radius: 99px;
  background: var(--accent);
  color: #07080d;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .04em;
}

/* ===== Buttons =========================================== */
.actions {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
  display: flex; justify-content: center; gap: 8px;
}

.btn {
  flex: 1 1 auto;
  max-width: 496px;
  border: 0;
  border-radius: 14px;
  padding: 17px 20px;
  background: var(--accent);
  color: #07080d;
  font: 800 17px/1 var(--font);
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 8px 26px var(--accent-dim);
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.975); }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
  font-weight: 600;
}

/* Zurück-Knopf: bewusst zurückhaltend, damit der Weiter-Knopf führt */
.btn.back {
  flex: 0 0 56px;
  max-width: 56px;
  padding: 17px 0;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
  font: 400 26px/1 var(--font);
}
.btn[disabled] { opacity: .3; cursor: default; }

/* ===== Startseite mit QR-Code für die Gäste ============== */
/* Wie die Weltbilder randlos, damit Steff hochkant überhaupt etwas erkennt. */
.start {
  padding-top: 6vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0 -16px;
}
.start .imagehead .place { margin-bottom: 0; }
.start h1 { font-size: clamp(30px, 9vw, 44px); }

.qr-card { text-align: center; margin-top: 28px; }
.qr-card > h2 { font-size: 18px; margin-bottom: 8px; }
.qr-card .note { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

.qr {
  width: min(240px, 62vw);
  margin: 0 auto 14px;
  padding: 10px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}
.qr svg { display: block; width: 100%; height: auto; }

.qr-url {
  margin: 0;
  font: 600 12px/1.5 var(--mono);
  color: var(--muted);
  word-break: break-all;
}
.qr-fallback { color: #ff6b6b; font-size: 14px; }

/* ===== Portal-Tor (Passworteingabe) ====================== */
.gate { text-align: center; padding-top: 8vh; }

.portal {
  width: min(62vw, 240px);
  aspect-ratio: 1;
  margin: 0 auto 34px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), #0b6b3a, var(--accent), #0b6b3a, var(--accent));
  animation: spin 7s linear infinite;
  filter: blur(1px);
  position: relative;
  box-shadow: 0 0 70px var(--accent-dim), inset 0 0 60px rgba(0, 0, 0, .65);
}
.portal::after {
  content: "";
  position: absolute; inset: 17%;
  border-radius: 50%;
  background: radial-gradient(circle, #04050a 55%, transparent);
}
.portal.locked { filter: blur(1px) grayscale(.75); opacity: .5; animation-duration: 26s; }

@keyframes spin { to { transform: rotate(360deg); } }

.gate h1 { font-size: clamp(22px, 6.5vw, 30px); }
.gate .place { margin-bottom: 26px; }

.codeform { display: grid; gap: 12px; margin-top: 6px; }

.code-input {
  width: 100%;
  padding: 18px 16px;
  text-align: center;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font: 700 22px/1 var(--mono);
  letter-spacing: .22em;
  text-transform: uppercase;
  outline: none;
  transition: border-color .2s ease;
}
.code-input::placeholder { color: #4a5064; letter-spacing: .1em; font-size: 15px; }
.code-input:focus { border-color: var(--accent); }

.gate-msg { min-height: 22px; font-size: 14px; color: var(--muted); }
.gate-msg.error { color: #ff6b6b; }

.shake { animation: shake .38s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

.hintlink {
  background: none; border: 0;
  color: var(--muted);
  font: 600 14px var(--font);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
  padding: 10px;
}

.riddlebox {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--card);
  text-align: left;
  font-size: 15px;
  color: var(--muted);
}
.riddlebox p { margin: 0 0 8px; }
.riddlebox p:last-child { margin: 0; }
.riddlebox .hintpattern {
  font: 700 17px var(--mono);
  letter-spacing: .18em;
  color: var(--accent);
}

/* ===== Belohnung ========================================= */
.reward { text-align: center; padding: 6px 0 4px; }
.reward-emoji {
  font-size: 84px;
  line-height: 1;
  display: block;
  margin-bottom: 14px;
  animation: pop .5s cubic-bezier(.2, 1.5, .4, 1);
}
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

/* Produktfoto auf weisser Kachel -- die Bilder sind auf Weiss
   freigestellt, direkt auf der dunklen Karte wirkte das wie ein Klotz.
   So liest es sich wie eine Gegenstandskarte. */
.reward-pic {
  width: min(320px, 82vw);
  aspect-ratio: 1;
  margin: 0 auto 16px;
  padding: 10px;
  background: #fff;
  border: 2px solid var(--accent);
  border-radius: 22px;
  box-shadow: 0 0 44px var(--accent-dim), 0 12px 30px rgba(0, 0, 0, .55);
  animation: pop .5s cubic-bezier(.2, 1.5, .4, 1);
}
.reward-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }

.reward-visual.has-pic .reward-emoji { display: none; }
.reward-visual:not(.has-pic) .reward-pic { display: none; }

.reward-sub {
  font: 700 11px/1 var(--mono);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.reward h2 { margin: 0 0 12px; font-size: 26px; }
.reward .note { color: var(--muted); font-size: 15px; margin: 0; }

/* ===== Portal-Uebergang (Vollbild) ======================= */
.warp {
  position: fixed; inset: 0;
  z-index: 100;
  display: grid; place-items: center;
  background: #04050a;
  animation: warpFade .45s ease;
}
.warp-core {
  width: 46vmin; aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), #0b6b3a, var(--accent), #0b6b3a, var(--accent));
  animation: warpIn 1.5s cubic-bezier(.5, 0, .3, 1) forwards;
  box-shadow: 0 0 120px var(--accent);
}
@keyframes warpFade { from { opacity: 0; } }
@keyframes warpIn {
  0%   { transform: scale(.1) rotate(0deg);     opacity: 0; }
  35%  { transform: scale(1) rotate(360deg);    opacity: 1; }
  100% { transform: scale(14) rotate(900deg);   opacity: 0; }
}

/* ===== Finale ============================================ */
.banners { display: grid; gap: 10px; margin: 0 0 26px; }
.banner {
  padding: 15px;
  text-align: center;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-dim);
  color: var(--accent);
  font: 800 15px/1.25 var(--mono);
  letter-spacing: .08em;
}

.stats { width: 100%; border-collapse: collapse; font-size: 15px; }
.stats td { padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.stats td:last-child { text-align: right; color: var(--accent); font-weight: 700; padding-left: 12px; }
.stats tr:last-child td { border-bottom: 0; }

.warnbox {
  border: 1px solid #6b3a1f;
  background: rgba(255, 138, 43, .09);
  border-radius: 12px;
  padding: 16px;
  margin: 22px 0;
  font-size: 15px;
}
.warnbox p { margin: 0 0 10px; }
.warnbox p:last-child { margin: 0; font-weight: 700; }
.signature { text-align: right; color: var(--muted); font-style: italic; margin-top: 12px !important; }

.gift { text-align: center; padding: 20px 0; }
.gift-emoji { font-size: 96px; line-height: 1; display: block; margin-bottom: 12px; animation: pop .6s cubic-bezier(.2, 1.5, .4, 1); }
.gift h2 { font-size: clamp(28px, 9vw, 40px); margin: 0 0 10px; }
.gift p { color: var(--muted); margin: 0; }

/* ===== Uebergangsanimation der Ansichten ================= */
.view { animation: rise .45s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Startseite: Fortschrittsleiste und Zähler verdecken, damit dort noch
   nichts über Anzahl oder Inhalt der Mission verrät. Nur unsichtbar,
   nicht entfernt — so springt das Layout beim Weiterblättern nicht. */
body.at-start .spices,
body.at-start .counter { visibility: hidden; }
