/* ============================================================
   DopaSpeak Web-App: Doodle-Design ("Papier + Tinte")
   Handgezeichneter Look: Creme-Papier, Ink-Outlines (#1A1625),
   harte Offset-Schatten, leicht unregelmaessige Radien.
   Farben: Pink #E0407B (Marke/Maskottchen), Blau #2D9CDB,
   Gruen #58A700 (richtig), Rot #D64541 (falsch/Herzen),
   Gelb #F7B500 (Gold/Combo), Orange #E8752E (Streak). KEIN Lila.
   ============================================================ */

:root {
  --paper:     #FAF6EF;
  --paper-2:   #F2ECE0;
  --card:      #FFFFFF;
  --card-2:    #F5EFDC;
  --ink:       #1A1625;
  --ink-soft:  #4B4458;
  --ink-mute:  #8A8298;
  --ink-faint: #B8B0C2;
  --line:      #1A1625;

  --pink:      #E0407B;
  --pink-d:    #B92E62;
  --pink-soft: #F9DEE9;

  --ok:        #58A700;
  --ok-d:      #3E7B12;
  --ok-soft:   #E4F3D2;

  --danger:    #D64541;
  --danger-d:  #A93330;
  --danger-soft: #F9E0DF;

  --info:      #2D9CDB;
  --info-d:    #1F7BB0;
  --info-soft: #DCEFFA;

  --gold:      #F7B500;
  --gold-d:    #C58F00;
  --gold-soft: #FCEFC8;

  --new:       #E0407B;
  --streak:    #E8752E;

  --font-display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, sans-serif;
  --font-hand: 'Patrick Hand', 'Bricolage Grotesque', cursive;

  --r-wonk: 18px 22px 19px 23px / 22px 18px 23px 19px;   /* wacklige Ecken */
  --r-wonk2: 24px 19px 23px 18px / 19px 24px 18px 23px;
  --nav-w: 232px;
  --side-w: 340px;
  --shadow: 3px 4px 0 var(--ink);
  --shadow-sm: 2px 3px 0 var(--ink);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--paper);
  background-image:
    radial-gradient(rgba(26,22,37,.045) 1.2px, transparent 1.3px);
  background-size: 26px 26px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.45;
  overflow-x: hidden;
}
h1,h2,h3,h4 { font-family: var(--font-display); letter-spacing: -0.02em; margin: 0; color: var(--ink); }
button { font-family: inherit; }
a { color: var(--info-d); text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--pink-soft); }

/* ============ HANDGEZEICHNETE BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  letter-spacing: .05em; text-transform: uppercase;
  color: #fff; background: var(--pink);
  border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  padding: 12px 24px; cursor: pointer;
  box-shadow: var(--shadow);
  transform: translate(0,0);
  transition: transform .06s ease, box-shadow .06s ease, filter .12s ease, background .15s;
  user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active, .btn.is-pressed { transform: translate(3px,4px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled {
  background: var(--paper-2); color: var(--ink-faint);
  border-color: var(--ink-faint); box-shadow: 2px 3px 0 var(--ink-faint);
  cursor: default; filter: none; transform: none;
}
.btn-ok      { background: var(--ok); }
.btn-danger  { background: var(--danger); }
.btn-info    { background: var(--info); }
.btn-gold    { background: var(--gold); color: var(--ink); }
.btn-ghost   { background: var(--card); color: var(--ink-soft); }
.btn-plain   { background: transparent; color: var(--ink-mute); border: none; box-shadow: none; text-transform: none; letter-spacing: 0; font-family: var(--font-body); }
.btn-plain:active { transform: none; }

.icon { width: 1.25em; height: 1.25em; fill: currentColor; flex: 0 0 auto; }

/* ============ APP-SHELL ============ */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0,1fr) var(--side-w); min-height: 100vh; max-width: 1280px; margin: 0 auto; }

.side-nav {
  position: sticky; top: 0; height: 100vh;
  border-right: 2.5px solid var(--ink);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 6px;
  background: var(--paper);
}
.nav-logo {
  font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -0.03em;
  color: var(--ink); padding: 4px 12px 18px;
}
.logo-dot { color: var(--pink); }
.nav-items { display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  background: transparent;
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: .06em;
  color: var(--ink-soft); text-transform: uppercase;
  padding: 10px 12px; border-radius: var(--r-wonk);
  border: 2.5px solid transparent; cursor: pointer;
}
.nav-item .icon { width: 26px; height: 26px; }
.nav-item:hover { background: var(--paper-2); border-color: var(--ink-faint); }
.nav-item.active { color: var(--ink); border-color: var(--ink); background: var(--pink-soft); box-shadow: var(--shadow-sm); }
.nav-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.nav-emoji { font-size: 22px; line-height: 1; }
.nav-foot { margin-top: auto; font-size: 12.5px; color: var(--ink-mute); padding: 10px 12px; }
.nav-foot:hover { color: var(--ink-soft); }

.main { padding: 24px 28px 90px; min-height: 100vh; }
/* In the edge-to-edge app WebView, keep the top content (pair chip, stats) below the status bar. */
body.in-app .main { padding-top: max(24px, calc(14px + env(safe-area-inset-top)), 48px); }
.right-bar { padding: 24px 22px 40px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }

/* ============ STATUSZEILE ============ */
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 2px 2px; }
.stat { display: flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 800; font-size: 16px; cursor: default; color: var(--ink); }
.stat .icon { width: 26px; height: 26px; }
.stat-flag .icon { width: 30px; height: 24px; }
.stat-streak { color: var(--streak); }
.stat-streak.cold { color: var(--ink-faint); }
.stat-gems { color: var(--info-d); }
.stat-gems .icon { fill: var(--info); }
.stat-hearts { color: var(--danger); }
.stat-hearts.pulse .icon { animation: heartShake .5s ease; }
@keyframes heartShake {
  0%,100% { transform: scale(1) rotate(0); }
  25% { transform: scale(1.35) rotate(-8deg); }
  55% { transform: scale(.9) rotate(6deg); }
  80% { transform: scale(1.12) rotate(0); }
}

/* ============ KARTEN ============ */
.card {
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk2);
  padding: 18px; box-shadow: var(--shadow);
}
.card h3 { font-size: 17px; margin-bottom: 10px; }
.card-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.card-head-row a { white-space: nowrap; font-size: 11px; }
.card .hint { color: var(--ink-mute); font-size: 14px; }
.card-row { display: flex; gap: 14px; align-items: center; }
.card-lockico {
  width: 46px; height: 46px; border-radius: 14px; background: var(--paper-2);
  border: 2px solid var(--ink-faint);
  display: grid; place-items: center; flex: 0 0 auto; color: var(--ink-mute);
}
.card-lockico .icon { width: 24px; height: 24px; fill: var(--ink-mute); }
.mission { display: flex; align-items: center; gap: 12px; }
.mission-ico { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; }
.mission-ico .icon { width: 34px; height: 34px; fill: var(--gold); stroke: var(--ink); stroke-width: 1.2; }
.mission-body { flex: 1; min-width: 0; }
.mission-title { font-weight: 700; font-size: 15px; margin-bottom: 7px; }
.mission-chest { width: 40px; height: 40px; flex: 0 0 auto; }
.mission-chest .icon { width: 100%; height: 100%; fill: var(--gold-d); stroke: var(--ink); stroke-width: 1.2; }
.mission-chest.done .icon { fill: var(--gold); }
.mission-chest.claimable { cursor: pointer; animation: chestWiggle 1.2s ease infinite; }
@keyframes chestWiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-7deg) scale(1.06); } 40% { transform: rotate(6deg); } 60% { transform: rotate(0); } }

.meter { height: 18px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; position: relative; }
.meter-fill { height: 100%; background: var(--gold); border-right: 2px solid var(--ink); border-radius: 0 999px 999px 0; transition: width .5s cubic-bezier(.22,.9,.35,1.15); min-width: 0; }
.meter-fill[style*="width: 100"] , .meter-fill[style*="width:100"] { border-right: none; }
.meter-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--ink); }

.card .btn { width: 100%; margin-top: 10px; }

/* ============ STORAGE-GUARD-BANNER (Map) ============ */
.guard-banner {
  position: relative;
  background: var(--gold-soft);
  border-radius: var(--r-wonk);
  padding: 14px 40px 14px 16px;
  margin: 0 auto 18px;
  max-width: 560px;
}
.guard-banner h3 { font-family: var(--font-hand); font-size: 19px; letter-spacing: 0; margin-bottom: 4px; }
.guard-banner .hint { color: var(--ink-soft); font-size: 13.5px; }
.guard-banner .guard-copy-btn { width: auto; margin-top: 10px; padding: 8px 16px; font-size: 12.5px; }
.guard-close {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--card); color: var(--ink-soft);
  border: 2px solid var(--ink); border-radius: 10px 12px 11px 13px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  font-size: 13px; font-weight: 800; line-height: 1;
}
.guard-close:active { transform: translate(2px,3px); box-shadow: 0 0 0 var(--ink); }

/* ============ SPIELSTAND-TRANSFER (Mehr) ============ */
.transfer-row { display: flex; gap: 10px; }
.transfer-row .btn { flex: 1; }
.transfer-card .transfer-code {
  min-height: 84px; margin: 10px 0 0; font-size: 12.5px;
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all; background: var(--paper-2);
}
.transfer-label { display: block; margin-top: 16px; font-weight: 700; font-size: 14px; color: var(--ink-soft); }
.transfer-msg { margin-top: 10px; font-weight: 700; }
.transfer-msg-bad { color: var(--danger-d) !important; }
.aside-links { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; padding: 6px 4px; }
.aside-links a { color: var(--ink-mute); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.aside-links a:hover { color: var(--ink-soft); }

/* ============ SKILL-TREE ============ */
.section-head {
  position: sticky; top: 14px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  border-radius: var(--r-wonk2); padding: 10px 18px;
  background: var(--sec-soft, var(--pink-soft));
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow);
  margin-bottom: 26px;
}
.section-head .sh-island { width: 74px; flex: 0 0 auto; margin: -14px 0 -10px; }
.section-head .sh-island svg { width: 100%; height: auto; }
.section-head .sh-meta { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; color: var(--sec-color, var(--pink-d)); text-transform: uppercase; }
.section-head h2 { font-size: 20px; }
.section-head .sh-body { flex: 1; min-width: 0; }
.section-head .btn { background: var(--card); color: var(--ink); font-size: 12.5px; padding: 9px 14px; flex: 0 0 auto; width: auto; margin: 0; }

.tree { position: relative; padding: 6px 0 30px; }
.tree-section { position: relative; margin-bottom: 30px; }
.tree-nodes { position: relative; display: flex; flex-direction: column; align-items: center; gap: 26px; }

/* Insel-Header eines Abschnitts */
.island-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 30px 0 22px; }
.island-head .island { width: 190px; }
.island-head .island-title {
  font-family: var(--font-hand); font-size: 22px; color: var(--ink);
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  box-shadow: var(--shadow-sm); padding: 4px 18px; transform: rotate(-1.5deg);
}
.island { display: inline-block; }
.island svg { width: 100%; height: auto; display: block; }
.float-bob   { animation: floatBob 4.2s ease-in-out infinite; }
.float-bob-2 { animation: floatBob 5.1s ease-in-out .7s infinite; }
.float-bob-3 { animation: floatBob 4.7s ease-in-out 1.4s infinite; }
@keyframes floatBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Deko am Pfadrand */
.tree-deco { position: absolute; pointer-events: none; opacity: .95; }
.tree-deco svg { width: 100%; height: auto; }

.node-wrap { position: relative; }
.node-wrap.has-pop { z-index: 60; }
.node {
  width: 76px; height: 76px; border-radius: 50%;
  border: 2.5px solid var(--ink); cursor: pointer; position: relative;
  display: grid; place-items: center;
  background: var(--card);
  box-shadow: 3px 5px 0 var(--ink);
  transition: transform .06s ease, box-shadow .06s ease, filter .12s;
}
.node:active { transform: translate(2px,4px); box-shadow: 1px 1px 0 var(--ink); }
.node .icon { width: 34px; height: 34px; fill: var(--ink-faint); }
.node.locked { background: var(--paper-2); border-color: var(--ink-faint); box-shadow: 3px 5px 0 var(--ink-faint); }
.node.done { background: var(--sec-color, var(--pink)); }
.node.done .icon { fill: #fff; }
.node.gold { background: var(--gold); }
.node.gold .icon { fill: var(--ink); }
.node.active-node { background: var(--sec-color, var(--pink)); animation: nodeBreath 2.2s ease-in-out infinite; }
.node.active-node .icon { fill: #fff; }
@keyframes nodeBreath { 0%,100% { transform: scale(1); } 50% { transform: scale(1.055); } }
.node.chest-node { border-radius: 24px 27px 25px 26px / 26px 24px 27px 25px; }
.node.chest-node.claimable { background: var(--gold); animation: nodeBreath 1.6s ease-in-out infinite; }
.node.chest-node.claimable .icon { fill: var(--ink); }
.node.jump-node { background: var(--streak); }
.node.jump-node .icon { fill: #fff; }

.node-ring { position: absolute; inset: -12px; pointer-events: none; }
.node-ring circle { fill: none; stroke-width: 6.5; stroke-linecap: round; }
.node-ring .ring-bg { stroke: rgba(26,22,37,.15); }
.node-ring .ring-fg { stroke: var(--sec-color, var(--pink)); transition: stroke-dashoffset .6s cubic-bezier(.22,.9,.35,1.1); }

.node-say {
  position: absolute; bottom: calc(100% + 16px); left: 50%; transform: translateX(-50%);
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  color: var(--sec-color, var(--pink));
  font-family: var(--font-hand); font-weight: 400; font-size: 17px; letter-spacing: .04em;
  padding: 5px 14px; white-space: nowrap; z-index: 5; text-transform: uppercase;
  box-shadow: var(--shadow-sm);
  animation: sayBob 1.6s ease-in-out infinite;
}
.node-say::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: var(--ink);
}
@keyframes sayBob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-5px); } }

.node-pop {
  position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  width: 300px; z-index: 40;
  background: var(--sec-color, var(--pink)); border: 2.5px solid var(--ink); border-radius: var(--r-wonk2);
  padding: 16px; box-shadow: 4px 6px 0 var(--ink);
  animation: popIn .18s cubic-bezier(.2,1.4,.4,1);
}
.node-pop::before {
  content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 9px solid transparent; border-bottom-color: var(--ink);
}
.node-pop h4 { color: #fff; font-size: 17px; margin-bottom: 4px; }
.node-pop p { margin: 0 0 12px; color: rgba(255,255,255,.9); font-size: 13.5px; font-weight: 600; }
.node-pop .btn { width: 100%; background: var(--card); color: var(--ink); }
.node-pop.pop-locked { background: var(--card); }
.node-pop.pop-locked h4 { color: var(--ink-soft); }
.node-pop.pop-locked p { color: var(--ink-mute); }
@keyframes popIn { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

/* Maskottchen neben dem Pfad */
.tree-mascot { position: absolute; width: 116px; pointer-events: none; }
.tree-mascot svg { width: 100%; height: auto; }

/* Ho-La Idle-Animationen */
.hola-eyes { animation: eyesDrift 5.2s ease-in-out infinite; }
@keyframes eyesDrift {
  0%, 42%, 100% { transform: translate(0,0); }
  48%, 62% { transform: translate(2.5px,-1px); }
  70%, 86% { transform: translate(-2px,1px); }
}
.hola-lids rect { animation: blink 4.6s linear infinite; }
@keyframes blink { 0%, 94.5%, 100% { height: 0; } 96%, 98.5% { height: 20px; } }
.hola-body { animation: mascotBob 3.4s ease-in-out infinite; transform-origin: 60px 122px; }
@keyframes mascotBob { 0%,100% { transform: scale(1,1); } 50% { transform: scale(1.012,.988); } }
.hola-mouth { transform-origin: 60px 78px; animation: mouthTalk 3.4s ease-in-out infinite; }
@keyframes mouthTalk { 0%,100% { transform: scale(1,1); } 50% { transform: scale(.985,1.03); } }
.speak-char.happy .hola-mouth, .inter-mascot.happy .hola-mouth { transform: scale(1.04,1.08); animation: none; }
.byte-prop { animation: propSpin 1.1s ease-in-out infinite; transform-origin: 50px 6px; }
@keyframes propSpin { 0%,100% { transform: scaleX(1); } 50% { transform: scaleX(.25); } }
.byte-eye { animation: byteBlink 3.8s linear infinite; }
@keyframes byteBlink { 0%, 91%, 100% { opacity: 1; } 94%, 97% { opacity: .15; } }

/* ============ WELTEN-TEASER ============ */
.worlds { margin: 44px 0 10px; text-align: center; }
.worlds h3 { font-family: var(--font-hand); font-size: 24px; margin-bottom: 4px; }
.worlds .hint { color: var(--ink-mute); font-size: 13.5px; margin: 0 0 18px; }
.world-row { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; }
.world-card { width: 170px; position: relative; }
.world-card .island { width: 100%; filter: saturate(.35) opacity(.75); }
.world-card .world-label {
  font-family: var(--font-hand); font-size: 17px; color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); border-radius: var(--r-wonk);
  box-shadow: var(--shadow-sm); padding: 2px 12px; display: inline-block; margin-top: 2px;
}
.world-card .world-soon {
  position: absolute; top: 8px; right: 2px; transform: rotate(8deg);
  font-family: var(--font-hand); font-size: 13px; background: var(--gold);
  border: 2px solid var(--ink); border-radius: 8px; padding: 1px 8px;
}

/* ============ LEKTIONS-VOLLBILD ============ */
.lesson-layer { position: fixed; inset: 0; z-index: 100; background: var(--paper); display: flex; flex-direction: column; }
.lesson-layer::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(26,22,37,.045) 1.2px, transparent 1.3px);
  background-size: 26px 26px;
}
.lesson-top { display: flex; align-items: center; gap: 16px; padding: 22px clamp(16px, 5vw, 44px) 8px; max-width: 1020px; width: 100%; margin: 0 auto; position: relative; z-index: 2; }
/* Edge-to-edge WebView: keep the header (incl. the X quit button) clear of the status bar/notch.
   env() gives the exact inset; the 34px floor guards phones where the WebView reports 0. */
.lesson-top { padding-top: calc(22px + env(safe-area-inset-top)); }
body.in-app .lesson-top { padding-top: calc(22px + max(env(safe-area-inset-top), 34px)); }
.lesson-quit { background: none; border: none; cursor: pointer; padding: 6px; color: var(--ink-faint); }
.lesson-quit .icon { width: 20px; height: 20px; fill: none; }
.lesson-quit:hover { color: var(--ink-soft); }

.lbar { flex: 1; height: 20px; background: var(--card); border: 2.5px solid var(--ink); border-radius: 999px; overflow: hidden; position: relative; }
.lbar-fill {
  height: 100%; width: 0%; border-radius: 0 999px 999px 0;
  background: var(--ok); border-right: 2.5px solid var(--ink);
  transition: width .35s cubic-bezier(.25,.9,.3,1.2), background .5s ease;
  position: relative; min-width: 0;
}
.lbar-fill.golden { background: var(--gold); }
.lbar-fill::after { content: ""; position: absolute; top: 3px; left: 10px; right: 10px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.5); }

.lesson-hearts { display: flex; align-items: center; gap: 6px; color: var(--danger); font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.lesson-hearts .icon { width: 26px; height: 26px; fill: var(--danger); }
.lesson-hearts.pulse .icon { animation: heartShake .5s ease; }

.combo-tag {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 4px; z-index: 6; white-space: nowrap;
  font-family: var(--font-hand); font-size: 17px; letter-spacing: .08em;
  color: var(--ok-d); text-transform: uppercase;
  animation: comboPop .3s cubic-bezier(.2,1.6,.4,1);
}
.combo-tag.golden { color: var(--gold-d); }
@keyframes comboPop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

.lesson-stage { flex: 1; overflow-y: auto; width: 100%; display: flex; flex-direction: column; position: relative; z-index: 1; }
.challenge {
  width: 100%; max-width: 640px; margin: 0 auto; padding: 20px 20px 30px;
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  animation: chSlide .3s cubic-bezier(.25,.9,.35,1);
}
@keyframes chSlide { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }

.ch-tags { display: flex; gap: 14px; margin-bottom: 10px; min-height: 24px; }
.ch-tag {
  font-family: var(--font-hand); font-size: 16px; letter-spacing: .08em;
  text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px;
}
.ch-tag .icon { width: 17px; height: 17px; }
.tag-new { color: var(--new); }
.tag-mistake { color: var(--streak); }
.ch-title { font-size: clamp(22px, 3.4vw, 28px); margin-bottom: 22px; }
/* Doodle tag next to the instruction: word-for-word vs. natural sentence */
.mode-chip {
  font-family: var(--font-hand); font-size: 14px; letter-spacing: .04em;
  color: var(--ink-soft); background: var(--card);
  border: 2px solid var(--ink); border-radius: 999px; box-shadow: var(--shadow-sm);
  padding: 1px 11px; margin-left: 8px; display: inline-block;
  vertical-align: middle; white-space: nowrap; transform: rotate(-1.5deg);
}

/* Sprecher + Sprechblase */
.speak-row { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 26px; }
.speak-char { width: 96px; flex: 0 0 auto; }
.speak-char svg { width: 100%; height: auto; }
.bubble {
  position: relative; background: var(--card); border: 2.5px solid var(--ink);
  border-radius: var(--r-wonk2); padding: 12px 17px; font-size: 19px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 11px; min-height: 52px;
  box-shadow: var(--shadow-sm);
}
.bubble::before {
  content: ""; position: absolute; left: -10px; bottom: 16px;
  width: 16px; height: 16px; background: var(--card);
  border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: rotate(45deg); border-radius: 0 0 0 4px;
}
.bubble.b-empty { color: var(--ink-faint); min-width: 130px; }
.word-new {
  text-decoration: underline; text-decoration-color: var(--new);
  text-decoration-thickness: 2.5px; text-underline-offset: 4px; cursor: pointer; position: relative;
  text-decoration-style: wavy;
}
.word-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) rotate(-1deg);
  background: var(--gold-soft); border: 2px solid var(--ink); border-radius: 10px;
  font-family: var(--font-hand); font-size: 16px; color: var(--ink); padding: 4px 12px; white-space: nowrap; z-index: 10;
  animation: popIn .15s ease;
}

.audio-btn {
  color: #fff;
  width: 46px; height: 46px; border-radius: 13px 15px 14px 16px / 15px 13px 16px 14px;
  border: 2.5px solid var(--ink); cursor: pointer;
  background: var(--info); box-shadow: var(--shadow-sm);
  display: inline-grid; place-items: center; flex: 0 0 auto;
  transition: transform .05s, box-shadow .05s, filter .1s;
}
.audio-btn:hover { filter: brightness(1.08); }
.audio-btn:active { transform: translate(2px,3px); box-shadow: 0 0 0 var(--ink); }
.audio-btn .icon { width: 24px; height: 24px; fill: #fff; }
.audio-btn.small { width: 38px; height: 38px; }
.audio-btn.small .icon { width: 19px; height: 19px; }
.audio-btn.big { width: 96px; height: 96px; border-radius: 26px 29px 27px 30px / 28px 26px 30px 27px; }
.audio-btn.big .icon { width: 48px; height: 48px; }
.audio-btn.playing .spk-w1 { animation: wob 0.9s ease infinite; }
.audio-btn.playing .spk-w2 { animation: wob 0.9s ease .15s infinite; }
@keyframes wob { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* Auswahl-Optionen */
.opt-grid { display: grid; gap: 12px; }
.opt-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.opt {
  position: relative; background: var(--card); border: 2.5px solid var(--ink);
  border-radius: var(--r-wonk); box-shadow: var(--shadow-sm);
  color: var(--ink); font-size: 17px; font-weight: 600;
  padding: 14px 16px 14px 52px; text-align: left; cursor: pointer;
  transition: background .12s, transform .05s, box-shadow .05s;
}
.opt:hover { background: var(--paper-2); }
.opt:active { transform: translate(2px,3px); box-shadow: 0 0 0 var(--ink); }
.opt .opt-num {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--ink-faint);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: var(--ink-mute);
}
.opt.selected { border-color: var(--info-d); color: var(--info-d); background: var(--info-soft); }
.opt.selected .opt-num { border-color: var(--info-d); color: var(--info-d); }
.opt.reveal-ok { border-color: var(--ok-d); color: var(--ok-d); background: var(--ok-soft); }
.opt.reveal-ok .opt-num { border-color: var(--ok-d); color: var(--ok-d); }
.opt.reveal-bad { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.opt.reveal-bad .opt-num { border-color: var(--danger); color: var(--danger); }
.opt:disabled { cursor: default; }
.opt.dimmed { opacity: .45; }

.opt-card { padding: 18px 14px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.opt-card .opt-emoji { font-size: 52px; line-height: 1; }
.opt-card .opt-num { position: absolute; left: 10px; top: 10px; transform: none; }

/* Funken */
.spark { position: absolute; width: 8px; height: 8px; border-radius: 50% 40% 55% 45%; background: var(--gold); border: 1.5px solid var(--ink); pointer-events: none; animation: sparkFly .65s ease-out forwards; }
@keyframes sparkFly { from { opacity: 1; transform: translate(0,0) scale(1) rotate(0); } to { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(.3) rotate(120deg); } }

/* Wortbank */
.answer-zone {
  min-height: 62px; border-bottom: 2.5px dashed var(--ink-faint);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start;
  padding: 4px 0 10px; margin-bottom: 26px;
}
.wb-pool { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.wb-tile {
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  box-shadow: var(--shadow-sm);
  color: var(--ink); font-size: 17px; font-weight: 600;
  padding: 8px 15px; cursor: pointer;
  transition: transform .05s, background .12s, box-shadow .05s;
  animation: tileIn .2s cubic-bezier(.2,1.4,.4,1);
}
@keyframes tileIn { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wb-tile:hover { background: var(--gold-soft); }
.wb-tile:active { transform: translate(2px,3px); box-shadow: 0 0 0 var(--ink); }
.wb-tile.ghost { color: transparent; background: var(--paper-2); border-color: var(--ink-faint); border-style: dashed; box-shadow: none; cursor: default; pointer-events: none; }
.typed-input {
  width: 100%; min-height: 110px; resize: vertical;
  background: var(--card); color: var(--ink); border: 2.5px solid var(--ink); border-radius: var(--r-wonk2);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-body); font-size: 17px; padding: 14px; margin-bottom: 26px;
}
.typed-input:focus { outline: none; border-color: var(--info-d); }

.listen-center { display: flex; align-items: center; gap: 18px; justify-content: center; margin: 8px 0 30px; }
.listen-alt { display: flex; gap: 22px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.listen-alt button {
  background: none; border: none; cursor: pointer; color: var(--info-d);
  font-family: var(--font-hand); font-size: 17px; letter-spacing: .05em; text-transform: uppercase;
  display: inline-flex; gap: 7px; align-items: center; padding: 6px 4px;
}
.listen-alt button:hover { color: var(--info); }
.listen-alt .icon { width: 18px; height: 18px; fill: currentColor; }

/* Dialog */
.dialog-wrap { display: flex; flex-direction: column; gap: 18px; margin-bottom: 26px; }
.dialog-line { display: flex; align-items: flex-end; gap: 12px; }
.dialog-line.right { flex-direction: row-reverse; }
.dialog-line.right .bubble::before { left: auto; right: -10px; transform: rotate(-135deg); }
.dialog-line .speak-char { width: 74px; }

/* ============ FUSSLEISTE + BANNER ============ */
/* flex-shrink:0 so the foot (banner + buttons) is NEVER squeezed by the lesson's flex
   column; the scrollable stage absorbs the space instead. This keeps the banner visible
   and the Weiter button reachable. */
.lesson-foot { border-top: 2.5px solid var(--ink); position: relative; z-index: 5; background: var(--paper); flex-shrink: 0; }
.lesson-foot-inner {
  max-width: 1020px; margin: 0 auto; padding: 18px clamp(16px, 5vw, 44px);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 92px;
}
.foot-skip { color: var(--ink-mute); }
/* In the app the native bottom bar hides during a lesson (setLessonOpen bridge), so the
   lesson gets the full height. Keep the foot clear of the gesture bar via the safe area. */
body.in-app .lesson-foot-inner { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

/* Result banner: a plain block in normal flow, above the foot buttons (first child of the
   non-shrinking .lesson-foot). No fixed/absolute tricks, so it can't be mispositioned. If the
   solution is very long the banner scrolls internally, keeping the Weiter button below reachable. */
.banner { display: none; max-height: 60vh; overflow-y: auto; border-bottom: 2px solid var(--ink-faint); }
.banner.show { display: block; }
.banner-inner {
  max-width: 1020px; margin: 0 auto; padding: 16px clamp(16px, 5vw, 44px);
  display: flex; align-items: flex-start; gap: 16px;
}
.banner.ok  .banner-inner { background: var(--ok-soft); }
.banner.bad .banner-inner { background: var(--danger-soft); }
.banner.info .banner-inner { background: var(--gold-soft); }
.banner-ico {
  width: 56px; height: 56px; border-radius: 50%; background: var(--card);
  border: 2.5px solid var(--ink);
  display: grid; place-items: center; flex: 0 0 auto;
}
.banner-ico .icon { fill: none; width: 30px; height: 30px; }
.banner.ok  .banner-ico { color: var(--ok-d); }
.banner.bad .banner-ico { color: var(--danger); }
.banner.info .banner-ico { color: var(--streak); }
.banner-body { flex: 1; min-width: 0; }
.banner-title { font-family: var(--font-display); font-weight: 800; font-size: 21px; }
.banner.ok  .banner-title { color: var(--ok-d); }
.banner.bad .banner-title { color: var(--danger); }
.banner.info .banner-title { color: var(--streak); }
.banner-sub { font-size: 15px; font-weight: 600; margin-top: 3px; color: var(--ink-soft); }
/* Word-by-word decode of the solution sentence (Birkenbihl line) */
.banner-decode { font-family: var(--font-hand); font-size: 14.5px; letter-spacing: .02em; line-height: 1.25; margin-top: 4px; color: var(--ink-soft); }
.banner-foot-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.banner-report { background: none; border: none; cursor: pointer; font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-mute); }
.banner-continue { margin-left: auto; padding: 13px 28px; font-size: 16px; }
/* Your-sentence / solution rows each carry an inline listen button on the right. */
.banner-yours, .banner-solution { display: flex; align-items: center; gap: 8px; }
.banner-yours > span, .banner-solution > span { flex: 1 1 auto; min-width: 0; }
.banner-yours .banner-say, .banner-solution .banner-say { flex: 0 0 auto; }
.banner-yours { color: var(--danger); }
/* Speak-for-bonus mic button (app-only) */
.banner-speak { font-size: 14px; padding: 8px 14px; }
.banner-speak.listening { animation: pron-pulse .9s ease-in-out infinite; }
.banner-speak.pron-done { opacity: .6; }
@keyframes pron-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
/* Quick pop when a word tile is tapped and spoken, so the sound feedback is felt. */
.wb-tile.playing { animation: pron-pulse .45s ease; }
/* The solution sentence is the key info: make it clearly readable, not tiny. */
.banner-solution > span { font-size: 18px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.banner-yours > span { font-size: 15.5px; }

/* ============ INTERSTITIALS & KASKADE ============ */
.inter {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 30px 24px; max-width: 560px; margin: 0 auto; width: 100%;
  animation: chSlide .3s cubic-bezier(.25,.9,.35,1);
}
.inter .speak-char, .inter .inter-mascot { width: 150px; margin-bottom: 8px; }
.inter .inter-mascot svg { width: 100%; height: auto; }
.inter .bubble { margin-bottom: 22px; }
.inter h2 { font-size: clamp(24px, 4vw, 32px); margin: 14px 0 8px; }
.inter h2.gold-title { color: var(--gold-d); }
.inter p { color: var(--ink-soft); font-size: 16px; margin: 0 0 10px; max-width: 420px; }

.result-cards { display: flex; gap: 14px; margin: 22px 0 8px; }
.result-card { border: 2.5px solid var(--ink); border-radius: var(--r-wonk); box-shadow: var(--shadow-sm); min-width: 130px; overflow: hidden; font-family: var(--font-display); background: var(--card); }
.result-card .rc-label { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); padding: 5px 8px 6px; border-bottom: 2px solid var(--ink); }
.result-card .rc-value { padding: 14px 10px; font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; }
.result-card .rc-value .icon { width: 24px; height: 24px; }
.rc-gold .rc-label { background: var(--gold); } .rc-gold .rc-value { color: var(--gold-d); } .rc-gold .icon { fill: var(--gold); }
.rc-green .rc-label { background: var(--ok-soft); } .rc-green .rc-value { color: var(--ok-d); } .rc-green .icon { fill: var(--ok); }
.rc-blue .rc-label { background: var(--info-soft); } .rc-blue .rc-value { color: var(--info-d); } .rc-blue .icon { fill: var(--info); }
.rc-orange .rc-label { background: #FBE4D4; } .rc-orange .rc-value { color: var(--streak); } .rc-orange .icon { fill: var(--streak); }

/* Streak-Wochenansicht */
.week-row { display: flex; gap: 10px; margin: 20px 0 6px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800; color: var(--ink-mute); }
.week-day .wd-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--paper-2); border: 2px solid var(--ink-faint); display: grid; place-items: center; }
.week-day.hit .wd-dot { background: var(--streak); border-color: var(--ink); color: #fff; }
.week-day.hit .wd-dot .icon { width: 18px; height: 18px; fill: none; }
.week-day.today { color: var(--streak); }
.streak-big { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 56px; color: var(--streak); }
.streak-big .icon { width: 52px; height: 52px; fill: var(--streak); }

.hearts-empty-row { display: flex; gap: 8px; margin: 18px 0; }
.hearts-empty-row .icon { width: 40px; height: 40px; fill: var(--ink-faint); }
.hearts-empty-row .icon.alive { fill: var(--danger); }

/* ============ STUB-SEITEN ============ */
.page { max-width: 620px; margin: 0 auto; animation: chSlide .25s ease; }
.page-head { text-align: center; padding: 20px 0 26px; }
.page-head .icon { width: 64px; height: 64px; }
.page-head h1 { font-size: 28px; margin-top: 12px; }
.page-head p { color: var(--ink-mute); max-width: 440px; margin: 8px auto 0; }
.list-card { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.list-card .lc-ico { width: 52px; height: 52px; border-radius: 14px; border: 2px solid var(--ink); display: grid; place-items: center; flex: 0 0 auto; }
.list-card .lc-ico .icon { width: 30px; height: 30px; }
.list-card .lc-body { flex: 1; min-width: 0; }
.list-card .lc-title { font-weight: 700; }
.list-card .lc-sub { color: var(--ink-mute); font-size: 13.5px; }
.list-card .btn { width: auto; margin: 0; padding: 10px 16px; font-size: 13px; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pstat { display: flex; gap: 12px; align-items: center; }
.pstat .icon { width: 30px; height: 30px; }
.pstat b { font-family: var(--font-display); font-size: 20px; display: block; }
.pstat span { color: var(--ink-mute); font-size: 13px; }
.json-area { width: 100%; min-height: 140px; background: var(--paper-2); color: var(--ink-soft); border: 2px solid var(--ink); border-radius: 12px; font-family: ui-monospace, monospace; font-size: 12.5px; padding: 12px; }

/* ============ TOASTS & FX ============ */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  padding: 12px 20px; font-weight: 700; box-shadow: var(--shadow); color: var(--ink);
  display: flex; gap: 10px; align-items: center;
  animation: toastIn .25s cubic-bezier(.2,1.4,.4,1);
}
.toast .icon { width: 22px; height: 22px; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px) scale(.9); } }

.fx-canvas { position: fixed; inset: 0; z-index: 250; pointer-events: none; }
.gem-fly { position: fixed; z-index: 260; width: 26px; height: 26px; pointer-events: none; }
.gem-fly .icon { width: 100%; height: 100%; fill: var(--info); }
.xp-float { position: absolute; font-family: var(--font-hand); color: var(--gold-d); animation: xpFloat 1s ease-out forwards; pointer-events: none; z-index: 20; font-size: 20px; }
@keyframes xpFloat { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-44px); } }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 84px minmax(0,1fr) 300px; }
  .nav-item > span:not(.nav-ico), .nav-logo, .nav-foot { display: none; }
  .side-nav { padding: 22px 10px; align-items: center; }
  .nav-item { padding: 12px; }
  :root { --side-w: 300px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side-nav {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 90;
    flex-direction: row; border-right: none; border-top: 2.5px solid var(--ink);
    background: var(--paper); padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .nav-items { flex-direction: row; gap: 4px; margin: 0 auto; }
  .nav-item { padding: 9px 11px; flex: 0 0 auto; }
  .right-bar { position: static; height: auto; order: -1; padding: 14px 16px 0; }
  .right-bar .card:not(.card-missions) { display: none; }
  .right-bar .aside-links { display: none; }
  .main { padding: 14px 14px 120px; }
  .opt-grid.cols-3 { grid-template-columns: 1fr; }
  .opt-card { flex-direction: row; gap: 14px; padding: 12px 14px 12px 52px; }
  .opt-card .opt-emoji { font-size: 34px; }
  .opt-card .opt-num { left: 14px; top: 50%; transform: translateY(-50%); }
  .result-cards { flex-wrap: wrap; justify-content: center; }
  .speak-char { width: 72px; }
  .section-head .sh-island { width: 56px; }
  .world-card { width: 130px; }
  .tree-deco, .tree-mascot { display: none; }
}

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

/* ============================================================
   v3: Real Birkenbihl content (engine port)
   Pair selector, decode curtain, hinted bank chips, decode match
   ============================================================ */

/* -- Language pair selector -- */
.pair-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.pair-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-mute); }
.pair-select {
  font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--ink);
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 12px;
  padding: 8px 10px; cursor: pointer; box-shadow: var(--shadow-sm);
}
.pair-select:focus { outline: none; border-color: var(--info-d); }

/* -- Sidebar pair stat -- */
.stat-pair { font-size: 14px; letter-spacing: .04em; }
.stat-pair .pair-count { font-size: 12px; color: var(--ink-mute); margin-left: 5px; }

/* -- Resume card -- */
.resume-card { margin: 14px auto 0; max-width: 560px; }
.resume-card .btn { margin-top: 8px; }

/* -- Birkenbihl curtain: POS-colored words, blurred decode underneath -- */
.curtain { display: inline-flex; flex-wrap: wrap; gap: 2px 6px; align-items: flex-start; }
.ct-tok { display: inline-flex; flex-direction: column; align-items: center; }
.ct-word { font-weight: 700; }
.ct-punct { align-self: flex-start; }
.ct-decode {
  border: none; background: none; padding: 0 2px; margin-top: 1px; cursor: pointer;
  font-family: var(--font-body); font-size: .72em; font-weight: 600; color: var(--ink-mute);
  line-height: 1.2;
}
.ct-decode span { display: inline-block; filter: blur(4.5px); transition: filter .25s ease; }
.ct-decode:hover span { filter: blur(3px); }
.ct-decode.revealed span { filter: none; }
.ct-decode.revealed { cursor: default; }

/* -- Word-bank chips with curtain hint (TO_TARGET) -- */
.wb-tile.tile-hinted { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; }
.wb-tile .tile-word { font-weight: 700; }
.wb-tile .tile-decode {
  font-size: .68em; font-weight: 600; color: var(--ink-mute); line-height: 1.15;
  filter: blur(4px); transition: filter .25s ease; cursor: pointer; padding: 0 2px;
}
.wb-tile .tile-decode.revealed { filter: none; cursor: default; }
.wb-tile.ghost .tile-word, .wb-tile.ghost .tile-decode { visibility: hidden; }

/* -- Decode match (surface -> decode pairs) -- */
.dm-hint { color: var(--ink-mute); font-size: 14px; margin: 0 0 16px; }
.dm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; max-width: 560px; }
.dm-col { display: flex; flex-direction: column; gap: 10px; }
.dm-tile {
  position: relative;
  font-family: var(--font-body); font-weight: 700; font-size: 16px; color: var(--ink);
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  padding: 12px 14px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .06s ease, box-shadow .06s ease, background .15s, border-color .15s;
}
.dm-tile:active { transform: translate(2px,3px); box-shadow: 0 0 0 var(--ink); }
.dm-tile.dm-selected { border-color: var(--info-d); color: var(--info-d); background: var(--info-soft); }
.dm-tile.paired { border-color: var(--dm-color, var(--ink)); color: var(--dm-color, var(--ink)); }
.dm-tile.paired::after {
  content: attr(data-dm-n);
  position: absolute; top: -9px; right: -9px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--dm-color, var(--ink)); color: #fff;
  font-size: 12px; font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--ink);
}
.dm-tile.dm-ok { border-color: var(--ok-d); color: var(--ok-d); background: var(--ok-soft); }
.dm-tile.dm-bad { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* -- Dialog options with speaker button -- */
.opt-col { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }
.dlg-opt { display: flex; gap: 10px; align-items: center; }
.dlg-opt .opt { flex: 1; }

/* -- Solution speaker in error banner -- */
.banner-say { vertical-align: middle; margin-left: 6px; }
.prompt-word { font-weight: 800; }

/* ============================================================
   v4: Insel-Map (Port der Android GameMapView, M8 v3)
   Welt-Schichten pro CEFR-Level, Zickzack-Pfad, Bitmap-Puppen.
   Farben: Wiese-Gruen, Strand-Sand, Berg-Blau. KEIN Lila.
   ============================================================ */

/* -- Compact world/country header -- */
.world-head {
  position: sticky; top: 10px; z-index: 30;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk2);
  box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 18px;
}
.pair-chip {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--paper-2); border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  box-shadow: var(--shadow-sm); padding: 7px 12px; cursor: pointer;
  font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--ink);
  transition: transform .06s ease, box-shadow .06s ease, filter .12s;
}
.pair-chip:hover { filter: brightness(1.04); }
.pair-chip:active { transform: translate(2px,3px); box-shadow: 0 0 0 var(--ink); }
.pc-flags { font-size: 19px; line-height: 1; }
.pc-caret { color: var(--ink-mute); font-size: 13px; }
.wh-progress { flex: 1; min-width: 130px; display: flex; align-items: center; gap: 9px; }
.wh-count { font-family: var(--font-hand); font-size: 16px; color: var(--ink-soft); white-space: nowrap; }
.wh-meter { flex: 1; height: 14px; }
.wh-trophy { font-size: 20px; }
.pair-panel {
  flex-basis: 100%; display: flex; gap: 14px; flex-wrap: wrap;
  border-top: 2px dashed var(--ink-faint); padding-top: 10px; margin-top: 2px;
}

/* -- Map + island world layers -- */
.map { position: relative; padding: 4px 0 26px; }
.m-island { position: relative; border-radius: 28px; padding: 4px 0 16px; margin-bottom: 26px; }
.mi-head { display: flex; flex-direction: column; align-items: center; padding: 16px 0 8px; }
.mi-island { width: 180px; }
.mi-island svg { width: 100%; height: auto; display: block; }
.mi-card {
  display: flex; align-items: center; gap: 10px;
  border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  box-shadow: var(--shadow-sm); padding: 6px 16px;
  transform: rotate(-1.2deg); margin-top: -10px; position: relative; z-index: 2;
}
.mi-emoji { font-size: 24px; line-height: 1; }
.mi-title { font-family: var(--font-display); font-weight: 800; font-size: 17px; color: var(--ink); }
.mi-sub { font-family: var(--font-hand); font-size: 14px; color: var(--ink-soft); }
.mi-trophy { font-size: 22px; }

/* -- Station rows on the winding path -- */
.mrow { position: relative; height: 118px; }
.mi-head + .mrow { margin-top: 30px; }  /* room for the Anfangen bubble under the island card */
.mrow-trophy { height: 100px; }
.mrow-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.mrow-deco {
  position: absolute; font-size: 20px; opacity: .85; pointer-events: none;
  animation: floatBob 5.2s ease-in-out infinite;
}
.mnode-wrap {
  position: absolute; top: 50%; transform: translate(-50%,-50%);
  display: flex; flex-direction: column; align-items: center;
  max-width: 172px; z-index: 2;
}
.mnode-wrap.is-current { z-index: 8; }
.mnode-box { position: relative; display: grid; place-items: center; }
.mnode-box.has-pop { z-index: 70; }
.mnode-ring { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); pointer-events: none; z-index: 1; }
.mnode-label {
  font-family: var(--font-hand); font-size: 12.5px; line-height: 1.15; color: var(--ink-soft);
  text-align: center; max-width: 122px; margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* -- Station nodes -- */
.mnode { position: relative; z-index: 2; cursor: pointer; transition: transform .06s ease, box-shadow .06s ease, filter .12s; }
.mnode:hover { filter: brightness(1.05); }
/* Current station invites the tap (the old "Anfangen" button was removed because
   people tapped it instead of the station). Bounce + soft pink glow draws the eye. */
.mnode.current { animation: nodeInvite 1.7s ease-in-out infinite; }
@keyframes nodeInvite {
  0%, 100% { transform: scale(1) translateY(0); filter: drop-shadow(0 2px 0 rgba(224,64,123,0)); }
  50% { transform: scale(1.07) translateY(-5px); filter: drop-shadow(0 7px 11px rgba(224,64,123,.4)); }
}

/* Bitmap puppet in a wonky ink frame */
.mnode-img {
  width: 78px; height: 78px; padding: 2px;
  border: 2.5px solid var(--ink);
  border-radius: 38% 42% 40% 44% / 42% 38% 44% 40%;
  background: var(--card); box-shadow: 3px 5px 0 var(--ink);
  display: grid; place-items: center; overflow: hidden;
}
.mnode-img:active { transform: translate(2px,4px); box-shadow: 1px 1px 0 var(--ink); }
.mnode-img img { width: 100%; height: 100%; max-width: 72px; max-height: 72px; object-fit: contain; display: block; }

/* Hand-drawn tag: puppet name + bubble line (Patrick Hand) */
.mnode-tag {
  font-family: var(--font-hand);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: var(--r-wonk);
  box-shadow: var(--shadow-sm); padding: 7px 13px; max-width: 158px;
  transform: rotate(-1.2deg);
}
.mrow:nth-child(even) .mnode-tag { transform: rotate(1.1deg); }
.mnode-tag:active { transform: translate(2px,3px); box-shadow: 0 0 0 var(--ink); }
.ptag-name { font-size: 17px; line-height: 1.1; color: var(--ink); }
.ptag-bubble { font-size: 12.5px; line-height: 1.15; color: var(--ink-mute); max-width: 132px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Fallback node without puppet data */
.mnode-plain {
  width: 76px; height: 76px;
  border: 2.5px solid var(--ink);
  border-radius: 38% 42% 40% 44% / 42% 38% 44% 40%;
  background: var(--card); box-shadow: 3px 5px 0 var(--ink);
  display: grid; place-items: center;
}
.mnode-plain:active { transform: translate(2px,4px); box-shadow: 1px 1px 0 var(--ink); }
.mnode-plain .icon { width: 32px; height: 32px; fill: var(--ink-faint); }

/* Done: green tint + checkmark badge */
.mnode.done { background: var(--ok-soft); border-color: var(--ok-d); }
.mnode-check {
  position: absolute; top: -8px; right: -8px; z-index: 3;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--ink); color: #fff;
  display: grid; place-items: center;
}
.mnode-check .icon { width: 13px; height: 13px; fill: none; }
.mnode-part {
  position: absolute; top: -10px; right: -10px; z-index: 3;
  font-family: var(--font-hand); font-size: 11.5px; line-height: 1; color: var(--ink);
  background: var(--gold-soft); border: 2px solid var(--ink); border-radius: 9px;
  padding: 2px 6px;
}

/* Walking puppet at the current station + Anfangen bubble (node-say reused) */
.m-puppet { position: absolute; bottom: 2px; width: 58px; pointer-events: none; z-index: 5; animation: puppetHop 1.5s ease-in-out infinite; }
.m-puppet.at-left { right: calc(100% + 8px); }
.m-puppet.at-right { left: calc(100% + 8px); }
.m-puppet img { width: 100%; display: block; filter: drop-shadow(1.5px 2.5px 0 rgba(26,22,37,.3)); }
.m-puppet svg { width: 100%; height: auto; display: block; }
@keyframes puppetHop {
  0%, 100% { transform: translateY(0) rotate(0); }
  28% { transform: translateY(-8px) rotate(-3deg); }
  56% { transform: translateY(0) rotate(0); }
  78% { transform: translateY(-4px) rotate(2deg); }
}

/* -- Island trophy -- */
.m-trophy {
  width: 64px; height: 64px; font-size: 28px;
  border: 2.5px solid rgba(26,22,37,.5); border-radius: 40% 42% 44% 38% / 42% 40% 38% 44%;
  background: var(--card); box-shadow: 3px 4px 0 rgba(26,22,37,.3);
  display: grid; place-items: center;
  filter: grayscale(.4) opacity(.75);
}
.m-trophy.gold { background: var(--gold); border-color: var(--ink); box-shadow: var(--shadow); filter: none; }

/* -- Mobile (bottom nav is fixed; .main already keeps 120px bottom padding) -- */
@media (max-width: 860px) {
  .world-head { top: 6px; padding: 8px 12px; gap: 10px; }
  .mi-island { width: 140px; }
  .mrow { height: 112px; }
  .mnode-img { width: 70px; height: 70px; }
  .mnode-plain { width: 68px; height: 68px; }
  .mnode-tag { max-width: 132px; padding: 6px 10px; }
  .ptag-name { font-size: 15.5px; }
  .ptag-bubble { max-width: 108px; }
  .mnode-label { max-width: 100px; font-size: 12px; }
  .m-puppet { width: 48px; }
  .map .tree-deco { display: none; }
}
@media (max-width: 420px) {
  .pc-names { font-size: 13px; }
  .wh-progress { min-width: 110px; }
}

/* ---- M8 v5: Welt-Kulisse (Vollbild hinter der Map) + Nebel + Geheimtuer ---- */
.world-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.wbg-sky { position: absolute; inset: 0; }
.wbg-hills { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 62%; }
.wbg-scrim { position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(250,246,239,.22), rgba(250,246,239,.55)); }
.map.has-worldbg { position: relative; z-index: 1; background: transparent; }
.m-island { background: transparent !important; }
/* Nebel-Knoten: angedeutet, verwischt, nicht antippbar */
.mnode-fog { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%;
  background: rgba(26,22,37,.12); font-size: 26px; opacity: .8; filter: blur(.3px); }
.mrow-fog .mnode-label { display: none; }
/* Geheimtuer zum Nacht-Viertel (verschlossen) */
.mnode-secret { position: relative; display: grid; place-items: center; width: 64px; height: 64px;
  border-radius: 30% 26% 28% 31% / 27% 30% 29% 26%; background: #1B3358; border: 3px solid var(--ink);
  font-size: 26px; cursor: pointer; box-shadow: 3px 3px 0 rgba(26,22,37,.25); }
.mnode-secret .ms-lock { position: absolute; top: -6px; right: -7px; font-size: 15px; }
.mrow-secret .mnode-label { font-family: var(--font-hand); font-size: 13px; color: var(--ink-soft); }

/* Generische Insel + Zielflagge (Sprachen ohne gezeichnete Insel, statt falscher UK-Insel) */
.mi-island-generic { position: relative; display: inline-block; font-size: 92px; line-height: 1; }
.mi-gflag { position: absolute; top: 2px; right: 4px; font-size: 34px; }
