/* iQuest Classic oder Game (Kim 16.10.2026): Umschalter, Auswahlbildschirm, Umbau-Sequenz.
   Gilt auf allen Seiten. Der Umschalter sieht im Game aus wie der Hell/Dunkel-Schalter (gemalte
   Bilder), in Classic schlicht. Aktiv ist immer die Seite, auf der man gerade ist. */

@font-face { font-family: 'Manrope'; src: url('fonts/manrope-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }
/* Bricolage und Atkinson (Game-Hälfte des Auswahlbildschirms) bringen Startseite und auth.css selbst mit. */

/* ---------- Umschalter: Game-Look ---------- */
.mode-toggle {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between; flex: none;
  width: 72px; height: 38px; min-height: 0; margin: 0; padding: 0 6px; gap: 0; border: 0; border-radius: 0;
  cursor: pointer; filter: none; transform: none; box-shadow: none; -webkit-tap-highlight-color: transparent;
  background: url('../assets/theme/pill-night.png') 0 0 / 100% 100% no-repeat;
  background-image: image-set(url('../assets/theme/pill-night.png') 1x, url('../assets/theme/pill-night@2x.png') 2x);
}
.mode-toggle::before {
  content: ''; position: absolute; top: 5px; left: 4px; width: 28px; height: 28px;
  background: url('../assets/theme/knob-day.png') 0 0 / 28px 28px no-repeat;
  background-image: image-set(url('../assets/theme/knob-day.png') 1x, url('../assets/theme/knob-day@2x.png') 2x);
}
.mode-toggle[aria-checked='true']::before { left: calc(100% - 32px); }
/* Im Game wie beim Hell/Dunkel-Schalter: gemalte Icons als Bilder (Controller = Game, Buch = Classic). */
.mode-toggle__icon { position: relative; display: block; width: 24px; height: 24px; object-fit: contain; }
.mode-toggle:focus-visible { outline: 3px solid #8FD0FF; outline-offset: 3px; border-radius: 99px; }
html[data-theme='light'] .mode-toggle {
  background-image: url('../assets/theme/pill-day.png');
  background-image: image-set(url('../assets/theme/pill-day.png') 1x, url('../assets/theme/pill-day@2x.png') 2x);
}

/* Startseite des Spiels: rechts neben dem Hell/Dunkel-Schalter (gleiche Höhe), dann Musik – wie im Spiel (RM#35). */
.mode-toggle--fixed { position: absolute; z-index: 100; top: 16px; right: 12px; }
body:has(#welcomeMusic) .mode-toggle--fixed { right: 64px; }
body:has(.lp-top) .mode-toggle--fixed { top: 34px; }
/* Am Handy steht der Umschalter in der Logozeile zwischen Logo und Musikknopf. */
@media (max-width: 860px) {
  body:has(.lp-top) .mode-toggle--fixed, body:has(#welcomeMusic):has(.lp-top) .mode-toggle--fixed { top: 11px; right: 60px; width: 64px; height: 34px; padding: 0 5px; }
  body:has(.lp-top) .mode-toggle--fixed::before { top: 4px; left: 3px; width: 26px; height: 26px; background-size: 26px 26px; }
  body:has(.lp-top) .mode-toggle--fixed[aria-checked='true']::before { left: calc(100% - 29px); }
  body:has(.lp-top) .mode-toggle--fixed .mode-toggle__icon { width: 22px; height: 22px; }
}
@media (max-width: 370px) {
  body:has(.lp-top) .mode-toggle--fixed, body:has(#welcomeMusic):has(.lp-top) .mode-toggle--fixed { right: 58px; width: 58px; padding: 0 4px; }
  body:has(.lp-top) .mode-toggle--fixed .mode-toggle__icon { width: 20px; height: 20px; }
  body:has(.lp-top) .mode-toggle--fixed::before { width: 24px; height: 24px; top: 5px; background-size: 24px 24px; }
  body:has(.lp-top) .mode-toggle--fixed[aria-checked='true']::before { left: calc(100% - 27px); }
}

/* Konto-, Kauf- und Rechtsseiten: direkt hinter dem Hell/Dunkel-Schalter, wie im Spiel (RM#35).
   Die Anordnung der Kopfleiste steht in css/site-bar.css (RM#48). */
.site-bar__mode:is(:hover, :active) { filter: none; transform: none; box-shadow: none; }
@media (max-width: 700px) {
  html[data-mode='game'] body.site .site-bar__mode { width: 60px; height: 34px; padding: 0 5px; }
  html[data-mode='game'] body.site .site-bar__mode::before { width: 26px; height: 26px; top: 4px; left: 4px; background-size: 26px 26px; }
  html[data-mode='game'] body.site .site-bar__mode[aria-checked='true']::before { left: calc(100% - 30px); }
  html[data-mode='game'] body.site .site-bar__mode .mode-toggle__icon { width: 22px; height: 22px; }
}
@media (max-width: 370px) {
  html[data-mode='game'] body.site :is(.site-bar__mode, .site-bar__theme) { width: 54px; }
  html[data-mode='game'] body.site .site-bar__theme::before { left: calc(100% - 30px); }
}
@media (max-width: 340px) {
  html[data-mode='game'] body.site :is(.site-bar__mode, .site-bar__theme) { width: 50px; height: 32px; padding: 0 4px; }
  html[data-mode='game'] body.site :is(.site-bar__mode, .site-bar__theme)::before { width: 24px; height: 24px; top: 4px; background-size: 24px 24px; }
  html[data-mode='game'] body.site .site-bar__theme::before { left: calc(100% - 27px); }
  html[data-mode='game'] body.site .site-bar__theme[aria-pressed='true']::before,
  html[data-mode='game'] body.site .site-bar__mode::before { left: 3px; }
  html[data-mode='game'] body.site .site-bar__mode[aria-checked='true']::before { left: calc(100% - 27px); }
  html[data-mode='game'] body.site :is(.site-bar__mode .mode-toggle__icon, .site-bar__theme img) { width: 19px; height: 19px; }
}

/* ---------- Hinweis auf die andere Oberfläche (Kim 17.10.2026) ----------
   Auf der Classic-Startseite steht „Lieber mit Spiel?“ in einer Box im Game-Look, auf der Game-Startseite
   „Lieber ohne Spiel?“ in einer Box im Classic-Look: man sieht sofort, wohin der Knopf führt. */
.mode-teaser {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: stretch;
  overflow: hidden; border-radius: 22px; text-align: left;
}
.mode-teaser__text { position: relative; z-index: 1; display: grid; align-content: center; justify-items: start; gap: 14px; padding: clamp(26px, 4vw, 44px); }
.mode-teaser__logo { display: block; width: auto; height: auto; }
.mode-teaser h2 { margin: 0; }
.mode-teaser p { margin: 0; max-width: 46ch; }
.mode-teaser__btn { display: inline-flex; align-items: center; justify-content: center; margin-top: 6px; cursor: pointer; text-decoration: none; }
.mode-teaser__art { position: relative; min-height: 220px; }

/* Game-Look (auf der Classic-Startseite) */
.mode-teaser--game {
  color: #F6F2E6; background: linear-gradient(180deg, rgba(23,30,69,.97) 0%, rgba(10,14,36,.98) 100%);
  border: 1px solid rgba(245,197,66,.55); box-shadow: 0 24px 60px -24px rgba(6,9,23,.55), inset 0 1px 0 rgba(255,233,166,.2);
}
.mode-teaser--game::before { content: ''; position: absolute; inset: 6px; z-index: 2; border: 1px solid rgba(245,197,66,.18); border-radius: 17px; pointer-events: none; }
.mode-teaser--game .mode-teaser__logo { width: 132px; filter: drop-shadow(0 4px 14px rgba(233,164,0,.35)); }
.mode-teaser--game h2 {
  font: 800 clamp(1.7rem, 3vw, 2.3rem)/1.1 'Bricolage', 'Trebuchet MS', system-ui, sans-serif; letter-spacing: -.015em;
  background: linear-gradient(180deg, #FFF3C9 0%, #F8CF55 48%, #E2A72B 100%); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.mode-teaser--game p { font: 400 17px/1.55 'Atkinson', 'Segoe UI', system-ui, sans-serif; color: #CDD3EA; }
.mode-teaser--game .mode-teaser__btn {
  min-height: 50px; padding: 0 24px; border: 0; border-radius: 14px; color: #1A1202; font: 800 18px/1.1 'Bricolage', 'Trebuchet MS', system-ui, sans-serif;
  background: linear-gradient(180deg, #FFE9A6 0%, #F5C542 46%, #C8860F 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 4px 0 #7E5200, 0 14px 30px rgba(245,197,66,.24);
  transition: transform .12s ease, filter .12s ease;
}
.mode-teaser--game .mode-teaser__btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.mode-teaser--game .mode-teaser__btn:focus-visible { outline: 3px solid #8FD0FF; outline-offset: 3px; }
.mode-teaser--game .mode-teaser__art {
  background: linear-gradient(90deg, rgba(14,19,46,1) 0%, rgba(14,19,46,.35) 34%, rgba(14,19,46,0) 60%),
    url('../assets/world/quest-map.webp') 62% 50% / cover no-repeat;
}

/* Classic-Look (auf der Game-Startseite) */
.mode-teaser--classic {
  color: #0C1638; background: #FFFFFF; border: 1px solid #DCE1EA; box-shadow: 0 30px 60px -36px rgba(0,0,0,.55);
  font-family: 'Manrope', system-ui, sans-serif;
}
.mode-teaser--classic .mode-teaser__logo { width: 168px; }
.mode-teaser--classic h2 { font: 800 clamp(1.6rem, 2.8vw, 2.2rem)/1.15 'Manrope', system-ui, sans-serif; letter-spacing: -.025em; color: #0C1638; }
.mode-teaser--classic p { font: 500 16.5px/1.6 'Manrope', system-ui, sans-serif; color: #4A5574; }
.mode-teaser--classic .mode-teaser__btn {
  min-height: 48px; padding: 0 22px; border: 1px solid #0C1638; border-radius: 10px; background: #0C1638; color: #FFFFFF;
  font: 700 15.5px/1.2 'Manrope', system-ui, sans-serif; box-shadow: none; transition: background-color .15s ease;
}
.mode-teaser--classic .mode-teaser__btn:hover { background: #1D2B5E; }
.mode-teaser--classic .mode-teaser__btn:focus-visible { outline: 2px solid #2F6FEB; outline-offset: 2px; }
.mode-teaser--classic .mode-teaser__art {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: center; gap: 12px; padding: clamp(22px, 3vw, 36px);
  background:
    linear-gradient(rgba(12,22,56,.045) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(12,22,56,.045) 1px, transparent 1px) 0 0 / 24px 24px,
    #F3F5F9;
  border-left: 1px solid #DCE1EA;
}
.mode-teaser__tile {
  display: grid; grid-template-rows: auto 1fr auto; gap: 10px; min-height: 76px; padding: 12px; border-radius: 10px;
  background: #FFFFFF; box-shadow: 0 0 0 1px #DCE1EA, 0 10px 22px -16px rgba(12,22,56,.4);
}
.mode-teaser__tile b { font: 800 17px/1 'Manrope', system-ui, sans-serif; color: #0C1638; font-variant-numeric: tabular-nums; }
.mode-teaser__tile i { display: flex; gap: 3px; align-self: end; }
.mode-teaser__tile i::before { content: ''; flex: 1; height: 3px; border-radius: 3px; background: #DCE1EA; max-width: 70%; }
.mode-teaser__tile--done i::before { background: #0C1638; max-width: 100%; }
.mode-teaser__tile--half i::before { background: linear-gradient(90deg, #0C1638 0 50%, #DCE1EA 50% 100%); max-width: 100%; }

@media (max-width: 760px) {
  .mode-teaser { grid-template-columns: 1fr; }
  .mode-teaser__art { order: -1; min-height: 150px; }
  .mode-teaser--game .mode-teaser__art { background: linear-gradient(180deg, rgba(14,19,46,0) 45%, rgba(14,19,46,1) 100%), url('../assets/world/quest-map.webp') 50% 45% / cover no-repeat; }
  .mode-teaser--classic .mode-teaser__art { border-left: 0; border-bottom: 1px solid #DCE1EA; gap: 8px; padding: 18px; }
  .mode-teaser__tile { min-height: 58px; padding: 10px; }
}

/* ---------- Umschalter: Classic-Look ---------- */
html[data-mode='classic'] .mode-toggle {
  width: 76px; height: 36px; padding: 2px; border-radius: 999px; justify-content: space-between;
  background: var(--cl-paper, #fff); border: 1px solid var(--cl-line, #D9DEE8);
}
html[data-mode='classic'] .mode-toggle::before {
  top: 2px; left: auto; right: 2px; width: 34px; height: 30px; border-radius: 999px;
  background: var(--cl-ink, #0C1638); transition: right .2s ease;
}
html[data-mode='classic'] .mode-toggle[aria-checked='false']::before { right: calc(100% - 36px); }
html[data-mode='classic'] .mode-toggle__icon {
  width: 34px; height: 30px; background: none; z-index: 1;
}
html[data-mode='classic'] .mode-toggle__icon::after {
  content: ''; position: absolute; inset: 5px 8px; background: var(--cl-ink-2, #4A5574);
  -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat;
}
html[data-mode='classic'] .mode-toggle__icon--game::after { -webkit-mask-image: url('../assets/mode/classic-controller.png'); mask-image: url('../assets/mode/classic-controller.png'); }
html[data-mode='classic'] .mode-toggle__icon--classic::after { -webkit-mask-image: url('../assets/mode/classic-buch.png'); mask-image: url('../assets/mode/classic-buch.png'); }
html[data-mode='classic'] .mode-toggle[aria-checked='true'] .mode-toggle__icon--classic::after,
html[data-mode='classic'] .mode-toggle[aria-checked='false'] .mode-toggle__icon--game::after { background: var(--cl-paper, #fff); }
html[data-mode='classic'] .mode-toggle:hover { border-color: var(--cl-ink-2, #4A5574); }
html[data-mode='classic'] .mode-toggle:focus-visible { outline: 2px solid var(--cl-focus, #2F6FEB); outline-offset: 2px; }

/* ---------- Auswahlbildschirm ---------- */
html.is-choosing, html.is-choosing body { overflow: hidden; }
.mode-choice { position: fixed; inset: 0; z-index: 2000; background: #0C1638; font-family: 'Manrope', system-ui, sans-serif; }
.mode-choice__half {
  position: absolute; inset: 0; margin: 0; padding: 0; border: 0; border-radius: 0; cursor: pointer; color: inherit;
  font: inherit; text-align: left; background: none; box-shadow: none; transform: none; min-height: 0;
  transition: clip-path .55s cubic-bezier(.2,.7,.2,1), opacity .4s ease;
}
.mode-choice__half--classic {
  clip-path: polygon(0 0, 100% 0, 0 100%); z-index: 1; color: #0C1638;
  background:
    linear-gradient(rgba(12,22,56,.045) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(12,22,56,.045) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(rgba(12,22,56,.07) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(90deg, rgba(12,22,56,.07) 1px, transparent 1px) 0 0 / 120px 120px,
    #F3F5F9;
}
.mode-choice__half--game {
  clip-path: polygon(100% 0, 100% 100%, 0 100%); z-index: 1; color: #FFF4D6;
  background: linear-gradient(160deg, rgba(6,9,23,.25), rgba(6,9,23,.82) 70%), url('../assets/world/quest-map.webp') center / cover no-repeat, #060917;
}
.mode-choice__inner { position: absolute; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, 42vw); }
.mode-choice__half--classic .mode-choice__inner { top: 9vh; left: 7vw; align-items: flex-start; }
.mode-choice__half--game .mode-choice__inner { bottom: 9vh; right: 7vw; align-items: flex-end; text-align: right; }
.mode-choice__logo { display: block; height: auto; }
.mode-choice__half--classic .mode-choice__logo { width: min(200px, 40vw); margin-bottom: 8px; }
.mode-choice__half--game .mode-choice__logo { width: min(260px, 52vw); margin-bottom: 4px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.55)); }
.mode-choice__name { font-weight: 800; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.01em; line-height: 1.1; }
/* Jede Hälfte spricht genau die Farben und Knöpfe ihrer Oberfläche (Kim 16.10.2026: Farben müssen übereinstimmen). */
.mode-choice__half--classic .mode-choice__name { color: #0C1638; }
.mode-choice__half--game .mode-choice__name {
  font-family: 'Bricolage', 'Manrope', system-ui, sans-serif; letter-spacing: -.015em;
  background: linear-gradient(180deg, #FFF3C9 0%, #F8CF55 48%, #E2A72B 100%); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 10px rgba(0,0,0,.55));
}
.mode-choice__text { font-size: clamp(15px, 1.4vw, 17px); line-height: 1.5; font-weight: 500; }
.mode-choice__half--classic .mode-choice__text { color: #4A5574; }
.mode-choice__half--game .mode-choice__text { color: #F6F2E6; font-family: 'Atkinson', 'Segoe UI', system-ui, sans-serif; font-weight: 400; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.mode-choice__go { margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; }
/* wie .cl-btn--primary in Classic */
.mode-choice__half--classic .mode-choice__go {
  min-height: 46px; padding: 0 22px; border-radius: 10px; background: #0C1638; color: #fff; font: 700 15px/1.2 'Manrope', system-ui, sans-serif;
}
/* wie .lp-btn--gold auf der Game-Startseite */
.mode-choice__half--game .mode-choice__go {
  min-height: 50px; padding: 0 24px; border-radius: 14px; color: #1A1202; font: 800 18px/1.1 'Bricolage', 'Manrope', system-ui, sans-serif;
  background: linear-gradient(180deg, #FFE9A6 0%, #F5C542 46%, #C8860F 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 4px 0 #7E5200, 0 14px 30px rgba(245,197,66,.24);
}
.mode-choice:focus { outline: none; }
@media (hover: hover) {
  .mode-choice__half--classic:hover { clip-path: polygon(0 0, 106% 0, 0 106%); z-index: 2; }
  .mode-choice__half--game:hover { clip-path: polygon(100% -6%, 100% 100%, -6% 100%); z-index: 2; }
}
.mode-choice__half:focus-visible { outline: none; }
.mode-choice__half:focus-visible .mode-choice__go { outline: 3px solid #8FD0FF; outline-offset: 3px; }
.mode-choice__center {
  position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none;
  display: grid; gap: 4px; justify-items: center; width: max-content; max-width: min(360px, 84vw); padding: 14px 22px; border-radius: 18px;
  background: #0C1638; color: #fff; text-align: center; box-shadow: 0 0 0 1px #C9A24A, 0 14px 36px rgba(0,0,0,.35); transition: opacity .3s ease;
}
.mode-choice__title { margin: 0; color: #fff; font: 700 clamp(17px, 1.8vw, 20px)/1.25 'Manrope', system-ui, sans-serif; }
.mode-choice__hint { margin: 0; font: 500 13px/1.45 'Manrope', system-ui, sans-serif; color: rgba(255,255,255,.78); }
.mode-choice.is-picked .mode-choice__center { opacity: 0; }
.mode-choice.is-picked--classic .mode-choice__half--classic,
.mode-choice.is-picked--game .mode-choice__half--game { clip-path: polygon(-50% -50%, 150% -50%, 150% 150%, -50% 150%); z-index: 4; transition-duration: .8s; }
.mode-choice.is-picked .mode-choice__go { opacity: 0; transition: opacity .2s ease; }
/* Hochformat: flachere Schräge, Classic oben links, Game unten rechts. */
@media (max-width: 700px) {
  .mode-choice__half--classic { clip-path: polygon(0 0, 100% 0, 100% 40%, 0 60%); }
  .mode-choice__half--game { clip-path: polygon(100% 40%, 100% 100%, 0 100%, 0 60%); }
  .mode-choice__inner { max-width: 78vw; gap: 7px; }
  .mode-choice__half--classic .mode-choice__inner { top: 5vh; left: 6vw; }
  .mode-choice__half--game .mode-choice__inner { bottom: 5vh; right: 6vw; }
  .mode-choice__half--classic .mode-choice__logo { width: 150px; }
  .mode-choice__half--game .mode-choice__logo { width: 190px; }
  .mode-choice__text { font-size: 14px; }
  .mode-choice__go { min-height: 42px; }
}
@media (max-width: 700px) and (hover: hover) {
  .mode-choice__half--classic:hover { clip-path: polygon(0 0, 100% 0, 100% 44%, 0 64%); }
  .mode-choice__half--game:hover { clip-path: polygon(100% 36%, 100% 100%, 0 100%, 0 56%); }
}
@media (prefers-reduced-motion: reduce) { .mode-choice__half, .mode-choice__title, .mode-choice__hint { transition: none; } }

/* ---------- Umbau-Sequenz (9 s) ----------
   Die zwölf Themen liegen als Kacheln auf dem Tisch und drehen sich in einer weichen, diagonalen Welle um:
   zum Game zeigt die Rückseite je einen Ausschnitt der gemalten Weltkarte, die Fugen lösen sich zur ganzen
   Karte auf; zu Classic wird aus der Karte die ruhige Themenübersicht. Die neue Welt breitet sich von der
   Mitte aus, am Ende fährt die Kamera heran und die neue Seite übernimmt das Bild (Kim 16.10.2026).
   Flüssig auch auf schwächeren Geräten: Es bewegen sich nur transform und opacity, nichts wird neu gesetzt.
   Zeitplan: 0–1,2 s Auftritt · 1,5–5,0 s Wende · 2,4–4,6 s Weltwechsel · 5,1–6,0 s Karte entsteht ·
   6,9–8,9 s Zoom. */
html.is-umbau, html.is-umbau body { overflow: hidden; }
.umbau {
  --wave-step: .34s; --flip: 1.45s; --flip-start: 1.5s; --ease-flip: cubic-bezier(.45,.05,.25,1);
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 24px;
  font-family: 'Manrope', system-ui, sans-serif; opacity: 0; transition: opacity .5s ease; overflow: hidden;
}
.umbau.is-on { opacity: 1; }
.umbau--classic { --flip-start: 1.7s; }
/* Classic-Welt folgt Hell/Dunkel, damit das Ankommen in der Übersicht nahtlos ist. */
.umbau {
  --cw-ground: #F3F5F9; --cw-grid: rgba(12,22,56,.04); --cw-grid-2: rgba(12,22,56,.06); --cw-glow: rgba(255,255,255,.9);
  --cw-paper: #FFFFFF; --cw-ink: #0C1638; --cw-ink-2: #4A5574; --cw-line: #DCE1EA; --cw-track: rgba(12,22,56,.12);
  --cw-shadow: rgba(12,22,56,.35);
}
html[data-theme='dark'] .umbau {
  --cw-ground: #0A1023; --cw-grid: rgba(255,255,255,.025); --cw-grid-2: rgba(255,255,255,.04); --cw-glow: rgba(40,58,110,.45);
  --cw-paper: #111A35; --cw-ink: #E9EDF6; --cw-ink-2: #AAB3CB; --cw-line: #2A355A; --cw-track: rgba(233,237,246,.14);
  --cw-shadow: rgba(0,0,0,.6);
}

/* Welten im Hintergrund */
.umbau__bg { position: absolute; inset: 0; }
.umbau__bg--classic {
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, var(--cw-glow), transparent 70%),
    linear-gradient(var(--cw-grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--cw-grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(var(--cw-grid-2) 1px, transparent 1px) 0 0 / 120px 120px,
    linear-gradient(90deg, var(--cw-grid-2) 1px, transparent 1px) 0 0 / 120px 120px,
    var(--cw-ground);
}
.umbau__bg--game {
  background:
    radial-gradient(ellipse 60% 55% at 50% 46%, rgba(64,92,190,.34), rgba(64,92,190,0) 70%),
    radial-gradient(ellipse 40% 30% at 50% 78%, rgba(245,197,66,.10), rgba(245,197,66,0) 70%),
    radial-gradient(1.2px 1.2px at 24px 38px, rgba(255,255,255,.55) 50%, transparent 52%) 0 0 / 260px 260px,
    radial-gradient(1px 1px at 132px 96px, rgba(255,233,166,.5) 50%, transparent 52%) 0 0 / 260px 260px,
    radial-gradient(1.4px 1.4px at 78px 170px, rgba(255,255,255,.4) 50%, transparent 52%) 0 0 / 260px 260px,
    radial-gradient(1px 1px at 208px 22px, rgba(255,255,255,.35) 50%, transparent 52%) 0 0 / 260px 260px,
    #060917;
}
/* Die neue Welt breitet sich von der Mitte aus: ein weicher Kreis in ihrer Grundfarbe wächst (nur transform),
   danach blendet ihr Muster ein. */
.umbau__reveal {
  position: absolute; left: 50%; top: 46%; width: 300vmax; height: 300vmax; margin: -150vmax 0 0 -150vmax; border-radius: 50%;
  transform: scale(0); will-change: transform; animation: umbau-reveal 2.2s cubic-bezier(.5,0,.2,1) 2.4s forwards;
}
.umbau--game .umbau__reveal { background: radial-gradient(circle closest-side, #0A1030 0%, #060917 86%, rgba(6,9,23,0) 100%); }
.umbau--classic .umbau__reveal { background: radial-gradient(circle closest-side, var(--cw-ground) 86%, transparent 100%); }
.umbau__bg--to { opacity: 0; animation: umbau-fade .9s ease 3.9s forwards; }

/* Bühne: Logo, Kacheln, Text */
.umbau__stage {
  position: relative; display: grid; justify-items: center; gap: clamp(18px, 3.4vh, 34px);
  width: min(860px, 100%);
}
.umbau__logos { position: relative; display: grid; place-items: center; height: 54px; width: 100%; }
.umbau__logo { position: absolute; display: block; height: auto; }
.umbau__logo--classic { width: 190px; }
.umbau__logo--game { width: 170px; filter: drop-shadow(0 6px 22px rgba(233,164,0,.4)); }
.umbau__logo--from { opacity: 0; animation: umbau-fade .8s ease .15s forwards, umbau-leave .7s ease 2.8s forwards; }
.umbau__logo--to { opacity: 0; transform: translateY(8px) scale(.96); animation: umbau-arrive 1.1s cubic-bezier(.2,.8,.2,1) 3.15s forwards; }

/* Das Brett: 4 × 3 Kacheln im Seitenverhältnis der Weltkarte */
.umbau__board {
  --gap: clamp(6px, 1.2vw, 12px);
  position: relative; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); gap: var(--gap);
  width: min(820px, 88vw, calc((100vh - 280px) * 1.777)); aspect-ratio: 1672 / 941; perspective: 1800px;
  opacity: 0; transform: translateY(14px) scale(.97); will-change: transform, opacity;
  animation: umbau-arrive 1.1s cubic-bezier(.2,.8,.2,1) .2s forwards;
}
.umbau--game .umbau__board { animation: umbau-arrive 1.1s cubic-bezier(.2,.8,.2,1) .2s forwards, umbau-zoom 2s cubic-bezier(.55,0,.15,1) 6.9s forwards; }
.umbau--classic .umbau__board { animation: umbau-arrive 1.1s cubic-bezier(.2,.8,.2,1) .2s forwards, umbau-zoom-in 1.9s cubic-bezier(.5,0,.2,1) 7s forwards; }
.umbau__tile {
  position: relative; z-index: 0; display: block; min-width: 0; transform-style: preserve-3d; will-change: transform;
  animation: umbau-flip var(--flip) var(--ease-flip) calc(var(--flip-start) + var(--wave) * var(--wave-step)) forwards;
}
.umbau__face {
  position: absolute; inset: 0; display: block; overflow: hidden; border-radius: clamp(6px, 1vw, 12px);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.umbau__back { transform: rotateY(180deg); }
/* Licht beim Umdrehen: eine Schattenschicht (nur opacity) statt eines teuren Filters. */
.umbau__face::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: #050816; opacity: 0; pointer-events: none; }
.umbau__front::after { animation: umbau-shade-in var(--flip) var(--ease-flip) calc(var(--flip-start) + var(--wave) * var(--wave-step)) forwards; }
.umbau__back::after { opacity: .45; animation: umbau-shade-out var(--flip) var(--ease-flip) calc(var(--flip-start) + var(--wave) * var(--wave-step)) forwards; }

/* Classic-Kachel wie in der App */
.umbau__face--classic {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; padding: clamp(7px, 1.1vw, 14px);
  background: var(--cw-paper); color: var(--cw-ink); box-shadow: 0 0 0 1px var(--cw-line), 0 10px 24px -14px var(--cw-shadow);
}
.umbau__num { font: 800 clamp(13px, 2.3vw, 26px)/1 'Manrope', system-ui, sans-serif; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.umbau__icon {
  width: clamp(12px, 1.9vw, 22px); height: clamp(12px, 1.9vw, 22px); background: var(--cw-ink-2);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.umbau__dots { grid-column: 1 / -1; grid-row: 3; display: flex; gap: 4px; }
.umbau__dots i { flex: 1; max-width: 22px; height: 3px; border-radius: 3px; background: var(--cw-line); }
.umbau__dots i.is-done { background: var(--cw-ink); }
/* In Classic angekommen: der mitgenommene Fortschritt füllt sich Schritt für Schritt. */
.umbau--classic .umbau__back .umbau__dots i.is-done {
  transform-origin: left; transform: scaleX(0);
  animation: umbau-dot .5s cubic-bezier(.2,.8,.2,1) calc(5.5s + var(--n) * .35s + var(--k) * .12s) forwards;
}

/* Game-Kachel: Ausschnitt der Weltkarte */
.umbau__face--game {
  background: #0A1230 url('../assets/world/quest-map.webp') 0 0 / 400% 300% no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255,214,110,.45), 0 14px 30px -14px rgba(0,0,0,.8);
}

/* Die ganze Karte als ein Bild: zum Game lösen sich die Fugen in sie auf, zu Classic zerfällt sie zuerst in Kacheln. */
.umbau__whole {
  position: absolute; inset: 0; z-index: 3; overflow: hidden; border-radius: 6px; opacity: 0; pointer-events: none;
  background: url('../assets/world/quest-map.webp') center / 100% 100% no-repeat;
  box-shadow: 0 0 0 1px rgba(255,214,110,.45), 0 0 0 6px rgba(255,214,110,.06), 0 40px 90px -30px rgba(0,0,0,.9), 0 0 120px rgba(245,197,66,.12);
}
.umbau--game .umbau__whole { animation: umbau-fade .9s ease 5.1s forwards; }
.umbau--classic .umbau__whole { opacity: 1; animation: umbau-unfade .7s ease .95s forwards; }
/* Ein Lichtstreif fährt einmal über die fertige Karte. */
.umbau__sheen {
  position: absolute; top: -10%; bottom: -10%; left: 0; width: 45%; opacity: 0; pointer-events: none;
  background: linear-gradient(105deg, rgba(255,255,255,0) 20%, rgba(255,244,214,.34) 50%, rgba(255,255,255,0) 80%);
  transform: translateX(-120%); will-change: transform;
}
.umbau--game .umbau__sheen { animation: umbau-sheen 1.5s cubic-bezier(.4,0,.2,1) 6s forwards; }

/* Text */
.umbau__text { display: grid; justify-items: center; gap: 12px; text-align: center; color: var(--cw-ink-2); }
.umbau--classic .umbau__text { color: rgba(246,242,230,.78); }
.umbau__title { position: relative; display: grid; margin: 0; font-size: clamp(22px, 3vw, 34px); line-height: 1.15; letter-spacing: -.015em; }
.umbau__title span { grid-area: 1 / 1; }
.umbau__title-from, .umbau__title-to { font-weight: 800; }
.umbau--game .umbau__title-from, .umbau--classic .umbau__title-to { font-family: 'Manrope', system-ui, sans-serif; color: var(--cw-ink); }
.umbau--game .umbau__title-to, .umbau--classic .umbau__title-from {
  font-family: 'Bricolage', 'Manrope', system-ui, sans-serif;
  background: linear-gradient(180deg, #FFF3C9 0%, #F8CF55 48%, #E2A72B 100%); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.umbau__title-from { opacity: 0; animation: umbau-fade .8s ease .35s forwards, umbau-leave .7s ease 2.8s forwards; }
.umbau__title-to { opacity: 0; animation: umbau-fade 1s ease 3.15s forwards; }
.umbau__bar { position: relative; display: block; width: min(260px, 64vw); height: 4px; border-radius: 4px; overflow: hidden; background: var(--cw-track); animation: umbau-bar-track 1s ease 2.9s forwards; }
.umbau--classic .umbau__bar { background: rgba(255,255,255,.16); animation-name: umbau-bar-track-classic; }
.umbau__bar span { position: absolute; inset: 0; border-radius: inherit; transform-origin: left; transform: scaleX(0); background: var(--cw-ink); animation: umbau-bar-fill 1s ease 2.9s forwards; }
.umbau--classic .umbau__bar span { background: #F5C542; animation-name: umbau-bar-fill-classic; }
.umbau__line { margin: 0; min-height: 1.5em; font-weight: 600; font-size: 15px; letter-spacing: .01em; color: inherit; }
.umbau__line.is-new { animation: umbau-line .6s ease both; }
/* Vor dem Zoom treten Logo und Schrift weich zurück. */
.umbau__logos { animation: umbau-step-back .7s ease 6.7s forwards; }
.umbau__text { animation: umbau-line-color 1s ease 2.9s forwards, umbau-step-back .7s ease 6.7s forwards; }
.umbau--classic .umbau__text { animation: umbau-line-color-classic 1s ease 2.9s forwards, umbau-step-back .7s ease 6.7s forwards; }

@keyframes umbau-fade { to { opacity: 1; } }
@keyframes umbau-unfade { from { opacity: 1; } to { opacity: 0; } }
@keyframes umbau-leave { to { opacity: 0; transform: translateY(-6px); } }
@keyframes umbau-arrive { to { opacity: 1; transform: none; } }
@keyframes umbau-reveal { to { transform: scale(1); } }
@keyframes umbau-flip {
  0% { transform: rotateY(0) translateZ(0); z-index: 2; }
  50% { transform: rotateY(90deg) translateZ(40px); z-index: 2; }
  99% { z-index: 2; }
  100% { transform: rotateY(180deg) translateZ(0); z-index: 0; }
}
@keyframes umbau-shade-in { 0% { opacity: 0; } 50% { opacity: .45; } 100% { opacity: .45; } }
@keyframes umbau-shade-out { 0% { opacity: .45; } 50% { opacity: .35; } 100% { opacity: 0; } }
@keyframes umbau-dot { to { transform: none; } }
@keyframes umbau-sheen { 0% { opacity: 1; transform: translateX(-120%); } 100% { opacity: 1; transform: translateX(260%); } }
@keyframes umbau-step-back { to { opacity: 0; transform: translateY(6px); } }
@keyframes umbau-zoom { to { transform: translate(var(--zoom-x, 0px), var(--zoom-y, 0px)) scale(var(--zoom-s, 1.6)); } }
@keyframes umbau-zoom-in { 0% { opacity: 1; } 55% { opacity: 1; } to { opacity: 0; transform: translate(var(--zoom-x, 0px), var(--zoom-y, 0px)) scale(var(--zoom-s, 1.55)); } }
@keyframes umbau-bar-track { to { background: rgba(255,255,255,.16); } }
@keyframes umbau-bar-track-classic { to { background: var(--cw-track); } }
@keyframes umbau-bar-fill { to { background: #F5C542; } }
@keyframes umbau-bar-fill-classic { to { background: var(--cw-ink); } }
@keyframes umbau-line-color { to { color: rgba(246,242,230,.78); } }
@keyframes umbau-line-color-classic { to { color: var(--cw-ink-2); } }
@keyframes umbau-line { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Hochformat: Brett und Text etwas enger. */
@media (max-width: 700px) {
  .umbau__logos { height: 44px; }
  .umbau__logo--classic { width: 150px; }
  .umbau__logo--game { width: 132px; }
  .umbau__dots { display: none; }
  .umbau__face--classic { grid-template-rows: 1fr auto; align-items: start; }
  .umbau__line { font-size: 14px; }
}

/* Reduzierte Bewegung: keine Drehung, nur eine ruhige Überblendung in die neue Welt (1,2 s). */
.umbau--calm .umbau__tile, .umbau--calm .umbau__face::after, .umbau--calm .umbau__sheen, .umbau--calm .umbau__reveal,
.umbau--calm .umbau__dots i { animation: none !important; }
.umbau--calm .umbau__reveal { display: none; }
.umbau--calm .umbau__dots i.is-done { transform: none; }
.umbau--calm .umbau__board { animation: none; opacity: 1; transform: none; }
.umbau--calm .umbau__whole { animation: none; opacity: 0; }
.umbau--calm .umbau__back { transform: none; opacity: 0; animation: umbau-fade .5s ease .2s forwards !important; }
.umbau--calm .umbau__bg--to, .umbau--calm .umbau__logo--to, .umbau--calm .umbau__title-to { animation: umbau-fade .5s ease .2s forwards; transform: none; }
.umbau--calm .umbau__logo--from, .umbau--calm .umbau__title-from { animation: none; opacity: 0; }
.umbau--calm .umbau__bar, .umbau--calm .umbau__bar span { animation-delay: 0s; animation-duration: .5s; }
.umbau--calm .umbau__logos, .umbau--calm .umbau__text { animation: none; }
.umbau--calm.umbau--game .umbau__text { color: rgba(246,242,230,.78); }

/* ---------- Ankommen nach dem Umbau ----------
   Die neue Seite beginnt mit dem letzten Bild der Sequenz und blendet es aus, sobald Karte bzw. Übersicht stehen. */
html.umbau-arrive::after { content: ''; position: fixed; inset: 0; z-index: 5000; pointer-events: none; opacity: 1; transition: opacity .9s cubic-bezier(.4,0,.2,1); }
html.umbau-arrive--game::after { background: #3B6A86 url('../assets/world/quest-map.webp') center / cover no-repeat; }
html.umbau-arrive--classic::after {
  background:
    linear-gradient(rgba(12,22,56,.035) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(12,22,56,.035) 1px, transparent 1px) 0 0 / 24px 24px,
    #F3F5F9;
}
html[data-theme='dark'].umbau-arrive--classic::after {
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 24px 24px,
    #0A1023;
}
html.umbau-arrive--out::after { opacity: 0; }
@media (prefers-reduced-motion: reduce) { html.umbau-arrive::after { transition-duration: .3s; } }

/* ---------- Truhe beim Wechsel zurück ins Game ---------- */
.mode-chest { position: fixed; inset: 0; z-index: 2500; display: grid; place-items: center; padding: 20px; background: rgba(4, 7, 20, .72); animation: umbau-in .3s ease both; opacity: 0; }
.mode-chest__box {
  position: relative; display: grid; gap: 12px; justify-items: center; width: min(460px, 100%); padding: 64px 26px 26px; border-radius: 22px; text-align: center;
  color: #FFF4D6; background: linear-gradient(180deg, #17204A, #0B1230); border: 1px solid #C8860F; box-shadow: 0 0 0 1px rgba(255, 214, 110, .25), 0 30px 80px rgba(0, 0, 0, .6);
  font-family: 'Atkinson', 'Manrope', system-ui, sans-serif;
}
.mode-chest__lid { position: absolute; top: -48px; display: grid; place-items: center; width: 96px; height: 96px; filter: drop-shadow(0 8px 24px rgba(233, 164, 0, .5)); animation: mode-chest-pop .7s cubic-bezier(.2, 1.4, .4, 1) .1s both; }
.mode-chest__lid img { width: 96px; height: 96px; }
.mode-chest__kicker { margin: 0; font: 700 13px/1.2 'Bricolage', 'Manrope', system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #FFD66E; }
.mode-chest h2 { margin: 0; font: 800 clamp(22px, 3vw, 28px)/1.15 'Bricolage', 'Manrope', system-ui, sans-serif; color: #fff; }
.mode-chest__list { list-style: none; margin: 6px 0 8px; padding: 0; display: grid; gap: 8px; width: 100%; text-align: left; }
.mode-chest__list li { display: grid; grid-template-columns: 40px auto 1fr; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.mode-chest__list img { width: 40px; height: 40px; object-fit: contain; }
.mode-chest__list b { font: 800 20px 'Bricolage', 'Manrope', system-ui, sans-serif; color: #FFD66E; }
.mode-chest__list span { font-size: 14.5px; line-height: 1.35; color: #E5E9F7; }
@keyframes mode-chest-pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mode-chest, .mode-chest__lid { animation: none; opacity: 1; } }

.mode-chest .btn { min-width: 180px; border: 0; border-radius: 12px; background: linear-gradient(180deg, #FFD66E, #E9A400); color: #2A1A00; font-weight: 800; box-shadow: 0 6px 20px rgba(233, 164, 0, .35); }
