/* =====================================================================
   Starfall Valley — glassmorphism UI over a Shinkai-inspired voxel world
   ===================================================================== */
:root {
  --navy: #1e3a8a;
  --navy-d: #141a42;
  --lav: #b57edc;
  --peach: #febb7e;
  --apricot: #f79760;
  --gold: #f5e049;
  --champ: #fff2d6;
  --mauve: #3d315b;
  --violet: #4a3e6d;
  --teal: #0f4c5c;
  --sakura: #ffb7c5;
  --emerald: #34d399;
  --coral: #f87171;
  --amber: #fbbf24;
  --slate: #334155;
  --text: #fff8ee;
  --text-dim: rgba(255, 248, 238, .74);
  --text-faint: rgba(255, 248, 238, .5);
  --glass: rgba(38, 28, 78, .44);
  --glass-strong: rgba(30, 22, 64, .78);
  --glass-line: rgba(255, 255, 255, .2);
  --r: 22px;
  --shadow: 0 22px 60px -18px rgba(18, 8, 48, .65);
  --display: 'Fredoka', 'Nunito', ui-rounded, system-ui, sans-serif;
  --body: 'Nunito', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--body);
  color: var(--text);
  background: radial-gradient(120% 80% at 70% 0%, #3a3a8a 0%, #1e2456 45%, #120f30 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; }
svg.ico { width: 1.05em; height: 1.05em; vertical-align: -0.15em; flex: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
b, strong { font-weight: 800; }

#world { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; outline: none; }
.fx-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(ellipse 85% 75% at 50% 45%, transparent 55%, rgba(26, 12, 56, .42) 100%),
    linear-gradient(180deg, rgba(20, 16, 60, .18), transparent 18%, transparent 78%, rgba(20, 12, 48, .35));
}
body.no3d #world { display: none; }
body.no3d { background: #1e2456 url('assets/img/loading.jpg') center / cover no-repeat; }
body.no3d::before { content: ''; position: fixed; inset: 0; backdrop-filter: blur(6px) brightness(.85); }

/* ------------------------------------------------------------- glass + buttons */
.glass {
  background: linear-gradient(165deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .04) 45%, rgba(255, 255, 255, .02)), var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .28);
  border-radius: var(--r);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  border: 0; border-radius: 999px;
  padding: .72em 1.35em;
  font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: .01em;
  transition: transform .12s, box-shadow .12s, filter .2s, opacity .2s;
  white-space: nowrap;
}
.btn.sm { font-size: 14.5px; padding: .58em 1.05em; }
.btn-xl { font-size: 21px; padding: .8em 1.6em; }
.btn-primary {
  color: #4a2412;
  background: linear-gradient(180deg, #fff1a6 0%, #ffcd75 45%, #f79760 100%);
  box-shadow: 0 4px 0 #c0643a, 0 12px 26px -8px rgba(247, 151, 96, .85), inset 0 2px 0 rgba(255, 255, 255, .7);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}
.btn-primary:hover { filter: brightness(1.06) saturate(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #c0643a, 0 6px 14px -6px rgba(247, 151, 96, .8), inset 0 2px 0 rgba(255, 255, 255, .6); }
.btn-primary.glow { animation: btnGlow 1.6s ease-in-out infinite; }
@keyframes btnGlow { 50% { box-shadow: 0 4px 0 #c0643a, 0 0 0 8px rgba(245, 224, 73, .25), 0 12px 34px -4px rgba(255, 200, 100, .9), inset 0 2px 0 rgba(255, 255, 255, .7); } }
.btn-glass {
  color: var(--text);
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .07));
  border: 1px solid rgba(255, 255, 255, .24);
  box-shadow: 0 3px 0 rgba(14, 8, 40, .35), inset 0 1px 0 rgba(255, 255, 255, .3);
  backdrop-filter: blur(10px);
}
.btn-glass:hover { background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .1)); }
.btn-glass:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(14, 8, 40, .35); }
.btn-glass:disabled { opacity: .4; }
.btn-glass.danger { color: #ffc2c2; }
.btn-danger { background: linear-gradient(180deg, #ffb4b4, #f87171 60%, #e05252); color: #4a0d0d; box-shadow: 0 4px 0 #a83a3a, inset 0 2px 0 rgba(255, 255, 255, .6); }

.icon-btn {
  width: 46px; height: 46px; border-radius: 15px; display: inline-grid; place-items: center; padding: 0;
  transition: transform .12s, background .2s, opacity .2s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { transform: translateY(-2px); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.ghost { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.icon-btn.off { opacity: .55; }
.icon-btn.off::after { content: ''; position: absolute; width: 26px; height: 2.5px; background: var(--text); transform: rotate(-45deg); border-radius: 2px; box-shadow: 0 0 0 2px rgba(40, 28, 80, .7); }
.icon-btn { position: relative; }

/* voxel number tile */
.tile {
  display: inline-grid; place-items: center;
  min-width: 1.5em; height: 1.5em; padding: 0 .22em;
  font-family: var(--display); font-weight: 700; line-height: 1;
  color: #3a2614;
  background: linear-gradient(180deg, #fffaea 0%, #ffe7b0 100%);
  border-radius: .2em;
  box-shadow: inset 0 -.11em 0 rgba(176, 102, 40, .32), inset 0 .07em 0 rgba(255, 255, 255, .95), 0 .09em 0 #c98a4a, 0 .22em .5em rgba(30, 14, 60, .4);
}
.tile.gold { background: linear-gradient(180deg, #fff9c4, #f9d84a 70%, #f2bf2c); box-shadow: inset 0 -.11em 0 rgba(180, 110, 0, .35), inset 0 .07em 0 rgba(255, 255, 255, .95), 0 .09em 0 #c08a1c, 0 .22em .6em rgba(245, 200, 60, .5); }
.tile.violet { color: #2a1a50; background: linear-gradient(180deg, #f2eaff, #cdb2f6); box-shadow: inset 0 -.11em 0 rgba(90, 50, 160, .3), inset 0 .07em 0 rgba(255, 255, 255, .95), 0 .09em 0 #8a62c9, 0 .22em .5em rgba(30, 14, 60, .4); }
.tile.big { font-size: 34px; }
.op { font-family: var(--display); font-weight: 600; color: var(--champ); opacity: .9; }
.math { font-family: var(--display); font-weight: 600; color: #ffe89a; white-space: nowrap; background: rgba(255, 230, 150, .1); border-radius: 8px; padding: 0 .25em; }

/* ------------------------------------------------------------- screens */
.screen {
  position: fixed; inset: 0; z-index: 5;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .55s var(--ease-out), visibility 0s linear .55s;
}
.screen.show { opacity: 1; visibility: visible; transition: opacity .55s var(--ease-out); }
.screen.show > * { pointer-events: auto; }
.screen.show > .float-layer { pointer-events: none; }

/* ------------------------------------------------------------- loading */
#scr-loading { z-index: 30; overflow: hidden; background: #1e2456; }
.ld-art {
  position: absolute; inset: -4%;
  background: url('assets/img/loading.jpg') center 35% / cover no-repeat;
  animation: kenburns 38s ease-in-out infinite alternate;
  pointer-events: none !important;
  translate: var(--px, 0) var(--py, 0);
  transition: translate .8s var(--ease-out);
}
.ld-rays {
  position: absolute; left: 50%; top: -30vmax; width: 160vmax; height: 160vmax; margin-left: -80vmax; pointer-events: none !important;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 236, 190, .12) 0deg 4deg, transparent 4deg 13deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .9) 0, transparent 55%);
  mask-image: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, .9) 0, transparent 55%);
  mix-blend-mode: screen; animation: raysTurn 90s linear infinite; opacity: .7;
  translate: calc(var(--px, 0) * -1.6) calc(var(--py, 0) * -1.6);
}
@keyframes raysTurn { to { transform: rotate(360deg); } }
.ld-flies { position: absolute; inset: 0; pointer-events: none !important; }
.ld-flies i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle, #fff7c8 0, #ffd26b 40%, transparent 70%);
  box-shadow: 0 0 10px 3px rgba(255, 214, 120, .55);
  animation: fly var(--d, 9s) ease-in-out infinite alternate, glim var(--g, 3s) ease-in-out infinite alternate;
}
@keyframes fly { to { transform: translate(var(--fx, 40px), var(--fy, -60px)); } }
@keyframes glim { from { opacity: .15; } to { opacity: .95; } }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.14) translate(-1.5%, 1.5%); } }
.ld-shade {
  position: absolute; inset: 0; pointer-events: none !important;
  background:
    linear-gradient(0deg, rgba(18, 12, 46, .92) 0%, rgba(30, 20, 70, .6) 32%, rgba(40, 24, 80, 0) 62%),
    radial-gradient(60% 50% at 50% 100%, rgba(255, 170, 120, .18), transparent 70%);
}
.ld-petals { position: absolute; inset: 0; pointer-events: none !important; }
.ld-petals i {
  position: absolute; top: -6%;
  width: calc(14px * var(--s)); height: calc(10px * var(--s));
  background: linear-gradient(135deg, #fff0f5, #ffb7c5 60%, #f48fb1);
  border-radius: 80% 0 80% 0;
  opacity: .9;
  animation: petalFall linear infinite;
  filter: drop-shadow(0 2px 3px rgba(120, 40, 80, .25));
}
@keyframes petalFall {
  0% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(calc(var(--drift) * .3), 28vh) rotate(140deg); }
  50% { transform: translate(calc(var(--drift) * .5), 55vh) rotate(260deg) scaleX(.6); }
  100% { transform: translate(var(--drift), 112vh) rotate(520deg); }
}
.ld-content {
  position: absolute; left: 50%; bottom: max(7vh, 40px); transform: translateX(-50%);
  width: min(720px, calc(100% - 32px));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.ld-head, .ld-actions { display: flex; flex-direction: column; align-items: center; width: 100%; }
/* phones in portrait: tall painting with Aria & Mochi in the lower third, title in the sky */
@media (orientation: portrait) and (max-aspect-ratio: 4/5) {
  .ld-art { background-image: url('assets/img/loading_portrait.jpg'); background-position: center 60%; }
  .ld-content { top: max(6vh, 28px); bottom: calc(max(4vh, 18px) + var(--safe-b)); justify-content: space-between; }
  .ld-shade {
    background:
      linear-gradient(180deg, rgba(24, 16, 60, .55) 0%, rgba(30, 20, 70, .15) 26%, transparent 42%),
      linear-gradient(0deg, rgba(18, 12, 46, .82) 0%, rgba(24, 16, 56, .35) 16%, transparent 30%);
  }
  .tagline { margin: 10px 0 0; font-size: 15px; }
  .ld-art { inset: -3% -4% calc(15vh + var(--safe-b)) -4%; background-position: center bottom; -webkit-mask-image: linear-gradient(180deg, #000 86%, transparent); mask-image: linear-gradient(180deg, #000 86%, transparent); }
  .ld-actions .ld-msg { margin-top: 6px; }
}
@media (orientation: portrait) and (max-aspect-ratio: 4/5) { .ld-foot { display: none !important; } }
.kicker {
  margin: 0 0 6px; font-family: var(--display); font-weight: 500; letter-spacing: .28em; text-transform: uppercase;
  font-size: 13px; color: #ffe2b8; text-shadow: 0 2px 8px rgba(30, 10, 60, .6);
  animation: rise 1s .2s var(--ease-out) backwards;
}
.logo {
  margin: 0; display: flex; flex-direction: column; align-items: center;
  font-family: var(--display); font-weight: 700; line-height: .82; letter-spacing: .005em;
}
.logo span { display: block; -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo .l1 {
  font-size: clamp(54px, 9.5vw, 118px);
  background-image: linear-gradient(180deg, #fffdf2 10%, #ffe9a3 50%, #ffb36b 95%);
  filter: drop-shadow(0 4px 0 rgba(96, 44, 92, .75)) drop-shadow(0 0 26px rgba(255, 200, 120, .55));
  animation: rise 1.1s .35s var(--ease-back) backwards;
}
.logo .l2 {
  font-size: clamp(64px, 11.5vw, 146px); margin-top: -.04em;
  background-image: linear-gradient(180deg, #ffe6f0 5%, #ffb7c5 45%, #b57edc 100%);
  filter: drop-shadow(0 5px 0 rgba(60, 30, 100, .8)) drop-shadow(0 0 30px rgba(255, 160, 210, .5));
  animation: rise 1.1s .5s var(--ease-back) backwards;
}
.tagline {
  max-width: 520px; margin: 14px 0 22px; font-size: 17px; line-height: 1.45; color: var(--text-dim);
  text-shadow: 0 2px 10px rgba(20, 10, 40, .8);
  animation: rise 1s .7s var(--ease-out) backwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.ld-bar {
  width: min(380px, 80%); height: 10px; border-radius: 99px; overflow: hidden;
  background: rgba(255, 255, 255, .14); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .14);
  transition: opacity .5s, height .4s;
}
.ld-bar.done { opacity: 0; height: 0; }
.ld-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, #b57edc, #ffb7c5, #ffd27a, #f5e049);
  background-size: 200% 100%;
  box-shadow: 0 0 16px rgba(255, 210, 122, .8);
  transition: width .4s var(--ease-out);
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.ld-msg { margin: 10px 0 0; font-size: 14px; color: var(--text-faint); min-height: 20px; font-weight: 700; letter-spacing: .02em; }
#btn-begin { margin-top: 6px; opacity: 0; transform: translateY(14px) scale(.96); transition: opacity .6s var(--ease-out), transform .6s var(--ease-back); }
#btn-begin.in { opacity: 1; transform: none; animation: btnGlow 2s 1s ease-in-out infinite; }
.ld-foot { position: absolute; right: 18px; bottom: calc(14px + var(--safe-b)); margin: 0; font-size: 13px; color: var(--text-faint); display: flex; gap: 6px; align-items: center; }

/* ------------------------------------------------------------- profile */
#scr-profile { display: flex; overflow-y: auto; padding: 84px 16px 24px; -webkit-overflow-scrolling: touch; }
#scr-profile.show { pointer-events: auto; }
.pf-card {
  margin: auto; flex: none;
  width: min(500px, 100%); padding: 74px 30px 24px; position: relative; text-align: center;
  background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 45%), var(--glass-strong);
  animation: cardIn .8s var(--ease-back) backwards .15s;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.pf-portraits { position: absolute; left: 50%; top: -62px; transform: translateX(-50%); width: 170px; height: 124px; }
.pf-portraits img { position: absolute; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 4px #ffe08a, 0 0 0 7px rgba(255, 255, 255, .25), 0 14px 30px rgba(20, 10, 50, .5); }
.pf-aria { width: 118px; height: 118px; left: 0; top: 0; animation: bob 4s ease-in-out infinite; }
.pf-mochi { width: 74px; height: 74px; right: 0; bottom: -2px; box-shadow: 0 0 0 4px #ffb76a, 0 0 0 7px rgba(255, 255, 255, .25), 0 10px 22px rgba(20, 10, 50, .5) !important; animation: bob 4s 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.pf-lang { display: flex; justify-content: center; margin: 0 0 14px; }
.pf-card h2 { margin: 0 0 6px; font-family: var(--display); font-size: 30px; font-weight: 700; color: #fff3d0; }
.pf-sub { margin: 0 auto 18px; max-width: 380px; color: var(--text-dim); line-height: 1.45; }
.pf-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; max-height: 34vh; overflow: auto; padding: 2px; }
.pf-item { display: flex; gap: 6px; align-items: center; }
.pf-pick {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; text-align: left;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 18px; background: rgba(255, 255, 255, .08);
  transition: background .2s, transform .15s, border-color .2s;
}
.pf-pick:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 224, 138, .6); transform: translateX(3px); }
.pf-meta { flex: 1; display: flex; flex-direction: column; }
.pf-meta b { font-family: var(--display); font-weight: 600; font-size: 19px; }
.pf-meta small { color: var(--text-dim); font-size: 13px; }
.pf-pick .go { width: 20px; height: 20px; opacity: .7; }
.pf-form label { display: block; font-weight: 800; margin-bottom: 8px; color: #ffe2b8; }
.pf-input { display: flex; gap: 8px; }
.pf-input input {
  flex: 1 1 120px; min-width: 0; font: 600 20px var(--display); color: #2c1d4a; padding: 12px 18px;
  border: 0; border-radius: 999px; background: linear-gradient(180deg, #fffaf0, #fff0d8);
  box-shadow: inset 0 3px 6px rgba(80, 40, 20, .18), 0 0 0 3px rgba(255, 255, 255, .15);
  user-select: text; -webkit-user-select: text;
}
.pf-input input::placeholder { color: #b49a86; }
.pf-input input:focus { outline: none; box-shadow: inset 0 3px 6px rgba(80, 40, 20, .18), 0 0 0 3px var(--gold); }
.pf-err { min-height: 20px; margin: 8px 0 0; color: #ffb4b4; font-weight: 700; font-size: 14px; }
.pf-note { margin: 6px 0 0; font-size: 13px; color: var(--text-faint); display: flex; gap: 6px; justify-content: center; align-items: center; }

.avatar {
  width: 48px; height: 48px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--av, #f79760) 55%, white), var(--av, #f79760) 70%);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), inset 0 3px 0 rgba(255, 255, 255, .45), 0 4px 10px rgba(20, 10, 50, .35);
  font-family: var(--display); font-weight: 700; font-size: 24px; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}
.avatar.sm { width: 42px; height: 42px; border-radius: 12px; font-size: 21px; }

/* ------------------------------------------------------------- hub */
.hud-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 12px; align-items: flex-start; z-index: 8; }
.player-wrap { position: relative; z-index: 6; }
.player { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; text-align: left; color: var(--text); transition: background-color .2s, transform .15s; }
.player:hover { background-color: rgba(60, 44, 110, .55); }
.player:active { transform: scale(.98); }
.pl-caret { width: 16px; height: 16px; opacity: .75; transform: rotate(90deg); transition: transform .25s var(--ease-back); flex: none; }
.player.open .pl-caret { transform: rotate(-90deg); }
.player-menu {
  position: absolute; top: calc(100% + 8px); left: 0; min-width: 250px; padding: 8px; display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 50%), var(--glass-strong);
  transform-origin: top left; animation: menuIn .28s var(--ease-back);
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.95); } }
.player-menu hr { border: 0; height: 1px; background: rgba(255, 255, 255, .14); margin: 6px 6px; }
.pm-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; border-radius: 12px; background: none; color: var(--text); font-weight: 800; font-size: 15px; text-align: left; }
.pm-item:hover, .pm-item:focus-visible { background: rgba(255, 255, 255, .1); }
.pm-item svg { width: 20px; height: 20px; flex: none; }
.pm-item span { flex: 1; }
.pm-state { position: relative; width: 38px; height: 22px; border-radius: 99px; flex: none; background: linear-gradient(90deg, #34d399, #7ee8c0); transition: background .25s; }
.pm-state::after { content: ''; position: absolute; top: 3px; left: 19px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .25s var(--ease-back); }
.pm-item.off .pm-state { background: rgba(255, 255, 255, .2); }
.pm-item.off .pm-state::after { left: 3px; }
.pm-item.off svg { opacity: .5; }
.pl-txt { display: flex; flex-direction: column; line-height: 1.15; }
.pl-name { font-family: var(--display); font-weight: 600; font-size: 20px; }
.pl-rank { font-size: 12.5px; color: var(--text-dim); font-weight: 700; }
.dust { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 18px 14px 12px; min-width: 250px; overflow: hidden; }
.dust-ico { width: 36px; height: 36px; filter: drop-shadow(0 0 10px rgba(255, 220, 100, .8)); animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: rotate(12deg) scale(1.1); filter: drop-shadow(0 0 16px rgba(255, 220, 100, 1)); } }
.dust-txt { display: flex; flex-direction: column; line-height: 1.1; }
.dust-n { font-family: var(--display); font-weight: 700; font-size: 24px; color: #fff3b0; text-shadow: 0 0 14px rgba(255, 210, 100, .55); }
#dust-next { font-size: 12.5px; color: var(--text-dim); font-weight: 700; }
.dust-track { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.dust-track i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #ffb7c5, #f5e049); box-shadow: 0 0 8px #f5e049; transition: width .8s var(--ease-out); }
.hud-btns { margin-left: auto; display: flex; gap: 8px; }

.hub-actions { position: absolute; right: 14px; top: 50%; transform: translateY(-58%); display: flex; flex-direction: column; gap: 10px; z-index: 2; }
.act {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; width: 236px; text-align: left;
  transition: transform .18s var(--ease-back), background .2s, opacity .2s;
}
.act:hover { transform: translateX(-5px); background-color: rgba(60, 44, 110, .55); }
.act:active { transform: translateX(-2px) scale(.98); }
.act:disabled { opacity: .55; }
.act:disabled:hover { transform: none; }
.act-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), inset 0 3px 0 rgba(255, 255, 255, .4); }
.act-ico svg { width: 24px; height: 24px; }
.act-ico.mix { background: linear-gradient(180deg, #d9b8ff, #9f6fe0); color: #2c1458; }
.act-ico.map { background: linear-gradient(180deg, #a8f5d4, #34d399); color: #0d4a35; }
.act-ico.vil { background: linear-gradient(180deg, #ffe0a8, #f79760); color: #5a2a10; }
.act-ico.walk { background: linear-gradient(180deg, #9ae6b4, #38bdf8); color: #064e3b; }
.act-txt { display: flex; flex-direction: column; line-height: 1.2; }
.act-txt b { font-family: var(--display); font-weight: 600; font-size: 18px; }
.act-txt small { color: var(--text-dim); font-size: 12.5px; font-weight: 700; }

.hub-bubble {
  position: absolute; left: 14px; top: 84px; max-width: 380px; z-index: 10;
  display: flex; gap: 12px; align-items: center; padding: 10px 16px 10px 10px;
  opacity: 0; transform: translateY(-10px) scale(.96); transform-origin: top left; pointer-events: none !important;
  transition: opacity .4s, transform .5s var(--ease-back);
}
.hub-bubble.in { opacity: 1; transform: none; }
.hub-bubble.anchored {
  transform-origin: bottom center;
  filter: drop-shadow(0 10px 24px rgba(10, 6, 24, 0.45));
  right: auto;
  max-width: min(340px, calc(100vw - 32px));
}
.hub-bubble.anchored::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: var(--tail-x, 32px);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 9px solid rgba(28, 22, 54, 0.75);
  pointer-events: none;
}
.hub-bubble img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px #ffd27a; flex: none; }
.hub-bubble p { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 600; }
.hub-bubble p b { color: #ffe89a; }
.visit-chip { position: absolute; left: 50%; top: 80px; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; font-weight: 800; display: flex; align-items: center; gap: 6px; z-index: 4; }

.journey {
  position: absolute; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%);
  width: min(1120px, calc(100% - 28px)); z-index: 2;
}
.journey-head { display: flex; align-items: baseline; gap: 12px; padding: 0 8px 8px; text-shadow: 0 2px 8px rgba(20, 10, 40, .8); }
.journey-head b { font-family: var(--display); font-weight: 600; font-size: 19px; color: #fff3d0; }
.journey-head small { color: var(--text-dim); font-weight: 700; font-size: 13px; }
.trail {
  position: relative; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  padding: 14px 10px 10px; border-radius: 26px;
  background: linear-gradient(180deg, rgba(30, 22, 70, .25), rgba(30, 22, 70, .55));
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%);
  box-shadow: var(--shadow);
}
.trail::before {
  content: ''; position: absolute; left: 7%; right: 7%; top: 46px; height: 4px; border-radius: 4px;
  background: repeating-linear-gradient(90deg, rgba(255, 240, 200, .55) 0 10px, transparent 10px 18px);
}
.stone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; animation: stoneIn .6s var(--ease-back) backwards; animation-delay: calc(var(--i) * 70ms); }
@keyframes stoneIn { from { opacity: 0; transform: translateY(20px) scale(.8); } }
.stone-face {
  position: relative; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(180deg, #fff6e0, #ffd9a0 70%);
  box-shadow: inset 0 -6px 0 rgba(170, 96, 40, .32), inset 0 4px 0 rgba(255, 255, 255, .9), 0 5px 0 #b97842, 0 10px 18px rgba(20, 10, 50, .45);
  transition: transform .2s var(--ease-back);
}
.stone:hover .stone-face { transform: translateY(-4px) rotate(-2deg); }
.stone:active .stone-face { transform: translateY(1px); }
.stone-sym { font-family: var(--display); font-weight: 700; font-size: 21px; color: #4a2a14; letter-spacing: -.01em; }
.stone-stars { display: flex; gap: 1px; height: 14px; }
.stone-stars svg { width: 14px; height: 14px; color: rgba(255, 255, 255, .22); }
.stone-stars svg.on { color: #ffd84a; filter: drop-shadow(0 0 4px rgba(255, 216, 74, .9)); }
.stone-name { font-size: 12.5px; font-weight: 800; color: var(--text-dim); text-align: center; line-height: 1.15; max-width: 120px; text-shadow: 0 1px 6px rgba(20, 10, 40, .9); }
.stone.done .stone-face { background: linear-gradient(180deg, #e8fff4, #8ff0c4 70%); box-shadow: inset 0 -6px 0 rgba(20, 120, 80, .3), inset 0 4px 0 rgba(255, 255, 255, .9), 0 5px 0 #2a9a6c, 0 10px 18px rgba(20, 10, 50, .45); }
.stone.done .stone-sym { color: #0d4a35; }
.stone.current .stone-face { background: linear-gradient(180deg, #fffbd0, #f9d84a 70%); animation: currentPulse 2s ease-in-out infinite; }
.stone.current .stone-name { color: #ffe89a; }
@keyframes currentPulse {
  0%, 100% { transform: translateY(0); box-shadow: inset 0 -6px 0 rgba(180, 110, 0, .35), inset 0 4px 0 rgba(255, 255, 255, .9), 0 5px 0 #c08a1c, 0 0 0 0 rgba(245, 224, 73, .6), 0 10px 18px rgba(20, 10, 50, .45); }
  50% { transform: translateY(-5px); box-shadow: inset 0 -6px 0 rgba(180, 110, 0, .35), inset 0 4px 0 rgba(255, 255, 255, .9), 0 5px 0 #c08a1c, 0 0 0 10px rgba(245, 224, 73, 0), 0 0 30px rgba(245, 224, 73, .8); }
}
.stone.locked .stone-face { background: linear-gradient(180deg, #8d88a8, #5e587e 70%); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .2), inset 0 3px 0 rgba(255, 255, 255, .25), 0 5px 0 #3d375c, 0 10px 18px rgba(20, 10, 50, .4); }
.stone.locked .stone-sym { color: rgba(255, 255, 255, .45); }
.stone.locked .stone-name { color: var(--text-faint); }
.stone .lock { position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; padding: 4px; border-radius: 9px; background: #3d315b; color: #d6cdf0; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }

.tier-pop {
  position: fixed; z-index: 20; padding: 18px; background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 50%), var(--glass-strong);
  opacity: 0; transform: translateY(10px) scale(.96); transform-origin: var(--arrow) 100%;
}
.tier-pop.in { opacity: 1; transform: none; transition: opacity .25s, transform .35s var(--ease-back); }
.tier-pop::after { content: ''; position: absolute; left: var(--arrow); bottom: -9px; width: 18px; height: 18px; transform: translateX(-50%) rotate(45deg); background: rgba(40, 30, 80, .95); border-right: 1px solid var(--glass-line); border-bottom: 1px solid var(--glass-line); }
.tp-head { display: flex; align-items: center; gap: 12px; }
.tp-sym { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font: 700 19px var(--display); color: #4a2a14; background: linear-gradient(180deg, #fff6e0, #ffd9a0); box-shadow: inset 0 -5px 0 rgba(170, 96, 40, .3), 0 4px 0 #b97842; flex: none; }
.tp-head small { color: #ffd9a6; font-weight: 800; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
.tp-head h3 { margin: 2px 0 0; font: 600 22px var(--display); }
.tier-pop p { margin: 12px 0; line-height: 1.45; color: var(--text-dim); }
.tp-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tp-meta span { font-size: 12.5px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.tp-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.tp-lock { color: #d6cdf0 !important; }

body.cinematic #scr-hub > *:not(.tier-pop) { opacity: 0; pointer-events: none !important; transition: opacity .6s; }
body.cinematic::before, body.cinematic::after { content: ''; position: fixed; left: 0; right: 0; height: 9vh; background: #0b0820; z-index: 8; animation: bars .8s var(--ease-out) both; }
body.cinematic::before { top: 0; }
body.cinematic::after { bottom: 0; }
@keyframes bars { from { height: 0; } }
#scr-hub > * { transition: opacity .6s; }

/* ------------------------------------------------------------- lesson */
.top-bar { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; align-items: center; gap: 12px; z-index: 3; }
.title-pill { padding: 8px 20px; display: flex; flex-direction: column; line-height: 1.15; border-radius: 18px; min-width: 0; flex: 0 1 auto; }
.title-pill small, .title-pill b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-pill small { font-size: 12px; color: #ffd9a6; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.title-pill b { font: 600 19px var(--display); }
#ls-skip { margin-left: auto; }
.top-bar .voice-toggle { flex: none; }

.stage {
  position: absolute; right: max(3vw, 16px); top: 44%; transform: translate(0, -50%) scale(.94);
  width: min(480px, 42vw); min-height: 260px; padding: 34px 22px 22px; display: grid; place-items: center;
  opacity: 0; transition: opacity .4s, transform .5s var(--ease-back);
  background:
    linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(165deg, rgba(110, 140, 255, .22), rgba(40, 30, 90, .25)), var(--glass-strong);
}
.stage.show { opacity: 1; transform: translate(0, -50%); }
.stage.pulse .stage-inner { animation: stageIn .5s var(--ease-out); }
@keyframes stageIn { from { opacity: 0; transform: translateY(8px); } }
.stage-label { position: absolute; left: 16px; top: 12px; font: 600 12px var(--display); letter-spacing: .2em; text-transform: uppercase; color: #b8c6ff; opacity: .8; }
.stage-inner { width: 100%; display: grid; place-items: center; }

.dialog {
  position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%);
  width: min(1000px, calc(100% - 28px)); min-height: 168px; display: flex; gap: 22px; padding: 20px 22px 18px 196px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 50%), var(--glass-strong);
  cursor: pointer; animation: cardIn .6s var(--ease-back) backwards;
}
.dlg-portrait { position: absolute; left: 22px; bottom: 18px; width: 156px; }
.dlg-portrait img {
  width: 156px; height: 156px; border-radius: 26px; object-fit: cover;
  box-shadow: 0 0 0 4px var(--ring, #7ee8c0), 0 0 0 8px rgba(255, 255, 255, .16), 0 16px 34px rgba(16, 8, 40, .6);
  transform: translateY(-34px);
}
.dlg-portrait img.swap { animation: portraitSwap .45s var(--ease-back); }
@keyframes portraitSwap { from { opacity: 0; transform: translateY(-14px) scale(.85) rotate(-4deg); } }
.dialog.aria { --ring: #7ee8c0; }
.dialog.mochi { --ring: #ffb76a; }
.dlg-name {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  padding: 5px 16px 6px; border-radius: 12px; white-space: nowrap; text-align: center; line-height: 1;
  font: 700 18px var(--display); color: #2c1a12;
  background: linear-gradient(180deg, #fffbe6, var(--ring));
  box-shadow: 0 3px 0 rgba(0, 0, 0, .2), 0 8px 18px rgba(16, 8, 40, .4);
}
.dlg-name small { display: block; font: 800 10px var(--body); letter-spacing: .12em; text-transform: uppercase; opacity: .7; margin-top: 2px; }
.dlg-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dlg-text { flex: 1; margin: 0; font-size: clamp(17px, 1.6vw, 21px); line-height: 1.55; font-weight: 700; color: #fffaf0; min-height: 3.1em; }
.dlg-text.typing::after { content: '▌'; color: var(--gold); animation: blink .7s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.dlg-nav { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.dlg-progress { display: flex; gap: 5px; margin-right: auto; flex-wrap: wrap; }
.dlg-progress i { width: 9px; height: 9px; border-radius: 3px; background: rgba(255, 255, 255, .2); transition: background .3s, transform .3s; }
.dlg-progress i.past { background: rgba(255, 216, 122, .6); }
.dlg-progress i.now { background: var(--gold); transform: scale(1.3); box-shadow: 0 0 8px var(--gold); }

/* ------------------------------------------------------------- practice */
.pr-dust { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 18px; }
.pr-dust svg { width: 26px; height: 26px; }
.pr-dust .dust-n { font-size: 22px; }
.pr-wrap { position: absolute; right: max(3vw, 14px); top: 52%; transform: translateY(-50%); display: flex; flex-direction: row-reverse; align-items: center; gap: 18px; z-index: 2; }
.pr-card {
  width: 400px; padding: 18px 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 50%), var(--glass-strong);
}
.pr-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.pr-dots i { width: 14px; height: 14px; border-radius: 4px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); transition: background .3s, transform .3s; }
.pr-dots i.now { background: rgba(255, 255, 255, .5); transform: translateY(-3px); box-shadow: 0 0 0 2px rgba(255, 255, 255, .4); }
.pr-dots i.ok { background: linear-gradient(180deg, #a8f5d4, #34d399); }
.pr-dots i.swift { background: linear-gradient(180deg, #fff6a8, #f5c542); box-shadow: 0 0 8px rgba(245, 224, 73, .9); }
.pr-dots i.miss { background: linear-gradient(180deg, #e6dcff, #b8a6e6); }
.pr-eq { display: flex; align-items: center; gap: 10px; font-size: 54px; margin: 10px 0 2px; }
.pr-eq .tile { font-size: 54px; min-width: 1.3em; height: 1.3em; }
.pr-eq .op { font-size: 44px; }
.pr-eq.pop .tile { animation: tilePop .5s var(--ease-back) backwards; }
.pr-eq.pop .tile.b { animation-delay: .08s; }
@keyframes tilePop { from { opacity: 0; transform: translateY(-16px) scale(.6) rotate(-8deg); } }
.pr-eq.win .tile { animation: tileWin .6s var(--ease-back); }
@keyframes tileWin { 40% { transform: translateY(-10px) scale(1.08); } }
.pr-eq.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.slot {
  min-width: 1.7em; height: 1.3em; padding: 0 .15em; border-radius: .2em; display: inline-grid; place-items: center;
  font: 700 54px var(--display); color: #fff;
  background: rgba(10, 6, 30, .35); border: 3px dashed rgba(255, 255, 255, .35);
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.slot.filled { border-style: solid; border-color: rgba(255, 255, 255, .6); background: rgba(255, 255, 255, .1); }
.slot .caret { width: 4px; height: .8em; background: var(--gold); border-radius: 2px; animation: blink 1s steps(1) infinite; box-shadow: 0 0 8px var(--gold); }
.slot.good { border: 3px solid #7ef0c0; background: linear-gradient(180deg, #d8ffef, #5fe0a8); color: #0b4a33; box-shadow: 0 0 26px rgba(52, 211, 153, .75); }
.slot.bad { border-color: #ffb0b0; background: rgba(248, 113, 113, .35); }
.slot.nudge { animation: shake .3s; }
.pr-feedback { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; font-weight: 700; font-size: 15.5px; line-height: 1.35; color: var(--text-dim); }
.pr-feedback img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px #ffb76a; }
.pr-feedback p { margin: 0; }
.pr-feedback.tip { text-align: left; background: rgba(255, 255, 255, .08); border-radius: 14px; padding: 6px 12px 6px 6px; animation: rise .4s var(--ease-out); }
.pr-feedback.soft p { color: #e6dcff; }
.praise { font: 700 26px var(--display); animation: praiseIn .55s var(--ease-back); display: inline-block; }
.praise.swift { background: linear-gradient(180deg, #fffbe0, #f5e049 60%, #ffb36b); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 10px rgba(255, 220, 100, .7)); font-size: 30px; }
.praise.fluent, .praise.retry, .praise.scaffold { color: #9ff2cc; }
.praise.slow { color: #c9f5e2; }
@keyframes praiseIn { from { opacity: 0; transform: scale(.5); } }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.numpad button {
  height: 62px; border: 0; border-radius: 16px;
  font: 600 30px var(--display); color: #3a2614;
  background: linear-gradient(180deg, #fffdf6, #ffeccc);
  box-shadow: inset 0 -5px 0 rgba(176, 102, 40, .22), inset 0 3px 0 rgba(255, 255, 255, .95), 0 4px 0 #c99a6a, 0 8px 14px rgba(20, 10, 50, .35);
  transition: transform .08s, box-shadow .08s, filter .15s;
  touch-action: manipulation;
}
.numpad button:hover { filter: brightness(1.04); }
.numpad button:active, .numpad button.press { transform: translateY(3px); box-shadow: inset 0 -3px 0 rgba(176, 102, 40, .22), inset 0 3px 0 rgba(255, 255, 255, .95), 0 1px 0 #c99a6a, 0 3px 8px rgba(20, 10, 50, .35); }
.numpad .k-fn { background: linear-gradient(180deg, #f1e8ff, #cdb6f2); color: #3a2470; box-shadow: inset 0 -5px 0 rgba(80, 40, 160, .2), inset 0 3px 0 rgba(255, 255, 255, .9), 0 4px 0 #8a6ac2, 0 8px 14px rgba(20, 10, 50, .35); }
.numpad .k-ok { background: linear-gradient(180deg, #d4ffec, #4fdca2); color: #0b4a33; box-shadow: inset 0 -5px 0 rgba(10, 100, 60, .25), inset 0 3px 0 rgba(255, 255, 255, .9), 0 4px 0 #23966a, 0 8px 14px rgba(20, 10, 50, .35); }
.numpad svg { width: 28px; height: 28px; }
.hint-btn { background: none; border: 0; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-weight: 800; font-size: 14.5px; color: #ffe2a0; transition: background .2s, opacity .2s; }
.hint-btn:hover { background: rgba(255, 255, 255, .1); }
.hint-btn:disabled { opacity: .35; }
.hint-btn svg { width: 20px; height: 20px; }

.pr-hint {
  width: 370px; padding: 16px 18px 18px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 50%), var(--glass-strong);
}
.pr-hint.in { animation: hintIn .5s var(--ease-back); }
@keyframes hintIn { from { opacity: 0; transform: translateX(30px) scale(.95); } }
.pr-hint.mochi { box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 0 2px rgba(255, 183, 106, .45); }
.pr-hint.aria { box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 0 2px rgba(126, 232, 192, .45); }
.hb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hb-face { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3); }
.hb-head b { font: 700 18px var(--display); display: block; }
.hb-head small { color: #ffd9a6; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.hb-text { margin: 0 0 12px; line-height: 1.5; font-weight: 700; font-size: 16px; }
.hb-text .lead { display: block; color: #ffe89a; margin-bottom: 4px; }
.hb-visual { display: grid; place-items: center; padding: 14px 8px 8px; border-radius: 16px; background: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px) 0 0 / 18px 18px, linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px) 0 0 / 18px 18px, rgba(80, 100, 220, .14); }
.hb-visual.empty { display: none; }

.float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.float-dust { position: fixed; transform: translate(-50%, 0); font: 700 28px var(--display); color: #fff3b0; text-shadow: 0 0 12px rgba(255, 210, 100, .9), 0 2px 0 rgba(120, 60, 20, .6); animation: floatUp 1.4s var(--ease-out) forwards; display: flex; align-items: center; gap: 4px; }
.float-dust.big { font-size: 38px; }
.float-dust small { font: 800 14px var(--body); color: #ffe8b0; margin-left: 4px; letter-spacing: .02em; }
.float-dust svg { width: 1em; height: 1em; }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -20px) scale(1.1); } to { opacity: 0; transform: translate(-50%, -90px) scale(1); } }
.spark { position: fixed; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: #fff3a0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: spark .9s var(--ease-out) forwards; filter: drop-shadow(0 0 4px #ffd84a); }
.spark:nth-child(3n) { background: #ffb7c5; }
.spark:nth-child(3n+1) { background: #9ff2cc; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(180deg) scale(.3); opacity: 0; } }

/* ------------------------------------------------------------- visual aids */
.va { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.va-cap { font-weight: 800; font-size: 16px; color: var(--text-dim); text-align: center; line-height: 1.4; }
.va-cap b { color: #ffe89a; font-family: var(--display); font-weight: 600; font-size: 1.15em; }
.va-cap .q { display: inline-grid; place-items: center; min-width: 1.6em; padding: 0 .3em; border-radius: 8px; background: rgba(245, 224, 73, .2); color: #fff3a0; animation: qPulse 1.4s ease-in-out infinite; }
@keyframes qPulse { 50% { box-shadow: 0 0 0 4px rgba(245, 224, 73, .18); } }
.va-cap .muted { color: var(--text-faint); font-weight: 700; }
.va-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.va-row.bottom { align-items: flex-end; }
.va-grid { display: grid; gap: 3px; }
.vx {
  display: block; width: var(--cell, 22px); height: var(--cell, 22px); border-radius: 3px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .2), inset 2px 2px 0 rgba(255, 255, 255, .45);
  animation: vxIn .38s var(--ease-back) backwards;
}
@keyframes vxIn { from { opacity: 0; transform: translateY(-10px) scale(.3); } }
.h-amber { --c1: #ffe08a; --c2: #f5b52e; }
.h-emerald { --c1: #b2f7d8; --c2: #2fc78c; }
.h-sky { --c1: #bfe3ff; --c2: #5aa7f2; }
.h-rose { --c1: #ffc6cf; --c2: #f0708a; }
.h-violet { --c1: #e2d0ff; --c2: #9b70e0; }
.h-peach { --c1: #ffd8b8; --c2: #f79760; }
.h-teal { --c1: #b5f0ec; --c2: #2bb3a8; }
.h-lime { --c1: #e2f9a8; --c2: #9ccc3a; }
.h-sakura { --c1: #ffe4ec; --c2: #ff9fbc; }
.h-gold { --c1: #fff6b0; --c2: #f5c542; box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .15), inset 2px 2px 0 rgba(255, 255, 255, .6), 0 0 8px rgba(245, 224, 73, .6); }
.vx.fade { opacity: .28; animation: vxIn .38s var(--ease-back) backwards, fadeOut 1.4s 1.2s forwards; }
@keyframes fadeOut { to { opacity: .22; transform: scale(.75); } }

.tray { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 10px 6px; border-radius: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
.tray-n { font: 700 16px var(--display); color: #ffe89a; }
.turn-stage { min-height: 120px; display: grid; place-items: center; }
.spin90 { animation: spin90 4s var(--ease-out) infinite; }
@keyframes spin90 { 0%, 30% { transform: rotate(0); } 50%, 80% { transform: rotate(90deg); } 100% { transform: rotate(0); } }

.mini-grid { display: grid; grid-template-columns: repeat(10, 14px); gap: 3px; }
.mini-grid .m { width: 14px; height: 14px; border-radius: 3px; background: rgba(255, 255, 255, .1); animation: vxIn .3s backwards; }
.mini-grid .m.on { background: linear-gradient(135deg, #b5f0ec, #2bb3a8); }
.mini-grid .m.gold { background: linear-gradient(135deg, #fff6b0, #f5c542); box-shadow: 0 0 6px rgba(245, 224, 73, .7); }
.mini-grid .m.dim { background: rgba(255, 255, 255, .06); }

.mirror-glass { width: 10px; height: 90px; border-radius: 6px; background: linear-gradient(180deg, #e0f2ff, #8fb8ff 40%, #e0f2ff 60%, #8fb8ff); box-shadow: 0 0 16px rgba(160, 200, 255, .8); background-size: 100% 200%; animation: mirrorShine 2.4s linear infinite; }
@keyframes mirrorShine { to { background-position: 0 -200%; } }
.tile.ghost { opacity: .5; transform: scaleX(-1); filter: blur(.4px) hue-rotate(10deg); }
.va-mirror .tile.big { font-size: 46px; }

.pv { display: flex; flex-direction: column; gap: 8px; }
.pv-head, .pv-row { display: grid; grid-template-columns: repeat(3, 84px); gap: 8px; text-align: center; }
.pv-head span { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #b8c6ff; }
.pv-row span { height: 56px; border-radius: 10px; background: rgba(255, 255, 255, .06); border: 1px dashed rgba(255, 255, 255, .2); display: grid; place-items: center; }
.pv-row .tile { font-size: 34px; }
.pv-row.before { opacity: .45; }
.pv .slide-left { animation: slideLeft .8s .5s var(--ease-back) backwards; }
.pv .drop { animation: dropIn .6s 1.2s var(--ease-back) backwards; }
@keyframes slideLeft { from { transform: translateX(92px); } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-40px); } }

.train { display: flex; gap: 6px; align-items: flex-end; }
.car { position: relative; font: 700 38px var(--display); width: 64px; height: 58px; display: grid; place-items: center; border-radius: 10px 10px 6px 6px; color: #3a2614; background: linear-gradient(180deg, #fffaea, #ffd9a0); box-shadow: inset 0 -5px 0 rgba(170, 96, 40, .3), inset 0 3px 0 #fff, 0 4px 0 #b97842; margin-bottom: 10px; }
.car::before, .car::after { content: ''; position: absolute; bottom: -12px; width: 16px; height: 16px; border-radius: 50%; background: #3d315b; border: 3px solid #8f86b8; }
.car::before { left: 8px; } .car::after { right: 8px; }
.car.engine { border-radius: 16px 10px 6px 6px; background: linear-gradient(180deg, #ffd0dc, #ff9fbc); color: #5a1430; box-shadow: inset 0 -5px 0 rgba(160, 40, 80, .3), inset 0 3px 0 #fff, 0 4px 0 #c0577a; }
.car.caboose { background: linear-gradient(180deg, #fff9c4, #f5c542); box-shadow: inset 0 -5px 0 rgba(180, 110, 0, .3), inset 0 3px 0 #fff, 0 4px 0 #c08a1c, 0 0 20px rgba(245, 224, 73, .6); animation: caboose 1s .5s var(--ease-back) backwards; }
@keyframes caboose { from { opacity: 0; transform: translateX(80px); } }
.rails { width: 90%; height: 6px; margin-top: -10px; border-radius: 3px; background: repeating-linear-gradient(90deg, #8f86b8 0 14px, #6b6294 14px 18px); }

.stack { display: flex; flex-direction: column-reverse; gap: 3px; align-items: center; }
.stack .vx { --cell: 22px; }
.stack .clone { animation: cloneIn .45s var(--ease-back) backwards; }
@keyframes cloneIn { from { opacity: 0; transform: translateX(-50px) scale(.6); } }
.stack-n { font: 700 18px var(--display); color: #ffe89a; order: -1; margin-top: 6px; }
.va-double .op { font-size: 30px; align-self: center; }

.clock-svg { width: 200px; height: 200px; overflow: visible; }
.clock-svg .face { fill: rgba(255, 252, 240, .95); }
.clock-svg .rim { fill: none; stroke: #ffd27a; stroke-width: 5; filter: drop-shadow(0 0 6px rgba(255, 210, 122, .6)); }
.clock-svg .hr { font: 700 15px var(--display); fill: #3d315b; text-anchor: middle; }
.clock-svg .hr.cur { fill: #e0457a; font-size: 19px; }
.clock-svg .mn { font: 700 11px var(--display); fill: #ffe89a; text-anchor: middle; opacity: 0; }
.clock-svg .mn.lit { animation: mnIn .3s forwards; }
@keyframes mnIn { to { opacity: 1; } }
.clock-svg .sweep { fill: rgba(245, 197, 66, .3); }
.clock-svg .hand { transform: rotate(var(--ang)); animation: hand 1.4s var(--ease-out); }
@keyframes hand { from { transform: rotate(0deg); } }
.clock-svg .hand line { stroke: #3d315b; stroke-width: 5; stroke-linecap: round; }
.clock-svg .pin { fill: #e0457a; }

.half-top { font: 600 20px var(--display); }
.half-top b { color: #ffe89a; }
.half-bar { position: relative; display: flex; width: 280px; height: 52px; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 0 #b97842, 0 8px 18px rgba(20, 10, 50, .4); }
.half-bar span { flex: 1; display: grid; place-items: center; font: 700 24px var(--display); color: #3a2614; }
.half-l { background: linear-gradient(180deg, #fff1c0, #ffd27a); animation: halfL 1s 1s var(--ease-out) forwards; }
.half-r { background: linear-gradient(180deg, #ffe0c8, #ffb98a); animation: halfR 1s 1s var(--ease-out) forwards; }
.half-cut { position: absolute; left: 50%; top: -10%; width: 0; height: 120%; border-left: 3px dashed #fff; animation: cut .8s .3s var(--ease-out) backwards; flex: none !important; }
@keyframes cut { from { transform: scaleY(0); } }
@keyframes halfL { to { transform: translateX(-8px); } }
@keyframes halfR { to { transform: translateX(8px); } }

.hands { display: flex; align-items: flex-end; gap: 5px; height: 96px; }
.finger { position: relative; width: 22px; height: 74px; border-radius: 11px 11px 6px 6px; animation: vxIn .4s var(--ease-back) backwards; box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .15), inset 3px 3px 0 rgba(255, 255, 255, .45); }
.finger.left { background: linear-gradient(180deg, #e2d0ff, #9b70e0); }
.finger.right { background: linear-gradient(180deg, #b2f7d8, #2fc78c); }
.finger.down { height: 30px; background: linear-gradient(180deg, #ffc6cf, #f0708a); animation: fold .8s .6s var(--ease-back) backwards; }
@keyframes fold { from { height: 74px; } }
.finger.gap { margin-right: 16px; }
.finger em { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font: 700 12px var(--display); font-style: normal; color: var(--text-faint); }
.va-fingers .va-cap { margin-top: 12px; }
.tag-l { color: #d4bfff; }
.tag-r { color: #9ff2cc; }

.chain { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { display: inline-grid; place-items: center; min-width: 52px; height: 48px; padding: 0 12px; border-radius: 12px; font: 700 24px var(--display); color: #3a2614; background: linear-gradient(180deg, #fffaea, #ffe2a6); box-shadow: inset 0 -4px 0 rgba(170, 96, 40, .25), inset 0 2px 0 #fff, 0 3px 0 #c98a4a; animation: vxIn .45s var(--ease-back) backwards; }
.chip.gold { background: linear-gradient(180deg, #fff9c4, #f5c542); box-shadow: inset 0 -4px 0 rgba(180, 110, 0, .3), inset 0 2px 0 #fff, 0 3px 0 #c08a1c, 0 0 16px rgba(245, 224, 73, .55); }
.chip u { text-decoration: none; color: #d4570f; }
.chip u.t { color: #7a4ad0; }
.arrow { font: 700 14px var(--display); color: #ffe89a; padding: 2px 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); }

.split { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.split-part { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.split-lbl { font-weight: 800; font-size: 14px; color: var(--text-dim); }
.split-lbl b { color: #ffe89a; }
.split-plus { font: 700 30px var(--display); color: var(--champ); }

.cad { display: flex; gap: 10px; }
.cad .tile { animation: vxIn .5s var(--ease-back) backwards; }
.cad .tile.join:first-child { animation: vxIn .5s var(--ease-back) backwards, joinR 1s 1.2s var(--ease-out) forwards; }
.cad .tile.join:nth-child(2) { animation: vxIn .5s .2s var(--ease-back) backwards, joinL 1s 1.2s var(--ease-out) forwards; }
@keyframes joinR { to { transform: translateX(6px); box-shadow: 0 0 22px rgba(245, 224, 73, .8); } }
@keyframes joinL { to { transform: translateX(-6px); box-shadow: 0 0 22px rgba(245, 224, 73, .8); } }
.cad-eq { display: flex; align-items: center; gap: 8px; font-size: 30px; animation: rise .6s 1.6s var(--ease-out) backwards; }

.mult { display: grid; grid-template-columns: repeat(5, auto); gap: 8px; }
.mult .chip { min-width: 54px; height: 44px; font-size: 21px; }
.va-eqrow { display: flex; align-items: center; gap: 10px; font-size: 44px; }
.va-eq .tile { animation: tilePop .5s var(--ease-back) backwards; }
.va-eq .tile:nth-child(3) { animation-delay: .15s; }
.va-eq .tile:nth-child(5) { animation-delay: .4s; }

/* ------------------------------------------------------------- overlays */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(30, 20, 70, .35), rgba(12, 8, 32, .7));
  opacity: 0; visibility: hidden; transition: opacity .35s, visibility 0s .35s;
}
.overlay.show { opacity: 1; visibility: visible; transition: opacity .35s; }
.modal {
  position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 50%), rgba(32, 24, 70, .86);
  transform: translateY(24px) scale(.96); transition: transform .5s var(--ease-back);
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.overlay.show .modal { transform: none; }
.modal.wide { width: min(1080px, 100%); }
.modal.small { width: min(420px, 100%); text-align: center; }
.modal-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.modal-head > div { flex: 1; }
.modal-head h2 { margin: 0; font: 600 28px var(--display); color: #fff3d0; }
.modal-head p { margin: 4px 0 0; color: var(--text-dim); font-weight: 600; }
.modal.small h3 { margin: 4px 0 8px; font: 600 24px var(--display); }
.modal.small p { color: var(--text-dim); line-height: 1.5; margin: 0 0 20px; }
.cf-btns { display: flex; gap: 10px; justify-content: center; }

/* results */
.results { text-align: center; padding-top: 30px; width: min(560px, 100%); }
.res-stars { display: flex; justify-content: center; gap: 10px; margin-bottom: 6px; }
.res-stars svg { width: 64px; height: 64px; color: rgba(255, 255, 255, .15); filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .2)); transition: color .2s; }
.res-stars svg:nth-child(2) { width: 80px; height: 80px; margin-top: -14px; }
.res-stars svg.on { color: #ffd84a; animation: starPop .6s var(--ease-back); filter: drop-shadow(0 4px 0 #c08a1c) drop-shadow(0 0 18px rgba(255, 216, 74, .9)); }
@keyframes starPop { from { transform: scale(.2) rotate(-90deg); } 60% { transform: scale(1.3) rotate(10deg); } }
.res-title { margin: 6px 0 2px; font: 700 34px var(--display); background: linear-gradient(180deg, #fffdf2, #ffe9a3 50%, #ffb36b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.res-sub { margin: 0 0 18px; color: var(--text-dim); font-weight: 700; }
.res-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat { padding: 12px 6px; border-radius: 16px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); display: flex; flex-direction: column; gap: 2px; animation: rise .5s var(--ease-back) backwards; }
.stat:nth-child(2) { animation-delay: .1s; } .stat:nth-child(3) { animation-delay: .2s; } .stat:nth-child(4) { animation-delay: .3s; }
.stat b { font: 700 28px var(--display); }
.stat b small { font-size: 16px; opacity: .6; }
.stat span { font-size: 12px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.stat.swift b { color: #fff3a0; }
.stat.stat-dust b { color: #ffd27a; }
.res-msg { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px; border-radius: 18px; background: rgba(255, 255, 255, .07); margin-bottom: 18px; }
.res-msg img { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; flex: none; box-shadow: 0 0 0 3px #ffd27a; }
.res-msg p { margin: 0; line-height: 1.5; font-weight: 700; }
.unlock-line { display: block; margin-top: 6px; color: #9ff2cc; }
.res-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* matrix */
.mx-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: start; }
.mx-grid { display: grid; grid-template-columns: 28px repeat(10, minmax(0, 1fr)); gap: 4px; width: 100%; max-width: min(600px, calc((100vh - 210px) * 1.08)); margin: 0 auto; }
.mx-corner, .mx-head { display: grid; place-items: center; font: 700 15px var(--display); color: var(--text-dim); border-radius: 8px; transition: background .15s, color .15s; aspect-ratio: 1; }
.mx-head.col { aspect-ratio: auto; height: 28px; }
.mx-corner { color: var(--gold); aspect-ratio: auto; height: 28px; }
.mx-head.hl { background: var(--gold); color: #3a2614; }
.mx-cell {
  aspect-ratio: 1; border: 0; border-radius: 8px; padding: 0; position: relative;
  display: grid; place-items: center; font: 600 clamp(11px, 1.3vw, 15px) var(--display);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .3);
  transition: transform .15s var(--ease-back), filter .15s, box-shadow .15s;
  animation: vxIn .4s var(--ease-back) backwards; animation-delay: var(--d);
}
.mx-cell:hover, .mx-cell:focus-visible { transform: scale(1.18); z-index: 2; filter: brightness(1.1); }
.mx-cell.xh { filter: brightness(1.12) saturate(1.1); }
.mx-cell.cur { transform: scale(1.18); z-index: 3; box-shadow: 0 0 0 3px #fff, 0 6px 16px rgba(10, 5, 30, .5); }
.mx-cell.twin { outline: 3px dashed var(--gold); outline-offset: 1px; z-index: 1; animation: twinPulse 1s ease-in-out infinite; }
@keyframes twinPulse { 50% { outline-color: #fff; } }
.st-untested { background: #334155; color: rgba(255, 255, 255, .45); }
.st-needs { background: linear-gradient(180deg, #ff9b9b, #f87171); color: #4a0d0d; }
.st-developing { background: linear-gradient(180deg, #ffd96a, #fbbf24); color: #4a3000; }
.st-mastered { background: linear-gradient(180deg, #8ff0c4, #34d399); color: #0b3d2b; }
.st-diamond { background: linear-gradient(180deg, #fff6a8, #f5e049); color: #4a3a00; box-shadow: inset 0 -3px 0 rgba(160, 120, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .6), 0 0 12px rgba(245, 224, 73, .7); }
.mx-cell.diag.st-untested { box-shadow: inset 0 0 0 2px rgba(245, 224, 73, .35), inset 0 -3px 0 rgba(0, 0, 0, .18); }
.mx-cell .gem { position: absolute; top: 1px; right: 3px; font-size: 9px; color: #b07a00; }
.mx-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.mx-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; flex: none; }
.sw.untested { background: #334155; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.sw.needs { background: #f87171; } .sw.developing { background: #fbbf24; } .sw.mastered { background: #34d399; } .sw.diamond { background: #f5e049; box-shadow: 0 0 6px #f5e049; }
.mx-side { display: flex; flex-direction: column; gap: 14px; }
.mx-summary { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .07); }
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: rgba(255, 255, 255, .12); }
.ring-fg { stroke: url(#g-gold); stroke: #f5e049; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease-out); filter: drop-shadow(0 0 6px rgba(245, 224, 73, .6)); }
.ring-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1; }
.ring-txt b { font: 700 30px var(--display); color: #fff3b0; }
.ring-txt span { font-size: 10.5px; font-weight: 800; color: var(--text-dim); max-width: 70px; margin-top: 3px; }
.mx-counts { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.mx-counts li { display: flex; align-items: center; gap: 7px; }
.mx-counts b { margin-left: auto; color: var(--text); }
.mx-detail { padding: 14px; border-radius: 18px; background: rgba(255, 255, 255, .07); min-height: 200px; display: flex; flex-direction: column; gap: 12px; }
.mx-fact { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.mx-eq { display: flex; align-items: center; gap: 6px; font-size: 30px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800; box-shadow: none !important; }
.badge.sm { font-size: 11px; padding: 2px 8px; }
.mx-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.mx-stats div { padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, .15); }
.mx-stats dt { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.mx-stats dd { margin: 2px 0 0; font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mx-stats dd small { font-size: 11px; color: var(--text-dim); }
.boxdots { display: inline-flex; gap: 3px; }
.boxdots i { width: 9px; height: 9px; border-radius: 2px; background: rgba(255, 255, 255, .18); }
.boxdots i.on { background: #9ff2cc; box-shadow: 0 0 4px #34d399; }
.mx-twin { font-weight: 700; font-size: 14px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mx-twin b { color: var(--text); }
.twin-ico { color: var(--gold); font-size: 16px; }
.mx-tip { display: flex; gap: 10px; align-items: flex-start; }
.mx-tip-face { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px #ffb76a; }
.mx-tip.aria .mx-tip-face { box-shadow: 0 0 0 2px #7ee8c0; }
.mx-tip p { margin: 0; font-size: 14px; line-height: 1.45; font-weight: 600; }
.t-needs { color: #ff9b9b; } .t-dev { color: #ffd96a; }
.mx-go { align-self: stretch; flex-direction: column; gap: 0; line-height: 1.15; }
.mx-go small { font: 800 11.5px var(--body); opacity: .75; }

/* village */
.village-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.vcard { border-radius: 18px; overflow: hidden; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); display: flex; flex-direction: column; animation: rise .5s var(--ease-back) backwards; }
.vcard:nth-child(2) { animation-delay: .04s; } .vcard:nth-child(3) { animation-delay: .08s; } .vcard:nth-child(4) { animation-delay: .12s; }
.vcard:nth-child(5) { animation-delay: .16s; } .vcard:nth-child(6) { animation-delay: .2s; } .vcard:nth-child(7) { animation-delay: .24s; } .vcard:nth-child(8) { animation-delay: .28s; }
.vimg { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
.vimg img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.vcard.built:hover .vimg img { transform: scale(1.06); }
.vcard.locked .vimg img { filter: grayscale(.85) brightness(.55) blur(2px); }
.vlock { position: absolute; inset: 0; display: grid; place-items: center; }
.vlock svg { width: 38px; height: 38px; color: #e6dcff; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.vbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.vbody small { font-weight: 800; color: #ffd27a; display: flex; align-items: center; gap: 4px; }
.vbody h4 { margin: 0; font: 600 17px var(--display); }
.vbody p { margin: 0 0 6px; font-size: 13px; color: var(--text-dim); line-height: 1.4; flex: 1; }
.vbody .btn { align-self: flex-start; }
.vtogo { font-size: 12.5px; font-weight: 800; color: #d6cdf0; }
.vcard.built { border-color: rgba(126, 232, 192, .45); }

/* settings */
.settings { width: min(560px, 100%); }
.st-profile { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .07); margin-bottom: 14px; }
.st-profile b { font: 600 19px var(--display); display: block; }
.st-profile small { color: var(--text-dim); font-weight: 700; font-size: 12.5px; }
.st-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; cursor: pointer; transition: background .2s; }
.toggle:hover { background: rgba(255, 255, 255, .06); }
.toggle > span { flex: 1; display: flex; flex-direction: column; }
.toggle small { color: var(--text-dim); font-weight: 600; font-size: 12.5px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { width: 50px; height: 30px; border-radius: 99px; background: rgba(255, 255, 255, .18); position: relative; transition: background .25s; flex: none; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .25); }
.toggle i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); transition: transform .3s var(--ease-back); }
.toggle input:checked + i { background: linear-gradient(90deg, #34d399, #7ee8c0); }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:focus-visible + i { outline: 3px solid var(--gold); outline-offset: 2px; }
.tod-row { cursor: default; }
.seg { display: flex; padding: 3px; border-radius: 99px; background: rgba(0, 0, 0, .2); }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 99px; font-weight: 800; font-size: 13px; color: var(--text-dim); display: flex; gap: 5px; align-items: center; transition: background .2s, color .2s; }
.seg button.on { background: linear-gradient(180deg, #fff1a6, #ffb36b); color: #4a2412; }
.seg.locked { opacity: .45; }
.st-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------- CRAFT-TOWER DOO studio branding */
.craft-logo {
  display: inline-block;
  vertical-align: middle;
  width: 28px;
  height: 28px;
  color: #fff;
  flex: none;
  overflow: visible;
  transition: transform .3s var(--ease-out), filter .3s var(--ease-out);
}

.logo-beam {
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity .3s, transform .3s;
}

.logo-dot {
  transition: filter .3s, transform .3s;
}

@keyframes lighthouseBeamL {
  0%, 100% { opacity: 0.85; transform: rotate(0deg); }
  50% { opacity: 0.35; transform: rotate(-6deg); }
}

@keyframes lighthouseBeamR {
  0%, 100% { opacity: 0.35; transform: rotate(6deg); }
  50% { opacity: 0.85; transform: rotate(0deg); }
}

@keyframes lighthouseGlow {
  0%, 100% { filter: drop-shadow(0 0 2px #f59e0b); }
  50% { filter: drop-shadow(0 0 6px #f59e0b) drop-shadow(0 0 12px rgba(245, 158, 11, .75)); }
}

@media (prefers-reduced-motion: no-preference) {
  .st-studio-card:hover .logo-beam--l,
  .ld-studio-pill:hover .logo-beam--l {
    animation: lighthouseBeamL 2.2s ease-in-out infinite;
  }
  .st-studio-card:hover .logo-beam--r,
  .ld-studio-pill:hover .logo-beam--r {
    animation: lighthouseBeamR 2.2s ease-in-out infinite;
  }
  .st-studio-card:hover .logo-dot,
  .ld-studio-pill:hover .logo-dot {
    animation: lighthouseGlow 1.8s ease-in-out infinite;
  }
}

/* Loading screen title colophon */
.ld-studio {
  position: absolute;
  left: 18px;
  bottom: calc(14px + var(--safe-b));
  z-index: 5;
  display: flex;
  align-items: center;
}

.ld-studio-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 10px;
  border-radius: 99px;
  background: rgba(22, 16, 48, .62);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform .25s var(--ease-out), border-color .25s, background .25s, box-shadow .25s;
}

.ld-studio-pill:hover {
  transform: translateY(-2px);
  background: rgba(32, 22, 68, .82);
  border-color: rgba(245, 158, 11, .55);
  box-shadow: 0 8px 24px -4px rgba(245, 158, 11, .3), 0 2px 8px rgba(0, 0, 0, .4);
}

.ld-studio-pill .craft-logo {
  width: 22px;
  height: 22px;
}

.ld-studio-txt {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  letter-spacing: .01em;
}

.ld-studio-txt b {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.ld-studio-role {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
}

@media (max-width: 680px) {
  .ld-studio-role,
  .ld-studio-sep {
    display: none;
  }
}

@media (orientation: portrait) and (max-aspect-ratio: 4/5) {
  .ld-studio {
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(10px + var(--safe-b));
  }
}

/* Player menu link */
.pm-studio {
  text-decoration: none;
  color: var(--text);
  border-top: 1px solid rgba(255, 255, 255, .12);
  margin-top: 4px;
  padding-top: 10px;
}

.pm-studio .craft-logo {
  width: 20px;
  height: 20px;
}

.pm-studio:hover .craft-logo {
  transform: scale(1.12);
}

.pm-studio .pm-ext {
  width: 14px;
  height: 14px;
  opacity: .55;
  color: var(--text-dim);
  flex: none;
  transition: opacity .2s, transform .2s var(--ease-out), color .2s;
}

.pm-studio:hover .pm-ext,
.pm-studio:focus-visible .pm-ext {
  opacity: 1;
  color: var(--gold, #f59e0b);
  transform: translate(2px, -2px);
}

/* Settings modal studio card */
.st-studio-wrap {
  margin: 18px 0 0;
}

.st-studio-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform .25s var(--ease-out), border-color .25s, background .25s, box-shadow .25s;
}

.st-studio-card:hover,
.st-studio-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, .55);
  background: linear-gradient(135deg, rgba(255, 255, 255, .18), rgba(245, 158, 11, .1));
  box-shadow: 0 16px 36px -8px rgba(245, 158, 11, .3), 0 4px 12px rgba(10, 5, 30, .4);
  outline: none;
}

.st-studio-lead {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.st-studio-logo-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: none;
  background: radial-gradient(circle at 50% 25%, rgba(245, 158, 11, .28), rgba(22, 14, 52, .75));
  border: 1px solid rgba(245, 158, 11, .4);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .25), 0 4px 12px rgba(0, 0, 0, .3);
  transition: transform .25s var(--ease-out), box-shadow .25s;
}

.st-studio-card:hover .st-studio-logo-wrap {
  transform: scale(1.05);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, .35), 0 6px 18px rgba(245, 158, 11, .4);
  border-color: #f59e0b;
}

.st-studio-logo-wrap .craft-logo {
  width: 32px;
  height: 32px;
}

.st-studio-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.st-studio-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  line-height: 1.2;
}

.st-studio-brand {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
  line-height: 1.25;
  margin: 1px 0 2px;
}

.st-studio-desc {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.35;
}

.st-studio-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 99px;
  font-weight: 800;
  font-size: 13.5px;
  color: #ffe2b8;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .18);
  white-space: nowrap;
  flex: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  transition: all .25s var(--ease-out);
}

.st-studio-pill svg {
  width: 14px;
  height: 14px;
  transition: transform .25s var(--ease-out);
}

.st-studio-card:hover .st-studio-pill {
  background: linear-gradient(180deg, #fff1a6, #ffb36b);
  color: #4a2412;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(245, 158, 11, .45);
}

.st-studio-card:hover .st-studio-pill svg {
  transform: translateX(3px);
}

@media (max-width: 520px) {
  .st-studio-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }
  .st-studio-pill {
    justify-content: center;
    width: 100%;
  }
}

.st-credits { margin: 16px 0 0; font-size: 12px; color: var(--text-faint); text-align: center; }

/* unlock */
.unlock { text-align: center; width: min(560px, 100%); padding: 16px 16px 24px; }
.un-img { position: relative; border-radius: 18px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 42vh; margin: 0 auto 16px; box-shadow: 0 12px 30px rgba(10, 5, 30, .5); }
.un-img img { width: 100%; height: 100%; object-fit: cover; animation: unZoom 6s var(--ease-out) both; }
@keyframes unZoom { from { transform: scale(1.18); filter: brightness(1.6) saturate(.5); } 30% { filter: none; } }
.un-shine { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%); transform: translateX(-100%); animation: shine 1.6s .4s var(--ease-out) forwards; }
@keyframes shine { to { transform: translateX(100%); } }
.un-kicker { display: block; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; color: #ffd27a; }
.unlock h2 { margin: 4px 0 8px; font: 700 34px var(--display); background: linear-gradient(180deg, #fffdf2, #ffe9a3 50%, #ffb36b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.unlock .un-quote { display: flex; align-items: center; gap: 10px; max-width: 460px; margin: 6px auto 12px; padding: 8px 14px 8px 8px; border-radius: 16px; background: rgba(255, 255, 255, .08); text-align: left; font-weight: 700; color: #fff3d0; font-style: italic; }
.unlock .un-quote img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 2px #7ee8c0; }
.unlock p { margin: 0 auto 18px; max-width: 440px; color: var(--text-dim); line-height: 1.5; font-weight: 600; }

/* toasts + saved */
#toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(520px, calc(100% - 24px)); }
.toast { padding: 10px 18px; border-radius: 16px; font-weight: 700; font-size: 14.5px; line-height: 1.4; text-align: center; opacity: 0; transform: translateY(-12px) scale(.96); transition: opacity .35s, transform .45s var(--ease-back); background: linear-gradient(165deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05) 50%), var(--glass-strong); }
.toast.in { opacity: 1; transform: none; }
.toast.gold { box-shadow: var(--shadow), 0 0 0 2px rgba(245, 224, 73, .55), 0 0 24px rgba(245, 224, 73, .35); }
.toast.warn { box-shadow: var(--shadow), 0 0 0 2px rgba(248, 113, 113, .6); }
.toast.ok { box-shadow: var(--shadow), 0 0 0 2px rgba(52, 211, 153, .6); }
.toast b { color: #ffe89a; }
.saved { position: fixed; right: 14px; bottom: calc(14px + var(--safe-b)); z-index: 60; padding: 7px 14px; border-radius: 99px; font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; color: #b8f5d8; opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s; pointer-events: none; }
.saved.in { opacity: 1; transform: none; }
body[data-screen="hub"] .saved { bottom: calc(196px + var(--safe-b)); }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; z-index: 99; font-size: 22px; background: #1e2456; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .act { width: 210px; }
  .stone-name { font-size: 11.5px; }
}
@media (max-width: 920px) {
  .hub-actions { top: 84px; transform: none; right: 10px; flex-direction: column; gap: 8px; }
  .act { width: 70px; flex-direction: column; gap: 4px; padding: 9px 4px 8px; text-align: center; border-radius: 18px; }
  .act:hover { transform: translateY(-2px); }
  .act-ico { width: 40px; height: 40px; border-radius: 12px; }
  .act-txt { align-items: center; }
  .act-txt b { font-size: 11.5px; line-height: 1.15; }
  .act-txt small { display: none; }
  .hub-bubble { right: 92px; max-width: none; }
  .mx-grid { max-width: 600px; }
  body[data-screen="hub"] .saved { bottom: calc(190px + var(--safe-b)); }
  .stage { top: 86px; right: 50%; transform: translate(50%, 0) scale(.94); width: min(480px, calc(100% - 28px)); min-height: 0; padding-top: 30px; }
  .stage.show { transform: translate(50%, 0); }
}
@media (max-width: 920px) and (orientation: portrait) {
  .pr-wrap { position: static; transform: none; }
  .pr-card { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); margin: 0 auto; width: auto; max-width: 440px; }
  .pr-hint { position: absolute; left: 10px; right: 10px; top: 72px; margin: 0 auto; width: auto; max-width: 440px; z-index: 5; max-height: max(170px, calc(100vh - 560px)); overflow: auto; padding: 12px 14px; }
  .pr-hint.in { animation: rise .4s var(--ease-out); }
  .hb-visual { padding: 8px 4px 4px; }
}
@media (max-width: 920px) {
  .mx-layout { grid-template-columns: 1fr; }
  .village-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .hud-top { gap: 8px; top: 10px; left: 10px; right: 10px; }
  .player-wrap { flex: none; max-width: 48%; }
  .pl-txt { min-width: 0; }
  .pl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
  .player-menu { min-width: min(260px, calc(100vw - 20px)); }
  .hub-actions { top: 76px; }
  .player { padding: 6px 12px 6px 6px; }
  .avatar { width: 40px; height: 40px; font-size: 20px; }
  .pl-name { font-size: 17px; }
  .pl-rank { display: none; }
  .dust { min-width: 0; flex: 1; padding: 6px 12px 12px 8px; }
  .dust-ico { width: 28px; height: 28px; }
  .dust-n { font-size: 20px; }
  .hide-sm { display: none !important; }
  .journey-head small { display: none; }
  .trail { grid-template-columns: repeat(8, 64px); overflow-x: auto; padding: 12px 10px 8px; scrollbar-width: none; }
  .trail::before { left: 30px; right: auto; width: 470px; top: 42px; }
  .stone-face { width: 54px; height: 54px; border-radius: 15px; }
  .stone-sym { font-size: 18px; }
  .stone-name { font-size: 10.5px; }
  .act-txt b { font-size: 15px; }
  .hub-bubble { left: 10px; top: 76px; right: 90px; }
  .hub-bubble img { width: 44px; height: 44px; }
  .hub-bubble p { font-size: 14px; }
  .dialog { flex-direction: column; padding: 16px 16px 14px; padding-top: 70px; min-height: 0; }
  .dlg-portrait { left: 16px; top: -46px; bottom: auto; width: 96px; }
  .dlg-portrait img { width: 96px; height: 96px; border-radius: 20px; transform: none; }
  .dlg-name { left: 112px; bottom: auto; top: 56px; transform: none; font-size: 16px; }
  .title-pill b { font-size: 16px; }
  #ls-skip { padding: .5em .8em; font-size: 13px; }
  .pr-eq, .pr-eq .tile, .slot { font-size: 42px; }
  .pr-eq .op { font-size: 34px; }
  .numpad { gap: 7px; }
  .numpad button { height: 52px; font-size: 26px; border-radius: 13px; }
  .pr-card { padding: 12px 14px 10px; gap: 6px; }
  .pr-feedback { min-height: 40px; font-size: 14px; }
  .praise { font-size: 22px; }
  .res-stats { grid-template-columns: repeat(2, 1fr); }
  .village-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .vbody p { display: none; }
  .modal { padding: 18px; }
  .modal-head h2 { font-size: 24px; }
  .clock-svg { width: 170px; height: 170px; }
}
@media (max-height: 620px) and (min-width: 641px) {
  .journey-head { display: none; }
  .stone-name { display: none; }
  .dialog { min-height: 130px; }
  .dlg-portrait img { width: 120px; height: 120px; }
  .dlg-portrait { width: 120px; }
  .dialog { padding-left: 160px; }
  .numpad button { height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .ld-art { animation: none; }
}

/* landscape phones and other short screens */
@media (max-height: 520px) and (min-width: 641px) {
  #scr-profile { padding-top: 64px; }
  .pf-portraits { top: -46px; transform: translateX(-50%) scale(.72); }
  .pf-card { padding-top: 52px; }
  .pf-list { max-height: none; }
  .hud-top { top: 8px; }
  .hub-actions { top: 50%; transform: translateY(-62%); right: 10px; flex-direction: column; }
  .act { width: 70px; flex-direction: column; gap: 3px; padding: 7px 4px; text-align: center; }
  .act-ico { width: 34px; height: 34px; }
  .act-txt { align-items: center; }
  .act-txt b { font-size: 11px; }
  .act-txt small { display: none; }
  .journey { bottom: 6px; }
  .trail { padding: 8px 8px 6px; }
  .stone-face { width: 48px; height: 48px; border-radius: 14px; }
  .stone-sym { font-size: 16px; }
  .trail::before { top: 30px; }
  .hub-bubble { top: 70px; }
  .top-bar { top: 8px; }
  .walk-friends { top: 8px; }
  .title-pill { padding: 5px 14px; }
  .stage { top: 58px; transform: none; min-height: 0; padding: 26px 14px 12px; width: min(380px, 44vw); }
  .stage.show { transform: none; }
  .dialog { min-height: 0; padding: 12px 16px 10px 130px; }
  .dlg-portrait { width: 96px; left: 16px; bottom: 10px; }
  .dlg-portrait img { width: 96px; height: 96px; border-radius: 18px; transform: translateY(-14px); }
  .dlg-text { font-size: 15.5px; min-height: 2.6em; }
  .pr-wrap { top: 56px; bottom: 8px; transform: none; align-items: flex-start; }
  .pr-card { width: 330px; padding: 10px 14px 8px; gap: 5px; }
  .pr-dots { display: none; }
  .pr-eq { margin: 2px 0 0; }
  .pr-eq, .pr-eq .tile, .slot { font-size: 34px; }
  .pr-eq .op { font-size: 28px; }
  .pr-feedback { min-height: 30px; font-size: 13px; }
  .numpad { gap: 6px; }
  .numpad button { height: 40px; font-size: 22px; border-radius: 11px; }
  .numpad svg { width: 22px; height: 22px; }
  .hint-btn { padding: 2px 10px; font-size: 13px; }
  .pr-hint { width: 330px; padding: 10px 12px; overflow: auto; }
  .hb-face { width: 38px; height: 38px; }
  .hb-text { font-size: 14px; margin-bottom: 8px; }
  .modal { padding: 16px; }
  .res-stars svg { width: 44px; height: 44px; }
  .res-stars svg:nth-child(2) { width: 54px; height: 54px; margin-top: -8px; }
  .res-title { font-size: 26px; }
  .res-stats { margin-bottom: 10px; }
  .stat { padding: 6px; }
  .stat b { font-size: 22px; }
  .res-msg { margin-bottom: 10px; padding: 8px; }
  .res-msg img { width: 52px; height: 52px; }
}
@media (max-height: 700px) and (max-width: 640px) {
  .numpad button { height: 46px; font-size: 24px; }
  .pr-dots i { width: 11px; height: 11px; }
  .pr-eq, .pr-eq .tile, .slot { font-size: 38px; }
  .dlg-text { font-size: 15px; }
}

@media (max-width: 640px) {
  .toggle.tod-row { flex-wrap: wrap; }
  .toggle.tod-row > span { flex-basis: 100%; }
  .toggle.tod-row .seg { margin-left: auto; }
  .top-bar { gap: 8px; }
  .title-pill { padding: 6px 14px; }
  .title-pill b { font-size: 15px; }
}
@media (max-height: 520px) and (min-width: 641px) {
  .mx-layout { grid-template-columns: auto minmax(0, 1fr); }
  .mx-grid { max-width: calc((100vh - 120px) * 1.08); }
  .un-img { max-height: 30vh; margin-bottom: 8px; }
  .unlock h2 { font-size: 26px; margin: 2px 0 4px; }
  .unlock p { margin-bottom: 10px; }
  .unlock .un-quote { margin: 4px auto 8px; }
  .pr-wrap { right: 10px; }
}

/* =================================================================== WALK SCREEN & CONTROLS */
#scr-walk {
  pointer-events: none;
  background: transparent;
}
#scr-walk .top-bar {
  pointer-events: auto;
  gap: 10px;
}
.walk-lessons-btn {
  font-family: var(--display);
  font-weight: 700;
  gap: 7px;
  box-shadow: 0 4px 16px rgba(255, 170, 50, 0.35);
  transition: transform 0.18s var(--ease-back), box-shadow 0.18s ease;
}
.walk-lessons-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 22px rgba(255, 170, 50, 0.5);
}
.walk-bubble {
  pointer-events: auto;
  z-index: 25;
}

#scr-walk .walk-reticle {
  position: absolute;
  top: 50%; left: 50%;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5), 0 0 4px rgba(255, 255, 255, 0.9);
  pointer-events: none;
  transition: transform 0.15s var(--ease-back), background 0.15s ease, box-shadow 0.15s ease;
  z-index: 5;
}
#scr-walk .walk-reticle.active {
  transform: scale(2.2);
  background: #ffe066;
  box-shadow: 0 0 12px #ffe066, 0 0 6px #ffa94d;
}

/* what the reticle is on: a small chip just under it (desktop); touch layouts use the action button instead */
.walk-prompt {
  position: absolute;
  top: calc(50% + 16px); left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(320px, 80vw);
  padding: 3px 12px 3px 3px;
  border-radius: 999px;
  border: 1px solid rgba(255, 225, 140, 0.4);
  background: rgba(22, 16, 42, 0.68);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.2;
  z-index: 10;
  cursor: pointer;
  animation: wpIn 0.22s var(--ease-back);
}
.walk-prompt:hover { border-color: rgba(255, 225, 140, 0.75); }
@keyframes wpIn {
  from { opacity: 0; transform: translate(-50%, -4px) scale(0.9); }
}
.wp-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fffae0, #ffd84a);
  color: #4a2800;
}
.wp-ico svg { width: 13px; height: 13px; }
.wp-txt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.walk-controls {
  position: absolute;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  pointer-events: auto;
  z-index: 5;
  background: rgba(22, 16, 42, 0.75);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.key-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 700;
  font-size: 11.5px;
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ---- touch: left half = floating joystick, right half = drag to look, action + jump bottom-right */
#scr-walk .walk-touch {
  position: absolute;
  inset: 0;
  display: none;
  pointer-events: none;
}
@media (pointer: coarse), (max-width: 920px) {
  #scr-walk .walk-touch { display: block; }
  #scr-walk .walk-prompt { display: none; }
  .hide-touch { display: none !important; }
  body[data-screen="walk"] .saved { bottom: calc(184px + var(--safe-b)); }   /* above the action + jump column */
}
.wt-zone {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.wt-move { left: 0; }
.wt-look { right: 0; }

.wt-stick {
  --r: 62px;
  position: absolute;
  /* resting spot bottom-left; GameApp moves it under the thumb with inline left/top */
  left: calc(22px + var(--r) + env(safe-area-inset-left, 0px));
  top: calc(100% - 26px - var(--r) - var(--safe-b));
  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: 1.5px solid rgba(255, 255, 255, 0.4);
  background: radial-gradient(circle, rgba(22, 16, 42, 0.08) 0 38%, rgba(22, 16, 42, 0.32) 72%, rgba(255, 255, 255, 0.1));
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28), inset 0 0 20px rgba(255, 255, 255, 0.1);
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.wt-stick.on { opacity: 1; }
.wt-knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #fffdf2, #ffe9a6 48%, #f2b347);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.35), inset 0 -3px 0 rgba(160, 90, 10, 0.3);
}
.wt-tip {
  position: absolute;
  bottom: calc(10px + var(--safe-b));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 99px;
  background: rgba(22, 16, 42, 0.55);
  color: rgba(255, 255, 255, 0.92);
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.wt-move .wt-tip { left: calc(22px + 62px + env(safe-area-inset-left, 0px)); transform: translateX(-50%); bottom: calc(160px + var(--safe-b)); }
.wt-look .wt-tip { left: 50%; transform: translateX(-50%); top: 64%; bottom: auto; }
.wt-tip b { font-weight: 600; }
.wt-tip .ico { width: 14px; height: 14px; opacity: 0.8; }
.wt-tip .ico.flip { transform: scaleX(-1); }
.walk-touch.moved .wt-move .wt-tip, .walk-touch.looked .wt-look .wt-tip { opacity: 0; }

.wt-buttons {
  position: absolute;
  right: calc(18px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}
.wt-btn {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  color: #fff;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.wt-btn:active, .wt-btn.active { transform: scale(0.92); filter: brightness(1.15); }
.wt-jump {
  display: grid;
  place-items: center;
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 2px solid rgba(255, 225, 140, 0.6);
  background: radial-gradient(circle at 50% 30%, rgba(120, 84, 200, 0.9), rgba(40, 25, 80, 0.9));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  color: #fff3c4;
}
.wt-jump svg { width: 32px; height: 32px; }
.wt-act {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(250px, 46vw);
  height: 54px;
  padding: 0 16px 0 6px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 240, 190, 0.7);
  background: linear-gradient(180deg, #ffd96b, #f59f2a);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3), 0 0 22px rgba(255, 200, 80, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: #3e2100;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  animation: wtPop 0.28s var(--ease-back);
}
.wt-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  color: #6b3a00;
}
.wt-ico svg { width: 22px; height: 22px; }
.wt-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes wtPop {
  from { opacity: 0; transform: translateY(10px) scale(0.8); }
}
/* landscape phones: everything a notch smaller so the view stays open */
@media (max-height: 500px) {
  .wt-stick { --r: 54px; top: calc(100% - 16px - var(--r) - var(--safe-b)); }
  .wt-knob { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .wt-move .wt-tip { bottom: calc(136px + var(--safe-b)); }
  .wt-buttons { bottom: calc(16px + var(--safe-b)); gap: 10px; }
  .wt-jump { width: 64px; height: 64px; }
  .wt-act { height: 48px; }
  .wt-ico { width: 36px; height: 36px; }
  body[data-screen="walk"] .saved { bottom: calc(146px + var(--safe-b)); }
}
@media (prefers-reduced-motion: reduce) {
  .walk-prompt, .wt-act { animation: none; }
}

/* =================================================================== HIDDEN FRIENDS (walk counter, discovery card, village chip) */
.walk-friends {
  position: absolute;
  top: 14px; right: 14px;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px;
  border-radius: 999px;
  background: rgba(28, 20, 52, 0.72);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
  z-index: 4;
  pointer-events: none;
}
.wf-ico, .fc-ico {
  display: grid; place-items: center; flex: none;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--sakura), var(--peach));
  color: #5b2a4a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 14px rgba(255, 183, 197, 0.45);
}
.wf-ico { width: 32px; height: 32px; }
.wf-ico svg { width: 18px; height: 18px; }
.wf-txt, .fc-txt { display: flex; flex-direction: column; line-height: 1.12; min-width: 0; }
.wf-txt small, .fc-txt small { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #ffd9a6; white-space: nowrap; }
.wf-txt b { font: 700 18px var(--display); font-variant-numeric: tabular-nums; }
.walk-friends.done .wf-ico { background: linear-gradient(160deg, #a7f3d0, var(--gold)); color: #14532d; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 16px rgba(245, 224, 73, 0.5); }
.walk-friends.bump { animation: friendBump .6s var(--ease-back); }
@keyframes friendBump { 0% { transform: scale(1); } 35% { transform: scale(1.16); } 100% { transform: scale(1); } }

.friend-card {
  position: absolute;
  top: 26%; left: 50%;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px 10px 10px;
  border-radius: 24px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 55%), var(--glass-strong);
  box-shadow: var(--shadow), 0 0 0 2px rgba(255, 183, 197, 0.55), 0 0 34px rgba(255, 183, 197, 0.35);
  opacity: 0;
  transform: translate(-50%, -14px) scale(.92);
  transition: opacity .35s ease, transform .5s var(--ease-back);
  z-index: 30;
  pointer-events: none;
  max-width: calc(100% - 32px);
}
.friend-card.in { opacity: 1; transform: translate(-50%, 0) scale(1); }
.fc-ico { width: 48px; height: 48px; }
.fc-ico svg { width: 26px; height: 26px; }
.friend-card.in .fc-ico { animation: friendIco 1.2s var(--ease-out); }
@keyframes friendIco { 0% { transform: scale(.4) rotate(-25deg); } 45% { transform: scale(1.15) rotate(8deg); } 100% { transform: none; } }
.fc-txt b { font: 600 21px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-dust {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(245, 224, 73, 0.14);
  border: 1px solid rgba(245, 224, 73, 0.45);
  color: #fff3b0;
  font: 700 17px var(--display);
  text-shadow: 0 0 12px rgba(255, 210, 100, 0.55);
}
.fc-dust .ico { width: 20px; height: 20px; }

.vfriend { display: inline-flex; align-items: center; gap: 5px; margin: -2px 0 6px; font-size: 12.5px; font-weight: 800; color: #ffc4d2; }
.vfriend .ico { width: 15px; height: 15px; flex: none; }
.vfriend.met { color: #9af0c8; }

@media (max-width: 640px) {
  .walk-friends { top: 76px; right: 10px; padding: 4px 12px 4px 4px; gap: 8px; }
  .wf-txt small { display: none; }
  .wf-ico { width: 28px; height: 28px; }
  .wf-txt b { font-size: 16px; }
  .friend-card { top: 25%; gap: 10px; padding: 8px 10px 8px 8px; }
  .fc-ico { width: 40px; height: 40px; }
  .fc-txt b { font-size: 17px; }
  .fc-dust { font-size: 15px; padding: 5px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .friend-card { transition: opacity .2s ease; transform: translate(-50%, 0); }
  .friend-card.in .fc-ico, .walk-friends.bump { animation: none; }
}
