/* Skate Skill Tree v1.2 — bright daytime street plaza, smooth "32-bit / hi-bit" look.
   One typeface (Nunito, bundled), rounded corners, soft shadows, thin borders, gentle gradients. */
@font-face { font-family: "Nunito"; src: url("fonts/Nunito.ttf") format("truetype"); font-weight: 200 1000; font-display: swap; }

:root {
  --ink: #2b1d0e;
  --ink-2: #5a4a36;          /* secondary text, 7:1 on cream */
  --line: rgba(43, 29, 14, .22);
  --line-2: rgba(43, 29, 14, .38);
  --cream: #fffaf0;
  --cream-2: #f6ecd6;
  --gold: #ffcf3a;
  --gold-lo: #e09a1c;
  --green: #146c2a;          /* white text 6.6:1 */
  --green-hi: #1b8536;       /* gradient top, white text 4.7:1 */
  --blue: #1f5fbd;           /* white text 6:1 */
  --blue-hi: #2b73d6;        /* 4.6:1 */
  --purple: #6a45d6;
  --purple-hi: #7a55e6;
  --red: #b52c18;
  --red-hi: #d23a24;
  --yellow: #ffd93b;
  --orange: #ff8a1f;
  --teal: #0b6a66;
  --sky: #5ec8ff;
  --concrete: #e9e2d4;
  --r-sm: 8px; --r: 12px; --r-lg: 14px;
  --sh-sm: 0 1px 2px rgba(43, 29, 14, .12), 0 2px 6px rgba(43, 29, 14, .10);
  --sh: 0 2px 4px rgba(43, 29, 14, .10), 0 8px 22px rgba(43, 29, 14, .16);
  --sh-lg: 0 4px 10px rgba(43, 29, 14, .12), 0 18px 44px rgba(43, 29, 14, .22);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --hud-h: 132px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-weight: 600; font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--concrete);
  overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
  display: flex; flex-direction: column; height: 100dvh;
}
button { font: inherit; color: inherit; }
svg.vic { display: block; overflow: visible; }
.flipx { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Primitives ---------- */
.px-panel {
  background: linear-gradient(#fffdf8, var(--cream)); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh);
}
.pxbtn {
  --b: var(--blue); --bh: var(--blue-hi);
  font-weight: 800; font-size: 16px; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; min-height: 42px; cursor: pointer; color: #fff;
  background: linear-gradient(var(--bh), var(--b)); border: 1px solid rgba(0, 0, 0, .18); border-radius: var(--r);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 6px rgba(43, 29, 14, .18); user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.pxbtn:hover { filter: brightness(1.05); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 12px rgba(43, 29, 14, .22); }
.pxbtn:active { transform: translateY(1px) scale(.99); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .2); }
.pxbtn:focus-visible, .node:focus-visible, .chip:focus-visible, .zbtn:focus-visible, .tick:focus-visible, .alt:focus-visible,
.world-toggle:focus-visible, .linkbtn:focus-visible, .pk-item:focus-visible, .links button:focus-visible, .sp-bar:focus-visible { outline: 3px solid #1f63c4; outline-offset: 3px; }
.pxbtn:disabled { filter: grayscale(1); opacity: .6; cursor: default; }
.pxbtn.blue { --b: var(--blue); --bh: var(--blue-hi); }
.pxbtn.purple { --b: var(--purple); --bh: var(--purple-hi); }
.pxbtn.green { --b: var(--green); --bh: var(--green-hi); }
.pxbtn.red { --b: var(--red); --bh: var(--red-hi); }
.pxbtn.yellow { --b: #ffc928; --bh: #ffe270; color: var(--ink); }
.pxbtn.cream { --b: #f3e8cf; --bh: #fffdf6; color: var(--ink); border-color: var(--line-2); }
.pxbtn.wide { flex: 1; }
.pxbtn.tiny { font-size: 15px; padding: 6px 12px; min-height: 36px; }
.burger { width: 16px; height: 12px; border-radius: 2px; background: linear-gradient(#fff 0 2.5px, transparent 2.5px 4.75px, #fff 4.75px 7.25px, transparent 7.25px 9.5px, #fff 9.5px 12px); }
.mapico { width: 16px; height: 14px; border-radius: 4px; background: linear-gradient(90deg, #ffd93b 0 33%, #6be07c 33% 66%, #8fd0ff 66%); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .8); }

/* ---------- HUD + sky ---------- */
.hud { position: relative; z-index: 30; flex: none; min-height: var(--hud-h); overflow: hidden;
  background: linear-gradient(#45b9fb 0%, #6fd0ff 45%, #a9e3ff 78%, #d6f2ff 100%);
  box-shadow: 0 2px 10px rgba(20, 60, 100, .25); }
.sky { position: absolute; inset: 0; pointer-events: none; }
.clouds { position: absolute; inset: 0 0 30px 0; }
.cloud { position: absolute; animation: drift linear infinite; opacity: .92; filter: drop-shadow(0 3px 4px rgba(40, 110, 170, .18)); }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-110vw); } }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 30px; opacity: .85; }
.hud-row { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 16px; padding: 12px 16px 10px; }
.hud-left { display: flex; gap: 10px; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hud-btns { display: flex; gap: 8px; }
.px-chip { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; color: var(--ink);
  background: rgba(255, 255, 255, .92); border: 1px solid rgba(255, 255, 255, .9); border-radius: 22px; box-shadow: var(--sh-sm);
  font-weight: 800; font-size: 17px; backdrop-filter: blur(6px); }
.px-chip b { font-weight: 900; }
.chip-ico { display: flex; }
.hud-center { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.plank { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 24px;
  background: linear-gradient(#3a5f88, #24405f); border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), inset 0 0 0 3px rgba(255, 255, 255, .08), var(--sh); }
.plank h1 { margin: 0; font-weight: 900; font-size: 30px; line-height: 1.1; color: #fff; letter-spacing: -.01em; white-space: nowrap; }
.plank h1 .hl { color: var(--yellow); }
.pbar-row { display: flex; align-items: center; gap: 10px; }
.pbar { position: relative; height: 14px; width: min(360px, 40vw); background: rgba(30, 60, 90, .28); border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25), 0 1px 0 rgba(255, 255, 255, .5); overflow: hidden; }
.pbar-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(#ffe680, #ffc21e); box-shadow: inset 0 -2px 0 rgba(200, 120, 0, .35); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.pbar-text { font-weight: 800; font-size: 16px; color: var(--ink); background: rgba(255, 255, 255, .88); padding: 2px 10px; border-radius: 999px; white-space: nowrap; box-shadow: var(--sh-sm); }
.pbar-text b { font-weight: 900; }
.pbar.mini { width: 100%; height: 10px; background: #ece3cf; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15); }
.stars { display: flex; gap: 4px; }
.stars .star { opacity: .35; filter: grayscale(1); }
.stars .star.on { opacity: 1; filter: drop-shadow(0 1px 2px rgba(150, 90, 0, .4)); }

/* ---------- Stage + map ---------- */
.stage { position: relative; flex: 1; min-height: 0; }
.map { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; background-color: #d3cbbb; }
.map.dragging { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.scene { position: absolute; left: 0; top: 0; display: block; shape-rendering: geometricPrecision; }
.scene .graffiti { font-family: var(--font); font-weight: 900; font-size: 46px; letter-spacing: .01em; }
.scene .stencil { font-family: var(--font); font-weight: 800; font-size: 16px; fill: #6e6250; }
.scene .teaser { filter: grayscale(.55) blur(.3px); opacity: .8; }
.nodes { position: absolute; inset: 0; }

/* edges = smooth painted lines */
.edge path { fill: none; }
.edge .e-under, .edge .e-top { stroke-linecap: round; stroke-linejoin: round; }
.edge.gold .e-under { stroke: rgba(179, 116, 0, .55); stroke-width: 16; }
.edge.gold .e-top { stroke: #ffd23f; stroke-width: 10; }
.edge.avail .e-under { stroke: rgba(255, 255, 255, .8); stroke-width: 12; }
.edge.avail .e-top { stroke: var(--green-hi); stroke-width: 6; stroke-dasharray: 14 10; animation: march 1.1s linear infinite; }
.edge.locked .e-under { stroke: none; }
.edge.locked .e-top { stroke: #9a948a; stroke-width: 5; stroke-dasharray: 2 11; }
.edge.hl .e-under { stroke: #fff; stroke-width: 20; }
.edge.faded { opacity: .25; }
@keyframes march { to { stroke-dashoffset: -24; } }

/* street signs */
.sign { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px; padding: 6px 14px;
  font-weight: 800; font-size: calc(18px * var(--lz, 1)); color: #fff; letter-spacing: .01em;
  background: linear-gradient(color-mix(in srgb, var(--sign, #1f63c4) 54%, #000 46%), color-mix(in srgb, var(--sign, #1f63c4) 44%, #000 56%));
  border: 1px solid rgba(255, 255, 255, .45); border-radius: 10px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22), var(--sh); pointer-events: none; white-space: nowrap; }
.sign::after { content: ""; position: absolute; left: 50%; top: 100%; width: 6px; height: 24px; margin-left: -3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, #8c96a0, #c3cad1 50%, #8c96a0); z-index: -1; }
.sign.soon { --sign: #8f969d; font-size: calc(16px * var(--lz, 1)); }
.sign.soon::after { display: none; }
.sign.faded { opacity: .35; }

/* ---------- Nodes (smooth round badges) ---------- */
.node { position: absolute; width: 204px; margin-left: -102px; margin-top: -36px; padding: 0; background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px; }
.node.static { position: relative; width: auto; margin: 0; cursor: default; --lz: 1; }
.medal { position: relative; width: 72px; height: 72px; display: block; transition: transform .18s ease; }
.medal .badge { position: absolute; inset: 0; overflow: visible; filter: drop-shadow(0 3px 4px rgba(43, 29, 14, .28)); }
.b-glow { fill: transparent; }
.b-out { fill: #fff; stroke: rgba(43, 29, 14, .55); stroke-width: 1.5; }
.b-fill { fill: url(#g-gray); }
.b-hi { fill: #fff; opacity: .45; }
.medal .ico { position: absolute; left: 16px; top: 16px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.medal .ico svg { position: absolute; inset: 0; margin: auto; }
.ico-lock { display: none !important; }
.ov { position: absolute; display: none; filter: drop-shadow(0 1px 2px rgba(43, 29, 14, .35)); }
.ov-check, .ov-learn { right: -4px; bottom: -2px; }
.ov-star { left: -6px; top: -6px; }
.spark { position: absolute; display: none; animation: twinkle 2s ease-in-out infinite; }
.spark.s1 { left: -10px; top: 18px; } .spark.s2 { right: -4px; top: -6px; animation-delay: -.6s; } .spark.s3 { right: -14px; top: 30px; animation-delay: -1.2s; }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .25; transform: scale(.6); } }
.arrow { position: absolute; top: -30px; left: 50%; margin-left: -11px; display: none; animation: bob 1.2s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(43, 29, 14, .3)); }
@keyframes bob { 50% { transform: translateY(-6px); } }
.n-name { font-weight: 800; font-size: calc(14px * var(--lz, 1)); line-height: 1.2; padding: calc(3px * var(--lz, 1)) calc(9px * var(--lz, 1)) calc(4px * var(--lz, 1)); max-width: calc(156px * min(var(--lz, 1), 1.3)); text-align: center; color: var(--ink);
  background: rgba(255, 253, 247, .97); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--sh-sm);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; }

/* locked */
.node.locked .ico-trick { display: none; }
.node.locked .ico-lock { display: block !important; }
.node.locked .n-name { background: #e6e3dc; color: #4f4b44; }
/* available / learning */
.node.available .b-fill { fill: url(#g-cream); }
.node.learning .b-fill { fill: url(#g-learn); }
.node.available .b-out, .node.learning .b-out { stroke: rgba(43, 29, 14, .6); }
.node.available .b-glow { fill: url(#g-glow); animation: glow 1.8s ease-in-out infinite; transform-origin: 36px 36px; }
.node.learning .b-glow { fill: url(#g-glow-learn); }
.node.available .arrow, .node.learning .arrow { display: block; }
@keyframes glow { 50% { opacity: .45; transform: scale(.94); } }
.node.learning .ov-learn { display: block; }
/* landed */
.node.landed .b-fill, .node.consistent .b-fill { fill: url(#g-gold); }
.node.landed .b-out, .node.consistent .b-out { fill: #fff6d6; stroke: #a8650c; }
.node.landed .ov-check, .node.consistent .ov-check { display: block; }
.node.consistent .ov-star { display: block; }
.node.landed .spark, .node.consistent .spark { display: block; }
.node.landed .n-name, .node.consistent .n-name { background: linear-gradient(#fff2b3, #ffe17a); border-color: rgba(168, 101, 12, .45); }
.node.next .n-name { background: #fff; border-color: rgba(27, 133, 54, .6); box-shadow: 0 0 0 2px rgba(47, 174, 76, .35), var(--sh-sm); }
.node.selected .n-name { box-shadow: 0 0 0 3px #1f63c4, var(--sh-sm); }
.node:hover:not(.static) .medal { transform: translateY(-3px); }
.node.faded { opacity: .3; }
.node.static .arrow, .node.static .spark { display: none; }
.node.just-unlocked .medal { animation: pop .6s cubic-bezier(.2, 1.4, .4, 1); }
.node.just-landed .medal { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.bubble { position: absolute; translate: 40px -78px; padding: 6px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  font-weight: 800; font-size: calc(15px * var(--lz, 1)); white-space: nowrap; box-shadow: var(--sh); pointer-events: none; animation: bob 1.4s ease-in-out infinite; }
.bubble::after { content: ""; position: absolute; left: -6px; bottom: -6px; width: 14px; height: 14px; background: #fff; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg) skew(10deg, 10deg); border-radius: 0 0 0 4px; }
/* the map is mirrored in the Switch world, so the bubble flips sides too */
body.world-switch .bubble { translate: calc(-100% - 40px) -78px; }
body.world-switch .bubble::after { left: auto; right: -6px; border-left: 0; border-right: 1px solid var(--line); transform: rotate(-45deg) skew(10deg, 10deg); border-radius: 0 0 4px 0; }

/* ---------- Map overlays ---------- */
.map-ui { position: absolute; z-index: 5; }
.filters { left: 12px; top: 12px; display: flex; gap: 6px; flex-wrap: wrap; max-width: 60%; }
.chip { display: inline-flex; align-items: center; gap: 7px; font-weight: 800; font-size: 15px; padding: 6px 13px; cursor: pointer; color: var(--ink);
  background: rgba(255, 253, 247, .96); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--sh-sm); }
.chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sign, var(--ink)); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .2); }
.chip.active { background: linear-gradient(#fff3b0, #ffe066); border-color: rgba(168, 101, 12, .45); }
.legend { left: 12px; bottom: 12px; display: flex; gap: 14px; padding: 8px 14px; background: rgba(255, 253, 247, .96); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-sm); font-weight: 700; font-size: 15px; }
.legend span, .legend-list li { display: flex; align-items: center; gap: 7px; }
.ln { display: inline-block; flex: none; width: 26px; height: 6px; border-radius: 3px; }
.ln.gold { background: #ffd23f; box-shadow: 0 0 0 1.5px rgba(179, 116, 0, .6); }
.ln.green { background: repeating-linear-gradient(90deg, var(--green-hi) 0 8px, transparent 8px 12px); }
.ln.gray { background: repeating-linear-gradient(90deg, #8f897f 0 3px, transparent 3px 8px); }
.zoom { right: 12px; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.zbtn { width: 44px; height: 44px; cursor: pointer; font-weight: 800; font-size: 22px; display: flex; align-items: center; justify-content: center; color: var(--ink);
  background: linear-gradient(#fff, #f3ead6); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
.zbtn.small { font-size: 15px; }
.zbtn:active { transform: translateY(1px); }
.zlevel { font-weight: 800; font-size: 14px; background: rgba(255, 253, 247, .96); border-radius: 999px; padding: 1px 8px; box-shadow: var(--sh-sm); }

/* ---------- Session panel content ---------- */
.goal-head { display: flex; gap: 16px; align-items: center; }
.goal-medal { flex: none; }
.goal-title { min-width: 0; }
.goal-title h2 { margin: 0; font-weight: 900; font-size: 22px; line-height: 1.2; }
.goal-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-weight: 800; font-size: 14px; padding: 2px 10px; border-radius: 999px; color: #fff;
  background: color-mix(in srgb, var(--sign, #6b5a44) 50%, #000 50%); }
.tag.plain { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.goal-target { margin: 10px 0 0; font-size: 16px; line-height: 1.5; }
.plan-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 18px; }
.plan-head h3, .alts-title, .drawer h3, .details h3 { margin: 0; font-weight: 800; font-size: 17px; letter-spacing: .005em; }
.plan-count { font-weight: 800; font-size: 15px; color: var(--ink-2); }
.plan-bar { margin: 8px 0 10px; }
.plan-bar .pbar-fill { background: linear-gradient(#55cf6f, #23963a); }
.plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tick { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; padding: 9px 12px; position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
.tick::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--k, transparent); }
.plan-item.warm .tick { --k: var(--blue-hi); }
.plan-item.drill .tick { --k: #ffc21e; }
.plan-item.try .tick { --k: var(--red-hi); background: #fff6ec; }
.plan-item.done .tick { background: #ecf8e8; }
.plan-item.done .ptext { text-decoration: line-through; text-decoration-thickness: 1.5px; color: #3d5a38; }
.box { flex: none; width: 24px; height: 24px; border: 1.5px solid var(--line-2); border-radius: 7px; background: #fff; display: flex; align-items: center; justify-content: center; }
.box svg { width: 16px; height: 16px; opacity: 0; }
.plan-item.done .box { background: linear-gradient(#3cbf5a, #1b8536); border-color: transparent; }
.plan-item.done .box svg { opacity: 1; }
.ptext { flex: 1; font-size: 16px; font-weight: 700; line-height: 1.35; }
.reps { flex: none; font-weight: 800; font-size: 14px; padding: 2px 9px; background: var(--cream-2); border-radius: 999px; white-space: nowrap; }
.goal-actions { display: flex; gap: 10px; margin-top: 14px; }
.goal-actions .pxbtn { min-height: 46px; }
.trophy { display: block; padding: 6px; }
.alts { display: flex; flex-direction: column; gap: 10px; }
.alt-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
.alt { display: flex; align-items: center; gap: 10px; padding: 10px; text-align: left; cursor: pointer; border-radius: var(--r); box-shadow: var(--sh-sm); }
.alt:hover { background: #fff; box-shadow: var(--sh); }
.alt:active { transform: translateY(1px); }
.alt-medal .medal { transform: scale(.8); margin: -6px; }
.alt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alt-name { font-weight: 800; font-size: 17px; }
.alt-sub { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.alt-cta { font-weight: 800; font-size: 15px; color: var(--blue); }

/* ---------- Practice log (reps) ---------- */
.practice { margin: 14px 0 4px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
.log-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.log-title { font-weight: 800; font-size: 17px; }
.log-stats { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.rate { height: 8px; margin: 8px 0 2px; border-radius: 999px; background: #ece3cf; overflow: hidden; }
.rate-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffb347, #2fae4c); }
.log-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.log-row .pxbtn { flex: 1; min-width: 120px; }

/* ---------- Drawers ---------- */
.scrim { position: absolute; inset: 0; z-index: 18; background: rgba(43, 29, 14, .22); backdrop-filter: blur(1.5px); }
.drawer { position: absolute; z-index: 20; top: 12px; right: 12px; bottom: 12px; width: min(400px, calc(100% - 24px)); padding: 20px 18px; overflow-y: auto;
  transform: translateX(calc(100% + 30px)); transition: transform .28s cubic-bezier(.2, .8, .2, 1); visibility: hidden; box-shadow: var(--sh-lg); }
.drawer.open { transform: none; visibility: visible; }
.drawer .close { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; cursor: pointer; font-weight: 800; font-size: 24px; line-height: 1;
  background: #f1e8d4; color: var(--ink); border: 1px solid var(--line); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.drawer .close:hover { background: #ffe1d9; color: var(--red); }
.drawer h2 { font-weight: 900; font-size: 24px; margin: 0 44px 14px 0; line-height: 1.2; }
.drawer section { margin-bottom: 20px; }
.drawer h3 { margin-bottom: 8px; }
.big { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.big b { font-weight: 900; font-size: 20px; }
.cat-list, .path-list, .activity-list, .legend-list, .links, .tips { list-style: none; margin: 0; padding: 0; }
.cat-list li { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 8px; margin: 8px 0; font-weight: 800; font-size: 16px; }
.cnt { font-weight: 800; font-size: 15px; text-align: right; }
.path-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; margin: 6px 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font-weight: 800; }
.path-list li.off { background: #efece6; color: #5f5b54; }
.ptag { font-weight: 800; font-size: 14px; }
.path-list li.on .ptag { color: var(--green); }
.activity-list li { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; padding: 6px 0; border-bottom: 1px solid #eadfc6; }
.activity-list .when { color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.activity-list .empty { color: var(--ink-2); }
.small { font-size: 16px; margin: 0 0 8px; color: var(--ink-2); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.legend-list li { font-size: 16px; margin: 8px 0; }

.details .d-top { display: flex; gap: 14px; align-items: center; margin-right: 38px; }
.d-cat { display: inline-block; font-weight: 800; font-size: 14px; padding: 2px 10px; border-radius: 999px; color: #fff;
  background: color-mix(in srgb, var(--sign, #6b5a44) 50%, #000 50%); }
.details h2 { margin: 6px 0; }
.d-meta { display: flex; gap: 8px; align-items: center; }
.state-pill { font-weight: 800; font-size: 14px; padding: 2px 10px; border-radius: 999px; background: #e3e1dc; }
.state-pill.available { background: #fff1a0; } .state-pill.learning { background: #ffd2a6; } .state-pill.landed, .state-pill.consistent { background: #ffd95c; }
.diff { font-size: 15px; letter-spacing: 1px; color: #8a5a00; }
.d-desc { font-size: 16px; line-height: 1.55; }
.status-group { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; padding: 4px; background: #efe6d2; border-radius: var(--r); }
.status-group .pxbtn { --b: transparent; --bh: transparent; color: var(--ink); padding: 6px 4px; font-size: 15px; min-height: 40px; border-color: transparent; box-shadow: none; border-radius: 9px; }
.status-group .pxbtn[aria-checked="true"] { --b: var(--green); --bh: var(--green-hi); color: #fff; box-shadow: var(--sh-sm); }
.status-group .pxbtn[data-s="none"][aria-checked="true"] { --b: #4f4b44; --bh: #66615a; }
.warn { font-size: 15px; padding: 10px 12px; background: #fff3cc; border: 1px solid #e8c25a; border-radius: var(--r-sm); }
.details h3 { margin: 16px 0 6px; }
.tips li { position: relative; padding-left: 20px; margin: 7px 0; font-size: 16px; line-height: 1.5; }
.tips li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(#ffe680, #f0a21c); box-shadow: 0 0 0 1px rgba(168, 101, 12, .5); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links button { cursor: pointer; font-weight: 800; font-size: 15px; padding: 5px 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--sh-sm); }
.links button.ok { background: linear-gradient(#fff2b3, #ffd95c); border-color: rgba(168, 101, 12, .4); }
.links .none { font-size: 15px; color: var(--ink-2); }

.toast { position: fixed; z-index: 50; left: 50%; top: calc(var(--hud-h) + 70px); transform: translateX(-50%); padding: 10px 18px; max-width: calc(100% - 32px);
  background: rgba(36, 28, 18, .95); color: #fff; border-radius: 999px; font-weight: 800; font-size: 16px; box-shadow: var(--sh-lg); text-align: center; }

/* ---------- World toggle (Regular / Switch) ---------- */
.world-toggle { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 5px 0 14px; cursor: pointer;
  background: linear-gradient(#34557a, #223d5c); color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 22px; box-shadow: var(--sh-sm); }
.wt-k { font-weight: 800; font-size: 15px; color: #e3f3ff; }
.wt-opts { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(0, 0, 0, .28); }
.wt-opt { font-weight: 800; font-size: 15px; padding: 4px 11px; border-radius: 999px; color: #d6e6f5; transition: background .2s, color .2s; }
.world-toggle[aria-checked="false"] .wt-opt.reg { background: linear-gradient(#ffe680, #ffc928); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.world-toggle[aria-checked="true"] .wt-opt.sw { background: linear-gradient(#8ff5ea, #2ee6d6); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.world-toggle:active { transform: translateY(1px); }
.switch-banner { display: none; position: absolute; right: -22px; top: -12px; transform: rotate(8deg); padding: 3px 10px; background: linear-gradient(#8ff5ea, #2ee6d6); color: var(--ink);
  border-radius: 999px; font-weight: 900; font-size: 15px; box-shadow: var(--sh-sm); }

/* Switch world: teal-dusk sky, teal accents, mirrored map (positions + scenery are mirrored in app.js) */
body.world-switch .hud { background: linear-gradient(#2fa9c2 0%, #55c6cf 45%, #95dcd4 78%, #d9d0ff 100%); }
body.world-switch .switch-banner { display: block; }
body.world-switch .map { background-color: #b2d3cd; }
body.world-switch .switch-tint { fill: #19b7b5; opacity: .13; pointer-events: none; }
body.world-switch .sp-tab { background: linear-gradient(#0e7f7a, var(--teal)); }
body.world-switch .pbar-fill#overall-bar { background: linear-gradient(#a8fff5, #22cfc0); }
body.world-switch .px-panel { box-shadow: 0 2px 4px rgba(14, 110, 105, .12), 0 8px 22px rgba(14, 110, 105, .2); }
body.world-switch .chip.active { background: linear-gradient(#c9fff8, #79eee2); border-color: rgba(14, 127, 122, .45); }
.map.flip-out { animation: flipOut .22s ease-in forwards; }
.map.flip-in { animation: flipIn .26s ease-out; }
@keyframes flipOut { from { transform: scaleX(1); filter: brightness(1); } to { transform: scaleX(0); filter: brightness(1.3); } }
@keyframes flipIn { from { transform: scaleX(0); filter: brightness(1.3); } to { transform: scaleX(1); filter: brightness(1); } }

/* ---------- HUD strip over the map ---------- */
.hud-strip { left: 12px; top: 60px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; width: min(560px, calc(100% - 430px)); border-radius: var(--r); }
.hs-tier { display: flex; align-items: baseline; gap: 4px; padding-right: 12px; border-right: 1px solid #e6d9bb; white-space: nowrap; }
.hs-k { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.hs-tier b { font-weight: 900; font-size: 20px; }
#hs-tier-of { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.hs-goal { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.hs-goal.none { justify-content: space-between; }
.hs-hint { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.hs-goal-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.hs-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.hs-line { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-sub { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.goal-bar { display: block; height: 8px; width: 100%; }
.goal-bar .pbar-fill { display: block; background: linear-gradient(#ffb066, #ff7a00); }
.hs-change { font-weight: 800; font-size: 14px; padding: 4px 10px; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.choose { white-space: nowrap; }

/* ---------- Session panel ---------- */
.session { top: 12px; right: 12px; width: 390px; padding: 0; display: flex; flex-direction: column; z-index: 6; overflow: hidden; }
.session:not(.collapsed) { bottom: 12px; }
.session.collapsed .sp-scroll { display: none; }
body.drawer-open .session { display: none; }
.sp-bar { display: grid; grid-template-columns: 1fr auto auto; grid-template-areas: "tab tab caret" "pick count caret"; align-items: center; gap: 4px 10px;
  width: 100%; padding: 10px 14px; background: none; border: 0; cursor: pointer; text-align: left; border-radius: var(--r-lg); }
.sp-tab { grid-area: tab; justify-self: start; padding: 2px 10px; background: linear-gradient(var(--red-hi), var(--red)); color: #fff; border-radius: 999px; font-weight: 800; font-size: 14px; }
.sp-pick { grid-area: pick; font-weight: 900; font-size: 18px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-count { grid-area: count; font-weight: 800; font-size: 15px; color: var(--ink-2); }
.sp-caret { grid-area: caret; width: 12px; height: 12px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); border-radius: 2px; transform: rotate(45deg) translate(-3px, -3px); transition: transform .2s; }
.session:not(.collapsed) .sp-caret { transform: rotate(225deg) translate(-3px, -3px); }
.sp-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; border-top: 1px solid #eadfc6; }
.sp-note { font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 10px 0 8px; }
.sp-context { margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r); font-weight: 700; font-size: 16px; line-height: 1.4; border: 1px solid var(--line); }
.sp-context.goal { background: #ffeedd; }
.sp-context.side { background: #eeeaff; }
.sp-context.free { background: #fff6d5; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 800; font-size: 16px; color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.hint { font-size: 15px; padding: 8px 10px; background: #e2f7f4; border: 1px solid #8fd3cb; border-radius: var(--r-sm); margin: 8px 0 0; }
.tag.side { --sign: #8a63f2; }
.alts { margin-top: 18px; }
.alt.side { background: #f5f2ff; }
.sp-empty p { font-size: 16px; line-height: 1.5; }
body.sp-open .zoom { right: 414px; }

/* ---------- Goal on the map ---------- */
.edge .e-route { stroke: none; }
.edge.route .e-route { stroke: #ff8a1f; stroke-width: 28; opacity: .4; stroke-linecap: round; filter: blur(2px); animation: routeGlow 1.8s ease-in-out infinite; }
@keyframes routeGlow { 50% { opacity: .18; } }
.edge.offroute { opacity: .45; }
.node.dim .medal, .node.dim .arrow { opacity: .45; filter: saturate(.5); }
.node.dim .n-name { color: #4f4b44; background: rgba(240, 237, 230, .95); }
.node.goal .b-glow { fill: url(#g-glow-goal); }
.node.goal .ov-flag { display: block; right: -14px; top: -26px; }
.node.goal .n-name { background: linear-gradient(#ffe0bf, #ffc78f); border-color: rgba(200, 90, 0, .5); }
.node.on-path:not(.goal) .n-name { box-shadow: 0 0 0 2.5px #ff8a1f, var(--sh-sm); }
.node.static.goal .ov-flag { display: none; }

/* ---------- Details goal row, picker, celebration ---------- */
.d-goal { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; padding: 10px 12px; border: 1px dashed #e3a35a; border-radius: var(--r); background: #fff6e8; }
.d-goal-on { font-weight: 800; font-size: 16px; color: #8f4700; }
.d-goal-off { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.picker-list { list-style: none; margin: 10px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pk-cat { font-weight: 800; font-size: 16px; margin-top: 10px; }
.pk-item { width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 9px 12px; cursor: pointer; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); font-weight: 800; font-size: 16px; }
.pk-item:hover:not(:disabled) { background: #fff7d6; }
.pk-item.current { background: #ffeedd; border-color: rgba(200, 90, 0, .45); }
.pk-item:disabled { background: #f1ede5; color: #5f5a50; cursor: default; box-shadow: none; }
.pk-steps { font-weight: 700; font-size: 14px; white-space: nowrap; color: var(--ink-2); }
#picker-clear { margin-bottom: 4px; }
.celebrate { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(255, 245, 200, .5); backdrop-filter: blur(2px); }
.cel-card { max-width: 420px; width: 100%; padding: 24px; text-align: center; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); box-shadow: var(--sh-lg); }
.cel-trophy { display: flex; justify-content: center; animation: bob 1.4s ease-in-out infinite; filter: drop-shadow(0 6px 10px rgba(200, 130, 0, .35)); }
.cel-card h2 { font-weight: 900; font-size: 28px; margin: 12px 0 8px; }
.cel-card p { font-size: 16px; line-height: 1.5; }

/* ---------- Responsive (kept last so it overrides the base rules) ---------- */
@media (max-width: 980px) {
  .plank h1 { font-size: 24px; }
  .pbar { width: min(300px, 36vw); }
}
@media (max-width: 640px) {
  .hud-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 6px; padding: 8px 8px; }
  .hud-left, .hud-right, .hud-btns { gap: 6px; }
  .hud-right { flex-direction: row; align-items: center; }
  .hud-center { order: 3; width: 100%; gap: 6px; }
  .px-chip { height: 36px; padding: 0 10px; font-size: 15px; gap: 5px; }
  .px-chip.coin-chip { padding: 0 9px; }
  #streak-word { display: none; }
  .toast { top: 180px; font-size: 15px; border-radius: 16px; }
  .pxbtn { font-size: 15px; padding: 6px 12px; min-height: 36px; gap: 6px; }
  .hud-btns .mapico, .hud-btns .burger { display: none; }
  #btn-map { display: none; }
  .world-toggle { height: 36px; padding: 0 3px; gap: 4px; }
  .wt-k { display: none; }
  .wt-opt { font-size: 14px; padding: 3px 9px; }
  .plank { padding: 6px 14px; gap: 8px; width: 100%; justify-content: center; }
  .plank h1 { font-size: 21px; }
  .plank-ico svg { width: 30px; height: auto; }
  .plank-star svg { width: 20px; height: auto; }
  .pbar-row { width: 100%; }
  .pbar { flex: 1; width: auto; height: 12px; }
  .pbar-text { font-size: 15px; }
  .stars { display: none; }
  .switch-banner { right: -6px; top: -10px; font-size: 14px; }
  .filters { top: 8px; left: 8px; max-width: calc(100% - 16px); }
  .chip { font-size: 15px; padding: 5px 11px; }
  .legend { display: none; }
  .zoom { bottom: 92px; right: 8px; }
  .zbtn { width: 40px; height: 40px; }
  body.sp-open .zoom { display: none; }
  .hud-strip { left: 8px; right: 8px; top: 50px; width: auto; padding: 6px 10px; gap: 10px; }
  .hs-line { font-size: 15px; white-space: normal; line-height: 1.25; }
  .hs-sub { font-size: 14px; }
  .hs-k, #hs-tier-of { font-size: 14px; }
  .hs-tier b { font-size: 18px; }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 80%; border-radius: 18px 18px 0 0; transform: translateY(100%); }
  .drawer.menu { max-height: 90%; }
  .session { left: 0; right: 0; bottom: 0; top: auto !important; width: auto; max-height: 74%; border-radius: 18px 18px 0 0; }
  .session:not(.collapsed) { top: auto; bottom: 0; height: 74%; }
  .sp-bar { min-height: 64px; }
  .goal-title h2 { font-size: 20px; }
  .status-group { grid-template-columns: repeat(2, 1fr); }
  .celebrate { align-items: flex-end; }
  #btn-menu { padding: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
