:root {
  --accent-1: #0a3d78;
  --green: #17c987;
  --green-grad: linear-gradient(135deg, #17c987, #12a5e0);

  --bg: #eef1f6;
  --bg-image: radial-gradient(circle at 8% 8%, #e7eefb 0%, transparent 45%),
              radial-gradient(circle at 95% 0%, #fdf3df 0%, transparent 40%),
              #eef1f6;
  --paper: rgba(255, 255, 255, 0.72);
  --paper-solid: #ffffff;
  --paper-soft: #f5f6fc;
  --border: rgba(10, 30, 60, 0.1);
  --ink: #101a2c;
  --ink-soft: #5c6478;
  --shadow: 0 10px 30px rgba(10, 30, 60, 0.12);
  --shadow-lg: 0 20px 50px rgba(10, 30, 60, 0.18);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg-image);
  transition: background .4s ease, color .3s ease;
}

#app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
  padding: 14px;
  gap: 14px;
}

/* ---------- Header ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--paper);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand .logo {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  box-shadow: 0 6px 16px rgba(10, 61, 120, 0.35);
  flex-shrink: 0;
  animation: floaty 4s ease-in-out infinite;
}
.brand .logo img { width: 100%; height: 100%; object-fit: contain; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-4deg); }
}

.brand h1 {
  font-size: 18px; margin: 0; line-height: 1.2; font-weight: 800;
  color: var(--accent-1);
}
.brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-soft); }

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}

.progress-ring {
  position: relative;
  width: 38px; height: 38px;
  flex-shrink: 0;
}
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring .ring-bg {
  fill: none; stroke: var(--border); stroke-width: 3.2;
}
.progress-ring .ring-fill {
  fill: none; stroke: var(--accent-1); stroke-width: 3.2;
  stroke-linecap: round;
  stroke-dasharray: 97.4;
  stroke-dashoffset: 97.4;
  transition: stroke-dashoffset .5s cubic-bezier(.4,0,.2,1);
}
.progress-ring span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; color: var(--ink);
}

.progress-label { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }

.icon-btn, .reset-btn {
  border: 1px solid var(--border);
  background: var(--paper-soft);
  color: var(--ink-soft);
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 13px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.icon-btn { font-size: 16px; line-height: 1; padding: 8px 10px; }
.icon-btn:hover, .reset-btn:hover {
  background: var(--paper-solid);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.icon-btn:active, .reset-btn:active { transform: translateY(0); }

.sidebar-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--paper-soft);
  border-radius: 11px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink);
}

.btn-icon { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---------- Layout ---------- */
main {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 14px;
  min-height: 0;
}

.map-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

#map { width: 100%; height: 100%; background: var(--paper-soft); }
.leaflet-control-attribution {
  background: var(--paper) !important;
  color: var(--ink-soft) !important;
  backdrop-filter: blur(8px);
  border-radius: 8px 0 0 0 !important;
}
.leaflet-control-attribution a { color: var(--ink-soft) !important; }
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow) !important;
  border-radius: 12px !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: var(--paper-solid) !important;
  color: var(--ink) !important;
  border: none !important;
}
.leaflet-control-zoom a:hover { background: var(--paper-soft) !important; }

/* animated route line */
.route-path {
  stroke-dasharray: 2 12;
  stroke-linecap: round;
  animation: dash-march 3.5s linear infinite;
  filter: drop-shadow(0 2px 6px rgba(10, 61, 120, .45));
}
@keyframes dash-march { to { stroke-dashoffset: -28; } }

/* ---------- Sidebar ---------- */
aside {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--paper);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
#sidebar {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}
#sidebar::-webkit-scrollbar { width: 6px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

.footer-credits {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--paper-soft);
}

.footer-organizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 12px 4px;
  text-decoration: none;
  transition: background .15s ease;
}
.footer-organizer:hover { background: var(--paper-solid); }
.footer-organizer span { font-size: 11px; color: var(--ink-soft); }
.footer-organizer img { height: 22px; width: auto; }

.footer-city {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0 12px 10px;
}
.footer-city img { height: 20px; width: auto; }

.footer-dev {
  display: block;
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent-1);
  text-decoration: none;
  padding: 7px 12px 2px;
  border-top: 1px dashed var(--border);
  transition: opacity .15s ease;
}
.footer-dev:hover { opacity: .75; text-decoration: underline; }

.footer-copyright {
  text-align: center;
  font-size: 9.5px;
  color: var(--ink-soft);
  padding: 0 12px 10px;
}

.stop-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  margin-bottom: 10px;
  cursor: pointer;
  background: var(--paper-soft);
  transition: border-color .18s ease, box-shadow .18s ease, transform .15s ease, background .18s ease;
  animation: card-in .4s cubic-bezier(.2,.8,.2,1) backwards;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.stop-card:hover { box-shadow: var(--shadow); transform: translateX(3px); }
.stop-card.active {
  border-color: var(--accent-1);
  background: var(--paper-solid);
  box-shadow: 0 8px 22px rgba(10, 61, 120, 0.22);
}
.stop-card.done { opacity: 0.55; }

.stop-badge {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--paper-solid);
  border: 2px solid var(--accent-1);
  color: var(--accent-1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.stop-card.done .stop-badge {
  background: var(--green-grad);
  border-color: transparent;
  color: white;
}

.stop-body { flex: 1; min-width: 0; }
.stop-body h3 { margin: 0 0 3px; font-size: 16.5px; font-weight: 700; }
.stop-body p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }

.stop-check {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  color: transparent;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .12s ease;
}
.stop-check:hover { border-color: var(--accent-1); transform: scale(1.08); }
.stop-check:active { transform: scale(0.94); }
.stop-card.done .stop-check {
  background: var(--green-grad);
  border-color: transparent;
  color: white;
}

/* ---------- Detail panel (over map) ---------- */
#detail-panel {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 380px;
  max-width: calc(100% - 32px);
  background: var(--paper);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 22px;
  z-index: 500;
  opacity: 0;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  transform: translateY(-10px) scale(.97);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.2,.8,.2,1);
}
#detail-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.detail-close {
  position: absolute;
  top: 14px; right: 14px;
  border: none;
  background: var(--paper-soft);
  font-size: 15px;
  cursor: pointer;
  color: var(--ink-soft);
  width: 30px; height: 30px;
  border-radius: 50%;
  z-index: 1;
  transition: transform .2s ease, background .2s ease;
}
.detail-close:hover { background: var(--paper-solid); transform: rotate(90deg); }

.detail-thumb {
  width: 100%;
  height: 220px;
  border-radius: 14px;
  display: flex; align-items: flex-end; justify-content: flex-start;
  background-color: var(--paper-soft);
  background-image:
    linear-gradient(180deg, rgba(10,29,56,0) 55%, rgba(8,20,38,.6) 100%),
    linear-gradient(rgba(10, 61, 120, .16), rgba(10, 61, 120, .16)),
    url("assets/kdoll-hero.jpg");
  background-size: cover, cover, contain;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: center, center, center;
  color: white;
  margin-bottom: 16px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.detail-thumb .thumb-tag {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}

#detail-panel h2 { margin: 0 0 6px; font-size: 21px; font-weight: 800; }
#detail-panel .place {
  font-size: 13.5px; font-weight: 700; margin-bottom: 8px;
  color: var(--accent-1);
}
#detail-panel .meta { font-size: 13.5px; color: var(--ink-soft); margin: 3px 0; }
#detail-panel .desc { font-size: 14px; color: var(--ink); margin-top: 12px; line-height: 1.55; }

.info-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--paper-soft);
  border: 1px solid var(--border);
}
.info-box-icon { font-size: 14px; line-height: 1.5; flex-shrink: 0; }
.info-box p { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }

.detail-buy {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: 1.5px solid var(--accent-1);
  background: transparent;
  color: var(--accent-1);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.detail-buy:hover { background: var(--accent-1); color: #fff; transform: translateY(-2px); }

.detail-mark {
  margin-top: 18px;
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: var(--accent-1);
  color: white;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(10, 61, 120, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.detail-mark:hover { transform: translateY(-2px); }
.detail-mark.done { background: var(--green-grad); box-shadow: 0 8px 18px rgba(23, 201, 135, .35); }

/* ---------- Leaflet marker tweaks ---------- */
.kdoll-pin {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-1);
  border: 3px solid var(--paper-solid);
  box-shadow: 0 4px 12px rgba(10, 61, 120, .5);
  color: white;
  font-weight: 700;
  font-size: 12.5px;
  animation: pin-in .5s cubic-bezier(.34,1.56,.64,1) backwards;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.kdoll-pin:hover { transform: scale(1.18); }
@keyframes pin-in {
  from { opacity: 0; transform: scale(.2); }
  to { opacity: 1; transform: scale(1); }
}
.kdoll-pin.done {
  background: var(--green-grad);
  box-shadow: 0 4px 12px rgba(23, 201, 135, .5);
}
.kdoll-pin.active-pulse::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent-1);
  animation: pulse-ring 1.4s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(.9); opacity: .8; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ---------- Milestone popup ---------- */
.milestone-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 24, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.milestone-modal.open { opacity: 1; pointer-events: auto; }

.milestone-card {
  background: var(--paper-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px 28px 28px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: scale(.82) translateY(10px);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.milestone-modal.open .milestone-card { transform: scale(1) translateY(0); }

.milestone-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: milestone-pop .6s cubic-bezier(.34,1.56,.64,1);
}
@keyframes milestone-pop {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.milestone-card h2 { margin: 0 0 8px; font-size: 19px; font-weight: 800; color: var(--accent-1); }
.milestone-card p { margin: 0 0 22px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }

.milestone-continue {
  border: none;
  background: var(--accent-1);
  color: white;
  padding: 11px 22px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(10, 61, 120, .35);
  transition: transform .15s ease;
}
.milestone-continue:hover { transform: translateY(-2px); }

/* ---------- Game HUD (timer + badges) ---------- */
.icon-btn.active, .reset-btn.active {
  background: var(--accent-1);
  color: #fff;
  border-color: var(--accent-1);
}
.reset-btn.active .btn-icon,
.reset-btn.active .btn-label { color: #fff; }

.game-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 6px 8px 6px 12px;
}
.game-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 13px;
  color: var(--accent-1);
  white-space: nowrap;
}
.game-hud .icon-btn { padding: 5px 8px; font-size: 15px; }

/* ---------- Riddle (game mode) ---------- */
.riddle {
  display: none;
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: var(--paper-soft);
  border: 1.5px dashed var(--border);
}
.riddle.active { display: block; }
.riddle-question { margin: 0 0 10px; font-weight: 700; font-size: 14.5px; }
.riddle-choices { display: flex; flex-direction: column; gap: 8px; }
.riddle-choice {
  border: 1.5px solid var(--border);
  background: var(--paper-solid);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.riddle-choice:hover { border-color: var(--accent-1); transform: translateX(2px); }
.riddle-choice.correct { background: var(--green-grad); border-color: transparent; color: white; }
.riddle-choice.wrong { background: #e5484d; border-color: transparent; color: white; animation: riddle-shake .4s; }
.riddle-choice[disabled] { pointer-events: none; opacity: .75; }
@keyframes riddle-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.riddle-feedback { margin: 10px 0 0; font-size: 13px; font-weight: 700; min-height: 16px; }
.riddle-feedback.ok { color: var(--green); }
.riddle-feedback.bad { color: #e5484d; }

/* ---------- Badges modal ---------- */
.badges-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 24, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.badges-modal.open { opacity: 1; pointer-events: auto; }

.badges-card {
  position: relative;
  background: var(--paper-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 420px;
}
.badges-card h2 { margin: 0 0 6px; font-size: 20px; color: var(--accent-1); font-weight: 800; }
.badges-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-soft); }

.badges-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.badge-slot {
  aspect-ratio: 1;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  border: 2px dashed var(--border);
  color: var(--ink-soft);
  background: var(--paper-soft);
}
.badge-slot.unlocked {
  border-style: solid;
  border-color: transparent;
  background: var(--green-grad);
  color: white;
  animation: pin-in .4s cubic-bezier(.34,1.56,.64,1) backwards;
}

/* ---------- Pourquoi K-Dolls ? ---------- */
.kdolls-info-card { text-align: left; max-width: 460px; }
.kdolls-info-card h2 { text-align: center; }
.kdolls-info-text { margin: 0 0 12px; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.kdolls-info-link {
  display: block;
  text-align: center;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-1);
  text-decoration: none;
}
.kdolls-info-link:hover { text-decoration: underline; }

/* ---------- Confetti ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3000;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 8px;
  height: 14px;
  opacity: .95;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

/* ---------- Mode enfant ---------- */
.mascot {
  position: fixed;
  bottom: 20px;
  left: 20px;
  font-size: 42px;
  display: none;
  animation: floaty 3s ease-in-out infinite;
  z-index: 50;
  pointer-events: none;
}
#app.kid-mode .mascot { display: block; }

#app.kid-mode { font-family: "Baloo 2", "Plus Jakarta Sans", sans-serif; }
#app.kid-mode .brand h1 { font-size: 22px; }
#app.kid-mode .brand p { font-size: 14px; }
#app.kid-mode .stop-card { padding: 20px; border-radius: 20px; }
#app.kid-mode .stop-badge { width: 50px; height: 50px; font-size: 19px; }
#app.kid-mode .stop-body h3 { font-size: 19px; }
#app.kid-mode .stop-body p { font-size: 14.5px; }
#app.kid-mode .stop-check { width: 38px; height: 38px; }
#app.kid-mode #detail-panel h2 { font-size: 25px; }
#app.kid-mode #detail-panel .desc,
#app.kid-mode .riddle-question { font-size: 16px; }
#app.kid-mode .detail-mark { font-size: 17px; padding: 16px; border-radius: 14px; }
#app.kid-mode .riddle-choice { font-size: 15.5px; padding: 13px 14px; }
#app.kid-mode .milestone-card h2 { font-size: 23px; }
#app.kid-mode .milestone-card p { font-size: 15px; }

/* ---------- Mode enfant : palette multicolore ---------- */
#app.kid-mode {
  --kid-red: #ff6b6b;
  --kid-orange: #ffa94d;
  --kid-yellow: #f2c94c;
  --kid-green: #51cf66;
  --kid-teal: #22b8cf;
  --kid-blue: #4dabf7;
  --kid-purple: #cc5de8;
}
#app.kid-mode .kid-c0 { --kid-c: var(--kid-red); }
#app.kid-mode .kid-c1 { --kid-c: var(--kid-orange); }
#app.kid-mode .kid-c2 { --kid-c: var(--kid-yellow); }
#app.kid-mode .kid-c3 { --kid-c: var(--kid-green); }
#app.kid-mode .kid-c4 { --kid-c: var(--kid-teal); }
#app.kid-mode .kid-c5 { --kid-c: var(--kid-blue); }
#app.kid-mode .kid-c6 { --kid-c: var(--kid-purple); }

#app.kid-mode header {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(255,107,107,.10), rgba(242,201,76,.10) 35%, rgba(77,171,247,.10) 70%, rgba(204,93,232,.10)),
    var(--paper);
}
#app.kid-mode header::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--kid-red), var(--kid-orange), var(--kid-yellow), var(--kid-green), var(--kid-teal), var(--kid-blue), var(--kid-purple));
}
#app.kid-mode .brand h1 { color: var(--kid-purple); }

#app.kid-mode #kid-toggle.active { background: var(--kid-purple); border-color: var(--kid-purple); }
#app.kid-mode #badges-btn { background: var(--kid-yellow); border-color: var(--kid-yellow); color: #6b4e00; }
#app.kid-mode #reset-btn { background: var(--kid-red); border-color: var(--kid-red); }
#app.kid-mode #reset-btn .btn-icon,
#app.kid-mode #reset-btn .btn-label { color: #fff; }

#app.kid-mode aside {
  background:
    linear-gradient(160deg, rgba(255,107,107,.07), rgba(81,207,102,.07) 45%, rgba(77,171,247,.07)),
    var(--paper);
}

#app.kid-mode .stop-card:not(.done) {
  border-left: 5px solid var(--kid-c, var(--accent-1));
  background: color-mix(in srgb, var(--kid-c, var(--accent-1)) 6%, var(--paper-soft));
}
#app.kid-mode .stop-card:not(.done) .stop-badge {
  border-color: var(--kid-c, var(--accent-1));
  color: var(--kid-c, var(--accent-1));
}
#app.kid-mode .stop-card.active:not(.done) {
  border-color: var(--kid-c, var(--accent-1));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .15);
}

#app.kid-mode .kdoll-pin:not(.done) {
  background: var(--kid-c, var(--accent-1));
  box-shadow: 0 4px 12px rgba(10, 30, 60, .35);
}

#app.kid-mode .progress-ring .ring-fill { stroke: var(--kid-teal); }

#app.kid-mode #detail-panel {
  border-width: 2.5px;
  border-color: var(--kid-c, var(--border));
}
#app.kid-mode .place { color: var(--kid-c, var(--accent-1)); }

#app.kid-mode .info-box {
  border-color: var(--kid-teal);
  background: color-mix(in srgb, var(--kid-teal) 10%, var(--paper-soft));
}

#app.kid-mode .detail-mark:not(.done) {
  background: linear-gradient(90deg, var(--kid-red), var(--kid-orange), var(--kid-yellow), var(--kid-green), var(--kid-teal), var(--kid-blue), var(--kid-purple));
  background-size: 300% 100%;
  animation: kid-rainbow-shift 6s linear infinite;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .2);
}
@keyframes kid-rainbow-shift { to { background-position: 300% 0; } }

#app.kid-mode .riddle {
  border-style: solid;
  border-color: var(--kid-c, var(--border));
  background: color-mix(in srgb, var(--kid-c, var(--accent-1)) 6%, var(--paper-soft));
}
#app.kid-mode .riddle-choice:not(.correct):not(.wrong):nth-child(3n+1) { border-color: var(--kid-blue); border-width: 2px; background: color-mix(in srgb, var(--kid-blue) 10%, var(--paper-solid)); }
#app.kid-mode .riddle-choice:not(.correct):not(.wrong):nth-child(3n+2) { border-color: var(--kid-orange); border-width: 2px; background: color-mix(in srgb, var(--kid-orange) 10%, var(--paper-solid)); }
#app.kid-mode .riddle-choice:not(.correct):not(.wrong):nth-child(3n+3) { border-color: var(--kid-purple); border-width: 2px; background: color-mix(in srgb, var(--kid-purple) 10%, var(--paper-solid)); }

#app.kid-mode .milestone-card { border: 3px solid var(--kid-yellow); }
#app.kid-mode .milestone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 78px;
  height: 78px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--kid-yellow), var(--kid-orange), var(--kid-red));
}

#app.kid-mode .badges-card { border: 3px solid var(--kid-blue); }
#app.kid-mode .badge-slot.unlocked {
  background: var(--kid-c, var(--green-grad));
}
#app.kid-mode .badge-slot:not(.unlocked) {
  border-color: var(--kid-c, var(--border));
  color: var(--kid-c, var(--ink-soft));
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  #app { padding: 10px; gap: 10px; }
  main { grid-template-columns: 1fr; grid-template-rows: 1fr; position: relative; }
  aside {
    position: absolute;
    inset: 0;
    z-index: 600;
    transform: translateX(-104%);
    transition: transform .3s cubic-bezier(.2,.8,.2,1);
    width: 86%;
    max-width: 340px;
  }
  aside.open { transform: translateX(0); box-shadow: 12px 0 30px rgba(0,0,0,.25); }
  .sidebar-toggle { display: block; }
  .progress-wrap { min-width: 0; gap: 6px; }
  .progress-label { display: none; }
  .brand p { display: none; }
  .brand h1 {
    font-size: 14.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 34vw;
  }
  header { padding: 10px 10px; gap: 6px; flex-wrap: wrap; }
  .brand { order: 1; flex: 1 1 auto; min-width: 0; }
  .progress-wrap { order: 2; }
  .sidebar-toggle { order: 3; }
  .header-actions {
    order: 4;
    flex: 1 1 100%;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 2px;
  }
  .btn-label { display: none; }
  .btn-icon { display: inline; font-size: 16px; }
  .reset-btn, .icon-btn, .sidebar-toggle { padding: 7px 9px; }
  #detail-panel { left: 12px; right: 12px; width: auto; top: auto; bottom: 14px; }
}

@media (max-width: 480px) {
  .header-actions { justify-content: space-between; }
}
