/* Spielerischer Lernpfad nach dem Coddy- und Duolingo-Prinzip */
.learning-path-page { min-height: 100vh; background: var(--cream); }

.quest-layout {
  --quest-unit: 58px;
  display: grid;
  grid-template-columns: minmax(0, 600px) 330px;
  justify-content: center;
  align-items: start;
  gap: 56px;
  padding: 34px 0 120px;
}
.quest-column { min-width: 0; }

/* Levelwahl */
.quest-level-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 30px; }
.quest-level-switch button { min-height: 50px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--line); border-radius: 16px; color: var(--muted); background: var(--paper); font-size: 1.1rem; font-weight: 900; box-shadow: 0 4px 0 var(--line); transition: transform .12s ease, color .12s ease; }
.quest-level-switch button small { font-size: .74rem; }
.quest-level-switch button:hover { color: var(--blue); }
.quest-level-switch button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.quest-level-switch button.active { border-color: var(--blue); color: white; background: var(--blue); box-shadow: 0 4px 0 var(--blue-deep); }

/* Mitlaufendes Kapitel-Banner */
.quest-banner { position: sticky; top: 86px; z-index: 30; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; border-radius: 20px; padding: 14px 16px 14px 12px; color: white; background: var(--blue); box-shadow: 0 5px 0 var(--blue-deep), 0 16px 30px rgba(23,50,143,.18); }
.quest-banner::before { content: ""; position: absolute; right: -24px; bottom: 100%; left: -24px; height: 26px; background: var(--cream); }
.quest-banner-back { width: 38px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; color: white; font-size: 1.7rem; line-height: 1; text-decoration: none; }
.quest-banner-back:hover, .quest-banner-back:focus-visible { background: rgba(255,255,255,.14); }
.quest-banner small { display: block; color: rgba(255,255,255,.78); font-size: .78rem; font-weight: 900; letter-spacing: .02em; }
.quest-banner strong { display: block; overflow: hidden; font-size: 1.22rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.quest-banner-jump { min-height: 40px; border: 0; border-radius: 12px; padding: 0 14px; color: var(--ink); background: var(--yellow); font-size: .78rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 3px 0 #c58c00; }
.quest-banner-jump:active { transform: translateY(2px); box-shadow: 0 1px 0 #c58c00; }

/* Kapitel */
.quest-chapter { padding-top: 54px; }
.quest-divider { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 1.05rem; font-weight: 900; text-align: center; }
.quest-divider::before, .quest-divider::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.quest-divider span { max-width: 70%; }
.quest-chapter-sub { margin: 4px 0 0; color: var(--muted); font-size: .86rem; font-weight: 700; text-align: center; }
.quest-chapter.is-current .quest-divider { color: var(--blue); }

.quest-track { position: relative; min-height: 300px; display: flex; flex-direction: column; justify-content: center; padding: 34px 0 6px; }
.quest-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.quest-lines path { fill: none; stroke-linecap: round; stroke-width: 7; }
.quest-lines path.is-reached { stroke: var(--teal); }
.quest-lines path.is-open { stroke: #d9d0c3; stroke-dasharray: 2 14; }
.quest-stations { position: relative; z-index: 1; display: grid; justify-items: center; gap: 30px; margin: 0; padding: 0; list-style: none; }

/* Sechseck-Stationen mit 3D-Kante */
.quest-station { position: relative; transform: translateX(calc(var(--x) * var(--quest-unit))); }
.quest-station.is-open { z-index: 5; }
.quest-node { --face: #e9e3da; --edge: #cfc6b9; --glyph: #a69b8c; position: relative; width: 78px; height: 82px; display: block; border: 0; padding: 0; background: none; -webkit-tap-highlight-color: transparent; }
.quest-hex-base, .quest-hex-top { position: absolute; left: 0; width: 78px; height: 74px; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
.quest-hex-base { top: 8px; background: var(--edge); }
.quest-hex-top { top: 0; display: grid; place-items: center; color: var(--glyph); background: var(--face); transition: transform .1s ease; }
.quest-hex-top svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.quest-node:hover .quest-hex-top { filter: brightness(1.04); }
.quest-node:active .quest-hex-top, .quest-node[aria-expanded="true"] .quest-hex-top { transform: translateY(5px); }
.quest-node:focus-visible { outline: 3px solid var(--blue); outline-offset: 6px; border-radius: 18px; }

.quest-station.is-complete .quest-node { --face: var(--teal); --edge: #1b988d; --glyph: white; }
.quest-station.is-current .quest-node { --face: var(--blue); --edge: var(--blue-deep); --glyph: white; }
.quest-station.is-test.is-upcoming .quest-node, .quest-station.is-test.is-available .quest-node { --face: #ffe7a6; --edge: #e5c160; --glyph: #b58500; }
/* Zusatzstationen (Variante C): Latihan, Bonus-Quiz und Mini Games */
.quest-station.is-latihan.is-upcoming .quest-node, .quest-station.is-latihan.is-available .quest-node { --face: #ece7f8; --edge: #cfc5ea; --glyph: #8b7cc0; }
.quest-station.is-quiz.is-upcoming .quest-node, .quest-station.is-quiz.is-available .quest-node { --face: #d9ccff; --edge: #b9a2ff; --glyph: #6b4fd1; }
.quest-station.is-game.is-upcoming .quest-node, .quest-station.is-game.is-available .quest-node { --face: #ffd3c6; --edge: #ff9e85; --glyph: #c24a2c; }
/* Offen, aber nicht gesperrt: Bonus oder Test vor der aktuellen Station, oder ein übersprungener Schritt. */
.quest-station.is-available:not(.is-latihan):not(.is-quiz):not(.is-game):not(.is-hoeren):not(.is-test) .quest-node { --face: #dce5ff; --edge: #b4c4f2; --glyph: var(--blue); }
.quest-station.is-hoeren.is-upcoming .quest-node, .quest-station.is-hoeren.is-available .quest-node { --face: #ffd6ea; --edge: #f29cc4; --glyph: #b23c78; }
.quest-station.is-hoeren.is-plus.is-available .quest-node, .quest-station.is-hoeren.is-plus.is-current .quest-node { --face: #f6e4ee; --edge: #dcb3c8; --glyph: #9a4d74; }
/* Übersprungene Plus-Station: eigenes Symbol, grau, kein Häkchen. */
.quest-station.is-skipped .quest-node { --face: #eee8de; --edge: #cfc6b8; --glyph: #8a8174; }
.quest-station.is-quiz .quest-node, .quest-station.is-game .quest-node, .quest-station.is-hoeren .quest-node { width: 66px; height: 70px; }
.quest-station.is-quiz .quest-hex-base, .quest-station.is-quiz .quest-hex-top,
.quest-station.is-game .quest-hex-base, .quest-station.is-game .quest-hex-top,
.quest-station.is-hoeren .quest-hex-base, .quest-station.is-hoeren .quest-hex-top { width: 66px; height: 62px; }
.quest-station.is-quiz .quest-hex-top svg, .quest-station.is-game .quest-hex-top svg, .quest-station.is-hoeren .quest-hex-top svg { width: 26px; height: 26px; }
.quest-station.is-test .quest-node { width: 90px; height: 94px; }
.quest-station.is-test .quest-hex-base, .quest-station.is-test .quest-hex-top { width: 90px; height: 86px; }
.quest-station.is-test .quest-hex-top svg { width: 38px; height: 38px; }

.quest-station.is-current .quest-node::before { content: ""; position: absolute; inset: -12px -12px -4px; border-radius: 50%; background: rgba(43,78,197,.16); animation: quest-pulse 1.8s ease-out infinite; }
@keyframes quest-pulse { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }

.quest-start-bubble { position: absolute; bottom: calc(100% + 12px); left: 50%; z-index: 3; border: 2px solid var(--line); border-radius: 14px; padding: 7px 14px; color: var(--blue); background: white; font-size: .78rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 3px 0 var(--line); transform: translateX(-50%); animation: quest-bob 1.6s ease-in-out infinite; }
.quest-start-bubble::after { content: ""; position: absolute; top: 100%; left: 50%; width: 12px; height: 12px; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); background: white; transform: translate(-50%, -5px) rotate(45deg); }
@keyframes quest-bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }

/* Mas Dennis auf der freien Seite jedes Kapitels */
.quest-buddy { position: absolute; top: 50%; z-index: 0; width: 200px; margin: 0; display: grid; justify-items: center; gap: 4px; transform: translateY(-50%); pointer-events: none; }
.quest-buddy.is-left { left: 0; }
.quest-buddy.is-right { right: 0; }
.quest-buddy-bubble { position: relative; max-width: 100%; border: 2px solid var(--line); border-radius: 16px; padding: 8px 12px; background: white; text-align: center; box-shadow: 0 3px 0 var(--line); }
.quest-buddy-bubble::after { content: ""; position: absolute; top: 100%; left: 50%; width: 12px; height: 12px; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); background: white; transform: translate(-50%, -5px) rotate(45deg); }
.quest-buddy-bubble strong { display: block; color: var(--blue); font-size: .9rem; line-height: 1.25; }
.quest-buddy-bubble span { display: block; margin-top: 2px; color: var(--muted); font-size: .72rem; font-weight: 700; line-height: 1.3; }
.quest-buddy-figure { position: relative; width: 120px; }
.quest-buddy-figure img { display: block; width: 100%; height: auto; }
.quest-buddy.is-right .quest-buddy-figure img { transform: scaleX(-1); }
.quest-buddy-prop { position: absolute; bottom: 6px; width: 46px; aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; background: var(--cream-panel); font-size: 1.45rem; box-shadow: 0 3px 0 var(--line); }
.quest-buddy.is-left .quest-buddy-prop { right: -14px; }
.quest-buddy.is-right .quest-buddy-prop { left: -14px; }

/* Popover an einer Station */
.quest-popover { position: absolute; top: calc(100% + 14px); left: 50%; z-index: 20; width: 270px; display: grid; gap: 4px; border-radius: 18px; padding: 16px; color: white; background: var(--blue); box-shadow: 0 5px 0 var(--blue-deep), 0 18px 34px rgba(30,39,75,.22); transform: translateX(-50%); text-align: left; }
.quest-popover::before { content: ""; position: absolute; bottom: 100%; left: 50%; border: 10px solid transparent; border-bottom-color: var(--blue); transform: translateX(-50%); }
.quest-popover.is-complete { background: #1b988d; box-shadow: 0 5px 0 #126b63, 0 18px 34px rgba(30,39,75,.22); }
.quest-popover.is-complete::before { border-bottom-color: #1b988d; }
.quest-popover.is-upcoming { color: var(--ink); background: white; box-shadow: 0 0 0 2px var(--line), 0 18px 34px rgba(30,39,75,.14); }
.quest-popover.is-upcoming::before { border-bottom-color: white; }
.quest-popover.is-skipped { color: var(--ink); background: #f4efe7; box-shadow: 0 0 0 2px var(--line), 0 18px 34px rgba(30,39,75,.14); }
.quest-popover.is-skipped::before { border-bottom-color: #f4efe7; }
.quest-popover .quest-popover-lock.is-plus { color: white; }
.quest-popover-button.is-secondary { color: white; background: transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.7); }
.quest-popover small { opacity: .82; font-size: .72rem; font-weight: 900; letter-spacing: .04em; }
.quest-popover strong { font-size: 1.05rem; line-height: 1.25; }
.quest-popover-button { min-height: 46px; margin-top: 10px; border: 0; border-radius: 14px; color: var(--blue); background: white; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.quest-popover.is-complete .quest-popover-button { color: #126b63; }
.quest-popover-button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.quest-popover-lock { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--muted); font-size: .85rem; font-weight: 800; }
.quest-popover-lock svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; }

.quest-load-error { margin-top: 40px; color: var(--muted); font-weight: 800; text-align: center; }

/* Seitenleiste: nur auf dem Desktop */
.quest-sidebar { position: sticky; top: 96px; max-height: calc(100vh - 116px); display: grid; gap: 16px; overflow-y: auto; scrollbar-width: none; }
.quest-sidebar::-webkit-scrollbar { display: none; }
.quest-stats, .quest-mobile-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); font-size: 1.05rem; font-weight: 900; }
.quest-stats b, .quest-mobile-stats b { color: var(--coral); }
.quest-stats span:last-child b, .quest-mobile-stats span:last-child b { color: #e0a400; }
.quest-level-badge { min-width: 46px; border-radius: 12px; padding: 5px 10px; color: white; background: var(--blue); text-align: center; box-shadow: 0 3px 0 var(--blue-deep); }
.quest-mobile-stats { display: none; }
.quest-card { border: 2px solid var(--line); border-radius: 22px; padding: 20px; background: white; }
.quest-card-soft { background: var(--cream-panel); }
.quest-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.quest-card h2 { margin: 0; font-size: 1.1rem; line-height: 1.25; }
.quest-goal-progress { height: 11px; overflow: hidden; border-radius: 999px; background: var(--cream-deep); }
.quest-goal-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--teal); transition: width .25s ease; }
.quest-goal-status { margin: 9px 0 13px; color: #13867b; font-size: .82rem; font-weight: 900; }
.quest-missions { display: grid; gap: 9px; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); list-style: none; }
.quest-missions li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; color: var(--muted); font-size: .8rem; font-weight: 800; }
.quest-missions b { display: grid; width: 20px; height: 20px; place-items: center; border: 2px solid var(--line); border-radius: 7px; color: transparent; }
.quest-missions small { color: #b98500; font-weight: 900; }
.quest-missions li.is-complete { color: var(--ink); }
.quest-missions li.is-complete b { border-color: var(--teal); color: white; background: var(--teal); }
.quest-chip { flex: none; border-radius: 999px; padding: 3px 10px; color: var(--muted); background: var(--cream); font-size: .7rem; font-weight: 900; }
.quest-goals { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.quest-goals li { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; font-size: .9rem; font-weight: 800; }
.quest-goals i { grid-column: 1 / -1; grid-row: 2; height: 12px; border-radius: 999px; background: linear-gradient(90deg, var(--teal) var(--goal), #eee7dc var(--goal)); }
.quest-goals small { color: var(--muted); font-weight: 900; }
.quest-chapter-progress { height: 12px; overflow: hidden; border-radius: 999px; background: #eee7dc; }
.quest-chapter-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--teal); transition: width .3s ease; }
.quest-topics { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.quest-topics li { font-size: .84rem; line-height: 1.4; }
.quest-topics strong { display: block; color: var(--blue); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.quest-topics span { color: var(--muted); font-weight: 700; }
.quest-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; color: var(--muted); font-size: .82rem; font-weight: 900; }
.quest-legend span { display: flex; align-items: center; gap: 8px; }
.quest-legend i { width: 18px; height: 17px; clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
.quest-legend .is-complete { background: var(--teal); }
.quest-legend .is-current { background: var(--blue); }
.quest-legend .is-test { background: #ffd666; }
.quest-legend .is-latihan { background: #cfc5ea; }
.quest-legend .is-quiz { background: #b9a2ff; }
.quest-legend .is-game { background: #ff9e85; }
.quest-legend .is-hoeren { background: #f29cc4; }
.quest-legend .is-skipped { background: #cfc6b8; }
.quest-legend .is-available { background: #dce5ff; }
.quest-legend .is-upcoming { background: #ddd5c9; }

.quest-toast { position: fixed; bottom: 24px; left: 50%; z-index: 80; width: min(440px, calc(100% - 32px)); border-radius: 16px; padding: 14px 18px; color: white; background: var(--blue-dark); font-weight: 800; text-align: center; box-shadow: 0 16px 34px rgba(16,29,80,.3); transform: translateX(-50%); }

@media (max-width: 1023px) {
  .quest-layout { grid-template-columns: minmax(0, 600px); }
  .quest-sidebar { display: none; }
  .quest-mobile-stats { display: flex; margin-bottom: 14px; }
}

@media (max-width: 650px) {
  .quest-layout { --quest-unit: 40px; width: calc(100% - 32px); padding-top: 18px; }
  .quest-banner { top: 74px; gap: 10px; padding: 12px 12px 12px 8px; border-radius: 18px; }
  .quest-banner strong { font-size: 1.02rem; }
  .quest-banner-jump { padding: 0 10px; font-size: .68rem; }
  .quest-level-switch button { min-height: 46px; flex-direction: column; gap: 0; line-height: 1.1; }
  .quest-level-switch button small { font-size: .62rem; }
  .quest-divider { font-size: .95rem; }
  .quest-track { min-height: 250px; }
  .quest-buddy { width: 126px; }
  .quest-buddy-bubble { padding: 6px 8px; border-radius: 13px; }
  .quest-buddy-bubble strong { font-size: .76rem; }
  .quest-buddy-bubble span { font-size: .64rem; }
  .quest-buddy-figure { width: 84px; }
  .quest-buddy-prop { width: 34px; font-size: 1.05rem; }
    .quest-popover { width: min(260px, calc(100vw - 48px)); }
}

@media (prefers-reduced-motion: reduce) {
  .quest-station.is-current .quest-node::before, .quest-start-bubble { animation: none; }
}

/* Tageswerte (echte Daten aus JJMPlatform.getActivity); Ziele kommen mit Priorität 2. */
.quest-today { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 0; list-style: none; }
.quest-today li { display: grid; gap: 2px; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.quest-today strong { color: var(--blue); font-size: 1.4rem; line-height: 1.1; }
.quest-today span { color: var(--muted); font-size: .78rem; font-weight: 800; }
/* Plus-Hinweis an gesperrten Hör-Stationen führt zur Plus-Seite. */
.quest-popover a.quest-popover-lock.is-plus { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.quest-popover-lock.is-skipped a { color: var(--blue); font-weight: 900; }
