:root {
  --bg: #070a14;
  --ink: #e8f6ff;
  --dim: #7d8aa3;
  --cyan: #8fd3e0;
  --mag: #e9a6c4;
  --amb: #f0c890;
  --grn: #a6dcb5;
  --accent: var(--cyan);
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --disp: 'Syne', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; font-family: var(--mono); }
body { cursor: crosshair; -webkit-tap-highlight-color: transparent; user-select: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#mtrail { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 29; mix-blend-mode: screen; }
canvas#trail { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 30; }
.layer { position: fixed; z-index: 10; }
.hidden { opacity: 0 !important; pointer-events: none !important; }

/* ---------- ACT I ---------- */
#intro { inset: 0; pointer-events: none; }
#story {
  position: absolute; left: 50%; bottom: 14vh; transform: translateX(-50%);
  width: min(92vw, 900px); text-align: center;
  font-size: clamp(15px, 2.1vw, 22px); letter-spacing: .06em; line-height: 1.6;
  text-shadow: 0 0 18px rgba(143, 211, 224, .45);
}
#story .line { opacity: 0; transition: opacity .6s; white-space: pre-wrap; }
#story .line.on { opacity: 1; }
#story .line.out { opacity: 0; transition: opacity 1.2s; }
#story .caret { display: inline-block; width: .6em; height: 1.1em; vertical-align: -0.18em; background: var(--cyan); margin-left: 2px; animation: blink 1s steps(1) infinite; box-shadow: 0 0 10px var(--cyan); }
#story .big { font-family: var(--disp); font-weight: 800; font-size: clamp(22px, 4vw, 46px); letter-spacing: .02em; }
@keyframes blink { 50% { opacity: 0; } }

#hold-hint {
  position: absolute; left: 50%; top: 74%; transform: translate(-50%, -50%);
  font-size: 13px; letter-spacing: .6em; color: var(--cyan); opacity: 0; transition: opacity .8s;
  text-shadow: 0 0 12px var(--cyan); padding-left: .6em;
}
#hold-hint.on { opacity: 1; animation: breathe 2.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; letter-spacing: .75em; } }
#hold-ring { position: absolute; width: 96px; height: 96px; transform: translate(-50%, -50%) rotate(-90deg); opacity: 0; transition: opacity .3s; pointer-events: none; }
#hold-ring.on { opacity: 1; }
#hold-ring circle { fill: none; stroke-width: 2.5; }
#hold-ring .track { stroke: rgba(143, 211, 224, .15); }
#hold-ring .fill { stroke: var(--cyan); stroke-dasharray: 276.5; stroke-dashoffset: 276.5; filter: drop-shadow(0 0 6px var(--cyan)); stroke-linecap: round; }
#skip {
  position: absolute; right: 22px; bottom: 20px; pointer-events: auto;
  background: none; border: 1px solid rgba(255,255,255,.12); color: var(--dim); font: 12px var(--mono);
  padding: 8px 12px; border-radius: 999px; cursor: pointer; letter-spacing: .1em; transition: color .2s, border-color .2s;
}
#skip:hover { color: var(--ink); border-color: var(--cyan); }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 40; mix-blend-mode: screen; }

/* ---------- ACT II ---------- */
#top {
  top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px; transition: opacity 1s;
}
#brand { font-family: var(--disp); font-weight: 800; letter-spacing: .12em; font-size: 15px; display: flex; align-items: center; gap: 10px; }
#brand b { color: var(--accent); font-weight: 800; transition: color .6s; }
#brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.55); opacity: .5; } }
#modes { display: flex; gap: 4px; background: rgba(10, 14, 26, .55); border: 1px solid rgba(255,255,255,.07); border-radius: 999px; padding: 4px; backdrop-filter: blur(8px); }
#modes button, #sound, #replay, #help {
  background: none; border: 0; color: var(--dim); font: 12px var(--mono); letter-spacing: .14em; text-transform: uppercase;
  padding: 7px 13px; border-radius: 999px; cursor: pointer; transition: color .2s, background .2s;
}
#modes button:hover, #sound:hover, #replay:hover, #help:hover { color: var(--ink); }
#modes button.on { color: #04050a; background: var(--accent); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent); }
#sound, #replay, #help { border: 1px solid rgba(255,255,255,.08); }
.top-right { display: flex; gap: 6px; }

#labels { inset: 0; pointer-events: none; transition: opacity .8s; }
.lbl {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font-size: 11px; letter-spacing: .28em; color: var(--c, var(--ink)); text-shadow: 0 0 10px var(--c, #fff);
  transition: opacity .4s;
}
.lbl.lobe { font-family: var(--disp); font-weight: 800; font-size: 15px; letter-spacing: .32em; }
.lbl.lobe small { display: block; font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .06em; color: #a9b6cc; text-shadow: none; text-align: center; margin-top: 4px; }
.lbl.proj { font-size: 10.5px; letter-spacing: .14em; opacity: .0; }
.lbl.proj.show { opacity: .9; }
.lbl.trophy { font-size: 11px; letter-spacing: .04em; text-align: center; white-space: normal; width: 150px; line-height: 1.35; }
.lbl.trophy b { display: block; font-family: var(--disp); font-size: 15px; letter-spacing: .1em; }
.lbl.trophy span { color: var(--dim); font-size: 10px; text-shadow: none; }
.lbl.skill { font-size: 12.5px; letter-spacing: .06em; pointer-events: auto; cursor: pointer; padding: 5px 10px; border-radius: 999px; background: rgba(8,12,24,.7); border: 1px solid rgba(255,255,255,.12); }
.lbl.skill:hover, .lbl.skill.hot { background: #dff6ff; color: #04050a; text-shadow: none; }

#tip {
  position: fixed; z-index: 20; pointer-events: none; padding: 8px 12px; border-radius: 8px;
  background: rgba(6, 9, 18, .82); border: 1px solid rgba(255,255,255,.1); font-size: 12px; max-width: 280px;
  transform: translate(14px, 14px); backdrop-filter: blur(6px); transition: opacity .15s;
}
#tip b { display: block; font-family: var(--disp); font-size: 15px; letter-spacing: .04em; margin-bottom: 2px; color: var(--c, #fff); }
#tip span { color: var(--dim); }

/* HUD: holographic memory file */
#hud {
  position: fixed; z-index: 15; right: 22px; top: 76px; bottom: 96px; width: min(440px, calc(100vw - 44px));
  overflow-y: auto; padding: 18px 20px 22px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(10, 18, 34, .72), rgba(4, 6, 14, .82));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 18%, transparent), inset 0 0 60px rgba(0,0,0,.4);
  backdrop-filter: blur(10px); transition: opacity .5s, transform .6s cubic-bezier(.2,.9,.2,1);
  scrollbar-width: thin; scrollbar-color: var(--accent) transparent; user-select: text;
}
#hud.hidden { transform: translateX(30px) skewX(-4deg); }
#hud::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
}
.hud-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; letter-spacing: .2em; color: var(--accent); }
#hud-close { background: none; border: 1px solid rgba(255,255,255,.12); color: var(--dim); font: 11px var(--mono); padding: 5px 9px; border-radius: 999px; cursor: pointer; letter-spacing: .1em; }
#hud-close:hover { color: #fff; border-color: var(--accent); }
#hud h2 { font-family: var(--disp); font-weight: 800; font-size: clamp(26px, 3vw, 36px); line-height: 1.05; margin: 14px 0 6px; letter-spacing: .01em; text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 50%, transparent); }
#hud-tag { margin: 0 0 14px; color: var(--accent); font-size: 13px; }
#hud-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { flex: 1 1 110px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); }
.stat b { display: block; font-family: var(--disp); font-size: 24px; color: #fff; text-shadow: 0 0 14px var(--accent); }
.stat span { font-size: 10.5px; color: var(--dim); letter-spacing: .08em; }
#hud-stack { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { font-size: 11px; padding: 4px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--ink); opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }
.chip.on { opacity: 1; transform: none; }
#hud-points { margin: 0; padding-left: 0; list-style: none; counter-reset: p; }
#hud-points li { position: relative; padding: 0 0 12px 30px; font-size: 13px; line-height: 1.55; color: #cfe2f2; counter-increment: p; }
#hud-points li::before { content: counter(p, decimal-leading-zero); position: absolute; left: 0; top: 1px; font-size: 10.5px; color: var(--accent); }
#hud-links { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
#hud-links a {
  display: inline-flex; align-items: center; gap: 8px; color: #04050a; background: var(--accent); text-decoration: none;
  font-size: 12px; font-weight: 600; letter-spacing: .1em; padding: 9px 14px; border-radius: 999px;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 50%, transparent);
}
#hud-links a.ghost { background: none; color: var(--ink); border: 1px solid rgba(255,255,255,.18); box-shadow: none; }
.cert { font-size: 12px; color: var(--dim); margin-top: 10px; }

/* agent cursor */
#agent { position: fixed; z-index: 35; left: 0; top: 0; width: 28px; height: 28px; pointer-events: none; transition: opacity .5s; will-change: transform; }
#agent svg { width: 28px; height: 28px; overflow: visible; filter: drop-shadow(0 0 6px var(--cyan)) drop-shadow(0 0 14px var(--cyan)); }
#agent path { fill: #04050a; stroke: var(--cyan); stroke-width: 1.8; stroke-linejoin: round; }
#agent.click path { fill: var(--cyan); }
#agent-say {
  position: absolute; left: 26px; top: 22px; white-space: nowrap; font-size: 12px; padding: 6px 10px; border-radius: 8px 8px 8px 2px;
  background: rgba(6, 10, 20, .88); border: 1px solid rgba(143, 211, 224, .45); color: var(--ink); opacity: 0; transform: translateY(4px);
  transition: opacity .3s, transform .3s; max-width: 320px; white-space: normal; width: max-content;
}
#agent-say.on { opacity: 1; transform: none; }
#agent-say.left { left: auto; right: 8px; border-radius: 8px 8px 2px 8px; }
.ripple { position: fixed; z-index: 34; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid var(--cyan); pointer-events: none; animation: rip .7s ease-out forwards; }
@keyframes rip { to { transform: scale(7); opacity: 0; } }

/* command bar */
#cmd {
  left: 50%; bottom: 18px; transform: translateX(-50%); width: min(720px, calc(100vw - 32px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; border-radius: 16px;
  background: rgba(6, 10, 20, .7); border: 1px solid rgba(143, 211, 224, .22); backdrop-filter: blur(10px); transition: opacity 1s;
}
.cmd-prompt { color: var(--cyan); font-size: 12px; letter-spacing: .1em; }
#cmd-in { flex: 1 1 200px; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font: 14px var(--mono); padding: 6px 0; }
#cmd-in::placeholder { color: #55607a; }
#chips { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
#chips button {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); color: #aab6cc; font: 11.5px var(--mono);
  padding: 5px 10px; border-radius: 999px; cursor: pointer; transition: all .2s;
}
#chips button:hover { color: #04050a; background: var(--cyan); border-color: var(--cyan); }

#hint { left: 50%; transform: translateX(-50%); bottom: 132px; font-size: 11px; letter-spacing: .2em; color: var(--dim); transition: opacity 1.2s; pointer-events: none; }
.nojs { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; }

@media (max-width: 720px) {
  #top { padding: 12px 14px; flex-wrap: wrap; }
  #brand { font-size: 13px; }
  #modes button { padding: 6px 8px; font-size: 10.5px; letter-spacing: .06em; }
  #sound, #replay { padding: 6px 8px; font-size: 10.5px; }
  #hud { left: 12px; right: 12px; width: auto; top: auto; bottom: 74px; max-height: 50vh; }
  #cmd { bottom: 10px; padding: 8px 10px; }
  #chips button { font-size: 10.5px; padding: 4px 8px; }
  #hint { display: none; }
  #agent-say { max-width: 230px; }
}
@media (prefers-reduced-motion: reduce) {
  #hold-hint.on, #brand .dot { animation: none; }
}

body.hud-open #chips { display: none; }
body.hud-open #hint { opacity: 0; }

/* ---------- remaster: calm palette, welcome, coach, journey ---------- */
#modes .j-tab { color: #cfe9ef; }
#modes .j-tab:not(.on) { box-shadow: inset 0 0 0 1px rgba(143, 211, 224, .35); }
body.journey-on #cmd, body.journey-on #hint, body.journey-on #hud, body.welcome-on #cmd, body.welcome-on #hint { opacity: 0 !important; pointer-events: none !important; }
body.welcome-on #labels { opacity: .35; }

#welcome {
  position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(7,10,20,.35), rgba(7,10,20,.8)); transition: opacity .8s;
}
.w-card {
  width: min(640px, 100%); padding: 30px 30px 24px; border-radius: 22px; text-align: center;
  background: linear-gradient(160deg, rgba(22, 30, 48, .78), rgba(10, 14, 26, .86));
  border: 1px solid rgba(255,255,255,.1); box-shadow: 0 30px 80px rgba(0,0,0,.45); backdrop-filter: blur(14px);
  animation: rise .9s cubic-bezier(.2,.9,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.w-kicker { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: #9fb4c8; }
.w-card h1 { font-family: var(--disp); font-weight: 800; font-size: clamp(26px, 4.6vw, 42px); margin: 8px 0 10px; line-height: 1.1;
  background: linear-gradient(90deg, #a9dde8, #ecc0d3 55%, #f3d6a8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.w-lead { color: #c6d3e2; font-size: 14px; line-height: 1.6; margin: 0 auto 20px; max-width: 460px; }
.w-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.w-choice {
  text-align: left; padding: 16px 16px 14px; border-radius: 16px; cursor: pointer; font: inherit; color: var(--ink);
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); transition: transform .25s, background .25s, border-color .25s;
}
.w-choice:hover { transform: translateY(-3px); background: rgba(255,255,255,.07); border-color: rgba(143,211,224,.5); }
.w-choice b { display: block; font-family: var(--disp); font-size: 17px; margin-bottom: 6px; }
.w-choice span { font-size: 12px; color: #9fb0c4; line-height: 1.5; }
.w-choice.main { background: linear-gradient(150deg, rgba(143,211,224,.22), rgba(233,166,196,.14)); border-color: rgba(143,211,224,.45); }
.w-foot { margin: 18px 0 0; font-size: 12px; color: #8d9cb1; }
.w-foot i { color: #cfe3ee; font-style: normal; }
@media (max-width: 560px) { .w-choices { grid-template-columns: 1fr; } .w-card { padding: 22px 18px 18px; } }

#coach { position: fixed; z-index: 12; width: 0; height: 0; pointer-events: none; transition: opacity .6s; }
#coach::before { content: ''; position: absolute; left: -46px; top: -46px; width: 92px; height: 92px; border-radius: 50%;
  border: 2px solid rgba(143,211,224,.8); animation: coach 1.8s ease-out infinite; }
#coach span { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); white-space: nowrap; font-size: 12px; letter-spacing: .08em;
  padding: 6px 12px; border-radius: 999px; background: rgba(10,14,26,.85); border: 1px solid rgba(143,211,224,.4); color: #e3f2f7; }
@keyframes coach { 0% { transform: scale(.7); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }

#journey { position: fixed; inset: 0; z-index: 14; pointer-events: none; transition: opacity .8s; }
#journey > * { pointer-events: auto; }
#j-bar { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); width: min(760px, calc(100vw - 32px)); display: flex; gap: 4px; }
#j-bar .seg { flex: 1; height: 14px; padding: 5px 0; background: none; border: 0; cursor: pointer; }
#j-bar .seg::before { content: ''; display: block; height: 3px; border-radius: 2px; background: rgba(255,255,255,.14); }
#j-bar .seg i { display: block; height: 3px; margin-top: -3px; border-radius: 2px; background: linear-gradient(90deg, #a9dde8, #ecc0d3); width: 0; transition: width .2s linear; }
.j-caption {
  position: absolute; left: clamp(16px, 5vw, 64px); bottom: 92px; width: min(500px, calc(100vw - 32px));
  max-height: calc(100vh - 220px); overflow-y: auto; scrollbar-width: none;
  padding: 22px 24px; border-radius: 20px; background: linear-gradient(160deg, rgba(20, 28, 46, .62), rgba(10, 14, 26, .78));
  border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(12px); box-shadow: 0 24px 60px rgba(0,0,0,.35);
  opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .9s cubic-bezier(.2,.9,.2,1);
}
.j-caption.in { opacity: 1; transform: none; }
.j-caption.kind-hello, .j-caption.kind-end { left: 50%; transform: translate(-50%, 18px); text-align: center; bottom: 50%; margin-bottom: -150px; width: min(620px, calc(100vw - 32px)); }
.j-caption.kind-hello.in, .j-caption.kind-end.in { transform: translate(-50%, 0); }
.j-kicker { font-size: 10.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--k, #9fb4c8); margin-bottom: 6px; }
.j-caption h2 { font-family: var(--disp); font-weight: 800; font-size: clamp(24px, 3vw, 34px); margin: 0 0 6px; line-height: 1.1; color: #eef3f8; }
.j-name { font-family: var(--disp); font-weight: 800; font-size: clamp(34px, 6vw, 64px); margin: 4px 0 8px; line-height: 1.02;
  background: linear-gradient(90deg, #a9dde8, #ecc0d3 55%, #f3d6a8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.j-lead { margin: 0 0 10px; color: #cbd8e6; font-size: 14px; line-height: 1.6; }
.j-small { margin: 6px 0 0; color: #8f9fb4; font-size: 12px; line-height: 1.6; }
.j-stats { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.j-stats span { padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.05); font-size: 11px; color: #9fb0c4; }
.j-stats b { display: block; font-family: var(--disp); font-size: 18px; color: #f1f5f9; }
.j-points { margin: 0 0 10px; padding-left: 18px; color: #c3d0de; font-size: 13px; line-height: 1.55; }
.j-points li { margin-bottom: 6px; }
.j-stack { display: flex; flex-wrap: wrap; gap: 5px; }
.j-stack i { font-style: normal; font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); color: #cdd8e4; }
.j-link, .j-links a, .j-free { display: inline-block; margin-top: 12px; font: 600 12px var(--mono); letter-spacing: .08em; padding: 9px 14px; border-radius: 999px;
  background: #cfe9ef; color: #0b1020; text-decoration: none; border: 0; cursor: pointer; }
.j-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.j-links a + a, .j-free.ghost { background: rgba(255,255,255,.06); color: #e3edf5; border: 1px solid rgba(255,255,255,.15); }
.j-trophies { list-style: none; margin: 6px 0 0; padding: 0; columns: 2; column-gap: 18px; font-size: 12.5px; color: #c9d5e2; }
.j-trophies li { break-inside: avoid; margin-bottom: 7px; }
.j-trophies b { color: #f3d9a4; font-family: var(--disp); margin-right: 4px; }
.j-trophies em { color: #8f9fb4; font-style: normal; font-size: 11px; }
#j-ctrl { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 999px;
  background: rgba(10,14,26,.7); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(10px); }
#j-ctrl button { background: none; border: 0; color: #cfdbe7; font: 13px var(--mono); padding: 8px 13px; border-radius: 999px; cursor: pointer; }
#j-ctrl button:hover { background: rgba(255,255,255,.08); }
#j-exit { font-size: 11px !important; letter-spacing: .1em; color: #8f9fb4 !important; }
#journey.paused #j-play { background: #cfe9ef; color: #0b1020; }
@media (max-width: 720px) {
  #j-bar { top: 108px; }
  .j-caption { left: 12px; right: 12px; width: auto; bottom: 76px; max-height: 46vh; padding: 16px; }
  .j-caption.kind-hello, .j-caption.kind-end { left: 50%; right: auto; width: calc(100vw - 24px); margin-bottom: -120px; }
  .j-trophies { columns: 1; }
}
body.journey-on #labels, body.journey-on #tip, body.journey-on #agent, body.journey-on #coach, body.journey-on #mtrail { display: none !important; }
#j-loading { position: fixed; inset: 0; z-index: 13; display: grid; place-items: center; color: #e6eef5; font: 13px var(--mono); letter-spacing: .3em;
  background: radial-gradient(ellipse at center, #1c2436, #0c111c); transition: opacity 1.2s; pointer-events: none; }
.j-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.j-chips i { font-style: normal; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); color: #aebccb; transition: all .5s; }
.j-chips i.on { background: #f2dcc4; color: #1a1410; border-color: #f2dcc4; }
.j-caption h2 .ch { display: inline-block; opacity: 0; transform: translateY(.4em); filter: blur(6px); transition: opacity .6s, transform .8s cubic-bezier(.2,.9,.2,1), filter .8s; }
.j-caption.in h2 .ch { opacity: 1; transform: none; filter: none; }

.j-caption.kind-hello { background: linear-gradient(160deg, rgba(20, 28, 46, .32), rgba(10, 14, 26, .42)); border-color: rgba(255,255,255,.14); bottom: 18%; margin-bottom: 0; }

/* ---------- nature theme: light, frosted, calm (mind over the lake + journey) ---------- */
body.nature { --ink: #1f2b31; --dim: #5d6c74; cursor: default; }
body.nature #brand { color: #1f2b31; text-shadow: 0 1px 12px rgba(255,255,255,.7); }
body.nature #brand b { color: #3f7f8c; }
body.nature #brand .dot { background: #6aa8b4; box-shadow: none; }
body.nature #modes, body.nature #sound, body.nature #replay, body.nature #help {
  background: rgba(252, 250, 246, .62); border: 1px solid rgba(40, 60, 70, .12); backdrop-filter: blur(14px);
}
body.nature #modes button, body.nature #sound, body.nature #replay, body.nature #help { color: #4a5a62; }
body.nature #modes button:hover, body.nature #sound:hover, body.nature #replay:hover, body.nature #help:hover { color: #14202a; }
body.nature #modes button.on { color: #10202a; background: #cfe7ea; box-shadow: none; }
body.nature #modes .j-tab { color: #2f6f7c; }
body.nature #modes .j-tab:not(.on) { box-shadow: inset 0 0 0 1px rgba(63,127,140,.35); }

body.nature .lbl { color: #1f2f37; text-shadow: 0 0 6px rgba(255,255,255,.95), 0 0 16px rgba(255,255,255,.8); }
body.nature .lbl.lobe { color: #20323a; padding-bottom: 4px; border-bottom: 2px solid var(--c); }
body.nature .lbl.lobe small { color: #48585f; text-shadow: 0 0 6px rgba(255,255,255,.95); }
body.nature .lbl.proj { font-weight: 600; }
body.nature .lbl.trophy span { color: #c9d3dc; }
body.nature .lbl.skill { background: rgba(252,250,246,.78); border-color: rgba(40,60,70,.14); color: #24343c; text-shadow: none; }
body.nature .lbl.skill:hover, body.nature .lbl.skill.hot { background: #24343c; color: #f7f5f0; }

body.nature #tip { background: rgba(252,250,246,.88); border-color: rgba(40,60,70,.12); color: #24343c; box-shadow: 0 10px 30px rgba(30,40,50,.15); }
body.nature #tip b { color: #20323a; }
body.nature #tip span { color: #5d6c74; }

body.nature #hud, body.nature .j-caption, body.nature .w-card {
  background: linear-gradient(160deg, rgba(253, 252, 249, .8), rgba(244, 241, 235, .74));
  border: 1px solid rgba(40, 60, 70, .12); color: #1f2b31; box-shadow: 0 24px 60px rgba(30, 40, 50, .18);
}
body.nature #hud::before { display: none; }
body.nature .hud-head { color: #3f7f8c; }
body.nature #hud h2, body.nature .j-caption h2 { color: #172329 !important; text-shadow: none; }
body.nature #hud-tag { color: #3f7f8c; }
body.nature .stat, body.nature .j-stats span { background: rgba(40, 60, 70, .05); border-color: rgba(40,60,70,.08); color: #5d6c74; }
body.nature .stat b, body.nature .j-stats b { color: #172329; text-shadow: none; }
body.nature .stat span { color: #5d6c74; }
body.nature .chip, body.nature .j-stack i { color: #24343c; border-color: rgba(40,60,70,.22); }
body.nature #hud-points li, body.nature .j-points, body.nature .j-lead { color: #33434b; }
body.nature #hud-points li::before { color: #3f7f8c; }
body.nature .j-small, body.nature .cert, body.nature .w-foot, body.nature .w-kicker { color: #66757c; }
body.nature .j-kicker { color: #5f8f98; }
body.nature #hud-links a, body.nature .j-link, body.nature .j-links a, body.nature .j-free { background: #24343c; color: #f7f5f0; box-shadow: none; }
body.nature #hud-links a.ghost, body.nature .j-links a + a, body.nature .j-free.ghost { background: transparent; color: #24343c; border: 1px solid rgba(40,60,70,.25); }
body.nature #hud-close { color: #5d6c74; border-color: rgba(40,60,70,.2); }
body.nature .j-trophies { color: #33434b; }
body.nature .j-trophies b { color: #a97b2c; }
body.nature .j-chips i { color: #4a5a62; border-color: rgba(40,60,70,.2); }
body.nature .j-chips i.on { background: #24343c; color: #f7f5f0; border-color: #24343c; }
body.nature .w-card h1, body.nature .j-name { background: linear-gradient(90deg, #3f7f8c, #b06d8a 55%, #b8874a); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.nature .w-lead { color: #3d4c54; }
body.nature .w-choice { background: rgba(40,60,70,.04); border-color: rgba(40,60,70,.14); color: #1f2b31; }
body.nature .w-choice span { color: #5d6c74; }
body.nature .w-choice.main { background: linear-gradient(150deg, rgba(143,211,224,.35), rgba(233,166,196,.22)); border-color: rgba(63,127,140,.4); }
body.nature .w-foot i { color: #24343c; }
body.nature #welcome { background: radial-gradient(ellipse at center, rgba(255,255,255,.05), rgba(30,40,50,.25)); }

body.nature #cmd { background: rgba(252,250,246,.72); border-color: rgba(40,60,70,.14); box-shadow: 0 16px 40px rgba(30,40,50,.12); }
body.nature .cmd-prompt { color: #3f7f8c; }
body.nature #cmd-in { color: #1f2b31; }
body.nature #cmd-in::placeholder { color: #8a979d; }
body.nature #chips button { background: rgba(40,60,70,.05); border-color: rgba(40,60,70,.12); color: #3d4c54; }
body.nature #chips button:hover { background: #24343c; color: #f7f5f0; border-color: #24343c; }
body.nature #hint { color: #2f3f47; text-shadow: 0 0 8px rgba(255,255,255,.9); }
body.nature #agent path { fill: #f7f5f0; stroke: #2f6f7c; }
body.nature #agent svg { filter: drop-shadow(0 2px 6px rgba(30,40,50,.35)); }
body.nature #agent-say { background: rgba(252,250,246,.92); border-color: rgba(63,127,140,.35); color: #1f2b31; box-shadow: 0 10px 30px rgba(30,40,50,.18); }
body.nature #coach::before { border-color: rgba(47,111,124,.85); }
body.nature #coach span { background: rgba(252,250,246,.92); color: #1f2b31; border-color: rgba(47,111,124,.4); }
body.nature #j-ctrl { background: rgba(252,250,246,.72); border-color: rgba(40,60,70,.14); }
body.nature #j-ctrl button { color: #2f3f47; }
body.nature #j-ctrl button:hover { background: rgba(40,60,70,.08); }
body.nature #journey.paused #j-play { background: #24343c; color: #f7f5f0; }
body.nature #j-bar .seg::before { background: rgba(40,60,70,.18); }
body.nature #j-bar .seg i { background: linear-gradient(90deg, #3f7f8c, #b06d8a); }
body.nature #j-loading { background: radial-gradient(ellipse at center, #f4efe6, #dfe7e8); color: #3d4c54; }
body.nature .ripple { border-color: #2f6f7c; }
body.nature #flash { background: #fffaf2; }

/* labels under the stars of the journey's night crown */
#star-labels { position: fixed; inset: 0; z-index: 13; pointer-events: none; }
.star-lbl { position: absolute; transform: translateX(-50%); width: 150px; text-align: center; opacity: 0; transition: opacity 1.2s ease;
  font: 11px var(--mono); line-height: 1.35; color: #e9eef7; text-shadow: 0 1px 8px rgba(0,0,10,.9); }
.star-lbl b { display: block; font-family: var(--disp); font-size: 15px; letter-spacing: .06em; color: #f3d9a4; }
.star-lbl.rank-1 b { color: #ffe3a3; font-size: 17px; }
.star-lbl.rank-2 b { color: #e4ebf7; }
.star-lbl.rank-3 b { color: #f2b49a; }
.star-lbl.rank-4 b { color: #a9dde8; }
.star-lbl.rank-5 b { color: #ecc0d3; }
.star-lbl em { display: block; font-style: normal; font-size: 10px; color: #a9b4c6; }
body:not(.journey-on) #star-labels { display: none; }

/* ---------- intro: one drop of ink in still water ---------- */
canvas#ink { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 9; display: block; transform-origin: 50% 50%; }
body.drop-intro { background: #f6f2ec; cursor: pointer; }
body.drop-intro #story { color: #24343c; text-shadow: 0 0 18px rgba(255,255,255,.9); bottom: 12vh; }
body.drop-intro #story .serif { font-family: 'Cormorant Garamond', Georgia, serif; font-style: italic; font-size: clamp(22px, 3.2vw, 38px); letter-spacing: .01em; }
body.drop-intro #story .serif.small { font-size: clamp(18px, 2.4vw, 28px); }
body.drop-intro #hold-hint { color: #3f7f8c; text-shadow: none; top: 66%; font-size: 12px; letter-spacing: .4em; }
body.drop-intro #hold-ring .track { stroke: rgba(63,127,140,.15); }
body.drop-intro #hold-ring .fill { stroke: #3f7f8c; filter: none; }
body.drop-intro #skip { color: #6b7a80; border-color: rgba(40,60,70,.18); }
body.drop-intro #skip:hover { color: #1f2b31; border-color: #3f7f8c; }
.drop { position: fixed; z-index: 11; width: 16px; height: 22px; pointer-events: none; transform: translate(-50%, -100%);
  border-radius: 50% 50% 50% 50% / 62% 62% 40% 40%;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.95) 0 10%, transparent 26%), radial-gradient(circle at 50% 65%, var(--c), color-mix(in srgb, var(--c) 60%, #102028));
  box-shadow: 0 6px 14px rgba(20,40,50,.25); }

body.drop-intro #labels, body.drop-intro #tip, body.drop-intro #coach, body.drop-intro #agent, body.drop-intro #mtrail, body.drop-intro #star-labels { display: none !important; }

/* A small instrument panel, leaving the world as the main experience. */
#atmosphere { position: fixed; left: 24px; bottom: 112px; z-index: 25; width: 236px; color: #20383e; background: rgba(245,250,249,.87); border: 1px solid rgba(60,100,110,.22); border-radius: 16px; box-shadow: 0 12px 36px #122e3820; backdrop-filter: blur(18px); font: 14px var(--mono); }
#atmosphere summary { cursor: pointer; padding: 15px 17px; font-weight: 600; }
#atmosphere summary span { display: block; margin: 5px 0 0 15px; color: #587178; font-size: 12px; font-weight: 400; }
.atmo-body { padding: 0 17px 17px; }
.atmo-body p { font: 14px/1.5 var(--mono); margin: 0 0 18px; }
.atmo-body label { display: flex; justify-content: space-between; margin: 14px 0 9px; }
.atmo-body output { color: #50757d; font-size: 12px; }
.atmo-body input { width: 100%; accent-color: #327b82; cursor: pointer; }
.atmo-times { display: flex; justify-content: space-between; font-size: 12px; color: #61777c; }
.atmo-body button, .atmo-body select { width: 100%; padding: 10px; border: 1px solid #597e7b40; border-radius: 8px; background: #ffffff90; color: #20383e; font: inherit; }
.atmo-body button { margin-top: 18px; cursor: pointer; }
.atmo-body button[aria-pressed=true] { background: #286770; color: white; }
.atmo-body .atmo-hint { margin: 16px 0 0; color: #61777c; font-size: 12px; }
body.drop-intro #atmosphere, body.journey-on #atmosphere, body:has(#welcome:not(.hidden)) #atmosphere { display: none; }
button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid #398a98; outline-offset: 4px; }
@media (max-width: 720px) {
  #atmosphere { left: 12px; bottom: 142px; width: 196px; }
  #atmosphere:not([open]) { width: auto; }
  #atmosphere summary { padding: 11px 13px; }
  #atmosphere summary span { display: none; }
  .atmo-body { max-height: 40vh; overflow: auto; }
  body:has(#hud:not(.hidden)) #atmosphere { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; } }

.startup-error { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; background: #10252c; color: #edf5f5; text-align: center; }
.startup-error button, .startup-error a { color: inherit; font: 16px var(--mono); }
.startup-error button { border: 1px solid #8fd3e0; border-radius: 8px; padding: 12px 20px; background: #23444c; cursor: pointer; }
