/* Keys to the Universe: design system + screens */

:root {
  --bg: #F5F4FB;
  --bg-glow: #ECE6FF;
  --on-bg: #1E1B3A;    /* text drawn directly on the page background */
  --on-bg-2: #5B5878;
  --on-bg-3: #8D8AA8;
  --track: #E4E1F1;    /* progress tracks sitting on the background */
  --tint: #F5F4FB;     /* light fill inside cards (never themed) */
  --bg-2: #ECEAF7;
  --surface: #FFFFFF;
  --ink: #1E1B3A;
  --ink-2: #5B5878;
  --ink-3: #8D8AA8;
  --line: #E4E1F1;
  --brand: #6C4DF6;
  --brand-2: #3D7BFF;
  --brand-soft: #EEE9FF;
  --good: #17B26A;
  --bad: #F04461;
  --gold: #FFC43D;
  --rh: #3D7BFF;
  --lh: #F0821E;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(30, 27, 58, .05), 0 8px 24px rgba(30, 27, 58, .07);
  --shadow-lg: 0 2px 6px rgba(30, 27, 58, .06), 0 24px 60px rgba(30, 27, 58, .16);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, .9, .3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 85% -10%, var(--bg-glow), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--on-bg);
  transition: background-color .4s;
  font: 500 16px/1.45 Nunito, ui-rounded, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
#app { height: 100%; display: flex; flex-direction: column; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 34px; font-weight: 900; }
h2 { font-size: 24px; font-weight: 900; }
h3 { font-size: 18px; font-weight: 800; }
p { margin: 0; }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--on-bg-2); }
.small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center; margin-top: 18px; }
.row.end { justify-content: flex-end; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--on-bg-3); }
.eyebrow.light { color: rgba(255,255,255,.8); }
.ico { width: 22px; height: 22px; flex: none; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 22px; border-radius: 999px; text-decoration: none;
  background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line);
  transition: transform .25s var(--spring), box-shadow .2s, background .2s, filter .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.94); }
.btn .ico { width: 20px; height: 20px; }
.btn.primary {
  background: linear-gradient(180deg, #7B5FF8, var(--brand)); color: #fff;
  box-shadow: 0 4px 0 #4E31D0, 0 10px 22px rgba(108,77,246,.32);
}
.btn.primary:active { transform: translateY(3px) scale(.97); box-shadow: 0 1px 0 #4E31D0, 0 4px 10px rgba(108,77,246,.3); }
.btn.ghost { background: var(--surface); }
.btn.white { background: #fff; color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.btn.white.solid { background: var(--ink); color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
.btn.big { height: 56px; padding: 0 30px; font-size: 18px; }
.btn.sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn.danger { color: var(--bad); }
.btn.primary.danger { background: var(--bad); color: #fff; box-shadow: 0 4px 0 #B92741; }

.icon-btn {
  appearance: none; border: 0; background: var(--surface); color: var(--ink); cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font: 800 22px/1 Nunito, sans-serif;
  box-shadow: inset 0 0 0 2px var(--line); transition: transform .25s var(--spring); flex: none;
}
.icon-btn:active { transform: scale(.88); }
.icon-btn.sm { width: 34px; height: 34px; font-size: 20px; }

.chip-btn {
  appearance: none; border: 0; cursor: pointer; font: 800 14px Nunito, sans-serif; color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--line);
  transition: transform .25s var(--spring), background .2s, color .2s, box-shadow .2s;
}
.chip-btn:active { transform: scale(.92); }
.chip-btn .ico { width: 18px; height: 18px; }
.chip-btn.toggle.on { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 2px #CFC3FF; }

.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button {
  appearance: none; border: 0; background: transparent; font: 800 14px Nunito, sans-serif; color: var(--ink-2);
  height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer; transition: background .25s var(--ease), color .2s, box-shadow .25s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgba(30,27,58,.1); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { appearance: none; border: 0; cursor: pointer; font: 800 14px Nunito, sans-serif; padding: 8px 14px; border-radius: 999px; background: var(--surface); color: var(--ink-2); box-shadow: inset 0 0 0 2px var(--line); transition: all .2s; }
.chip.on { background: var(--ink); color: #fff; box-shadow: none; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }

/* ---------- layout ---------- */
.screen {
  flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(110px + var(--safe-b));
}
.page { max-width: 1120px; margin: 0 auto; padding: calc(22px + var(--safe-t)) 22px 30px; animation: page-in .45s var(--ease) both; }
.page > * { animation: rise .5s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .05s; }
.page > *:nth-child(3) { animation-delay: .1s; }
.page > *:nth-child(4) { animation-delay: .15s; }
.page > *:nth-child(5) { animation-delay: .2s; }
.page > *:nth-child(n+6) { animation-delay: .25s; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.85) translateY(10px); } 100% { opacity: 1; transform: none; } }
.pop { animation: pop .45s var(--spring) both; }

header.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.brand { display: inline-flex; align-items: flex-end; gap: 4px; font-size: 38px; }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); margin-bottom: 11px; }
.pills { display: flex; gap: 8px; }
.pill { display: flex; align-items: center; gap: 6px; background: var(--surface); padding: 8px 14px 8px 10px; border-radius: 999px; box-shadow: var(--shadow); font-size: 17px; }
.pill.flame .ico { color: #FF7A2E; }
.pill.stars-pill .ico { color: var(--gold); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 6px; border-radius: 999px; z-index: 20;
  background: rgba(255,255,255,.86); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: var(--shadow-lg);
}
.tab {
  display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 18px; border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-weight: 800; font-size: 15px;
  transition: background .3s var(--ease), color .2s, transform .25s var(--spring);
}
.tab:active { transform: scale(.92); }
.tab.active { background: var(--ink); color: #fff; }
.tab span { white-space: nowrap; }
@media (max-width: 560px) { .tab { padding: 0 14px; } .tab span { display: none; } .tab.active span { display: inline; } }

/* ---------- learn ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 30px; color: #fff; margin-bottom: 34px;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--c) 55%, #fff) 0%, var(--c) 45%, color-mix(in srgb, var(--c) 70%, #1E1B3A) 100%);
  box-shadow: 0 20px 50px color-mix(in srgb, var(--c) 35%, transparent);
}
.hero h2 { font-size: 32px; margin: 6px 0 8px; }
.hero p { opacity: .92; max-width: 460px; margin-bottom: 20px; }
.hero-body { position: relative; z-index: 1; }
.hero-keys {
  position: absolute; right: -30px; bottom: -40px; width: 340px; height: 200px; transform: rotate(-14deg);
  background:
    linear-gradient(90deg, transparent 0 9%, rgba(255,255,255,.0) 9%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.28) 0 38px, rgba(255,255,255,.1) 38px 41px);
  border-radius: 18px; animation: float 6s ease-in-out infinite;
}
.hero-keys::after {
  content: ''; position: absolute; inset: 0 0 45% 0;
  background: repeating-linear-gradient(90deg, transparent 0 27px, rgba(30,27,58,.35) 27px 51px, transparent 51px 82px, rgba(30,27,58,.35) 82px 106px, transparent 106px 123px);
  -webkit-mask: linear-gradient(#000, #000); border-radius: 18px 18px 6px 6px;
}
@keyframes float { 0%, 100% { transform: rotate(-14deg) translateY(0); } 50% { transform: rotate(-12deg) translateY(-10px); } }

.course { display: flex; flex-direction: column; gap: 10px; }
.unit-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); border-left: 8px solid var(--c); margin-top: 18px;
}
.unit-head p { color: var(--ink-2); font-size: 14px; }
.unit-head .eyebrow { color: var(--c); }
.ring {
  --p: 0; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 360deg), var(--bg-2) 0);
}
.ring span { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 900; font-size: 13px; }

.nodes { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 26px 0 10px; }
.node {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--on-bg);
  transform: translateX(var(--x)); width: 160px;
}
.node .disc {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 900;
  background: var(--surface); color: var(--c); box-shadow: 0 6px 0 var(--bg-2), var(--shadow);
  transition: transform .3s var(--spring), box-shadow .3s;
}
.node .glyph { font-family: Nunito, "Noto Music", sans-serif; display: grid; place-items: center; }
.node .glyph .ico { width: 34px; height: 34px; stroke-width: 3; }
.node:active .disc { transform: translateY(4px) scale(.95); box-shadow: 0 2px 0 var(--bg-2), var(--shadow); }
.node.done .disc { background: var(--c); color: #fff; box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000), 0 10px 22px color-mix(in srgb, var(--c) 35%, transparent); }
.node.current .disc {
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 80%, #fff), var(--c)); color: #fff;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000), 0 0 0 8px color-mix(in srgb, var(--c) 18%, transparent);
  animation: breathe 2.2s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000), 0 0 0 6px color-mix(in srgb, var(--c) 20%, transparent); } 50% { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 70%, #000), 0 0 0 16px color-mix(in srgb, var(--c) 6%, transparent); } }
.node.locked { color: var(--on-bg-3); }
.node.locked .disc { color: var(--ink-3); background: var(--bg-2); box-shadow: 0 6px 0 #DCD9EC; }
.node .label { font-weight: 800; font-size: 14px; text-align: center; line-height: 1.2; }
.node .bubble {
  position: absolute; top: -34px; background: var(--ink); color: #fff; font-weight: 900; font-size: 12px; letter-spacing: .08em;
  padding: 6px 12px; border-radius: 10px; animation: bob 1.6s ease-in-out infinite; z-index: 1;
}
.node .bubble::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -6px; border: 6px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.mini-stars { display: inline-flex; gap: 1px; }
.mini-stars .star svg { width: 15px; height: 15px; }
.star { color: #DAD7EA; display: inline-block; }
.star.on { color: var(--gold); }
.stars-big { display: flex; justify-content: center; gap: 6px; margin: 4px 0 10px; }
.stars-big .star svg { width: 64px; height: 64px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.08)); }
.stars-big .star:nth-child(2) svg { width: 80px; height: 80px; margin-top: -12px; }
.stars-big .star { animation: star-pop .6s var(--spring) both; }
.stars-big .star.on svg { filter: drop-shadow(0 4px 0 #E3A400) drop-shadow(0 8px 18px rgba(255,196,61,.5)); }
@keyframes star-pop { 0% { opacity: 0; transform: scale(.2) rotate(-40deg); } 100% { opacity: 1; transform: none; } }

/* ---------- full-screen layers ---------- */
.fullscreen {
  position: fixed; inset: 0; z-index: 40; background: radial-gradient(1200px 700px at 85% -10%, var(--bg-glow), transparent 60%), var(--bg); color: var(--on-bg); display: flex; flex-direction: column;
  opacity: 0; transform: translateY(24px); transition: opacity .3s var(--ease), transform .4s var(--ease);
}
.fullscreen.open { opacity: 1; transform: none; }
.ls-top { display: flex; align-items: center; gap: 14px; padding: calc(12px + var(--safe-t)) 18px 10px; }
.ls-title { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30%; }
.ls-steps { flex: 1; display: flex; gap: 6px; }
.ls-steps i { flex: 1; height: 10px; border-radius: 99px; background: var(--track); position: relative; overflow: hidden; }
.ls-steps i::after { content: ''; position: absolute; inset: 0; background: var(--c); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); border-radius: 99px; }
.ls-steps i.done::after { transform: scaleX(1); }
.ls-steps i.cur::after { transform: scaleX(.35); opacity: .6; }
.ls-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ls-center { flex: 1; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 16px 18px 30px; }
.ls-player { flex: 1; min-height: 0; display: flex; }
.ls-player .player .pl-top > .icon-btn { display: none; }
.learn-card { width: 100%; max-width: 760px; margin: auto 0; padding: 30px; }
.learn-card h2 { font-size: 30px; margin: 6px 0 10px; }
.learn-card .eyebrow { color: var(--c); }
.lead { font-size: 19px; line-height: 1.55; color: var(--ink-2); }
.lead b { color: var(--ink); }
.learn-visual { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.learn-kb { height: 170px; }
.mini-staff { width: 100%; height: 150px; display: block; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 2px var(--line); }
.chord-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hand-art svg { width: 100%; max-height: 240px; display: block; }
.hand-art .f { fill: #FFE1C9; stroke: #E9B48F; stroke-width: 2; }
.hand-art .palm { fill: #FFE1C9; stroke: #E9B48F; stroke-width: 2; }
.hand-art .fn { font: 900 18px Nunito, sans-serif; fill: var(--brand); text-anchor: middle; }
.hand-art .cap { font: 800 14px Nunito, sans-serif; fill: var(--ink-2); text-anchor: middle; }

/* ---------- player ---------- */
.player { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.player-host .player { background: radial-gradient(1200px 700px at 85% -10%, var(--bg-glow), transparent 60%), var(--bg); }
.player-host { z-index: 45; }
.pl-top { display: flex; align-items: center; gap: 14px; padding: calc(10px + var(--safe-t)) 16px 8px; }
.ls-player .pl-top { padding-top: 4px; }
.pl-title { min-width: 0; max-width: 40%; }
.pl-title .t { font-weight: 900; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-title .sub { font-size: 13px; color: var(--on-bg-2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-progress { flex: 1; height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; }
.pl-progress .bar { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transform-origin: left; transform: scaleX(0); border-radius: 99px; transition: transform .35s var(--ease); }
.pl-input { display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 99px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--line); font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.pl-input .ico { width: 18px; height: 18px; }
.pl-input.mode-midi { color: var(--good); }
.pl-input.mode-mic { color: var(--brand); }
.pl-input .lvl { --lvl: 0; width: 8px; height: 18px; border-radius: 4px; background: linear-gradient(to top, var(--good) calc(var(--lvl) * 100%), var(--bg-2) 0); transition: background .08s; }
@media (max-width: 700px) { .pl-input span { display: none; } .pl-title { max-width: 50%; } }

.pl-stage { flex: 1; min-height: 0; position: relative; margin: 4px 14px 0; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.pl-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pl-count { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font: 900 120px/1 Nunito, sans-serif; color: var(--brand); pointer-events: none; text-shadow: 0 6px 30px rgba(108,77,246,.25); }
.pl-count.pulse { animation: count .5s var(--spring); }
@keyframes count { 0% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.pl-toast { position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-weight: 800; font-size: 14px; opacity: 0; transition: all .35s var(--spring); pointer-events: none; max-width: 90%; text-align: center; }
.pl-toast.show { opacity: 1; transform: translate(-50%, 0); }
.pl-controls { display: flex; align-items: center; gap: 8px; padding: 10px 16px; flex-wrap: wrap; }
.pl-controls .spacer { flex: 1; }
.tempo { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 14px; }
.tempo-val { min-width: 44px; text-align: center; }
.player.demo .pl-stage { box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.player.demo .listen { background: var(--brand); color: #fff; box-shadow: none; }
.pl-keys { height: clamp(110px, 24vh, 220px); margin: 0 10px calc(10px + var(--safe-b)); }

.pl-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; z-index: 5; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.pl-overlay.open { display: flex; animation: page-in .25s both; }
.start-card, .result-card { max-width: 520px; width: 100%; text-align: center; padding: 30px; }
.start-card h2, .result-card h2 { font-size: 28px; margin: 6px 0 8px; }
.start-card p { color: var(--ink-2); }
.notice { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px !important; padding: 8px 14px; border-radius: 12px; background: var(--tint); font-weight: 700; font-size: 14px; color: var(--ink-2) !important; }
.notice .ico { width: 18px; height: 18px; }
.notice.ok { background: #E3F8EE; color: #0B7F4B !important; }
.notice.warn { background: #FFF1D6; color: #8A5A00 !important; }
.stats { display: flex; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.stat { background: var(--tint); border-radius: 16px; padding: 10px 16px; min-width: 86px; animation: rise .5s var(--ease) both; }
.stat:nth-child(2) { animation-delay: .1s; } .stat:nth-child(3) { animation-delay: .2s; } .stat:nth-child(4) { animation-delay: .3s; }
.stat b { display: block; font-size: 24px; font-weight: 900; }
.stat span { font-size: 12px; color: var(--ink-2); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.tips { text-align: left; color: var(--ink-2); padding-left: 20px; line-height: 1.7; }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear both; }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; } }

/* ---------- keyboard ---------- */
.kb { position: relative; width: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.kb-key { position: absolute; top: 0; transition: background .12s, transform .12s, box-shadow .12s; }
.kb-white {
  height: 100%; background: linear-gradient(180deg, #fff 80%, #F1F0F7); border: 1px solid #D9D6E8; border-top: 0;
  border-radius: 0 0 10px 10px; box-shadow: inset 0 -6px 0 #E6E4F0; z-index: 1;
}
.kb-black {
  height: 61%; background: linear-gradient(180deg, #3A3755, #1E1B33 85%); border-radius: 0 0 7px 7px; z-index: 2;
  box-shadow: inset 0 -5px 0 #0E0C1F, 0 3px 6px rgba(0,0,0,.25);
}
.kb-label { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-weight: 800; font-size: 12px; color: var(--ink-3); pointer-events: none; }
.kb-label.kb-middle { color: var(--brand); }
.kb-key.hint.kb-white { background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--rh) 28%, #fff) 100%); box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--rh) 45%, #fff); }
.kb-key.hint.hint-L.kb-white { background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--lh) 30%, #fff) 100%); box-shadow: inset 0 -6px 0 color-mix(in srgb, var(--lh) 50%, #fff); }
.kb-key.hint.kb-black { background: linear-gradient(180deg, color-mix(in srgb, var(--rh) 70%, #000), var(--rh)); }
.kb-key.hint.hint-L.kb-black { background: linear-gradient(180deg, color-mix(in srgb, var(--lh) 70%, #000), var(--lh)); }
.kb-finger {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font: 900 14px Nunito, sans-serif; color: #fff; background: var(--rh); pointer-events: none;
  animation: pop .35s var(--spring) both; box-shadow: 0 3px 8px rgba(61,123,255,.35);
}
.hint-L .kb-finger { background: var(--lh); box-shadow: 0 3px 8px rgba(240,130,30,.35); }
.kb-black .kb-finger { bottom: 10px; width: 22px; height: 22px; font-size: 12px; }
.kb-key.on-play.kb-white { background: linear-gradient(180deg, #F2EEFF, #DCD3FF); transform: translateY(2px); box-shadow: inset 0 -3px 0 #C8BBFF; }
.kb-key.on-play.kb-black { background: #6C4DF6; transform: translateY(2px); }
.kb-key.on-good.kb-white { background: linear-gradient(180deg, #E5FAF0, #9EE8C4); transform: translateY(2px); box-shadow: inset 0 -3px 0 #6AD9A3, 0 0 24px rgba(23,178,106,.5); }
.kb-key.on-good.kb-black { background: var(--good); transform: translateY(2px); box-shadow: 0 0 20px rgba(23,178,106,.6); }
.kb-key.on-bad.kb-white { background: linear-gradient(180deg, #FFECEF, #FFB3C0); box-shadow: inset 0 -3px 0 #FF8FA2; animation: shake .3s; }
.kb-key.on-bad.kb-black { background: var(--bad); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* ---------- library ---------- */
.import-card { display: flex; align-items: center; gap: 18px; padding: 20px 22px; border-radius: var(--radius); background: linear-gradient(135deg, #2A2554, #1E1B3A); color: #fff; margin-bottom: 20px; flex-wrap: wrap; }
.import-card p { opacity: .8; font-size: 14px; margin-top: 2px; }
.import-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: rgba(255,255,255,.12); }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 999px; padding: 0 16px; height: 46px; box-shadow: inset 0 0 0 2px var(--line); flex: 1 1 220px; color: var(--ink-3); }
.search input { border: 0; outline: 0; font: 700 16px Nunito, sans-serif; background: transparent; flex: 1; min-width: 0; color: var(--ink); }
.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.song-card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .3s var(--spring), box-shadow .3s; animation: rise .5s var(--ease) both; }
.song-card:active { transform: scale(.96); }
.cover { height: 110px; position: relative; display: flex; align-items: flex-end; justify-content: space-between; padding: 12px; }
.cover-note { position: absolute; right: -10px; top: -14px; color: rgba(255,255,255,.25); }
.cover-note .ico { width: 110px; height: 110px; stroke-width: 1.6; }
.tag { font-size: 11px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; padding: 5px 9px; border-radius: 8px; }
.tag.light { background: rgba(255,255,255,.25); color: #fff; backdrop-filter: blur(4px); }
.song-card .meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.song-card .meta b { font-weight: 900; line-height: 1.2; }
.song-card .meta span { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.progress-line { height: 6px; border-radius: 99px; background: var(--bg-2); margin-top: 8px; overflow: hidden; }
.progress-line i { display: block; height: 100%; background: var(--good); border-radius: 99px; }
.empty { grid-column: 1 / -1; padding: 30px; text-align: center; }
.sources { margin-top: 36px; }
.sources > p { margin: 6px 0 14px; }
.source-list { display: flex; flex-direction: column; gap: 10px; }
.source { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 16px; padding: 14px 16px; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .25s var(--spring); }
.source:active { transform: scale(.98); }
.source b { display: block; }
.source span { font-size: 14px; color: var(--ink-2); }
.source > .ico { color: var(--ink-3); width: 18px; }
.fmt { font-size: 11px; font-weight: 900; padding: 5px 9px; border-radius: 8px; letter-spacing: .04em; white-space: nowrap; }
.fmt-musicxml { background: #E7F0FF; color: #2459CC; }
.fmt-midi { background: #E3F8EE; color: #0B7F4B; }
.fmt-pdf { background: #FFF1D6; color: #8A5A00; }
.pdf-help { margin-top: 14px; background: var(--surface); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.pdf-help summary { font-weight: 800; cursor: pointer; }
.pdf-help p { margin-top: 8px; color: var(--ink-2); }

/* ---------- song page ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; text-decoration: none; color: var(--on-bg-2); margin-bottom: 12px; }
.back-link .ico { width: 18px; height: 18px; }
.song-hero { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; padding: 28px; border-radius: 28px; color: #fff; box-shadow: var(--shadow-lg); margin-bottom: 26px; }
.song-hero h1 { font-size: 36px; margin-top: 4px; }
.song-hero .by { opacity: .85; font-weight: 800; }
.song-hero .about { opacity: .9; max-width: 520px; margin-top: 8px; }
.facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.facts span { background: rgba(255,255,255,.2); padding: 5px 10px; border-radius: 10px; font-weight: 800; font-size: 13px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.song-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }
.song-cols h2 { margin-bottom: 12px; }
@media (max-width: 780px) { .song-cols { grid-template-columns: 1fr; } }
.plan { display: flex; flex-direction: column; gap: 14px; }
.plan-sec { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 6px 10px; }
.plan-head span { font-size: 13px; color: var(--ink-3); font-weight: 800; }
.plan-steps { display: flex; flex-direction: column; gap: 8px; }
.step { appearance: none; border: 0; font: inherit; color: inherit; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--tint); text-align: left; transition: transform .25s var(--spring), background .2s; }
.step:active { transform: scale(.97); }
.step.next { background: var(--brand-soft); box-shadow: inset 0 0 0 2px #CFC3FF; }
.step-text { flex: 1; display: flex; flex-direction: column; }
.step-text small { color: var(--ink-2); font-weight: 700; }
.hand-badge { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; font-size: 13px; color: #fff; flex: none; }
.h-R { background: var(--rh); }
.h-L { background: var(--lh); }
.h-both { background: linear-gradient(135deg, var(--lh) 50%, var(--rh) 50%); }
.free { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.free-row { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; color: var(--ink-2); margin-top: 8px; }
input[type=range] { width: 100%; accent-color: var(--brand); height: 28px; }

/* ---------- chords ---------- */
.chord-card { display: flex; flex-direction: column; gap: 12px; }
.chord-top { display: flex; gap: 18px; justify-content: space-between; flex-wrap: wrap; }
.chord-name h2 { font-size: 46px; line-height: 1; }
.chord-name h2 small { font-size: 18px; color: var(--ink-2); font-weight: 800; }
.chord-notes { display: flex; gap: 8px; margin: 10px 0 6px; }
.chord-notes span { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; font-size: 18px; background: var(--brand-soft); color: var(--brand); animation: pop .4s var(--spring) both; }
.chord-notes span:nth-child(2) { animation-delay: .05s; } .chord-notes span:nth-child(3) { animation-delay: .1s; } .chord-notes span:nth-child(4) { animation-delay: .15s; }
.chord-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.chord-actions .row { margin-top: 0; }
.chord-kb { height: 160px; margin: 6px 0; }
.pick-label { font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.pick-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { appearance: none; border: 0; cursor: pointer; font: 800 15px Nunito, sans-serif; padding: 9px 14px; border-radius: 12px; background: var(--tint); color: var(--ink); transition: all .2s var(--ease); }
.pick.on { background: var(--brand); color: #fff; transform: scale(1.04); }
.chords > h2 { margin-top: 30px; }
.chords > p { margin: 4px 0 12px; }
.prog-list { display: flex; flex-direction: column; gap: 10px; }
.prog { display: flex; align-items: center; gap: 12px; background: var(--surface); padding: 14px 16px; border-radius: 16px; box-shadow: var(--shadow); }
.prog b { display: block; font-size: 17px; }
.prog span { font-size: 14px; color: var(--ink-2); }

/* ---------- settings ---------- */
.settings .card { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.settings h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.settings h3 .ico { color: var(--brand); }
.set-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.set-row b { display: block; }
.set-row span { font-size: 14px; color: var(--ink-2); }
.inline { display: flex; align-items: center; gap: 10px; width: 220px; }
.val { font-weight: 800; font-size: 14px; color: var(--ink-2); min-width: 60px; }
.sub-card { background: var(--tint); border-radius: 16px; padding: 16px; margin-top: 8px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.mic-test { display: flex; align-items: center; gap: 16px; margin: 8px 0; }
.meter { flex: 1; height: 14px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), #9BE15D, var(--gold)); transform-origin: left; transform: scaleX(0); transition: transform .08s; }
.mic-test small { display: block; font-size: 11px; font-weight: 900; text-transform: uppercase; color: var(--ink-3); letter-spacing: .06em; }
.heard { font-size: 30px; font-weight: 900; min-width: 70px; color: var(--brand); }
.heard.flash { animation: pop .3s var(--spring); }
.badge { font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 10px; background: var(--bg-2); color: var(--ink-2); }
.badge.ok { background: #E3F8EE; color: #0B7F4B; }
.badge.warn { background: #FFF1D6; color: #8A5A00; }
.midi-help { color: var(--ink-2); font-size: 15px; }
.midi-help h4 { color: var(--ink); margin: 12px 0 4px; }
.midi-help ol { padding-left: 20px; margin: 4px 0; line-height: 1.7; }
.midi-help code { background: var(--surface); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--bg-2); transition: background .25s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .3s var(--spring); }
.switch input:checked + i { background: var(--good); }
.switch input:checked + i::after { transform: translateX(22px); }
.about { color: var(--on-bg-3); font-size: 13px; padding: 10px 6px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- modal / toast / onboarding ---------- */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(30,27,58,.4); display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .25s; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal-back.open { opacity: 1; }
.modal { max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 28px; }
.modal h2 { margin-bottom: 8px; }
.onb-hero { text-align: center; margin-bottom: 18px; }
.onb-hero p { color: var(--ink-2); margin-top: 6px; }
.onb-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.onb-opt { appearance: none; border: 0; cursor: pointer; font: inherit; color: inherit; display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px; border-radius: 18px; background: var(--tint); transition: transform .25s var(--spring), background .2s; }
.onb-opt:active { transform: scale(.97); }
.onb-opt b { display: block; }
.onb-opt small { color: var(--ink-2); font-weight: 700; font-size: 14px; }
.onb-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.toast-host { position: fixed; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 800; font-size: 15px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-14px) scale(.96); transition: all .35s var(--spring); max-width: min(560px, 90vw); }
.toast.show { opacity: 1; transform: none; }
.toast.ok { background: #0E8A55; }
.toast.bad { background: #C42A47; }

/* ---------- piano navigation ---------- */
.nav-focus { outline: none !important; position: relative; z-index: 3; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--brand), 0 8px 24px rgba(108,77,246,.35) !important; animation: nav-glow 1.6s ease-in-out infinite; }
.node.nav-focus { box-shadow: none !important; animation: none; }
.node.nav-focus .disc { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--brand), 0 10px 24px rgba(108,77,246,.35) !important; }
@keyframes nav-glow { 50% { box-shadow: 0 0 0 4px #fff, 0 0 0 9px color-mix(in srgb, var(--brand) 70%, #fff), 0 8px 24px rgba(108,77,246,.25); } }
.nav-legend {
  position: fixed; right: 16px; bottom: calc(18px + var(--safe-b)); z-index: 30; display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; border-radius: 18px;
  background: rgba(30,27,58,.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px) scale(.96); transition: opacity .3s, transform .35s var(--spring); pointer-events: none;
}
.nav-legend.show { opacity: 1; transform: none; }
.nav-legend-title { font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; opacity: .65; padding-left: 2px; }
.nav-legend-keys { display: flex; gap: 3px; }
.nav-legend-keys div { width: 40px; height: 54px; border-radius: 0 0 7px 7px; background: #fff; color: var(--ink); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 5px; font-size: 9.5px; font-weight: 900; line-height: 1.1; text-align: center; transition: background .15s, transform .15s, color .15s; }
.nav-legend-keys div small { color: var(--ink-3); font-size: 9px; }
.nav-legend-keys div.c4 { box-shadow: inset 0 -4px 0 var(--brand); }
.nav-legend-keys div.hit { background: var(--brand); color: #fff; transform: translateY(3px); }
.nav-legend-keys div.hit small { color: rgba(255,255,255,.8); }
@media (max-width: 1100px) { .nav-legend:not(.low) { bottom: calc(86px + var(--safe-b)); } }
.pl-count.word { font-size: 64px; color: var(--ink-2); }
.pl-count.word.go { color: var(--good); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 600px) {
  .page { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 28px; }
  .hero { padding: 22px; }
  .hero h2 { font-size: 26px; }
  .song-hero { padding: 22px; }
  .learn-card { padding: 22px; }
  .chord-actions { align-items: flex-start; }
}
.nav-map { display: flex; gap: 4px; margin-top: 6px; }
.nav-map div { flex: 1; max-width: 90px; height: 92px; border-radius: 0 0 12px 12px; background: linear-gradient(180deg, #fff 70%, #F1F0F7); box-shadow: inset 0 0 0 2px var(--line), inset 0 -6px 0 #E6E4F0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 12px; }
.nav-map div b { font-size: 13px; }
.nav-map div small { font-size: 11px; color: var(--ink-3); font-weight: 800; }
.nav-map div.c4 { background: linear-gradient(180deg, #fff 40%, var(--brand-soft)); box-shadow: inset 0 0 0 2px #CFC3FF, inset 0 -6px 0 #CFC3FF; }
.nav-map div.c4 b { color: var(--brand); }
.fs-pill { border: 0; cursor: pointer; color: var(--ink); padding: 8px 12px; }
.install-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 18px; border: 2px dashed #CFC3FF; }
.install-card b { display: block; }
.install-card span { color: var(--ink-2); font-size: 14px; }
.install-ic img { width: 52px; height: 52px; border-radius: 13px; display: block; }
.share-glyph { display: inline-flex; vertical-align: -4px; color: var(--brand-2); }
.share-glyph .ico { width: 18px; height: 18px; }
/* Big iPads (e.g. 13" iPad Pro): roomier keyboard and sheet */
@media (min-width: 1300px) and (min-height: 900px) {
  .pl-keys { height: clamp(150px, 25vh, 270px); }
  .learn-card { max-width: 900px; }
  .learn-kb { height: 210px; }
  .song-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}
.calib { text-align: center; }
.calib h2 { margin-bottom: 6px; }
.calib-kb { height: 120px; margin: 16px 0 12px; }
.calib-dots { display: flex; justify-content: center; gap: 8px; margin: 6px 0; }
.calib-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--bg-2); transition: background .3s, transform .3s var(--spring); }
.calib-dots i.on { background: var(--good); transform: scale(1.25); }
.calib-status { font-weight: 800; color: var(--brand); min-height: 24px; margin-top: 8px; }
.calib-status small { color: var(--ink-3); font-weight: 700; }
.calib-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; }
.calib-row b { display: block; }
.calib-row span { font-size: 14px; color: var(--ink-2); }

/* Everything that sits on a card keeps the normal ink colours on any theme. */
.card, .song-card, .unit-head, .plan-sec, .source, .prog, .install-card, .pill, .tabbar, .modal, .pdf-help,
.btn, .chip-btn, .chip, .icon-btn, .search, .pl-input, .stat, .toast, .seg { color: var(--ink); }
.card .muted, .modal .muted, .plan-sec .muted, .source .muted { color: var(--ink-2); }
.card .eyebrow, .modal .eyebrow { color: var(--ink-3); }
.learn-card .eyebrow { color: var(--c); }
.seg { background: var(--bg-2); }
.btn.white.solid { color: #fff; }
.btn.primary { color: #fff; }
.chip.on { color: #fff; }
.tab { color: var(--ink-2); }
.tab.active { color: #fff; }

/* ---------- background themes ---------- */
:root[data-theme="sky"]      { --bg: #E9F2FF; --bg-glow: #D3E5FF; --track: #D2E1F7; }
:root[data-theme="mint"]     { --bg: #E7F6EF; --bg-glow: #CDEFDF; --track: #CFE6DA; }
:root[data-theme="peach"]    { --bg: #FFF1E7; --bg-glow: #FFE0CB; --track: #F3DCCB; }
:root[data-theme="rose"]     { --bg: #FCECF2; --bg-glow: #F9D5E3; --track: #EED3DE; }
:root[data-theme="sand"]     { --bg: #F4EEE3; --bg-glow: #EADFCB; --track: #E2D7C4; }
:root[data-theme="slate"]    { --bg: #2B2F45; --bg-glow: #3B4160; --on-bg: #F4F3FA; --on-bg-2: #C4C6DB; --on-bg-3: #9A9DB8; --track: #424866; }
:root[data-theme="midnight"] { --bg: #16132E; --bg-glow: #2C2260; --on-bg: #F4F3FA; --on-bg-2: #C3BFE6; --on-bg-3: #9690C4; --track: #2F2A55; }
:root[data-theme="forest"]   { --bg: #12291F; --bg-glow: #1E4634; --on-bg: #F1F8F4; --on-bg-2: #BCD8C9; --on-bg-3: #8DB4A0; --track: #24453A; }
:root[data-theme="cocoa"]    { --bg: #2A1E1A; --bg-glow: #4A3128; --on-bg: #FAF3EF; --on-bg-2: #DCC6BB; --on-bg-3: #B39A8E; --track: #4A3830; }
:root[data-dark] .node.locked .disc { background: rgba(255,255,255,.12); color: var(--on-bg-3); box-shadow: 0 6px 0 rgba(0,0,0,.25); }
:root[data-dark] .node .disc { box-shadow: 0 6px 0 rgba(0,0,0,.3), var(--shadow); }
:root[data-dark] .ring span { color: var(--ink); }
:root[data-dark] .pl-overlay { background: color-mix(in srgb, var(--bg) 70%, transparent); }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { appearance: none; border: 0; cursor: pointer; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; font: 800 12px Nunito, sans-serif; color: var(--ink-2); padding: 0; }
.swatch i { width: 52px; height: 52px; border-radius: 16px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); position: relative; transition: transform .3s var(--spring), box-shadow .2s; }
.swatch i::after { content: ''; position: absolute; left: 12px; right: 12px; top: 14px; height: 18px; border-radius: 6px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.swatch.on i { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--brand); transform: scale(1.06); }
.swatch:active i { transform: scale(.92); }
:root[data-dark] .node .bubble { background: #fff; color: var(--ink); }
:root[data-dark] .node .bubble::after { border-top-color: #fff; }
.vol-row { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--brand); }
.vol-row input { flex: 1; }
.vol-val { min-width: 48px; font-weight: 900; color: var(--ink); text-align: right; }
.kb-key.on-soft.kb-white { background: linear-gradient(180deg, #F4F3F8, #E2E0EC); }
.kb-key.on-soft.kb-black { background: #5B5878; }

/* ===================== Universe layout (Learn tab) ===================== */
body.in-universe { background: #0B0B2B; }
body.in-universe .screen { color: #F4F3FA; }
.universe { position: relative; min-height: 100%; }
.cosmos { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.uni-page { position: relative; z-index: 1; color: #F4F3FA; --on-bg: #F4F3FA; --on-bg-2: #C9C6E6; --on-bg-3: #9C98C8; }
.uni-page .eyebrow { color: #B8B3E6; }
.uni-page .pill { background: rgba(255,255,255,.12); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.uni-page .fs-pill { color: #fff; }

.uni-next {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 22px 26px; border-radius: 28px; margin-bottom: 40px;
  background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.05)); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 20px 60px rgba(0,0,0,.35); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.uni-next h2 { font-size: 28px; margin: 4px 0 6px; }
.uni-next p { color: #D9D6F2; }
.uni-next-ship { width: 74px; height: 74px; flex: none; animation: hover-ship 3s ease-in-out infinite; }
.uni-next-ship svg, .ship svg { width: 100%; height: 100%; overflow: visible; }
@keyframes hover-ship { 0%, 100% { transform: translateY(0) rotate(8deg); } 50% { transform: translateY(-8px) rotate(14deg); } }
.flame { fill: #FFB547; transform-origin: 32px 46px; animation: flame .18s ease-in-out infinite alternate; }
@keyframes flame { from { transform: scaleY(.75); fill: #FFD36E; } to { transform: scaleY(1.15); fill: #FF7A2E; } }

.galaxy { position: relative; margin: 30px 0 70px; }
.galaxy-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.galaxy-head h2 { font-size: 30px; color: #fff; text-shadow: 0 0 24px var(--g1); }
.galaxy-head p { color: #D2CEF0; }
.galaxy-emblem { width: 76px; height: 76px; position: relative; flex: none; }
.galaxy-emblem i { position: absolute; inset: 0; border-radius: 50%; }
.galaxy-emblem i:first-child {
  background: conic-gradient(from 0deg, var(--g1) 0 9%, transparent 22% 47%, var(--g2) 50% 59%, transparent 72%);
  -webkit-mask: radial-gradient(circle, #000 12%, rgba(0,0,0,.8) 38%, transparent 72%); mask: radial-gradient(circle, #000 12%, rgba(0,0,0,.8) 38%, transparent 72%);
  animation: spin 14s linear infinite; filter: blur(2px) saturate(1.4); transform-origin: center;
}
.galaxy-emblem i:last-child { inset: 32%; background: radial-gradient(circle, #fff, var(--g3) 60%, transparent 75%); box-shadow: 0 0 22px var(--g3); }
@keyframes spin { to { transform: rotate(360deg); } }
.galaxy-count { text-align: center; color: #fff; }
.galaxy-count b { display: block; font-size: 22px; font-weight: 900; }
.galaxy-count span { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: #B8B3E6; font-weight: 800; }

.system { position: relative; padding: 10px 0 30px; }
.sun-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 12px; }
.sun { position: relative; width: 110px; height: 110px; }
.sun .core {
  position: absolute; inset: 18px; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #FFFDF0, #FFE27A 35%, #FFB23F 70%, #FF7A2E);
  box-shadow: 0 0 40px #FFC14D, 0 0 90px rgba(255,170,60,.55); animation: sun-pulse 4s ease-in-out infinite;
}
.sun .corona {
  position: absolute; inset: -10px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,214,120,.55) 0 4deg, transparent 4deg 16deg);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 42%, transparent 70%); mask: radial-gradient(circle, transparent 38%, #000 42%, transparent 70%);
  animation: spin 40s linear infinite; filter: blur(.5px);
}
@keyframes sun-pulse { 50% { transform: scale(1.05); box-shadow: 0 0 55px #FFC14D, 0 0 120px rgba(255,170,60,.6); } }
.sun-label { text-align: center; }
.sun-label small { display: block; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: #FFD58A; }
.sun-label b { font-size: 18px; color: #fff; }

.bodies { position: relative; display: flex; flex-direction: column; align-items: center; gap: 46px; padding: 30px 0 10px; }
.route { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.route-glow { fill: none; stroke: rgba(255,255,255,.08); stroke-width: 10; stroke-linecap: round; }
.route-dash { fill: none; stroke: rgba(255,255,255,.45); stroke-width: 2.5; stroke-dasharray: 2 12; stroke-linecap: round; animation: travel 2.4s linear infinite; }
@keyframes travel { to { stroke-dashoffset: -28; } }

.planet { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; transform: translateX(var(--off)); z-index: 1; }
.planet-body { position: relative; width: var(--size); height: var(--size); animation: bob 6s ease-in-out infinite; animation-delay: calc(var(--spin) * -0.3); }
.orb {
  position: absolute; inset: 0; border-radius: 50%; display: block; overflow: hidden; text-decoration: none;
  background: radial-gradient(circle at 32% 30%, color-mix(in srgb, var(--base) 35%, #fff), var(--base) 48%, color-mix(in srgb, var(--base) 55%, #000) 100%);
  filter: hue-rotate(var(--hue));
  box-shadow: 0 0 30px color-mix(in srgb, var(--base) 60%, transparent), 0 0 70px color-mix(in srgb, var(--base) 25%, transparent);
  transition: transform .35s var(--spring), box-shadow .3s;
}
.orb:active { transform: scale(.92); }
.orb .surface { position: absolute; inset: 0 -100%; transform: rotate(var(--tilt)); animation: rotate-surface var(--spin) linear infinite; mix-blend-mode: soft-light; }
@keyframes rotate-surface { from { translate: 0 0; } to { translate: 50% 0; } }
.kind-banded .surface { background: repeating-linear-gradient(180deg, rgba(255,255,255,.35) 0 7%, transparent 7% 13%, rgba(0,0,0,.25) 13% 18%, transparent 18% 26%); }
.kind-ringed .surface { background: repeating-linear-gradient(180deg, rgba(255,255,255,.25) 0 10%, transparent 10% 22%); }
.kind-rocky .surface, .kind-lava .surface, .kind-ice .surface {
  background:
    radial-gradient(circle at 10% 30%, rgba(0,0,0,.35) 0 6%, transparent 7%), radial-gradient(circle at 30% 70%, rgba(0,0,0,.3) 0 4%, transparent 5%),
    radial-gradient(circle at 55% 40%, rgba(0,0,0,.3) 0 8%, transparent 9%), radial-gradient(circle at 75% 75%, rgba(0,0,0,.25) 0 5%, transparent 6%),
    radial-gradient(circle at 90% 25%, rgba(0,0,0,.3) 0 6%, transparent 7%);
  background-size: 50% 100%;
}
.kind-lava .surface { mix-blend-mode: screen; background: radial-gradient(circle at 20% 40%, rgba(255,200,60,.7) 0 5%, transparent 6%), radial-gradient(circle at 60% 70%, rgba(255,120,40,.6) 0 7%, transparent 8%), radial-gradient(circle at 80% 30%, rgba(255,220,90,.6) 0 4%, transparent 5%); background-size: 50% 100%; }
.kind-ice .surface { mix-blend-mode: screen; opacity: .6; }
.kind-ocean .surface { background: radial-gradient(ellipse at 20% 40%, rgba(120,255,170,.55) 0 12%, transparent 13%), radial-gradient(ellipse at 65% 65%, rgba(120,255,170,.45) 0 10%, transparent 11%), radial-gradient(ellipse at 85% 30%, rgba(255,255,255,.5) 0 6%, transparent 7%); background-size: 50% 100%; mix-blend-mode: normal; }
.orb .shade { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.35), transparent 30%), radial-gradient(circle at 75% 78%, rgba(0,0,0,.55), transparent 65%); }
.planet-body .p-ring { position: absolute; left: -34%; right: -34%; top: 39%; height: 24%; border-radius: 50%; border: 5px solid color-mix(in srgb, var(--base) 35%, #fff); transform: rotate(-16deg); pointer-events: none; filter: hue-rotate(var(--hue)); }
.ring-back { z-index: 0; clip-path: inset(0 0 50% 0); opacity: .7; }
.ring-front { z-index: 2; clip-path: inset(50% 0 0 0); box-shadow: 0 4px 10px rgba(0,0,0,.25); }
.planet-body .orb { z-index: 1; }
.planet.locked .p-ring { filter: saturate(.4) brightness(.7); }
.orb .lock { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.85); }
.orb .lock .ico { width: 28px; height: 28px; }
.orb .flag { position: absolute; right: 8%; bottom: 8%; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.8); }
.orb .flag .ico { width: 18px; height: 18px; stroke-width: 3; }
.planet.locked .orb { filter: hue-rotate(var(--hue)) saturate(.45) brightness(.72); box-shadow: 0 0 22px color-mix(in srgb, var(--base) 25%, transparent); }
.planet.current .orb { box-shadow: 0 0 0 6px rgba(255,255,255,.18), 0 0 40px var(--base), 0 0 90px color-mix(in srgb, var(--base) 50%, transparent); animation: planet-call 2.4s ease-in-out infinite; }
@keyframes planet-call { 50% { box-shadow: 0 0 0 14px rgba(255,255,255,.06), 0 0 60px var(--base), 0 0 120px color-mix(in srgb, var(--base) 60%, transparent); } }
.planet.done .orb { box-shadow: 0 0 36px color-mix(in srgb, var(--base) 70%, transparent), 0 0 0 3px rgba(255,255,255,.25); }

.moon-orbit { position: absolute; left: 50%; top: 50%; width: calc(var(--r) * 2); height: calc(var(--r) * 2); margin: calc(var(--r) * -1) 0 0 calc(var(--r) * -1); border-radius: 50%; border: 1px dashed rgba(255,255,255,.18); animation: spin var(--dur) linear infinite; animation-delay: var(--delay); pointer-events: none; }
.moon { position: absolute; top: -11px; left: calc(50% - 11px); width: 22px; height: 22px; border-radius: 50%; pointer-events: auto;
  background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--base) 40%, #d9d6e8) 45%, color-mix(in srgb, var(--base) 30%, #5d5a75) 100%);
  box-shadow: 0 0 12px rgba(255,255,255,.4); }
.moon.locked { filter: grayscale(1) brightness(.6); box-shadow: none; }
.moon.done { box-shadow: 0 0 12px var(--good), 0 0 0 2px rgba(23,178,106,.7); }

.ship { position: absolute; width: 54px; height: 54px; right: -46px; top: -30px; animation: orbit-ship 5s ease-in-out infinite; z-index: 3; pointer-events: none; }
@keyframes orbit-ship { 0%, 100% { transform: translate(0, 0) rotate(-35deg); } 50% { transform: translate(-10px, -12px) rotate(-28deg); } }

.body-label { text-align: center; max-width: 220px; position: relative; z-index: 3; }
.moon-chips { position: relative; z-index: 3; }
.body-label small { display: block; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #B8B3E6; }
.body-label b { font-size: 17px; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.body-label .mini-stars { display: flex; justify-content: center; margin-top: 2px; }
.planet.locked .body-label b { color: #9C98C8; }

.moon-chips { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.moon-chip {
  display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 8px; border-radius: 999px; color: #fff; text-decoration: none; font-weight: 800; font-size: 14px;
  background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .25s var(--spring), background .2s;
}
.moon-chip:active { transform: scale(.95); }
.moon-chip small { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #B8B3E6; font-weight: 900; }
.moon-chip .ico { width: 16px; height: 16px; opacity: .7; }
.moon-chip.locked { color: #9C98C8; }
.moon-chip.current { background: rgba(255,255,255,.22); box-shadow: inset 0 0 0 2px rgba(255,255,255,.6), 0 0 24px rgba(255,255,255,.25); }
.moon-dot { width: 18px; height: 18px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #fff, color-mix(in srgb, var(--base) 40%, #d9d6e8) 50%, #5d5a75); }

.uni-page .install-card { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }
.uni-page .install-card span { color: #D9D6F2; }
.uni-page .nav-focus { box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 0 30px rgba(255,255,255,.5) !important; }
.planet .orb.nav-focus { box-shadow: 0 0 0 5px #fff, 0 0 40px #fff !important; }
@media (min-width: 900px) { .bodies { gap: 56px; } }
@media (max-width: 600px) { .planet { transform: translateX(calc(var(--off) * .5)); } .galaxy-head h2 { font-size: 24px; } }
@media (prefers-reduced-motion: reduce) { .moon-orbit, .orb .surface, .planet-body, .ship, .uni-next-ship, .route-dash, .sun .corona, .galaxy-emblem i { animation: none !important; } }

/* ===================== Handbook ===================== */
.hb-pill { text-decoration: none; color: var(--ink); font-size: 15px; }
.hb-pill .ico { color: var(--brand); }
.uni-page .hb-pill .ico { color: #D7CCFF; }
.hb-search { margin-bottom: 22px; max-width: 640px; }
.hb-unit { margin-bottom: 30px; }
.hb-unit-head { border-left: 6px solid var(--c); padding-left: 14px; margin-bottom: 12px; }
.hb-unit-head .eyebrow { color: var(--c); }
.hb-cards { display: flex; flex-direction: column; gap: 10px; }
.hb-card { background: var(--surface); color: var(--ink); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.hb-card-head { appearance: none; border: 0; background: none; font: inherit; color: inherit; width: 100%; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.hb-card-head b { display: block; font-size: 17px; }
.hb-card-head small { color: var(--ink-3); font-weight: 700; font-size: 13px; }
.hb-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
.hb-chev { color: var(--ink-3); transition: transform .3s var(--spring); }
.hb-card.open .hb-chev { transform: rotate(90deg); }
.hb-body { display: none; padding: 0 18px 18px 44px; }
.hb-card.open .hb-body { display: block; animation: rise .35s var(--ease) both; }
.hb-card.locked { opacity: .7; }
.hb-card.locked .hb-card-head { cursor: default; color: var(--ink-2); }
.hb-card.locked .ico { width: 18px; height: 18px; color: var(--ink-3); }
.hb-body .lead { font-size: 17px; }
.hb-body .mini-staff { height: 200px; }

/* ---- textured worlds ---- */
.planet { margin-top: var(--lift, 0); }
.planet-body { animation-duration: var(--bob, 6s); }
.orb { filter: none; background: #222; }
.orb .tiltw { position: absolute; inset: -22%; transform: rotate(var(--tilt)); pointer-events: none; }
.orb .tex { position: absolute; top: 0; bottom: 0; left: 0; width: 200%; background-repeat: repeat-x; background-size: 50% 100%; animation: world-spin var(--spin) linear infinite; animation-direction: var(--dir); will-change: transform; }
.orb .tex.clouds { opacity: .85; }
@keyframes world-spin { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.orb .shade {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle at 33% 30%, rgba(255,255,255,.32), transparent 32%),
    radial-gradient(circle at 50% 50%, transparent 52%, rgba(0,0,0,.35) 70%, rgba(0,0,0,.65) 100%),
    radial-gradient(circle at 72% 76%, rgba(0,0,0,.55), transparent 62%);
}
.orb .shade.atmo { box-shadow: inset 0 0 14px rgba(140,200,255,.55); }
.planet .orb { box-shadow: 0 0 26px color-mix(in srgb, var(--base) 55%, transparent), 0 0 70px color-mix(in srgb, var(--base) 20%, transparent); }
.planet.locked .orb { filter: saturate(.45) brightness(.7); }
.planet-body .p-ring { transform: rotate(var(--rt, -16deg)); filter: none; border-color: color-mix(in srgb, var(--base) 30%, #F2E6D0); border-width: 6px; opacity: .9; }
.planet-body .ring-back { opacity: .55; }
.moon-path { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 1px dashed rgba(255,255,255,.2); pointer-events: none; z-index: 0; }
.moon3d { position: absolute; left: 50%; top: 50%; width: var(--ms, 20px); height: var(--ms, 20px); border-radius: 50%; overflow: hidden; display: block; z-index: 4; box-shadow: 0 0 10px rgba(255,255,255,.35); background: #888; transition: filter .3s; }
.moon3d.behind { filter: brightness(.55); }
.moon3d.done { box-shadow: 0 0 0 2px rgba(23,178,106,.85), 0 0 12px rgba(23,178,106,.6); }
.moon3d.locked { filter: saturate(.3) brightness(.6); }
.moon3d.locked.behind { filter: saturate(.3) brightness(.4); }
.moon-orbit { display: none; }
@media (prefers-reduced-motion: reduce) { .orb .tex { animation: none !important; } }

/* ===================== Boss battles ===================== */
.energy { position: relative; width: 150px; height: 22px; border-radius: 99px; background: rgba(240,68,97,.15); overflow: hidden; flex: none; box-shadow: inset 0 0 0 2px rgba(240,68,97,.35); }
.energy i { position: absolute; inset: 0; transform-origin: left; transform: scaleX(.6); background: linear-gradient(90deg, #F04461, #FFC43D 55%, #17B26A); transition: transform .35s var(--spring); }
.energy span { position: relative; z-index: 1; display: block; text-align: center; font: 900 11px/22px Nunito, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.energy.low { animation: low-pulse .6s ease-in-out infinite alternate; }
.energy.hurt { animation: shake .3s; }
@keyframes low-pulse { to { box-shadow: inset 0 0 0 2px #F04461, 0 0 16px rgba(240,68,97,.7); } }
.player.exam .tempo { opacity: .4; pointer-events: none; }
.player.exam .pl-stage { box-shadow: 0 0 0 3px rgba(240,68,97,.25), 0 0 40px rgba(240,68,97,.15), var(--shadow); }
.boss-card { background: radial-gradient(120% 120% at 50% 0%, #3A1030, #1A0C24); color: #fff; box-shadow: 0 0 0 2px rgba(255,90,120,.4), 0 30px 80px rgba(240,68,97,.35); }
.boss-card p { color: #F2D7E3 !important; }
.boss-card .eyebrow { color: #FF8FA8; }
.boss-emblem { position: relative; width: 110px; height: 110px; margin: 0 auto 8px; display: grid; place-items: center; }
.boss-emblem i { position: absolute; inset: 0; border-radius: 50%; }
.boss-emblem i:first-child { background: conic-gradient(from 0deg, #F04461, #7C3AED, #F97316, #F04461); filter: blur(8px); animation: spin 3s linear infinite; }
.boss-emblem i:nth-child(2) { inset: 10px; background: radial-gradient(circle, #2A0A1F 55%, #000); box-shadow: inset 0 0 20px rgba(255,80,110,.6); }
.boss-emblem span { position: relative; font-size: 44px; animation: bob 2s ease-in-out infinite; }
.exam-result.won .exam-badge { background: linear-gradient(90deg, #FFC43D, #F97316); }
.exam-result.lost .exam-badge { background: linear-gradient(90deg, #6B7280, #374151); }
.exam-badge { display: inline-block; color: #fff; font: 900 14px Nunito, sans-serif; letter-spacing: .12em; text-transform: uppercase; padding: 8px 16px; border-radius: 99px; margin-bottom: 8px; animation: pop .5s var(--spring) both; }
.pl-count.word { font-size: 64px; }
.backup-offer { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; border-radius: 14px; background: var(--tint); color: var(--ink-2); font-weight: 700; font-size: 14px; }
.boss-card .backup-offer { background: rgba(255,255,255,.08); color: #F2D7E3; }
.lesson-loading { align-items: center; justify-content: center; gap: 14px; font-weight: 800; color: var(--on-bg-2); }
.spinner { width: 48px; height: 48px; border-radius: 50%; border: 5px solid var(--track); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.song-hero .credit { opacity: .8; font-size: 13px; margin-top: 8px; } .song-hero .credit a { color: #fff; }

/* ---- Guardian (boss) worlds ---- */
.guardian { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 10px 0 20px; }
.guardian-orb { position: relative; width: 150px; height: 150px; display: block; text-decoration: none; transition: transform .35s var(--spring); }
.guardian-orb:active { transform: scale(.94); }
.guardian-orb .disk { position: absolute; inset: -18px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, var(--g1), #fff6, var(--g2), transparent 60%, var(--g1), transparent); filter: blur(6px); transform: scaleY(.38) rotate(0deg); animation: accrete 4s linear infinite; }
.guardian-orb .disk.d2 { inset: -30px; opacity: .55; animation-duration: 7s; animation-direction: reverse; filter: blur(10px); }
@keyframes accrete { from { transform: scaleY(.38) rotate(0deg); } to { transform: scaleY(.38) rotate(360deg); } }
.guardian-orb .core { position: absolute; inset: 26px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #000 55%, #1a0010 70%, var(--g1) 100%); box-shadow: 0 0 30px var(--g1), 0 0 80px color-mix(in srgb, var(--g1) 60%, transparent), inset 0 0 25px var(--g2); animation: core-pulse 3s ease-in-out infinite; }
@keyframes core-pulse { 50% { box-shadow: 0 0 45px var(--g1), 0 0 120px color-mix(in srgb, var(--g1) 70%, transparent), inset 0 0 35px var(--g2); } }
.guardian-orb .g-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 38px; filter: drop-shadow(0 0 10px var(--g1)); animation: bob 2.4s ease-in-out infinite; }
.guardian-orb .lock { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,255,255,.75); }
.guardian.locked .guardian-orb { filter: saturate(.4) brightness(.65); }
.guardian.current .guardian-orb .core { box-shadow: 0 0 0 8px rgba(255,255,255,.15), 0 0 50px var(--g1), 0 0 140px var(--g1); }
.guardian.done .guardian-orb .core { background: radial-gradient(circle, #1a1405 50%, #FFC43D 100%); box-shadow: 0 0 40px #FFC43D, 0 0 90px rgba(255,196,61,.5); }
.guardian .body-label small { color: #FF8FA8; }
.guardian.done .body-label small { color: #FFD58A; }
.guardian .g-sub { display: block; color: #C9C6E6; font-weight: 700; font-size: 13px; }
.guardian-ship { right: -10px; top: -10px; }
.node.boss .disc { width: 100px; height: 100px; background: radial-gradient(circle, #2A0A1F 50%, #F04461); color: #fff; box-shadow: 0 6px 0 #7A1530, 0 0 30px rgba(240,68,97,.45); }
.node.boss.locked .disc { filter: saturate(.3) brightness(.8); }
.node.boss.done .disc { background: radial-gradient(circle, #3A2A05 50%, #FFC43D); box-shadow: 0 6px 0 #A06A00, 0 0 30px rgba(255,196,61,.5); }

/* ===================== Stardust economy ===================== */
.wallet-pill { text-decoration: none; color: var(--ink); gap: 6px; }
.wallet-pill .sd, .sd { color: #B98CFF; text-shadow: 0 0 10px rgba(185,140,255,.7); font-weight: 900; }
.wallet-pill.big { font-size: 20px; padding: 10px 18px 10px 14px; }
.wallet-pill.bump { animation: pop .45s var(--spring); }
.uni-page .wallet-pill { color: #fff; }
.stardust-burst { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 120; pointer-events: none; display: flex; flex-direction: column; align-items: center; animation: sd-rise 2.2s var(--ease) both; }
.stardust-burst b { font: 900 46px Nunito, sans-serif; color: #fff; text-shadow: 0 0 20px #B98CFF, 0 0 40px #7C3AED, 0 4px 0 #4C1D95; }
.stardust-burst span { font-weight: 900; color: #fff; background: rgba(76,29,149,.85); padding: 4px 12px; border-radius: 99px; margin-top: 4px; font-size: 14px; }
.stardust-burst .dust { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle, #fff, #C4B5FD 50%, transparent 70%); animation: dust 1.4s ease-out both; }
@keyframes sd-rise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 25% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -90%); } }
@keyframes dust { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

/* Shop */
.shop-note { background: linear-gradient(135deg, #7C3AED, #3D7BFF); color: #fff; padding: 14px 18px; border-radius: 16px; margin-bottom: 16px; }
.earn-card { background: var(--surface); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 24px; }
.earn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 22px; margin-top: 8px; }
.earn-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-2); border-bottom: 1px dashed var(--line); padding: 4px 0; }
.earn-row b { color: #7C3AED; white-space: nowrap; }
.shop-cat { margin-bottom: 28px; }
.shop-cat > p { margin: 2px 0 12px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.shop-item { background: var(--surface); color: var(--ink); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .3s var(--spring); animation: rise .45s var(--ease) both; }
.shop-item.on { box-shadow: 0 0 0 3px #7C3AED, var(--shadow); }
.shop-preview { height: 120px; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #2A2560, #120F2E); position: relative; overflow: hidden; }
.shop-meta { padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.shop-meta span { font-size: 13px; color: var(--ink-2); }
.shop-buy { padding: 8px 14px 14px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.ship-demo { width: 70px; height: 70px; animation: hover-ship 3s ease-in-out infinite; }
.ship-demo svg { width: 100%; height: 100%; overflow: visible; }
.blink { animation: blink 1s steps(2) infinite; } .blink.b2 { animation-delay: .5s; }
@keyframes blink { 50% { opacity: .2; } }
.glow { animation: glow-pulse 1.6s ease-in-out infinite alternate; }
@keyframes glow-pulse { to { opacity: .35; } }
.flame.f2 { animation-delay: .09s; }
.prev-amb { display: flex; flex-direction: column; gap: 10px; }
.amb-art { width: 120px; height: 46px; border-radius: 30px; background: linear-gradient(90deg, #6C4DF6, #3D7BFF, #EC4899, #6C4DF6); background-size: 300% 100%; animation: amb-flow 6s linear infinite; opacity: .8; filter: blur(.5px); }
.amb-art.amb-none { background: #3A3660; animation: none; }
@keyframes amb-flow { to { background-position: 300% 0; } }
.prev-kb, .prev-press { background: linear-gradient(180deg, #ECEAF7, #fff); padding: 10px; }
.kb-demo { width: 100%; height: 96px; }

/* Completion effects demo + real */
.fx-demo { position: relative; width: 70px; height: 70px; }
.fx-demo .demo-orb { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #9FE3FF, #3D7BFF 50%, #1B2A6B); box-shadow: inset -8px -8px 18px rgba(0,0,0,.5); }
.fx-demo.fx-check .demo-fx { position: absolute; right: -2px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px #fff; }
.fx-demo.fx-supernova .demo-fx, .fx-supernova .nova-ring { position: absolute; inset: -10px; border-radius: 50%; border: 3px solid #FFE58A; box-shadow: 0 0 22px #FFC43D, inset 0 0 14px #FFC43D; animation: nova 2.4s ease-out infinite; }
.fx-supernova .nova-ring.r2 { animation-delay: 1.2s; }
@keyframes nova { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }
.fx-demo.fx-heavenly .demo-fx { position: absolute; left: 10%; right: 10%; top: -16px; height: 12px; border-radius: 50%; border: 3px solid #FFE9A8; box-shadow: 0 0 16px #FFE9A8; animation: halo 3s ease-in-out infinite; }
@keyframes halo { 50% { transform: translateY(-4px); } }
.fx-demo.fx-restore .demo-orb { animation: restore-demo 3s ease-in-out infinite; }
@keyframes restore-demo { 0%, 30% { filter: grayscale(1) brightness(.5) sepia(.6) hue-rotate(230deg); } 60%, 100% { filter: none; box-shadow: 0 0 20px #5EEAD4, inset -8px -8px 18px rgba(0,0,0,.5); } }
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.planet.fx-supernova.done .orb { box-shadow: 0 0 30px #FFC43D, 0 0 80px rgba(255,196,61,.45); }
.planet.fx-heavenly .halo { position: absolute; left: 14%; right: 14%; top: -22px; height: 16px; border-radius: 50%; border: 4px solid #FFE9A8; box-shadow: 0 0 18px #FFE9A8, inset 0 0 8px #FFE9A8; animation: halo 3s ease-in-out infinite; }
.planet.fx-heavenly .rays { position: absolute; inset: -40%; background: repeating-conic-gradient(rgba(255,240,190,.18) 0 6deg, transparent 6deg 24deg); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); animation: spin 30s linear infinite; z-index: -1; }
.planet.fx-heavenly .cloud { position: absolute; width: 60%; height: 26%; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,255,255,.95), rgba(255,255,255,0) 70%); filter: blur(2px); }
.planet.fx-heavenly .cloud.c1 { left: -22%; bottom: 8%; animation: cloud-drift 7s ease-in-out infinite; }
.planet.fx-heavenly .cloud.c2 { right: -22%; bottom: 26%; animation: cloud-drift 9s ease-in-out infinite reverse; }
@keyframes cloud-drift { 50% { transform: translateX(14px); } }
.planet.fx-restore.done .healed { position: absolute; inset: -8px; border-radius: 50%; box-shadow: 0 0 24px #5EEAD4, 0 0 60px rgba(94,234,212,.35); }
.planet.corrupt .orb { filter: grayscale(.85) brightness(.55) sepia(.5) hue-rotate(230deg); }
.planet.corrupt.locked .orb { filter: grayscale(.9) brightness(.45) sepia(.5) hue-rotate(230deg); }
.orb .corruption { position: absolute; inset: 0; border-radius: 50%; background: repeating-radial-gradient(circle at 30% 40%, rgba(170,60,255,.45) 0 2px, transparent 2px 14px), repeating-linear-gradient(60deg, rgba(120,30,200,.35) 0 2px, transparent 2px 18px); mix-blend-mode: screen; animation: corrupt 4s ease-in-out infinite alternate; }
@keyframes corrupt { to { opacity: .4; transform: rotate(8deg); } }
.planet.celebrate .orb { animation: celebrate-orb 1.6s var(--spring) both; }
@keyframes celebrate-orb { 0% { transform: scale(1); } 20% { transform: scale(1.35); filter: brightness(2.4); } 100% { transform: scale(1); } }
.celebration { position: absolute; left: 50%; top: 50%; z-index: 5; pointer-events: none; }
.celebration i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #FFE58A; box-shadow: 0 0 10px #FFC43D; animation: shard 1.4s ease-out both; }
.fx-heavenly .celebration i { background: #fff; box-shadow: 0 0 12px #FFF7D6; }
.fx-restore .celebration i { background: #5EEAD4; box-shadow: 0 0 12px #5EEAD4; }
@keyframes shard { from { transform: rotate(var(--a)) translateX(0) scale(1.4); opacity: 1; } to { transform: rotate(var(--a)) translateX(var(--d)) scale(.2); opacity: 0; } }

/* Keyboard themes */
.kbt-midnight .kb-white { background: linear-gradient(180deg, #2A2742 80%, #1E1B33); border-color: #3B3858; box-shadow: inset 0 -6px 0 #151229; }
.kbt-midnight .kb-black { background: linear-gradient(180deg, #F5F4FB, #D9D6E8 85%); box-shadow: inset 0 -5px 0 #B8B4CF, 0 3px 6px rgba(0,0,0,.3); }
.kbt-midnight .kb-label { color: #8D8AA8; }
.kbt-wood .kb-white { background: linear-gradient(180deg, #FFF8EC 80%, #F1E3C8); border-color: #D9C29C; box-shadow: inset 0 -6px 0 #E8D3AE; }
.kbt-wood .kb-black { background: linear-gradient(180deg, #6B3F22, #3E220F 85%); box-shadow: inset 0 -5px 0 #2A1608, 0 3px 6px rgba(0,0,0,.3); }
.kbt-pastel .kb-white:nth-child(7n+1) { background: linear-gradient(180deg, #fff 60%, #FFD6E0); } .kbt-pastel .kb-white:nth-child(7n+2) { background: linear-gradient(180deg, #fff 60%, #FFE7C7); }
.kbt-pastel .kb-white:nth-child(7n+3) { background: linear-gradient(180deg, #fff 60%, #FFF6C2); } .kbt-pastel .kb-white:nth-child(7n+4) { background: linear-gradient(180deg, #fff 60%, #D6F5D6); }
.kbt-pastel .kb-white:nth-child(7n+5) { background: linear-gradient(180deg, #fff 60%, #CFEFFF); } .kbt-pastel .kb-white:nth-child(7n+6) { background: linear-gradient(180deg, #fff 60%, #DCD6FF); }
.kbt-pastel .kb-white:nth-child(7n) { background: linear-gradient(180deg, #fff 60%, #F3D6FF); }
.kbt-pastel .kb-black { background: linear-gradient(180deg, #8B84B8, #5D5891 85%); }
.kbt-neon .kb-white { background: #0E0B22; border-color: #FF3DF2; box-shadow: inset 0 0 8px rgba(255,61,242,.5), inset 0 -4px 0 #2A0F45; }
.kbt-neon .kb-black { background: #05030F; box-shadow: 0 0 0 1px #3DE7FF, 0 0 10px rgba(61,231,255,.6); }
.kbt-neon .kb-label { color: #FF9CF7; }
.kbt-glass .kb-white { background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(220,230,255,.55)); border-color: rgba(255,255,255,.9); box-shadow: inset 0 0 12px rgba(255,255,255,.8), inset 0 -6px 0 rgba(180,190,230,.5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.kbt-glass .kb-black { background: linear-gradient(180deg, rgba(40,40,80,.75), rgba(20,20,50,.85)); box-shadow: inset 0 0 6px rgba(255,255,255,.25); }

/* Key press effects */
.kb-key { overflow: visible; }
.kfx { position: absolute; left: 50%; top: 18%; pointer-events: none; z-index: 5; }
.kfx.spark { width: 5px; height: 5px; border-radius: 50%; background: #FFE58A; box-shadow: 0 0 8px #FFC43D; animation: kfx-fly .7s ease-out both; }
.kfx.star { color: #FFE58A; font-size: 14px; text-shadow: 0 0 8px #FFC43D; animation: kfx-fly .85s ease-out both; }
.kfx.ripple { width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 3px solid #7CF7FF; animation: kfx-ripple .7s ease-out both; }
.kfx.flame { width: 14px; height: 22px; margin-left: -7px; border-radius: 50% 50% 40% 40%; background: radial-gradient(circle at 50% 70%, #FFF3B0, #FF9F1C 50%, rgba(240,68,40,0) 75%); animation: kfx-flame .8s ease-out both; }
@keyframes kfx-fly { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
@keyframes kfx-ripple { to { transform: scale(4); opacity: 0; } }
@keyframes kfx-flame { from { transform: translate(var(--dx), 0) scale(.6); opacity: 1; } to { transform: translate(var(--dx), -70px) scale(1.3); opacity: 0; } }
.press-rainbow .kb-key.on-good, .press-rainbow .kb-key.on-play { background: hsl(var(--hue), 85%, 70%) !important; box-shadow: 0 0 24px hsl(var(--hue), 90%, 60%) !important; }

/* Challenges */
.ch-card { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); background: var(--surface); border-radius: 20px; padding: 14px 18px; box-shadow: var(--shadow); margin-bottom: 30px; }
.uni-page .ch-card { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.ch-card-head { display: flex; flex-direction: column; }
.ch-card-head span { font-size: 13px; opacity: .75; font-weight: 700; }
.ch-mini { display: flex; gap: 6px; flex: 1; min-width: 160px; }
.ch-mini i { flex: 1; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #B98CFF var(--p), rgba(150,140,200,.25) var(--p)); }
.ch-mini i.done { background: var(--good); }
.ch-more { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 14px; opacity: .85; }
.ch-more .ico { width: 16px; height: 16px; }
.ch-period { margin-bottom: 16px; }
.ch-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
.ch-row { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.ch-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ch-text small { color: var(--ink-3); font-weight: 700; }
.ch-bar { height: 10px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.ch-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7C3AED, #B98CFF); border-radius: 99px; transition: width .6s var(--ease); }
.ch-row.done .ch-bar i { background: var(--good); }
.ch-reward { font-weight: 900; color: #7C3AED; white-space: nowrap; }
.ch-row.done .ch-reward { color: var(--good); }
.quest-list { display: flex; flex-direction: column; gap: 8px; }
.quest-row { appearance: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 16px; background: var(--tint); transition: transform .25s var(--spring); }
.quest-row:active { transform: scale(.98); }
.quest-row b { display: block; }
.quest-row small { color: var(--ink-2); }
.quest-orb { width: 42px; height: 42px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #fff, #8B5CF6 45%, #2E1065); box-shadow: 0 0 14px rgba(139,92,246,.6); }
.quest-orb.k-ice { background: radial-gradient(circle at 35% 30%, #fff, #7DD3FC 45%, #0C4A6E); } .quest-orb.k-lava { background: radial-gradient(circle at 35% 30%, #FFE58A, #F97316 45%, #450A0A); }
.quest-orb.k-ocean { background: radial-gradient(circle at 35% 30%, #fff, #38BDF8 45%, #0B2A6B); } .quest-orb.k-desert { background: radial-gradient(circle at 35% 30%, #FFF7D6, #F59E0B 45%, #78350F); }
.quest-orb.k-terran { background: radial-gradient(circle at 35% 30%, #fff, #22C55E 40%, #1E3A8A); } .quest-orb.k-rocky { background: radial-gradient(circle at 35% 30%, #fff, #94A3B8 45%, #1E293B); }
.quest-modal .quest-facts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-weight: 800; color: var(--ink-2); }
.quest-modal .quest-facts .ico { width: 16px; height: 16px; color: var(--gold); vertical-align: -2px; }
.rogue { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; margin: -10px 0 40px; animation: rogue-drift 14s ease-in-out infinite; }
@keyframes rogue-drift { 0%, 100% { transform: translateX(-180px); } 50% { transform: translateX(180px); } }
.rogue-body { position: relative; width: 70px; height: 70px; }
.rogue-body .orb { width: 70px; height: 70px; border: 0; padding: 0; cursor: pointer; box-shadow: 0 0 22px #B98CFF, 0 0 50px rgba(185,140,255,.4); }
.rogue-trail { position: absolute; right: 60%; top: 30%; width: 160px; height: 40%; border-radius: 99px; background: linear-gradient(90deg, transparent, rgba(185,140,255,.5)); filter: blur(4px); animation: trail 14s ease-in-out infinite; }
@keyframes trail { 0%, 49% { transform: scaleX(-1); transform-origin: right; right: auto; left: 60%; } 50%, 100% { transform: none; } }
.rogue .body-label small { color: #D8B4FE; }
.rogue.done .orb { box-shadow: 0 0 22px var(--good); }
@media (max-width: 700px) { @keyframes rogue-drift { 0%, 100% { transform: translateX(-70px); } 50% { transform: translateX(70px); } } }

/* Songs: locks */
.song-card { position: relative; }
.song-card.locked .cover { filter: saturate(.35) brightness(.75); }
.price-tag { position: absolute; top: 10px; right: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; background: rgba(30,27,58,.85); color: #fff; font-weight: 900; font-size: 13px; padding: 5px 10px; border-radius: 99px; }
.price-tag .ico { width: 14px; height: 14px; }
.unlock-card { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.unlock-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }

/* ---- Special bosses (from a personal pack) ---- */
.sboss { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 20px 0; }
.sboss-orb { appearance: none; border: 0; padding: 0; cursor: pointer; background: none; position: relative; width: 140px; height: 140px; transition: transform .35s var(--spring); }
.sboss-orb:active { transform: scale(.94); }
.sboss-orb .aura { position: absolute; inset: -16px; border-radius: 50%; background: conic-gradient(from 0deg, #4ADE80, #FDE68A, #F9A8D4, #34D399, #4ADE80); filter: blur(14px); opacity: .75; animation: spin 9s linear infinite; }
.sboss-orb .core { position: absolute; inset: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #F0FFF4, #86EFAC 35%, #15803D 75%, #052E16); box-shadow: 0 0 40px #4ADE80, inset -14px -14px 30px rgba(0,0,0,.45); animation: core-pulse 4s ease-in-out infinite; --g1: #4ADE80; --g2: #FDE68A; }
.sboss-orb .leaf { position: absolute; left: 50%; top: 50%; width: 16px; height: 9px; margin: -4px 0 0 -8px; border-radius: 0 100% 0 100%; background: linear-gradient(135deg, #BBF7D0, #22C55E); box-shadow: 0 0 8px rgba(74,222,128,.6); animation: leaf-orbit var(--d) linear infinite; transform: rotate(var(--a)) translateX(78px); }
.sboss-orb .leaf:nth-child(odd) { background: radial-gradient(circle, #FFF1F2, #F9A8D4); border-radius: 50%; width: 11px; height: 11px; }
@keyframes leaf-orbit { from { transform: rotate(var(--a)) translateX(78px) rotate(0deg); } to { transform: rotate(calc(var(--a) + 360deg)) translateX(78px) rotate(-360deg); } }
.sboss-orb .g-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 42px; filter: drop-shadow(0 0 10px #4ADE80); animation: bob 3s ease-in-out infinite; }
.sboss .body-label small { color: #86EFAC; }
.special-boss .sboss .body-label b { color: var(--ink); text-shadow: none; }
.special-boss .sboss-orb { width: 110px; height: 110px; }
.sboss-modal { text-align: center; }
.sboss-emblem { position: relative; width: 90px; height: 90px; margin: 0 auto 6px; display: grid; place-items: center; }
.sboss-emblem i { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#4ADE80, #FDE68A, #F9A8D4, #4ADE80); filter: blur(8px); animation: spin 6s linear infinite; }
.sboss-emblem span { position: relative; font-size: 40px; }
.sboss-need { text-align: left; background: var(--tint); border-radius: 14px; padding: 10px 14px; margin-top: 12px; }
.sboss-need ol { padding-left: 20px; color: var(--ink-2); line-height: 1.6; margin: 6px 0 0; }
.sboss-linked { display: inline-flex; gap: 8px; align-items: center; margin-top: 12px; background: #E3F8EE; color: #0B7F4B; padding: 8px 14px; border-radius: 12px; }
.sboss-pick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.sboss-pick small { width: 100%; color: var(--ink-3); font-weight: 800; }
.planet.fx-bloom.done .orb { box-shadow: 0 0 26px #4ADE80, 0 0 70px rgba(74,222,128,.35); }
.fx-bloom .bloom { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: radial-gradient(circle, #FFF7D6 25%, #F9A8D4 30%, #EC4899 70%); box-shadow: 0 0 8px #F9A8D4; transform: rotate(var(--a)) translateX(calc(var(--size) / 2 + 6px)); animation: bloom-sway 4s ease-in-out infinite; }
.fx-bloom .bloom:nth-child(even) { background: radial-gradient(circle, #FEF9C3 25%, #86EFAC 30%, #16A34A 75%); border-radius: 0 100% 0 100%; }
@keyframes bloom-sway { 50% { transform: rotate(calc(var(--a) + 8deg)) translateX(calc(var(--size) / 2 + 9px)); } }
.fx-bloom .celebration i { background: #F9A8D4; box-shadow: 0 0 12px #EC4899; }
.fx-demo.fx-bloom .demo-orb { box-shadow: 0 0 20px #4ADE80, inset -8px -8px 18px rgba(0,0,0,.5); }
.shop-item.exclusive { opacity: .85; }
.g-sub { display: block; color: #C9C6E6; font-weight: 700; font-size: 13px; }
.sboss-need summary { font-weight: 800; cursor: pointer; } .sboss-need p { margin-top: 6px; color: var(--ink-2); }

/* ===================== Cosmos (GPU-composited, full refresh rate) ===================== */
@property --c-top { syntax: '<color>'; inherits: true; initial-value: #0B0B2B; }
@property --c-bottom { syntax: '<color>'; inherits: true; initial-value: #1A1550; }
@property --c-n1 { syntax: '<color>'; inherits: true; initial-value: #5B6CFF; }
@property --c-n2 { syntax: '<color>'; inherits: true; initial-value: #9B7BFF; }
@property --c-n3 { syntax: '<color>'; inherits: true; initial-value: #3BC9FF; }
.cosmos {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(180deg, var(--c-top), var(--c-bottom));
  transition: --c-top 1.6s ease, --c-bottom 1.6s ease, --c-n1 1.6s ease, --c-n2 1.6s ease, --c-n3 1.6s ease;
}
.cosmos .neb { position: absolute; border-radius: 50%; will-change: transform; filter: blur(2px); }
.cosmos .n1 { width: 110vmax; height: 110vmax; left: -45vmax; top: -40vmax; background: radial-gradient(circle, color-mix(in srgb, var(--c-n1) 34%, transparent), transparent 62%); animation: neb-drift 38s ease-in-out infinite alternate; }
.cosmos .n2 { width: 100vmax; height: 100vmax; right: -45vmax; top: 10vmax; background: radial-gradient(circle, color-mix(in srgb, var(--c-n2) 28%, transparent), transparent 62%); animation: neb-drift 46s ease-in-out infinite alternate-reverse; }
.cosmos .n3 { width: 120vmax; height: 120vmax; left: -10vmax; bottom: -75vmax; background: radial-gradient(circle, color-mix(in srgb, var(--c-n3) 22%, transparent), transparent 62%); animation: neb-drift 52s ease-in-out infinite alternate; }
@keyframes neb-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(6vmax, 3vmax, 0) scale(1.08); } }
.cosmos .far { position: absolute; inset: -20%; background-size: 512px 512px; will-change: opacity, transform; }
.cosmos .f1 { animation: twinkle 3.4s ease-in-out infinite alternate, far-drift 120s linear infinite; }
.cosmos .f2 { background-size: 380px 380px; animation: twinkle 2.6s ease-in-out infinite alternate-reverse, far-drift 160s linear infinite reverse; }
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes far-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-512px, 0, 0); } }
.cosmos .warp-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 50%, rgba(200,220,255,.18), transparent 70%); opacity: 0; transition: opacity .25s; }
body.warping .cosmos .warp-glow { opacity: 1; }
.cosmos .shooters { position: absolute; inset: 0; }
.shooting { position: absolute; width: 180px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(255,255,255,0), #fff); transform: rotate(-24deg); animation: shoot 1.4s ease-out forwards; will-change: transform, opacity; }
@keyframes shoot { from { transform: rotate(-24deg) translate3d(0, 0, 0); opacity: 0; } 12% { opacity: 1; } to { transform: rotate(-24deg) translate3d(-520px, 0, 0); opacity: 0; } }

/* Near stars: belong to each galaxy and scroll natively with it */
.galaxy > .gstars { position: absolute; left: -50vw; right: -50vw; top: -80px; bottom: -80px; z-index: -1; overflow: hidden; pointer-events: none; }
.gstars .gs { position: absolute; left: 0; right: 0; top: -512px; bottom: -512px; background-size: 512px 512px; will-change: transform, opacity; transition: transform .28s ease-out, opacity .28s; }
.gstars .gs.b { background-size: 420px 420px; animation: twinkle 2.2s ease-in-out infinite alternate; }
.gstars .gs.a { animation: twinkle 3.8s ease-in-out infinite alternate-reverse; }
.st-embers .gs.a, .st-embers .gs.b { animation: rise-tile 22s linear infinite; }
.st-embers .gs.b { animation-duration: 15s; }
.st-motes .gs.a, .st-motes .gs.b { animation: fall-tile 30s linear infinite; }
.st-motes .gs.b { animation-duration: 20s; }
@keyframes rise-tile { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, -512px, 0); } }
@keyframes fall-tile { from { transform: translate3d(0, -512px, 0); } to { transform: translate3d(0, 0, 0); } }
.gstars .gs.streaks { opacity: 0; background-size: 512px 512px; }
.gstars .g-rays { position: absolute; left: 25%; right: 25%; top: -10%; height: 70%; background: repeating-conic-gradient(from 160deg at 50% 0%, rgba(200,170,255,.14) 0 5deg, transparent 5deg 18deg); -webkit-mask: linear-gradient(#000, transparent); mask: linear-gradient(#000, transparent); animation: rays-sway 16s ease-in-out infinite alternate; }
@keyframes rays-sway { to { transform: rotate(4deg); } }
.gstars .g-aurora { position: absolute; left: 0; right: 0; top: 4%; height: 50%; background: linear-gradient(180deg, transparent, rgba(34,211,238,.18) 30%, rgba(99,102,241,.14) 55%, transparent); filter: blur(18px); animation: aurora-wave 12s ease-in-out infinite alternate; transform-origin: center; }
@keyframes aurora-wave { from { transform: skewY(-4deg) scaleY(.9); } to { transform: skewY(4deg) scaleY(1.15) translateY(20px); } }

/* Warp speed: stars stretch into trails while you scroll fast */
body.warping .gstars .gs.a, body.warping .gstars .gs.b { transform: scaleY(2.6); opacity: .5; }
body.warping .gstars .gs.streaks { opacity: .9; }
body.warping.warp-up .gstars .gs.streaks { transform: scaleY(-1); }
@media (prefers-reduced-motion: reduce) { .cosmos *, .gstars * { animation: none !important; transition: none !important; } }
.special-row { display: flex; flex-wrap: wrap; gap: 30px; justify-content: center; }
.sboss.ascended .sboss-orb .aura { background: conic-gradient(from 0deg, #FDE68A, #4ADE80, #F472B6, #A78BFA, #FDE68A); filter: blur(18px); opacity: .9; animation-duration: 5s; }
.sboss.ascended .sboss-orb .core { background: radial-gradient(circle at 35% 30%, #FFFBEB, #FDE68A 25%, #22C55E 60%, #052E16); box-shadow: 0 0 50px #FDE68A, 0 0 100px rgba(74,222,128,.5), inset -14px -14px 30px rgba(0,0,0,.45); }
.sboss.ascended .body-label small { color: #FDE68A; }
.sboss-modal.ascended .sboss-emblem i { background: conic-gradient(#FDE68A, #4ADE80, #F472B6, #A78BFA, #FDE68A); }
.planet.arrive .planet-body, .guardian.arrive .guardian-orb { animation: arrive 1.2s var(--spring) 2; }
@keyframes arrive { 0% { transform: scale(1); } 30% { transform: scale(1.18); filter: brightness(1.5); } 100% { transform: scale(1); } }
.planet.arrive .body-label b::after, .guardian.arrive .body-label b::after { content: '  \2190  tap to land'; font-size: 13px; color: #FDE68A; font-weight: 800; }

/* ---- Personal constellations ---- */
.constellation { appearance: none; border: 0; background: none; cursor: pointer; position: absolute; top: 70px; right: 0; width: 220px; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; color: #fff; padding: 0; transition: transform .3s var(--spring); }
.constellation:active { transform: scale(.95); }
.galaxy:nth-of-type(even) .constellation { right: auto; left: 0; }
.constellation-art svg { width: 100%; max-height: 240px; overflow: visible; }
.constellation .constellation-art { width: 200px; }
.c-lines line { stroke: rgba(255,255,255,.35); stroke-width: .6; stroke-linecap: round; }
.c-stars circle { fill: #fff; filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 5px #C4B5FD); animation: c-twinkle 2.6s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -.37s); transform-box: fill-box; transform-origin: center; }
@keyframes c-twinkle { from { opacity: .45; transform: scale(.8); } to { opacity: 1; transform: scale(1.15); } }
.constellation.hidden .c-lines { opacity: 0; }
.constellation.hidden .c-stars circle { opacity: .25; animation: none; }
.constellation.available .c-lines line { stroke-dasharray: 2 2; }
.constellation.unlocked .c-lines line { stroke: rgba(253,230,138,.75); filter: drop-shadow(0 0 2px #FDE68A); }
.constellation.unlocked .c-stars circle { fill: #FFF7D6; }
.c-label { display: flex; flex-direction: column; align-items: center; text-align: center; }
.c-label small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #D8C9FF; font-weight: 900; }
.c-label b { font-size: 15px; }
.c-label em { font-style: normal; font-size: 12px; font-weight: 900; color: #FDE68A; display: inline-flex; align-items: center; gap: 3px; }
.c-label em .ico { width: 12px; height: 12px; }
@media (max-width: 900px) { .constellation { position: relative; top: 0; margin: 0 auto 20px; } }
.const-modal { text-align: center; }
.const-modal .constellation-art.big { width: 260px; margin: 0 auto 8px; background: radial-gradient(circle, #2A2560, #120F2E); border-radius: 20px; padding: 14px; }
.const-reveal { text-align: center; }
.reveal-stage { position: relative; width: min(100%, 460px); max-height: 70vh; margin: 0 auto 12px; border-radius: 18px; overflow: hidden; background: #0B0B2B; }
.reveal-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; animation: photo-in 1.6s ease 1.8s forwards; }
@keyframes photo-in { to { opacity: 1; } }
.constellation-art.overlay { position: absolute; inset: 0; }
.constellation-art.overlay svg { width: 100%; height: 100%; max-height: none; }
.constellation-art.overlay line { stroke: rgba(253,230,138,.9); stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw-line 1.2s ease forwards, fade-overlay 1.2s ease 2.6s forwards; animation-delay: calc(var(--i) * .06s), 2.6s; }
.constellation-art.overlay circle { animation: star-in .5s var(--spring) both, fade-overlay 1.2s ease 2.8s forwards; animation-delay: calc(var(--i) * .05s), 2.8s; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes star-in { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade-overlay { to { opacity: .25; } }
.sboss-orb .core { overflow: hidden; display: block; }
.sboss-orb .core svg, .emblem-art svg { width: 100%; height: 100%; display: block; }
.sboss-orb .core > svg { animation: goddess-breathe 5s ease-in-out infinite; transform-origin: 50% 70%; }
@keyframes goddess-breathe { 50% { transform: scale(1.03) translateY(-1px); } }
.sboss-orb .won-badge { position: absolute; right: 4px; bottom: 4px; font-size: 26px; filter: drop-shadow(0 0 6px #F9A8D4); z-index: 3; }
.sboss-orb .leaf { z-index: 2; }
.emblem-art { position: relative; width: 84px; height: 84px; border-radius: 50%; overflow: hidden; display: block; }
.rogue-boss { margin: 10px 0 60px; animation-duration: 20s; }
.rogue-boss .rogue-trail { top: 38%; height: 28%; width: 220px; background: linear-gradient(90deg, transparent, rgba(253,230,138,.55), rgba(74,222,128,.5)); }
.rogue-boss .sboss { margin: 0; }
.rogue-boss .body-label small::before { content: 'Rogue planet \00b7  '; }

/* ---- Shop expansion ---- */
.planet .spiral { position: absolute; inset: -38%; border-radius: 50%; background: conic-gradient(from 0deg, transparent, color-mix(in srgb, var(--base) 60%, #fff) 10%, transparent 25%, transparent 50%, color-mix(in srgb, var(--base) 60%, #fff) 60%, transparent 75%); -webkit-mask: radial-gradient(circle, transparent 34%, #000 38%, transparent 72%); mask: radial-gradient(circle, transparent 34%, #000 38%, transparent 72%); animation: spin 9s linear infinite; z-index: -1; filter: blur(1px); }
.planet .spiral.s2 { animation-duration: 14s; animation-direction: reverse; opacity: .6; }
.planet .note-ring { position: absolute; inset: -26%; border-radius: 50%; border: 1px dashed rgba(253,230,138,.4); animation: spin 12s linear infinite; }
.planet .note-ring span { position: absolute; color: #FDE68A; font-size: 16px; text-shadow: 0 0 8px #FDE68A; }
.planet .note-ring span:nth-child(1) { top: -10px; left: 45%; } .planet .note-ring span:nth-child(2) { right: -8px; top: 45%; }
.planet .note-ring span:nth-child(3) { bottom: -10px; left: 45%; } .planet .note-ring span:nth-child(4) { left: -8px; top: 45%; }
.fx-demo.fx-galaxy .demo-fx { position: absolute; inset: -16px; border-radius: 50%; background: conic-gradient(transparent, #C4B5FD 15%, transparent 30%, transparent 50%, #C4B5FD 65%, transparent 80%); -webkit-mask: radial-gradient(circle, transparent 40%, #000 45%, transparent 72%); mask: radial-gradient(circle, transparent 40%, #000 45%, transparent 72%); animation: spin 6s linear infinite; }
.fx-demo.fx-notes .demo-fx { position: absolute; inset: -14px; border-radius: 50%; border: 1px dashed #FDE68A; animation: spin 8s linear infinite; }
.fx-demo.fx-notes .demo-fx::before { content: '\266A'; position: absolute; top: -12px; left: 40%; color: #FDE68A; font-size: 16px; }
.kbt-ocean .kb-white { background: linear-gradient(180deg, #F0FDFF 70%, #BAE6FD); border-color: #A5D8F0; box-shadow: inset 0 -6px 0 #93C5FD; }
.kbt-ocean .kb-black { background: linear-gradient(180deg, #155E75, #0C4A6E 85%); }
.kbt-sunset .kb-white { background: linear-gradient(180deg, #FFF7ED 30%, #FDBA74 75%, #F472B6); border-color: #F9A8D4; box-shadow: inset 0 -6px 0 #EC4899; }
.kbt-sunset .kb-black { background: linear-gradient(180deg, #7C3AED, #4C1D95 85%); }
.kbt-galaxy .kb-white { background: radial-gradient(1px 1px at 30% 20%, #fff, transparent), radial-gradient(1px 1px at 70% 60%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 80%, #fff, transparent), linear-gradient(180deg, #2E1065, #1E1B4B); border-color: #4C1D95; box-shadow: inset 0 -6px 0 #6D28D9; }
.kbt-galaxy .kb-black { background: linear-gradient(180deg, #0B0618, #000); box-shadow: 0 0 0 1px #A78BFA; }
.kbt-galaxy .kb-label { color: #C4B5FD; }
.kfx.heart { color: #FB7185; text-shadow: 0 0 8px #F43F5E; font-size: 16px; }
.kfx.note { color: #A78BFA; text-shadow: 0 0 8px #7C3AED; font-size: 18px; }
.kfx.bolt { width: 14px; height: 60px; margin-left: -7px; top: -50px; background: linear-gradient(180deg, transparent, #FDE68A); clip-path: polygon(40% 0, 70% 0, 52% 45%, 80% 45%, 30% 100%, 45% 55%, 20% 55%); filter: drop-shadow(0 0 6px #FDE68A); animation: bolt .45s ease-out both; }
@keyframes bolt { 0%, 40% { opacity: 1; } 20% { opacity: .3; } 100% { opacity: 0; transform: scaleY(1.2); } }
.route.trail-comet .route-dash { stroke-dasharray: none; stroke: #FDE68A; stroke-width: 3; filter: drop-shadow(0 0 4px #FDE68A); animation: none; opacity: .85; }
.route.trail-comet .route-glow { stroke: rgba(253,230,138,.25); stroke-width: 14; }
.route.trail-rainbow .route-dash { stroke-dasharray: none; stroke: #F472B6; stroke-width: 4; animation: rainbow-hue 6s linear infinite; }
@keyframes rainbow-hue { to { filter: hue-rotate(360deg); } }
.route.trail-notes .route-dash, .route.trail-stars .route-dash { stroke: transparent; }
.route-text { fill: #E9D5FF; font-size: 14px; letter-spacing: 3px; }
.route.trail-stars .route-text { fill: #FDE68A; font-size: 11px; letter-spacing: 6px; }
body[data-sheet="parchment"] .pl-stage { background: #F6ECD6; }
body[data-sheet="night"] .pl-stage { background: #17152E; }
body[data-sheet="blueprint"] .pl-stage { background: #0F3D70; }
body[data-sheet="night"] .mini-staff, body[data-sheet="blueprint"] .mini-staff { background: transparent; }

/* ---- Unique suns ---- */
.sun-redgiant { width: 150px; height: 150px; }
.sun-redgiant .core { inset: 14px; background: radial-gradient(circle at 42% 38%, #FFD7B0, #FF8A4C 35%, #E2421E 70%, #8E1B0C); box-shadow: 0 0 60px #FF5A2A, 0 0 130px rgba(255,80,30,.5); animation: sun-pulse 7s ease-in-out infinite; }
.sun-redgiant .corona { background: repeating-conic-gradient(from 0deg, rgba(255,120,60,.45) 0 6deg, transparent 6deg 22deg); animation-duration: 70s; }
.sun-bluegiant .core { background: radial-gradient(circle at 42% 38%, #FFFFFF, #CFE6FF 30%, #6FA8FF 65%, #2F5BD8); box-shadow: 0 0 50px #8DBBFF, 0 0 110px rgba(120,170,255,.6); animation: sun-pulse 2.6s ease-in-out infinite; }
.sun-bluegiant .corona { background: repeating-conic-gradient(from 0deg, rgba(190,220,255,.7) 0 2deg, transparent 2deg 9deg); animation-duration: 18s; }
.sun-whitedwarf { width: 80px; height: 80px; }
.sun-whitedwarf .core { inset: 22px; background: radial-gradient(circle, #FFFFFF 40%, #E8F0FF); box-shadow: 0 0 25px #fff, 0 0 60px rgba(220,235,255,.9), 0 0 120px rgba(200,220,255,.4); animation: sun-pulse 1.4s ease-in-out infinite; }
.sun-whitedwarf .corona { inset: 0; background: repeating-conic-gradient(rgba(255,255,255,.6) 0 1deg, transparent 1deg 12deg); }
.sun-orange .core { background: radial-gradient(circle at 42% 38%, #FFF1D6, #FFC072 35%, #F08A2C 70%, #B5520F); box-shadow: 0 0 40px #FFA94D, 0 0 90px rgba(255,150,60,.45); animation-duration: 5s; }
.sun-orange .corona { background: repeating-conic-gradient(rgba(255,190,120,.45) 0 5deg, transparent 5deg 18deg); }
.sun-magenta .core { background: radial-gradient(circle at 42% 38%, #FFE4F6, #F472B6 35%, #C026D3 70%, #6B0F7A); box-shadow: 0 0 45px #E879F9, 0 0 100px rgba(217,70,239,.55); }
.sun-magenta .corona { background: repeating-conic-gradient(rgba(244,114,182,.5) 0 4deg, transparent 4deg 15deg); animation-direction: reverse; }
.sun-binary { width: 140px; }
.sun .binary-orbit { position: absolute; inset: 0; animation: spin 9s linear infinite; }
.sun .binary-orbit .core { inset: auto; width: 50px; height: 50px; top: 30px; }
.sun .binary-orbit .core.a { left: 8px; background: radial-gradient(circle at 40% 38%, #FFFDF0, #FFE27A 40%, #FFB23F); box-shadow: 0 0 30px #FFC14D; }
.sun .binary-orbit .core.b { right: 8px; width: 36px; height: 36px; top: 37px; background: radial-gradient(circle at 40% 38%, #fff, #A5D8FF 40%, #4F8BFF); box-shadow: 0 0 26px #8DBBFF; }
.sun-pulsar .core { inset: 38px; background: radial-gradient(circle, #fff 35%, #C4B5FD); box-shadow: 0 0 30px #fff, 0 0 70px #A78BFA; animation: sun-pulse .8s ease-in-out infinite; }
.sun-pulsar .beam { position: absolute; left: 50%; top: -60%; width: 10px; margin-left: -5px; height: 220%; background: linear-gradient(180deg, transparent, rgba(196,181,253,.7), rgba(255,255,255,.9) 50%, rgba(196,181,253,.7), transparent); filter: blur(2px); animation: spin 2.2s linear infinite; transform-origin: center; }
.sun-pulsar .beam.b2 { animation-delay: -1.1s; opacity: .6; }
.sun-proto .core { inset: 32px; background: radial-gradient(circle, #FFF7E0, #FCA5A5 50%, #B45309); box-shadow: 0 0 30px #FDBA74, 0 0 70px rgba(253,186,116,.5); }
.sun-proto .disk { position: absolute; inset: -14px -40px; border-radius: 50%; background: conic-gradient(from 0deg, rgba(253,186,116,.0), rgba(253,186,116,.6), rgba(167,139,250,.5), rgba(253,186,116,.0) 60%, rgba(253,186,116,.5), rgba(253,186,116,0)); transform: scaleY(.35); filter: blur(3px); animation: accrete 6s linear infinite; }
.sun-emerald .core { background: radial-gradient(circle at 42% 38%, #F0FFF4, #6EE7B7 35%, #10B981 70%, #064E3B); box-shadow: 0 0 45px #34D399, 0 0 100px rgba(16,185,129,.55); }
.sun-emerald .corona { background: repeating-conic-gradient(rgba(110,231,183,.55) 0 4deg, transparent 4deg 14deg); }
.sun-aqua .core { background: radial-gradient(circle at 42% 38%, #F0FDFF, #67E8F9 35%, #06B6D4 70%, #164E63); box-shadow: 0 0 45px #22D3EE, 0 0 100px rgba(6,182,212,.55); animation-duration: 3.2s; }
.sun-aqua .corona { background: repeating-conic-gradient(rgba(103,232,249,.55) 0 3deg, transparent 3deg 12deg); animation-direction: reverse; }
.sun-prism .core { background: radial-gradient(circle at 42% 38%, #fff, #FDE68A 30%, #F472B6 60%, #7C3AED); box-shadow: 0 0 50px #F472B6, 0 0 110px rgba(124,58,237,.5); animation: sun-pulse 4s ease-in-out infinite, rainbow-hue 10s linear infinite; }
.sun-prism .corona { background: repeating-conic-gradient(#F87171 0 3deg, transparent 3deg 9deg, #FDE68A 9deg 12deg, transparent 12deg 18deg, #4ADE80 18deg 21deg, transparent 21deg 27deg, #60A5FA 27deg 30deg, transparent 30deg 36deg); opacity: .7; animation-duration: 25s; }
.sun-void .core { background: radial-gradient(circle, #05010D 58%, #3B0764 72%, #A855F7 88%, #F0ABFC); box-shadow: 0 0 40px #A855F7, 0 0 90px rgba(168,85,247,.55), inset 0 0 18px #000; }
.sun-void .corona { background: repeating-conic-gradient(rgba(240,171,252,.6) 0 2deg, transparent 2deg 10deg); animation-duration: 50s; animation-direction: reverse; }
.sun-rosegold .core { background: radial-gradient(circle at 42% 38%, #FFF7F0, #FBCFE8 30%, #F5B48A 60%, #B76E4B); box-shadow: 0 0 45px #F9A8D4, 0 0 100px rgba(245,180,138,.5); }
.sun-rosegold .corona { background: repeating-conic-gradient(rgba(251,207,232,.6) 0 5deg, transparent 5deg 16deg); }

/* ---- Background music bar ---- */
.musicbar { position: fixed; left: 16px; bottom: calc(22px + var(--safe-b)); z-index: 25; display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-radius: 99px; background: rgba(30,27,58,.88); color: #fff; box-shadow: var(--shadow-lg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); max-width: 360px; }
.mb-title { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.mb-btn { appearance: none; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; font-weight: 900; transition: transform .2s var(--spring); }
.mb-btn:active { transform: scale(.88); }
.mb-btn .ico { width: 16px; height: 16px; }
.mb-btn.shuf.on { background: #7C3AED; }
.mb-eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.mb-eq i { width: 3px; height: 4px; background: #B98CFF; border-radius: 2px; }
.musicbar.playing .mb-eq i { animation: eq 0.9s ease-in-out infinite alternate; }
.musicbar.playing .mb-eq i:nth-child(2) { animation-delay: .3s; } .musicbar.playing .mb-eq i:nth-child(3) { animation-delay: .6s; }
@keyframes eq { to { height: 14px; } }
@media (max-width: 1100px) { .musicbar { bottom: calc(86px + var(--safe-b)); } }
.playlist-modal .pl-list { max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.pl-song { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; background: var(--tint); cursor: pointer; }
.pl-song.on { background: var(--brand-soft); }
.pl-song b { display: block; font-size: 15px; } .pl-song small { color: var(--ink-3); font-weight: 700; }
.pl-song input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---- Star gate ---- */
.galaxy-count { min-width: 150px; }
.galaxy-count .gate { position: relative; height: 8px; border-radius: 99px; background: rgba(255,255,255,.15); margin: 8px 0 4px; overflow: visible; }
.galaxy-count .gate i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, #FDE68A, #FFC43D); }
.galaxy-count .gate em { position: absolute; top: -4px; width: 2px; height: 16px; background: #fff; border-radius: 2px; box-shadow: 0 0 6px #fff; }
.galaxy-count small { display: block; font-size: 11px; color: #D8D3F5; font-weight: 800; letter-spacing: .02em; text-transform: none; }
.galaxy-count.gate-open .gate i { background: linear-gradient(90deg, #86EFAC, #22C55E); }
.gate-card { box-shadow: inset 0 0 0 2px rgba(253,230,138,.5), 0 20px 60px rgba(0,0,0,.35); }

/* ---- Star colours ---- */
body { --star-on: var(--gold); }
.star.on { color: var(--star-on); }
body[data-starc="silver"], .starc-silver { --star-on: #D9DDE8; }
body[data-starc="rose"], .starc-rose { --star-on: #F9A8D4; }
body[data-starc="emerald"], .starc-emerald { --star-on: #34D399; }
body[data-starc="sapphire"], .starc-sapphire { --star-on: #60A5FA; }
body[data-starc="cosmic"], .starc-cosmic { --star-on: #C084FC; }
body[data-starc="cosmic"] .star.on svg, .starc-cosmic .star.on svg { filter: drop-shadow(0 0 5px #A855F7); }
body[data-starc="rainbow"], .starc-rainbow { --star-on: #F472B6; }
body[data-starc="rainbow"] .star.on, .starc-rainbow .star.on { animation: rainbow-hue 4s linear infinite; }
.starc-gold { --star-on: var(--gold); }
.star-demo { display: flex; gap: 4px; }
.star-demo .star { color: var(--star-on); }
.star-demo .star svg { width: 34px; height: 34px; }
.stars-big .star.on svg { filter: drop-shadow(0 4px 0 color-mix(in srgb, var(--star-on) 70%, #000)) drop-shadow(0 8px 18px color-mix(in srgb, var(--star-on) 50%, transparent)); }

/* Cosmos: two canvases (soft sky stretched from a small canvas + crisp star sprites). */
.cosmos canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cosmos .cosmos-bg { image-rendering: auto; }

/* Rogue planets wander back and forth on their own path (no trail, just their glow). */
.rogue { margin: 10px 0 40px; left: var(--home, 0%); animation: rogue-wander var(--dur, 20s) ease-in-out var(--delay, 0s) infinite; will-change: transform; }
.rogue-boss { margin: 20px 0 50px; animation-duration: calc(var(--dur, 20s) * 1.3); }
.rogue-trail { display: none; }
@keyframes rogue-wander {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(var(--x1), var(--y1)); }
  55% { transform: translate(var(--x2), var(--y2)); }
  80% { transform: translate(var(--x3), var(--y3)); }
}
@media (max-width: 700px) { .rogue { left: calc(var(--home, 0%) * .3); } @keyframes rogue-wander { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(calc(var(--x1) * .4), var(--y1)); } 55% { transform: translate(calc(var(--x2) * .4), var(--y2)); } 80% { transform: translate(calc(var(--x3) * .4), var(--y3)); } } }
@media (prefers-reduced-motion: reduce) { .rogue { animation: none; } }

/* Achievement reward cards in the Shop */
.shop-item.achv { box-shadow: inset 0 0 0 1.5px rgba(251,191,36,.55); }
.shop-item.achv .achv-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #B45309; }
.shop-item.achv .achv-req { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2, #555); }
.achv-bar { height: 6px; border-radius: 99px; background: rgba(0,0,0,.1); overflow: hidden; }
.achv-bar i { display: block; height: 100%; background: linear-gradient(90deg, #F59E0B, #FBBF24); border-radius: inherit; }
.shop-item.achv.met .achv-tag { color: #059669; }
.achv-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.achv-row { display: grid; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--card, #fff); box-shadow: 0 1px 0 rgba(0,0,0,.05); text-align: left; border: 0; font: inherit; cursor: pointer; color: inherit; }
.achv-row small { color: var(--ink-3, #777); font-weight: 700; }
.achv-row.met { box-shadow: inset 0 0 0 1.5px #34D399; }
.achv-row.owned { opacity: .6; }
.shop-item.flash { animation: achv-flash 1.4s ease; }
@keyframes achv-flash { 0%, 100% { transform: none; } 20% { transform: scale(1.03); box-shadow: 0 0 0 3px #FBBF24; } }
@keyframes star-pulse { 0%, 100% { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 6px currentColor); } 50% { filter: drop-shadow(0 0 7px #fff) drop-shadow(0 0 14px currentColor); } }

/* ---- Galactic features (decor between solar systems; GPU transforms only) ---------- */
.feature { position: relative; height: 190px; margin: 0 -20px 20px; pointer-events: none; }
.feat-label { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); text-align: center; display: grid; opacity: .75; white-space: nowrap; }
.feat-label small { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--on-bg-3, #9C98C8); font-weight: 800; }
.feat-label b { font-size: 13px; color: var(--on-bg-2, #C9C6E6); }
.feat-belt { overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.belt-track { position: absolute; left: 0; top: 10px; height: 140px; width: 200%; display: flex; transform: rotate(-4deg); animation: belt-move var(--bd, 90s) linear infinite var(--dir, normal); will-change: transform; }
@keyframes belt-move { from { transform: rotate(-4deg) translateX(0); } to { transform: rotate(-4deg) translateX(-50%); } }
.belt-half { position: relative; width: 50%; height: 100%; }
.rock { position: absolute; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tone) 60%, #fff), var(--tone) 45%, color-mix(in srgb, var(--tone) 45%, #000)); box-shadow: inset -2px -3px 4px rgba(0,0,0,.45); }
.rock.spin { animation: spin var(--rd, 10s) linear infinite; }
.belt-dust { position: absolute; left: 0; right: 0; top: 50px; height: 70px; background: radial-gradient(ellipse at 50% 50%, rgba(200,190,170,.13), transparent 70%); transform: rotate(-4deg); }
.bh { position: absolute; left: 50%; top: 50%; width: 150px; height: 150px; margin: -85px 0 0 -75px; }
.bh-glow { position: absolute; inset: -30px; border-radius: 50%; background: radial-gradient(circle, rgba(251,146,60,.35), rgba(168,85,247,.15) 45%, transparent 70%); }
.bh-disk { position: absolute; inset: 20px -40px; border-radius: 50%; background: conic-gradient(from 0deg, #FDE68A, #F97316, #7C2D12, #F97316, #FFF7ED, #FB923C, #FDE68A); -webkit-mask: radial-gradient(closest-side, transparent 55%, #000 58%, #000 85%, transparent 100%); mask: radial-gradient(closest-side, transparent 55%, #000 58%, #000 85%, transparent 100%); transform: scaleY(.28) rotate(0deg); animation: bh-spin 6s linear infinite; }
@keyframes bh-spin { to { transform: scaleY(.28) rotate(360deg); } }
.bh-core { position: absolute; inset: 45px; border-radius: 50%; background: #000; box-shadow: 0 0 0 2px rgba(255,237,213,.8), 0 0 18px 4px rgba(251,146,60,.7); }
.bh-ring { position: absolute; inset: 38px; border-radius: 50%; border: 2px solid rgba(255,237,213,.35); animation: twinkle 3s ease-in-out infinite alternate; }
.wh { position: absolute; left: 50%; top: 45%; width: 0; height: 0; }
.wh i { position: absolute; left: calc(-30px - var(--i) * 16px); top: calc(-30px - var(--i) * 16px); width: calc(60px + var(--i) * 32px); height: calc(60px + var(--i) * 32px); border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--f1) 70%, #fff); opacity: calc(1 - var(--i) * .17); transform: scaleY(.55) rotate(0deg); animation: wh-spin calc(4s + var(--i) * 2s) linear infinite; box-shadow: inset 0 0 calc(10px + var(--i) * 4px) var(--f2); }
.wh i:first-child { background: radial-gradient(circle, #fff, var(--f2) 40%, #000 75%); border-style: solid; }
.wh i:nth-child(even) { animation-direction: reverse; }
@keyframes wh-spin { to { transform: scaleY(.55) rotate(360deg); } }
.station { position: absolute; left: calc(50% + var(--fside) * 22%); top: 18px; width: 130px; height: 130px; margin-left: -65px; animation: hover-ship 7s ease-in-out infinite; }
.station svg { width: 100%; height: 100%; overflow: visible; }
.st-spin { transform-origin: 60px 60px; animation: spin 24s linear infinite; }
.blink { animation: blink 1.6s steps(2) infinite; } .blink.b2 { animation-delay: .8s; }
@keyframes blink { 50% { opacity: .15; } }
.comet { position: absolute; left: -20%; top: 20%; width: 0; height: 0; animation: comet-fly var(--cd, 20s) linear infinite; }
.c-head { position: absolute; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: radial-gradient(circle, #fff, #BAE6FD 50%, transparent 72%); box-shadow: 0 0 18px 6px rgba(186,230,253,.6); }
.c-tail { position: absolute; right: 0; top: -4px; width: 220px; height: 8px; border-radius: 99px; background: linear-gradient(90deg, transparent, rgba(186,230,253,.15) 30%, rgba(224,242,254,.85)); }
@keyframes comet-fly { 0% { transform: translate(0, 0) rotate(12deg); opacity: 0; } 8% { opacity: 1; } 70% { opacity: 1; } 85%, 100% { transform: translate(140vw, 60px) rotate(12deg); opacity: 0; } }
.neb-cloud { position: absolute; border-radius: 50%; will-change: transform; }
.neb-cloud.n1 { left: 10%; top: -10%; width: 60%; height: 120%; background: radial-gradient(closest-side, color-mix(in srgb, var(--f1) 45%, transparent), transparent); animation: neb-drift 30s ease-in-out infinite alternate; }
.neb-cloud.n2 { right: 5%; top: 0; width: 55%; height: 110%; background: radial-gradient(closest-side, color-mix(in srgb, var(--f2) 40%, transparent), transparent); animation: neb-drift 38s ease-in-out infinite alternate-reverse; }
.neb-cloud.n3 { left: 30%; top: 20%; width: 40%; height: 80%; background: radial-gradient(closest-side, color-mix(in srgb, var(--f3) 45%, transparent), transparent); animation: neb-drift 26s ease-in-out infinite alternate; }
.sat { position: absolute; width: 56px; height: 28px; animation: sat-drift var(--sd, 24s) ease-in-out infinite alternate; }
.sat svg { width: 100%; height: 100%; }
@keyframes sat-drift { from { transform: translate(-20px, 0) rotate(calc(var(--sr) * -20deg)); } to { transform: translate(20px, 14px) rotate(calc(var(--sr) * 40deg)); } }
.crystal { position: absolute; aspect-ratio: .55; background: linear-gradient(135deg, #fff, var(--cc) 45%, color-mix(in srgb, var(--cc) 50%, #000)); clip-path: polygon(50% 0, 100% 30%, 80% 100%, 20% 100%, 0 30%); filter: drop-shadow(0 0 8px var(--cc)); transform: rotate(var(--rot)); animation: crystal-bob 6s ease-in-out var(--cdel) infinite; opacity: .9; }
@keyframes crystal-bob { 0%, 100% { transform: rotate(var(--rot)) translateY(0); } 50% { transform: rotate(calc(var(--rot) + 8deg)) translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .feature * { animation: none !important; } }

/* ---- Pets -------------------------------------------------------------------------- */
.pet-buddy { position: absolute; width: 40px; height: 40px; right: -78px; top: 6px; z-index: 3; pointer-events: none; animation: pet-follow 5s ease-in-out -1.2s infinite; }
@keyframes pet-follow { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-8px, -14px); } }
.pet { display: grid; place-items: center; width: 100%; height: 100%; }
.pet-emoji { font-size: 28px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.pet-space svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 6px var(--glow)); }
.pet-space .glow, .ship-body .glow { animation: twinkle 1.8s ease-in-out infinite alternate; }
.pet-space .tent { animation: tent-wave 2.4s ease-in-out infinite; transform-origin: top center; } .pet-space .tent.t1, .pet-space .tent.t3 { animation-delay: -1.2s; }
@keyframes tent-wave { 50% { transform: skewX(8deg); } }
.pet-space .wing { animation: wing-flap 1.2s ease-in-out infinite; transform-origin: 32px 32px; }
@keyframes wing-flap { 50% { transform: scaleX(.82); } }
.pet-water .bowl { position: relative; display: grid; place-items: center; width: 38px; height: 36px; border-radius: 48% 48% 44% 44% / 40% 40% 56% 56%; background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.55), rgba(255,255,255,.08) 30%, rgba(186,230,253,.12) 60%); box-shadow: inset 0 0 0 1.5px rgba(224,242,254,.7), 0 3px 8px rgba(0,0,0,.3); overflow: hidden; }
.pet-water .bowl::before { content: ''; position: absolute; top: -2px; left: 22%; right: 22%; height: 6px; border-radius: 50%; border: 1.5px solid rgba(224,242,254,.8); }
.pet-water .water { position: absolute; left: 0; right: 0; bottom: 0; height: 66%; background: linear-gradient(180deg, rgba(56,189,248,.55), rgba(14,116,144,.7)); }
.pet-water .pet-emoji { position: relative; font-size: 18px; margin-top: 8px; animation: swim 3s ease-in-out infinite; }
@keyframes swim { 0%, 100% { transform: translateX(-4px) scaleX(1); } 49% { transform: translateX(4px) scaleX(1); } 50% { transform: translateX(4px) scaleX(-1); } 99% { transform: translateX(-4px) scaleX(-1); } }
.pet-water .bubble { position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; border: 1px solid rgba(255,255,255,.8); animation: bubble-up 2.6s ease-in infinite; }
.pet-water .bubble.b1 { left: 30%; } .pet-water .bubble.b2 { left: 62%; animation-delay: -1.3s; }
@keyframes bubble-up { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-22px); opacity: 0; } }
.uni-next-ship { position: relative; }
.uni-next-ship .pet { position: absolute; left: -18px; bottom: -10px; width: 34px; height: 34px; }
.uni-next-ship .pet-emoji { font-size: 24px; }
.guardian-pet { right: -90px; }
.pet-demo { width: 76px; height: 76px; animation: hover-ship 3s ease-in-out infinite; }
.pet-demo .pet-emoji { font-size: 48px; }
.pet-demo .pet-water .bowl { width: 66px; height: 62px; }
.pet-demo .pet-water .pet-emoji { font-size: 30px; margin-top: 14px; }
.pet-demo .pet-none { font-size: 13px; color: var(--ink-3, #888); }

/* ---- Reward completion effects -------------------------------------------------- */
.glyph-ring { position: absolute; inset: -24%; border-radius: 50%; animation: spin var(--spin, 12s) linear infinite; pointer-events: none; }
.glyph-ring span { position: absolute; left: 50%; top: 50%; margin: -9px 0 0 -7px; font-size: 15px; line-height: 18px; color: var(--c); text-shadow: 0 0 8px var(--c); transform: rotate(var(--a)) translateY(calc(var(--size, 70px) * -.74)) rotate(calc(var(--a) * -1)); }
.fx-saturn { position: absolute; left: -30%; right: -30%; top: 42%; height: 16%; border-radius: 50%; border: 3px solid #FCD34D; box-shadow: 0 0 10px #F59E0B; transform: rotate(-16deg); pointer-events: none; }
.fx-saturn.s2 { left: -40%; right: -40%; top: 38%; height: 24%; border-width: 1.5px; opacity: .6; }
.fx-demo .glyph-ring { inset: -18px; --size: 70px; }
.fx-demo .fx-saturn { top: 40%; }

/* ---- Shop: achievements header ------------------------------------------------------ */
.achv-top { display: grid; gap: 10px; margin: 6px 0 14px; }
.achv-badges { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; background: linear-gradient(135deg, #312E81, #6D28D9); color: #fff; text-decoration: none; box-shadow: 0 6px 18px rgba(76,29,149,.3); }
.achv-badges .ab-icon { font-size: 28px; }
.achv-badges span:nth-child(2) { display: grid; flex: 1; }
.achv-badges small { opacity: .8; font-weight: 700; }
.achv-ready { padding: 12px 14px; border-radius: 16px; background: rgba(251,191,36,.14); box-shadow: inset 0 0 0 1.5px rgba(251,191,36,.5); display: grid; gap: 8px; }
.achv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.achv-head { display: flex; align-items: baseline; gap: 6px; margin: 18px 0 8px; font-size: 16px; }
.achv-head small { font-weight: 600; font-size: 12px; }
.shop-item.achv.locked .shop-preview { filter: saturate(.5) brightness(.85); }

/* ---- Badges page -------------------------------------------------------------------- */
.badge-total { display: grid; text-align: center; padding: 8px 16px; border-radius: 16px; background: var(--card, #fff); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.badge-total b { font-size: 26px; } .badge-total span { font-size: 12px; font-weight: 700; color: var(--ink-3, #777); }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 13px; color: var(--accent, #6D28D9); text-decoration: none; margin-bottom: 4px; }
.badge-tiers { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.tier-chip { padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; color: #fff; }
.tier-bronze { --t1: #D6A274; --t2: #8C5A2B; } .tier-silver { --t1: #E5E7EB; --t2: #8C93A1; } .tier-gold { --t1: #FDE68A; --t2: #D97706; } .tier-cosmic { --t1: #C4B5FD; --t2: #6D28D9; }
.tier-chip { background: linear-gradient(135deg, var(--t1), var(--t2)); text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.badge-group h2 { font-size: 18px; margin: 18px 0 8px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge-card { display: grid; justify-items: center; gap: 4px; padding: 14px 10px 12px; border-radius: 18px; background: var(--card, #fff); box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05); text-align: center; }
.badge-card b { font-size: 14px; line-height: 1.2; }
.badge-card small { font-size: 11px; color: var(--ink-3, #777); font-weight: 600; line-height: 1.3; }
.badge-card .achv-bar { width: 80%; margin-top: 4px; }
.badge-card .badge-prog { font-weight: 800; }
.badge-medal { position: relative; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--t1), var(--t2)); box-shadow: 0 4px 12px rgba(0,0,0,.2), inset 0 -3px 6px rgba(0,0,0,.25); font-size: 28px; }
.badge-medal .medal-ring { position: absolute; inset: 4px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); }
.badge-card.locked .badge-medal { background: radial-gradient(circle at 35% 30%, #E5E7EB, #9CA3AF); filter: grayscale(1); opacity: .55; font-size: 22px; }
.badge-card.earned.tier-cosmic .badge-medal { animation: medal-glow 3s ease-in-out infinite; }
@keyframes medal-glow { 50% { box-shadow: 0 0 22px var(--t1), inset 0 -3px 6px rgba(0,0,0,.25); } }
.badge-done { font-size: 11px; font-weight: 900; color: #059669; text-transform: uppercase; letter-spacing: .06em; }
.badge-card.fresh { box-shadow: 0 0 0 2px #FBBF24, 0 6px 20px rgba(251,191,36,.35); animation: achv-flash 1.6s ease 2; }
.badge-card.fresh .badge-done { color: #D97706; }

/* ---- Galaxy reset -------------------------------------------------------------------- */
.galaxy-title { all: unset; cursor: pointer; display: grid; gap: 2px; -webkit-tap-highlight-color: transparent; }
.galaxy-title h2 { margin: 0; text-decoration: underline dotted rgba(255,255,255,.35); text-underline-offset: 6px; }
.galaxy-title .gt-hint { font-size: 12px; font-weight: 800; color: #6EE7B7; }
.galaxy-title:focus-visible { outline: 2px solid #A78BFA; outline-offset: 4px; border-radius: 8px; }
.reset-modal { display: grid; gap: 10px; text-align: center; justify-items: center; }
.reset-emblem { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; color: #fff; background: radial-gradient(circle at 35% 30%, var(--g2), var(--g1)); box-shadow: 0 0 24px var(--g1); }
.reset-modal .row { justify-content: center; gap: 10px; }
.guardian .g-skip { display: block; margin-top: 4px; font-size: 12px; font-weight: 800; color: #FCD34D; }

/* Handbook: Chords entry at the top */
.hb-chords { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; padding: 16px 18px; border-radius: 20px; text-decoration: none; color: #fff; background: linear-gradient(135deg, #4338CA, #7C3AED 60%, #DB2777); box-shadow: 0 8px 22px rgba(76,29,149,.3); }
.hb-chords .grow { display: grid; gap: 2px; }
.hb-chords b { font-size: 18px; }
.hb-chords small { opacity: .85; font-weight: 600; }
.hb-chords-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: rgba(255,255,255,.18); }
.hb-chords-icon .ico { width: 28px; height: 28px; }
.page-back { margin: 16px 0 -8px 20px; }

/* ---- Tab bar position (Settings › Display) ------------------------------------------- */
body[data-tabpos="top"] .tabbar { top: calc(12px + var(--safe-t)); bottom: auto; }
body[data-tabpos="top"] .screen { padding-bottom: calc(40px + var(--safe-b)); }
body[data-tabpos="top"] .page { padding-top: calc(92px + var(--safe-t)); }
body[data-tabpos="left"] .tabbar, body[data-tabpos="right"] .tabbar {
  top: 50%; bottom: auto; transform: translateY(-50%); flex-direction: column; gap: 6px; padding: 8px; border-radius: 28px;
}
body[data-tabpos="left"] .tabbar { left: calc(12px + env(safe-area-inset-left, 0px)); }
body[data-tabpos="right"] .tabbar { left: auto; right: calc(12px + env(safe-area-inset-right, 0px)); }
body[data-tabpos="left"] .tab, body[data-tabpos="right"] .tab { flex-direction: column; justify-content: center; gap: 4px; width: 74px; height: 64px; padding: 6px 4px; border-radius: 20px; font-size: 11px; }
body[data-tabpos="left"] .tab span, body[data-tabpos="right"] .tab span { display: inline; }
body[data-tabpos="left"] .screen { padding-left: 104px; padding-bottom: calc(40px + var(--safe-b)); }
body[data-tabpos="right"] .screen { padding-right: 104px; padding-bottom: calc(40px + var(--safe-b)); }
/* With the bar out of the way, the music bar and key legend can sit low again. */
body:not([data-tabpos="bottom"]) .musicbar { bottom: calc(18px + var(--safe-b)); }
body:not([data-tabpos="bottom"]) .nav-legend:not(.low) { bottom: calc(18px + var(--safe-b)); }
body[data-tabpos="left"] .musicbar { left: 108px; }
body[data-tabpos="right"] .nav-legend { right: 108px; }
@media (max-width: 560px) {
  body[data-tabpos="left"] .tab, body[data-tabpos="right"] .tab { width: 56px; height: 52px; }
  body[data-tabpos="left"] .tab span, body[data-tabpos="right"] .tab span { display: none; }
  body[data-tabpos="left"] .screen { padding-left: 80px; } body[data-tabpos="right"] .screen { padding-right: 80px; }
  body[data-tabpos="left"] .musicbar { left: 84px; } body[data-tabpos="right"] .nav-legend { right: 84px; }
}

.sboss-glyph { display: grid; place-items: center; width: 100%; height: 100%; font-size: 40px; color: #FDE68A; }

/* Pet nicknames */
.pet-tag { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 2px; padding: 1px 7px; border-radius: 99px; background: rgba(30,27,58,.8); color: #fff; font-size: 10px; font-weight: 800; white-space: nowrap; }
.pet-name-modal { display: grid; gap: 12px; justify-items: center; text-align: center; }
.pet-name-input { width: min(320px, 100%); font: 800 18px Nunito, sans-serif; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line, #ddd); text-align: center; }
.pet-name-input:focus { outline: none; border-color: #8B5CF6; }
.shop-buy { flex-wrap: wrap; }

/* Learn-page challenges summary: 3 open challenges per period */
.ch-card.ch-card-full { display: grid; gap: 10px; align-items: stretch; }
.ch-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ch-col { display: grid; gap: 8px; align-content: start; }
.ch-col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ch-col-head span { font-size: 12px; opacity: .75; font-weight: 700; }
.ch-line { display: grid; gap: 3px; }
.ch-text { font-size: 13px; font-weight: 700; line-height: 1.25; }
.ch-bar { height: 6px; border-radius: 99px; background: rgba(150,140,200,.25); overflow: hidden; }
.ch-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8B5CF6, #B98CFF); }
.ch-num { font-size: 11px; opacity: .7; font-weight: 700; }
.ch-rest { font-size: 12px; font-weight: 800; opacity: .75; }
.ch-line.all-done { font-size: 13px; font-weight: 800; color: #34D399; }
.ch-card-full .ch-more { justify-self: end; }
@media (max-width: 760px) { .ch-cols { grid-template-columns: 1fr; } }

/* Floating stars + Stardust while scrolling the Learn map */
.uni-hud { position: fixed; top: calc(12px + var(--safe-t)); left: 50%; margin-left: -90px; width: 180px; justify-content: center; z-index: 19; display: flex; gap: 8px; opacity: 0; transform: translateY(-10px); pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
.uni-hud.show { opacity: 1; transform: none; pointer-events: auto; }
.uni-hud .pill { background: rgba(30,27,58,.82); color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.3), inset 0 0 0 1px rgba(255,255,255,.15); }
body[data-tabpos="top"] .uni-hud { top: calc(84px + var(--safe-t)); }
body[data-tabpos="left"] .uni-hud { margin-left: -38px; } body[data-tabpos="right"] .uni-hud { margin-left: -142px; }

/* ---- Uncharted galaxies: silhouettes until you reach them ------------------------- */
.galaxy.unknown .planet-body,
.galaxy.unknown .guardian-orb,
.galaxy.unknown .rogue-body,
.galaxy.unknown .sboss-orb,
.galaxy.unknown .feature > :not(.feat-label) {
  filter: brightness(.13) saturate(0) drop-shadow(0 0 1.5px rgba(210,200,255,.6)) drop-shadow(0 0 14px rgba(120,110,210,.35));
}
.galaxy.unknown .route { opacity: .18; }
.galaxy.unknown .body-label, .galaxy.unknown .sun-label, .galaxy.unknown .feat-label { opacity: .55; }
.galaxy.unknown .body-label b, .galaxy.unknown .sun-label b, .galaxy.unknown .feat-label b { letter-spacing: .2em; }
.galaxy.unknown .galaxy-head p { letter-spacing: .2em; opacity: .6; }
.galaxy.unknown .lock { display: none; }
.galaxy.unknown .moon-chip { opacity: .55; }
.galaxy.unknown .moon-chip .mc-dot { width: 14px; height: 14px; border-radius: 50%; background: #111; box-shadow: 0 0 0 1px rgba(210,200,255,.4); flex: none; }
.galaxy.unknown .moon-chip span { display: grid; }

/* Inventory */
.shop-top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.inv-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.inv-pill { text-decoration: none; color: inherit; }
.inv-ico { font-size: 16px; line-height: 1; }
.inventory .shop-cat h2 small { font-size: 13px; font-weight: 700; }

/* ---- Holiday Season (limited-time rares) -------------------------------------------- */
.season-shop { margin: 6px 0 20px; padding: 18px; border-radius: 24px; background: linear-gradient(135deg, color-mix(in srgb, var(--ev) 22%, var(--surface, #fff)), var(--surface, #fff)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ev) 45%, transparent), var(--shadow); }
.season-head h2 { margin: 2px 0 4px; }
.season-head p { margin: 0 0 10px; }
.season-event h3 { display: flex; align-items: baseline; gap: 6px; margin: 16px 0 8px; }
.season-event h3 small { font-size: 12px; font-weight: 700; }
.season-soon { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; font-size: 13px; }
.sale-banner { padding: 10px 14px; border-radius: 14px; background: #0A0A0A; color: #FDE68A; font-size: 14px; margin-bottom: 6px; }
.shop-item.rare { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ev) 70%, transparent), 0 6px 18px color-mix(in srgb, var(--ev) 25%, transparent); }
.rare-tag { display: inline-block; font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; color: color-mix(in srgb, var(--ev) 80%, #000); }
s.was { opacity: .6; margin-right: 4px; font-weight: 700; }
.season-banner { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 14px 18px; border-radius: 20px; text-decoration: none; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--ev) 55%, #1E1B3A), #1E1B3A 85%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 8px 24px color-mix(in srgb, var(--ev) 30%, transparent); }
.season-banner .grow { display: grid; gap: 2px; }
.season-banner small { opacity: .85; font-weight: 600; }
.sb-emoji { font-size: 34px; }
.leaves-chip { margin-left: auto; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; background: rgba(0,0,0,.06); color: var(--ink-2, #555); }
.leaves-chip.soon { background: #FEE2E2; color: #B91C1C; }
.season-event.gone { opacity: .75; }
.shop-preview.silhouette > * { filter: brightness(0) drop-shadow(0 0 1.5px rgba(255,255,255,.55)) drop-shadow(0 0 10px color-mix(in srgb, var(--ev) 50%, transparent)); }
.shop-preview.silhouette .chip-btn { pointer-events: none; }
.shop-item.coming .shop-meta b { letter-spacing: .2em; }
.shop-item.coming { opacity: .92; }
.leaves-chip.countdown, .badge.countdown { background: color-mix(in srgb, var(--ev, #F59E0B) 18%, transparent); color: color-mix(in srgb, var(--ev, #F59E0B) 70%, #000); }
.all-items-head { margin: 26px 0 6px; padding-top: 18px; border-top: 2px solid var(--line, rgba(0,0,0,.08)); }
.all-items-head h2 { margin: 0; font-size: 26px; }
.all-items-head p { margin: 2px 0 0; }

/* ---- About & credits ---------------------------------------------------------------- */
.about-link { display: flex; align-items: center; gap: 14px; margin: 16px 0; padding: 16px 18px; border-radius: 18px; background: var(--surface, #fff); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.about-link .grow { display: grid; gap: 2px; }
.about-link small { color: var(--ink-3, #777); font-weight: 600; }
.about-link-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--tint, #EEF); color: var(--brand, #6D28D9); }
.about-card { margin-bottom: 16px; }
.about-card h2 { margin: 0 0 10px; font-size: 20px; }
.about-card p { line-height: 1.55; color: var(--ink-2); }
.about-card a { color: var(--brand, #6D28D9); font-weight: 700; }
.about-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.5; color: var(--ink-2); }
.about-pieces { margin-top: 14px; }
.about-pieces summary { cursor: pointer; font-weight: 800; color: var(--brand, #6D28D9); }
.piece-table { display: grid; margin-top: 10px; }
.piece-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line, rgba(0,0,0,.08)); }
.pr-title { display: grid; gap: 2px; }
.pr-title small, .pr-meta small { color: var(--ink-3, #777); font-weight: 600; }
.pr-meta { display: grid; justify-items: end; gap: 2px; font-size: 13px; text-align: right; flex: none; max-width: 45%; }
@media (max-width: 560px) { .piece-row { flex-direction: column; } .pr-meta { justify-items: start; text-align: left; max-width: none; } }
/* The app name is longer than it used to be: scale it down on narrow screens. */
.brand { font-size: clamp(26px, 4.2vw, 38px); line-height: 1.05; flex-wrap: wrap; }
@media (max-width: 560px) {
  header.top { flex-wrap: wrap; align-items: flex-start; }
  .brand { font-size: 28px; }
  header.top .pills { flex-wrap: wrap; }
}
