@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

:root {
  --c-orange: #FF8A3D;
  --c-orange-l: #FFAA6B;
  --c-orange-d: #D9661C;
  --c-red: #e81111;
  --c-red-l: #FF5A4E;
  --c-red-d: #A80C0C;
  --c-yellow: #FFD23F;
  --c-yellow-l: #FFE38A;
  --c-yellow-d: #D9A800;
  --c-mint: #6DD3A8;
  --c-mint-l: #9BE6C4;
  --c-mint-d: #36A97A;

  --bg-cream: #FFF8E7;
  --bg-white: #FFFFFF;
  --bg-sky: #E8F6FF;

  --ink: #3B2F2F;
  --ink-2: #7A6A5C;
  --on-color: #FFFFFF;

  --ok: #4CC38A;
  --err: #FF6B6B;
  --warn: #FFB020;
  --info: #4F8CFF;

  --font: "Times New Roman", Times, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", serif;
  --fs-h1: 40px;
  --fs-h2: 24px;
  --fs-body: 18px;

  --r-xl: 36px;
  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --bw: 3px;

  --shadow-pop: 0 6px 0 var(--ink);
  --shadow-card: 0 6px 0 rgba(59, 47, 47, .14), 0 22px 44px -18px rgba(59, 47, 47, .35);

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);

  --tap: 64px;
  --mic: 148px;
  --topbar-h: 76px;
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--ink);
  background-color: var(--bg-cream);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 210, 63, .28) 0, transparent 32%),
    radial-gradient(circle at 92% 18%, rgba(109, 211, 168, .22) 0, transparent 30%),
    radial-gradient(circle at 80% 96%, rgba(255, 138, 61, .18) 0, transparent 34%),
    radial-gradient(rgba(122, 106, 92, .10) 1.2px, transparent 1.3px);
  background-size: auto, auto, auto, 22px 22px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

input, textarea { -webkit-user-select: text; user-select: text; font-family: var(--font); }

button {
  font-family: var(--font);
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { cursor: default; }

.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 26px;
  height: 26px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.card {
  background: var(--bg-white);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* ---------- Screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--sat) + 14px) calc(var(--sar) + 24px) calc(var(--sab) + 20px) calc(var(--sal) + 24px);
  opacity: 0;
  visibility: hidden;
  transform: translateX(48px) scale(.985);
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .28s ease, transform .28s ease, visibility 0s;
}

.screen.is-back { transform: translateX(-48px) scale(.985); }

/* ---------- Buttons ---------- */
.btn-jelly {
  --bg: var(--c-orange);
  --bg-l: var(--c-orange-l);
  --fg: var(--on-color);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 28px;
  font-size: 22px;
  color: var(--fg);
  background: linear-gradient(180deg, var(--bg-l) 0%, var(--bg) 62%);
  border: var(--bw) solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 6px 0 var(--ink), inset 0 -6px 0 rgba(0, 0, 0, .12), inset 0 4px 0 rgba(255, 255, 255, .45);
  transition: transform .12s ease, box-shadow .12s ease, filter .2s ease, opacity .2s ease;
  white-space: nowrap;
}

.btn-jelly::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 18%;
  width: 22%;
  height: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .55);
  pointer-events: none;
}

.btn-jelly:active:not(:disabled) {
  transform: translateY(4px) scale(.96);
  box-shadow: 0 2px 0 var(--ink), inset 0 -4px 0 rgba(0, 0, 0, .12), inset 0 4px 0 rgba(255, 255, 255, .45);
}

.btn-jelly:disabled {
  filter: grayscale(.85);
  opacity: .55;
}

.btn-primary { --bg: var(--c-orange); --bg-l: var(--c-orange-l); }
.btn-secondary { --bg: var(--c-yellow); --bg-l: var(--c-yellow-l); --fg: var(--ink); }
.btn-danger { --bg: var(--c-red); --bg-l: var(--c-red-l); }
.btn-mint { --bg: var(--c-mint); --bg-l: var(--c-mint-l); --fg: var(--ink); }
.btn-block { width: 100%; }

.btn-mini {
  min-height: 48px;
  padding: 0 18px;
  font-size: 17px;
  gap: 6px;
  --bg: var(--c-yellow);
  --bg-l: var(--c-yellow-l);
  --fg: var(--ink);
}
.btn-mini .ico { width: 20px; height: 20px; }
.btn-mini.btn-danger { --bg: var(--c-red); --bg-l: var(--c-red-l); --fg: #fff; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: var(--tap);
  height: var(--tap);
  padding: 0 14px;
  font-size: 19px;
  background: var(--bg-white);
  border: var(--bw) solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.icon-btn:active { transform: translateY(4px) scale(.95); box-shadow: 0 1px 0 var(--ink); }
.icon-btn .ico { width: 30px; height: 30px; }
.icon-btn--label { padding: 0 20px 0 16px; }
.icon-btn--soft {
  min-width: 52px;
  height: 52px;
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink);
  background: var(--bg-cream);
}
.icon-btn--soft .ico { width: 26px; height: 26px; }

.link-btn {
  background: none;
  border: 0;
  padding: 10px 6px;
  font-size: 16px;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: rgba(122, 106, 92, .4);
  text-underline-offset: 5px;
}

/* ---------- Mascot ---------- */
.mascot { position: relative; flex: none; }
.mascot svg { width: 100%; height: 100%; overflow: visible; }
.mascot-hero { width: 150px; height: 190px; }
.mascot-md { width: 110px; height: 140px; margin: 0 auto; }
.mascot-sm { width: 72px; height: 92px; }

.mascot .m-body { transform-box: fill-box; transform-origin: 50% 100%; animation: m-sway 3.2s ease-in-out infinite; }
.mascot .m-eyes-open { transform-box: fill-box; transform-origin: 50% 50%; animation: m-blink 4s infinite; }
.mascot .m-eyes-closed,
.mascot .m-mouth-o,
.mascot .m-mouth-grin,
.mascot .m-zzz,
.mascot .m-ear-wave { display: none; }
.mascot .m-arm-r { transform-box: fill-box; transform-origin: 10% 90%; }

.mascot[data-mood="wave"] .m-arm-r { animation: m-wave 1.1s ease-in-out infinite; }
.mascot[data-mood="listen"] .m-body { animation: m-tilt 1.6s ease-in-out infinite; }
.mascot[data-mood="listen"] .m-ear-wave { display: block; animation: m-pulse 1s ease-in-out infinite; }
.mascot[data-mood="think"] .m-mouth-smile { display: none; }
.mascot[data-mood="think"] .m-mouth-o { display: block; }
.mascot[data-mood="think"] .m-pupils { transform: translate(2px, -3px); }
.mascot[data-mood="think"] .m-body { animation: m-think 1.2s ease-in-out infinite; }
.mascot[data-mood="happy"] .m-mouth-smile { display: none; }
.mascot[data-mood="happy"] .m-mouth-grin { display: block; }
.mascot[data-mood="happy"] .m-body { animation: m-hop .7s ease-in-out infinite; }
.mascot[data-mood="happy"] .m-arm-r { animation: m-wave .7s ease-in-out infinite; }
.mascot[data-mood="sleep"] .m-eyes-open { display: none; }
.mascot[data-mood="sleep"] .m-eyes-closed { display: block; }
.mascot[data-mood="sleep"] .m-body { animation: m-breathe 3s ease-in-out infinite; }
.mascot[data-mood="sad"] .m-mouth-smile { display: none; }
.mascot[data-mood="sad"] .m-mouth-o { display: block; }

@keyframes m-sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes m-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes m-wave { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-28deg); } }
@keyframes m-tilt { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(-2deg); } }
@keyframes m-think { 0%, 100% { transform: translateY(0) rotate(4deg); } 50% { transform: translateY(-4px) rotate(6deg); } }
@keyframes m-hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-12px) scale(.96, 1.04); } 80% { transform: translateY(0) scale(1.05, .95); } }
@keyframes m-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03, .97); } }
@keyframes m-pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* ---------- Launch ---------- */
.screen-launch {
  justify-content: center;
  background: linear-gradient(180deg, var(--bg-sky) 0%, rgba(232, 246, 255, 0) 60%);
}

.deco-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.deco-cloud {
  position: absolute;
  width: 180px;
  height: 56px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 0 rgba(59, 47, 47, .06);
  animation: drift 26s linear infinite;
}
.deco-cloud::before, .deco-cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.deco-cloud::before { width: 80px; height: 80px; left: 26px; top: -40px; }
.deco-cloud::after { width: 60px; height: 60px; left: 92px; top: -26px; }
.deco-cloud.c1 { top: 12%; left: -10%; }
.deco-cloud.c2 { top: 28%; left: 60%; transform: scale(.7); animation-duration: 34s; animation-delay: -12s; }
.deco-cloud.c3 { top: 6%; left: 30%; transform: scale(.5); animation-duration: 40s; animation-delay: -20s; }

@keyframes drift {
  from { translate: -20vw 0; }
  to { translate: 120vw 0; }
}

.deco-bubble {
  position: absolute;
  border-radius: 50%;
  border: var(--bw) solid var(--ink);
  opacity: .9;
  animation: float 6s ease-in-out infinite;
}
.deco-bubble.b1 { width: 34px; height: 34px; background: var(--c-yellow); left: 6%; bottom: 18%; }
.deco-bubble.b2 { width: 22px; height: 22px; background: var(--c-mint); left: 14%; top: 22%; animation-delay: -2s; }
.deco-bubble.b3 { width: 28px; height: 28px; background: var(--c-orange); right: 7%; bottom: 12%; animation-delay: -3s; }
.deco-bubble.b4 { width: 18px; height: 18px; background: var(--info); right: 18%; top: 14%; animation-delay: -1s; }
.deco-bubble.b5 { width: 40px; height: 40px; background: #FFB4C8; left: 44%; bottom: 5%; animation-delay: -4s; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }

.launch-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 40px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}

.launch-hero { display: flex; flex-direction: column; align-items: center; text-align: center; }

.logo {
  display: flex;
  gap: 2px;
  margin: 0 0 6px;
  font-size: 96px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.logo .lg {
  display: inline-block;
  color: var(--c-orange);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink);
  animation: letter-bounce 2.6s var(--ease-pop) infinite;
}
.logo .l2 { color: var(--c-yellow); animation-delay: .12s; }
.logo .l3 { color: var(--c-mint); animation-delay: .24s; }
.logo .l4 { color: var(--c-red); animation-delay: .36s; }
.logo .l5 { color: var(--info); animation-delay: .48s; }
.logo .l6 { color: var(--c-orange); animation-delay: .6s; }

@keyframes letter-bounce {
  0%, 60%, 100% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(-14px) rotate(-6deg); }
  40% { transform: translateY(0) rotate(3deg); }
}

.tagline { margin: 8px 0 0; font-size: var(--fs-h1); font-weight: 800; letter-spacing: 4px; }
.tagline-en { margin: 4px 0 0; font-size: 20px; color: var(--ink-2); font-style: italic; }

.launch-pin {
  padding: 28px 28px 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  max-width: 440px;
  width: 100%;
  justify-self: center;
}

.pin-head { display: flex; align-items: center; gap: 14px; }
.pin-badge {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--c-yellow);
  border: var(--bw) solid var(--ink);
  flex: none;
}
.pin-title { margin: 0; font-size: var(--fs-h2); font-weight: 800; }
.pin-hint { margin: 2px 0 0; font-size: 16px; color: var(--ink-2); min-height: 22px; transition: color .2s; }
.pin-hint.is-error { color: var(--err); }
.pin-hint.is-ok { color: var(--ok); }

.pinpad { display: flex; flex-direction: column; gap: 16px; }
.pin-dots { display: flex; justify-content: center; gap: 18px; padding: 4px 0; }
.pin-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: var(--bw) solid var(--ink);
  background: var(--bg-cream);
  transition: background .15s, transform .2s var(--ease-pop);
}
.pin-dot.is-filled { background: var(--c-orange); transform: scale(1.15); }
.pinpad.is-error .pin-dot { border-color: var(--err); background: #FFE1E1; }
.pinpad.is-error .pin-dot.is-filled { background: var(--err); }
.pinpad.is-ok .pin-dot { background: var(--ok); }
.pinpad.shake .pin-dots { animation: shake .45s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-14px); }
  40% { transform: translateX(12px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(5px); }
}

.pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pin-key {
  height: 66px;
  font-size: 30px;
  font-weight: 800;
  background: var(--bg-cream);
  border: var(--bw) solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, background .15s;
  display: grid;
  place-items: center;
}
.pin-key:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); background: var(--c-yellow-l); }
.pin-key--fn { background: var(--bg-sky); font-size: 18px; }
.pin-key:disabled { opacity: .45; }

.btn-enter { font-size: 26px; min-height: 72px; }
.btn-enter:not(:disabled) { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 6px 0 var(--ink), 0 0 0 0 rgba(255, 138, 61, .55), inset 0 -6px 0 rgba(0, 0, 0, .12), inset 0 4px 0 rgba(255, 255, 255, .45); }
  50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 14px rgba(255, 138, 61, 0), inset 0 -6px 0 rgba(0, 0, 0, .12), inset 0 4px 0 rgba(255, 255, 255, .45); }
}

.launch-links { display: flex; justify-content: center; align-items: center; gap: 10px; }
.beian {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: rgba(59, 47, 47, .42);
  text-decoration: none;
}
.beian:hover { text-decoration: underline; }
.dot-sep { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); opacity: .4; }

/* ---------- Topbar ---------- */
.topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.brand {
  background: none;
  border: 0;
  padding: 0 6px;
  font-size: 32px;
  font-weight: 800;
  color: var(--c-orange);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 var(--ink);
}
.brand b { color: var(--c-mint); }

.timer {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 18px;
  background: var(--bg-white);
  border: var(--bw) solid var(--ink);
  border-radius: 999px;
  max-width: 520px;
  margin-left: auto;
}
.timer .ico { width: 26px; height: 26px; color: var(--c-orange); animation: hourglass 6s ease-in-out infinite; }
@keyframes hourglass { 0%, 85% { transform: rotate(0); } 95%, 100% { transform: rotate(180deg); } }
.timer-track {
  flex: 1;
  height: 16px;
  border-radius: 99px;
  background: var(--bg-cream);
  border: 2px solid var(--ink);
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: repeating-linear-gradient(-45deg, var(--c-mint) 0 10px, var(--c-mint-l) 10px 20px);
  background-size: 28px 28px;
  animation: stripes 1.2s linear infinite;
  transition: width .6s ease, background .3s;
  transform-origin: left;
}
.timer.is-low .timer-fill { background: repeating-linear-gradient(-45deg, var(--err) 0 10px, #FF9B9B 10px 20px); }
.timer.is-low { animation: low-pulse 1s ease-in-out infinite; }
@keyframes stripes { from { background-position: 0 0; } to { background-position: 28px 0; } }
@keyframes low-pulse { 50% { transform: scale(1.03); } }
.timer-text { min-width: 64px; text-align: right; font-size: 20px; font-variant-numeric: tabular-nums; }

.page-title { margin: 0; font-size: 32px; font-weight: 800; }
.count-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--c-yellow);
  border: var(--bw) solid var(--ink);
  font-size: 18px;
}
.count-pill .ico { width: 20px; height: 20px; }
.count-pill--mint { background: var(--c-mint-l); }

/* ---------- Play ---------- */
.play-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
}

.canvas-card {
  position: relative;
  min-height: 0;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background:
    radial-gradient(rgba(59, 47, 47, .045) 1px, transparent 1.2px) 0 0 / 14px 14px,
    linear-gradient(180deg, #DDF1FF 0%, var(--bg-sky) 55%, #FFFDF5 100%);
}
.canvas-card::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: calc(var(--r-xl) - 10px);
  border: 2px dashed rgba(59, 47, 47, .12);
  pointer-events: none;
}

.stage { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.stage.anim .ln { transition-property: stroke-dashoffset; transition-timing-function: cubic-bezier(.45, .05, .35, 1); }
.stage.anim .fl { opacity: 0; transition: opacity .38s ease; }
.stage.anim.go .ln { stroke-dashoffset: 0 !important; }
.stage.anim.go .fl { opacity: 1; }
.stage.anim.idle .ln { stroke-dasharray: none !important; }
.stage.anim .bg-layer { opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .45s ease; }
.stage.anim.go .bg-layer { opacity: 1; transform: none; }
.stage .bob { transform-box: fill-box; transform-origin: 50% 100%; }
.stage.idle .bob { animation: bob 2.6s ease-in-out infinite; }
.stage.idle .sprite:nth-child(2n) .bob { animation-delay: -1.1s; }
.stage.idle .sprite:nth-child(3n) .bob { animation-delay: -.6s; }
.stage.idle .bg-sun { animation: sun-rock 4s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 50%; }
.stage.idle .bg-cloud { animation: cloud-move 9s ease-in-out infinite; }
.stage .bg-twinkle { animation: twinkle 2.4s ease-in-out infinite; }
@keyframes sun-rock { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.06); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-6px) rotate(-1.5deg); } 60% { transform: translateY(0) rotate(1.5deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes cloud-move { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(26px); } }

.canvas-card, .art-thumb, .drawer-stage { transition: background .6s ease; }
.canvas-card.is-night, .art-thumb.is-night, .drawer-stage.is-night {
  background:
    radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.2px) 0 0 / 14px 14px,
    linear-gradient(180deg, #2B2F6B 0%, #4B4F9A 60%, #6F6FB4 100%);
}
.canvas-card.is-night .stage-empty .empty-title,
.canvas-card.is-night .stage-empty .empty-sub { color: rgba(255, 255, 255, .5); }

.cant-draw {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 8%;
  text-align: center;
  z-index: 2;
}
.cant-draw .cd-title { margin: 0; font-size: 30px; font-weight: 800; }
.cant-draw .cd-sub { margin: 0; font-size: 19px; color: var(--ink-2); }
.cant-draw .chips { justify-content: center; overflow: visible; }

.credit {
  position: absolute;
  right: 18px;
  bottom: 10px;
  font-size: 11px;
  color: rgba(59, 47, 47, .45);
  z-index: 1;
  pointer-events: none;
}
.canvas-card.is-night .credit { color: rgba(255, 255, 255, .5); }

.source-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--bg-sky);
  vertical-align: middle;
}
.source-pill[data-src="deepseek"] { background: #E3EEFF; color: #2E5BCC; }
.source-pill[data-src="local"] { background: #DDF6EA; color: #1F8A57; }
.source-pill[data-src="cache"] { background: #FFF1D0; color: #9A6B00; }
.source-pill[data-src="offline"] { background: #F1E6FF; color: #6B3FB8; }

.stage-photo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 7% 8% 9%;
  pointer-events: none;
}
.stage-photo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  border: 10px solid #fff;
  outline: var(--bw) solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 10px 0 rgba(59, 47, 47, .18);
  transform: rotate(-2deg);
  animation: photo-in .9s var(--ease-pop) both;
}
@keyframes photo-in {
  0% { opacity: 0; transform: rotate(-12deg) scale(.6); filter: blur(12px) saturate(.2); }
  60% { opacity: 1; filter: blur(2px) saturate(.8); }
  100% { opacity: 1; transform: rotate(-2deg) scale(1); filter: none; }
}
.photo-tag {
  position: absolute;
  bottom: 5%;
  right: 7%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(90deg, #8B5CF6, var(--info));
  border: 2px solid var(--ink);
  border-radius: 999px;
  transform: rotate(3deg);
}
.photo-tag .ico { width: 18px; height: 18px; }

.magic-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .92) 0, rgba(232, 246, 255, .85) 60%);
  z-index: 3;
}
.magic-loading p { margin: 0; font-size: 24px; font-weight: 800; }
.magic-orbit { position: relative; width: 150px; height: 150px; animation: spin 2.4s linear infinite; }
.magic-orbit span {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: var(--bw) solid var(--ink);
}
.magic-orbit span:nth-child(1) { background: var(--c-orange); top: 0; left: 62px; }
.magic-orbit span:nth-child(2) { background: var(--c-yellow); right: 0; top: 62px; }
.magic-orbit span:nth-child(3) { background: var(--c-mint); bottom: 0; left: 62px; }
.magic-orbit span:nth-child(4) { background: var(--info); left: 0; top: 62px; }
.magic-wand {
  position: absolute;
  width: 84px;
  height: 84px;
  margin-top: -50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #B794F6, var(--info));
  border: var(--bw) solid var(--ink);
  color: #fff;
  animation: wand 1s ease-in-out infinite;
}
.magic-wand .ico { width: 44px; height: 44px; }
@keyframes wand { 0%, 100% { transform: rotate(-12deg) scale(1); } 50% { transform: rotate(14deg) scale(1.08); } }

.stage-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  padding-bottom: 6%;
}
.stage-empty .empty-title { margin: 0; font-size: 34px; font-weight: 800; color: rgba(59, 47, 47, .35); }
.stage-empty .empty-sub { margin: 8px 0 0; font-size: 20px; color: rgba(59, 47, 47, .3); }
.stage-empty::before {
  content: "";
  width: 120px;
  height: 120px;
  margin-bottom: 16px;
  border-radius: 50%;
  border: 4px dashed rgba(59, 47, 47, .18);
  animation: spin 14s linear infinite;
}

.count-badge {
  position: absolute;
  top: 22px;
  right: 24px;
  padding: 6px 18px;
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  background: var(--c-red);
  border: var(--bw) solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--ink);
  transform: rotate(8deg);
  animation: pop-in .5s var(--ease-pop) both;
  z-index: 2;
}

.sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.sparkle {
  position: absolute;
  width: 26px;
  height: 26px;
  color: var(--c-yellow);
  fill: currentColor;
  stroke: var(--ink);
  stroke-width: 1.6;
  animation: sparkle 1.1s ease-out forwards;
}
@keyframes sparkle {
  0% { opacity: 0; transform: scale(0) rotate(0); }
  40% { opacity: 1; transform: scale(1.2) rotate(70deg); }
  100% { opacity: 0; transform: scale(.4) rotate(160deg) translateY(-30px); }
}

.mascot-dock {
  position: absolute;
  left: 18px;
  top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  z-index: 5;
  max-width: calc(100% - 36px);
}

.bubble {
  position: relative;
  margin-top: 8px;
  padding: 12px 18px;
  max-width: 420px;
  font-size: 19px;
  line-height: 1.35;
  background: var(--bg-white);
  border: var(--bw) solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 4px 0 rgba(59, 47, 47, .15);
  animation: pop-in .35s var(--ease-pop);
}
.bubble::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 18px;
  width: 18px;
  height: 18px;
  background: var(--bg-white);
  border-left: var(--bw) solid var(--ink);
  border-bottom: var(--bw) solid var(--ink);
  transform: rotate(45deg);
  border-radius: 0 0 0 5px;
}
.bubble.is-bump { animation: bump .35s var(--ease-pop); }
.bubble .live { color: var(--c-orange); }

@keyframes pop-in { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }
@keyframes bump { 0% { transform: scale(.9); } 100% { transform: scale(1); } }

/* side panel */
.side-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.word-card {
  position: relative;
  flex: none;
  padding: 18px 22px 18px;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(255, 210, 63, .18), rgba(255, 210, 63, 0) 60%),
    var(--bg-white);
}
.word-label {
  position: absolute;
  top: -15px;
  left: 20px;
  padding: 2px 14px;
  font-size: 15px;
  color: #fff;
  background: var(--c-mint-d);
  border: 2px solid var(--ink);
  border-radius: 999px;
  letter-spacing: 1px;
}
.word-en {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding-right: 58px;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.12;
  min-height: 52px;
  word-break: break-word;
}
.word-en.is-long { font-size: 34px; }
.word-en.is-xlong { font-size: 28px; }
.word-placeholder { color: rgba(59, 47, 47, .25); }
.w {
  display: inline-block;
  transform-origin: 50% 90%;
  animation: word-pop .5s var(--ease-pop) both;
  transition: color .15s;
  border-radius: 10px;
}
.w.is-hl {
  color: var(--c-orange);
  animation: word-jump .45s var(--ease-pop);
}
.w.is-done { color: var(--ink); }
@keyframes word-pop { 0% { opacity: 0; transform: translateY(18px) scale(.5); } 100% { opacity: 1; transform: none; } }
@keyframes word-jump { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-12px) scale(1.15); } 100% { transform: translateY(0) scale(1.05); } }

.word-zh { margin-top: 8px; font-size: 22px; color: var(--ink-2); }

.speaker-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  margin-top: -30px;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #7FB0FF, var(--info));
  border: var(--bw) solid var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.speaker-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.speaker-btn:disabled { opacity: .35; }
.speaker-btn.is-playing .ico { animation: m-pulse .6s ease-in-out infinite; }

.suggest { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.suggest-head { display: flex; align-items: center; gap: 10px; }
.suggest-label { font-size: 18px; color: var(--ink-2); }
.level-pill {
  padding: 2px 12px;
  font-size: 14px;
  border-radius: 999px;
  background: var(--c-mint-l);
  border: 2px solid var(--ink);
}
.chips { display: flex; flex-wrap: wrap; gap: 10px; overflow-y: auto; padding: 2px 2px 8px; }
.chip {
  min-height: 48px;
  padding: 0 18px;
  font-size: 19px;
  background: var(--bg-white);
  border: var(--bw) solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .12s, box-shadow .12s, background .15s;
  animation: pop-in .4s var(--ease-pop) both;
}
.chip:nth-child(3n+1) { background: #FFF1D0; }
.chip:nth-child(3n+2) { background: #DDF6EA; }
.chip:nth-child(3n) { background: #E3EEFF; }
.chip:active { transform: translateY(3px) scale(.96); box-shadow: 0 1px 0 var(--ink); }
.chip:disabled { opacity: .5; }

.dock {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}

.mic-wrap {
  position: relative;
  width: var(--mic);
  height: var(--mic);
  display: grid;
  place-items: center;
}
.mic-btn {
  position: relative;
  z-index: 1;
  width: var(--mic);
  height: var(--mic);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: radial-gradient(circle at 35% 28%, #FFC08E 0, var(--c-orange) 45%, var(--c-orange-d) 100%);
  border: 4px solid var(--ink);
  box-shadow: 0 9px 0 var(--ink), inset 0 -10px 0 rgba(0, 0, 0, .12), inset 0 8px 0 rgba(255, 255, 255, .35);
  animation: breathe 2.4s ease-in-out infinite;
  transition: transform .12s, box-shadow .12s, background .3s;
}
.mic-btn .ico { width: 64px; height: 64px; stroke-width: 2.6; transition: opacity .2s, transform .2s; }
.mic-btn:active:not(:disabled) { transform: translateY(6px) scale(.95); box-shadow: 0 3px 0 var(--ink), inset 0 -10px 0 rgba(0, 0, 0, .12), inset 0 8px 0 rgba(255, 255, 255, .35); }
.mic-btn:disabled { animation: none; filter: grayscale(.6); opacity: .7; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.mic-btn .wave {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mic-btn .wave i {
  width: 9px;
  height: 46px;
  border-radius: 9px;
  background: #fff;
  border: 2px solid var(--ink);
  animation: wavebar .8s ease-in-out infinite;
}
.mic-btn .wave i:nth-child(2) { animation-delay: -.2s; }
.mic-btn .wave i:nth-child(3) { animation-delay: -.4s; }
.mic-btn .wave i:nth-child(4) { animation-delay: -.6s; }
.mic-btn .wave i:nth-child(5) { animation-delay: -.1s; }
@keyframes wavebar { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.mic-wrap .ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid var(--c-red);
  opacity: 0;
}
.mic-wrap.is-listening .mic-btn {
  background: radial-gradient(circle at 35% 28%, #FF8A80 0, var(--c-red-l) 40%, var(--c-red) 100%);
  animation: none;
}
.mic-wrap.is-listening .mic-btn .ico { display: none; }
.mic-wrap.is-listening .mic-btn .wave { display: flex; }
.mic-wrap.is-listening .ripple { animation: ripple 1.8s ease-out infinite; }
.mic-wrap.is-listening .ripple:nth-child(2) { animation-delay: .6s; }
.mic-wrap.is-listening .ripple:nth-child(3) { animation-delay: 1.2s; }
@keyframes ripple { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }
.mic-wrap.is-busy .mic-btn { animation: none; }
.mic-wrap.is-busy .mic-btn .ico { opacity: .5; transform: scale(.85); }

.mic-label { font-size: 20px; font-weight: 800; min-height: 26px; }

.lang-mode { width: 100%; flex: none; }
.lang-mode button { font-size: 18px; }

.dock-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 4px;
}

.btn-follow {
  min-height: 56px;
  padding: 0 20px;
  font-size: 20px;
  --bg: var(--c-mint-d);
  --bg-l: var(--c-mint);
}
.btn-follow.is-ready { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-6deg) scale(1.06); } 85% { transform: rotate(6deg) scale(1.06); } }

/* text form */
.text-form {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 24px);
  transform: translateX(-50%);
  width: min(640px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  z-index: 20;
  animation: slide-up .3s var(--ease-pop);
}
.text-form input {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 18px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg-cream);
  border: var(--bw) solid var(--ink);
  border-radius: 18px;
  outline: none;
}
.text-form input:focus { box-shadow: 0 0 0 4px rgba(255, 138, 61, .35); }
.btn-go { min-height: 56px; padding: 0 24px; }
@keyframes slide-up { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- Album ---------- */
.filter-chips { flex: none; display: flex; gap: 12px; margin-bottom: 16px; overflow-x: auto; padding: 2px 2px 8px; }
.fchip {
  flex: none;
  min-height: 52px;
  padding: 0 24px;
  font-size: 20px;
  background: var(--bg-white);
  border: var(--bw) solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  transition: background .2s, transform .12s, box-shadow .12s, color .2s;
}
.fchip.is-on { background: var(--c-orange); color: #fff; }
.fchip:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

.album-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 4px 24px; }
.album-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.art-card {
  display: flex;
  flex-direction: column;
  padding: 10px;
  text-align: left;
  background: var(--bg-white);
  border: var(--bw) solid var(--ink);
  border-radius: 26px;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform .15s, box-shadow .15s;
  animation: card-in .45s var(--ease-pop) both;
}
.art-card:nth-child(4n+1) { transform: rotate(-1deg); }
.art-card:nth-child(4n+3) { transform: rotate(1deg); }
.art-card:active { transform: translateY(4px) scale(.97); box-shadow: 0 2px 0 var(--ink); }
@keyframes card-in { from { opacity: 0; transform: translateY(26px) scale(.9); } }
.art-thumb {
  position: relative;
  aspect-ratio: 800 / 560;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: linear-gradient(180deg, #DDF1FF 0%, var(--bg-sky) 55%, #FFFDF5 100%);
}
.art-thumb svg, .art-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; }
.art-thumb img { object-fit: contain; background: #fff; }
.art-thumb .thumb-count {
  position: absolute;
  top: 6px;
  right: 8px;
  padding: 0 10px;
  font-size: 16px;
  color: #fff;
  background: var(--c-red);
  border: 2px solid var(--ink);
  border-radius: 999px;
}
.art-meta { padding: 10px 6px 4px; display: flex; flex-direction: column; gap: 4px; }
.art-en { font-size: 21px; font-weight: 800; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-sub { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 14px; color: var(--ink-2); }
.art-sub > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-sub .mini-stars { flex: none; }

.mini-stars { display: inline-flex; gap: 2px; }
.mini-stars svg { width: 20px; height: 20px; fill: #EFE6D6; stroke: var(--ink); stroke-width: 1.6; }
.mini-stars svg.on { fill: var(--c-yellow); }

.album-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 8vh; font-size: 22px; color: var(--ink-2); }

.drawer { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.drawer-mask { position: absolute; inset: 0; background: rgba(59, 47, 47, .45); animation: fade-in .25s ease; }
.drawer-panel {
  position: relative;
  width: min(1000px, calc(100% - 48px));
  max-height: calc(100% - 48px);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  padding: 24px;
  animation: drawer-up .35s var(--ease-pop);
}
@keyframes drawer-up { from { transform: translateY(60px) scale(.95); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.drawer-close { position: absolute; top: -18px; right: -12px; z-index: 2; background: var(--bg-white); }
.drawer-stage {
  position: relative;
  aspect-ratio: 800 / 560;
  border: var(--bw) solid var(--ink);
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(180deg, #DDF1FF 0%, var(--bg-sky) 55%, #FFFDF5 100%);
}
.drawer-info { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.drawer-en { font-size: 40px; font-weight: 800; line-height: 1.1; }
.drawer-zh { font-size: 22px; color: var(--ink-2); }
.drawer-meta { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--ink-2); }
.drawer-meta .mini-stars svg { width: 28px; height: 28px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.drawer-actions .btn-jelly { min-height: 58px; padding: 0 20px; font-size: 19px; flex: 1 1 auto; }

/* ---------- Parent ---------- */
.parent-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 4px 24px; }
.parent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: start; }
.p-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.p-title { margin: 0; display: flex; align-items: center; gap: 12px; font-size: var(--fs-h2); font-weight: 800; }
.p-ico { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; border: var(--bw) solid var(--ink); }
.p-ico--orange { background: var(--c-orange-l); }
.p-ico--mint { background: var(--c-mint-l); }
.p-ico--blue { background: #B9D3FF; }
.p-row { display: flex; flex-direction: column; gap: 10px; }
.p-row--stack { gap: 12px; }
.p-label { display: flex; flex-direction: column; font-size: 19px; }
.p-label small { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-top: 2px; }
.p-row .btn-mini { align-self: flex-start; }

.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: var(--bg-cream);
  border: var(--bw) solid var(--ink);
  border-radius: 18px;
}
.segmented button {
  flex: 1;
  min-height: 48px;
  padding: 0 8px;
  font-size: 17px;
  background: none;
  border: 0;
  border-radius: 13px;
  color: var(--ink-2);
  transition: background .2s, color .2s, transform .2s var(--ease-pop);
}
.segmented button.is-on {
  background: var(--c-orange);
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15), 0 0 0 2px var(--ink);
}
.segmented button:active { transform: scale(.95); }
.segmented button:disabled { opacity: .4; }
.segmented--wide { flex-wrap: wrap; }
.segmented--wide button { flex: 1 1 40%; }

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--c-mint) 0, var(--c-yellow) 50%, var(--c-orange) 100%);
  border: var(--bw) solid var(--ink);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: var(--bw) solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
}
.slider::-moz-range-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: var(--bw) solid var(--ink);
}

.p-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.p-stat > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  background: var(--bg-cream);
  border: 2px solid var(--ink);
  border-radius: 18px;
  text-align: center;
}
.p-stat b { font-size: 32px; font-weight: 800; color: var(--c-orange); line-height: 1.1; }
.p-stat span { font-size: 13px; color: var(--ink-2); }
.p-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.p-actions .btn-jelly { flex: 1 1 auto; min-height: 56px; font-size: 18px; padding: 0 16px; }

.privacy-note {
  display: flex;
  gap: 10px;
  padding: 14px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--bg-sky);
  border: 2px dashed rgba(79, 140, 255, .5);
  border-radius: 18px;
}
.privacy-note p { margin: 0; }
.privacy-note .ico { color: var(--info); width: 24px; height: 24px; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--sat) + 20px) 20px calc(var(--sab) + 20px);
  background: rgba(59, 47, 47, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in .25s ease;
}

.modal { position: relative; padding: 30px; width: min(540px, 100%); max-height: 100%; overflow-y: auto; animation: modal-in .4s var(--ease-pop); }
@keyframes modal-in { from { opacity: 0; transform: scale(.7) translateY(30px); } }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-actions { display: flex; gap: 14px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.modal-actions .btn-jelly { flex: 1 1 160px; }

.score-card { text-align: center; width: min(620px, 100%); }
.score-card .phase-result, .score-card .phase-replay { display: none; }
.score-card.is-result .phase-listen, .score-card.is-replay .phase-listen { display: none; }
.score-card.is-result .phase-result, .score-card.is-replay .phase-replay { display: block; }
.replay-speaker {
  width: 76px;
  height: 76px;
  margin: 10px auto 4px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #7FB0FF, var(--info));
  border: var(--bw) solid var(--ink);
  animation: replay-pulse 1s ease-in-out infinite;
}
.replay-speaker .ico { width: 40px; height: 40px; }
@keyframes replay-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(79, 140, 255, .5); } 50% { box-shadow: 0 0 0 16px rgba(79, 140, 255, 0); } }
.score-tip { margin: 8px 0 6px; font-size: 20px; color: var(--ink-2); }
.score-target { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: 34px; font-weight: 800; margin: 12px 0 6px; }
.score-target.big { font-size: 44px; }
.score-target .tw { padding: 0 6px; border-radius: 10px; transition: background .3s, color .3s; }
.score-target .tw.ok { background: #D6F5E5; color: #1F8A57; }
.score-target .tw.miss { background: #FFE4E4; color: #C0392B; text-decoration: underline wavy rgba(192, 57, 43, .5); text-underline-offset: 6px; }
.score-live { margin: 8px 0 18px; font-size: 20px; color: var(--c-orange); min-height: 28px; }
.score-said { margin: 6px 0 0; font-size: 18px; color: var(--ink-2); }
.score-said span { color: var(--ink); }
.score-title { margin: 0; font-size: var(--fs-h1); font-weight: 800; }

.listen-wave { display: flex; justify-content: center; align-items: center; gap: 8px; height: 70px; margin-top: 8px; }
.listen-wave i { width: 12px; height: 60px; border-radius: 10px; background: var(--c-mint); border: 2px solid var(--ink); animation: wavebar .9s ease-in-out infinite; }
.listen-wave i:nth-child(2n) { background: var(--c-orange); animation-delay: -.3s; }
.listen-wave i:nth-child(3n) { background: var(--c-yellow); animation-delay: -.55s; }

.stars { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 18px 0 6px; height: 120px; }
.big-star { width: 96px; height: 96px; fill: #EFE6D6; stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.big-star:nth-child(2) { width: 118px; height: 118px; }
.big-star.on { fill: var(--c-yellow); animation: star-drop .7s var(--ease-pop) both; filter: drop-shadow(0 5px 0 rgba(59, 47, 47, .25)); }
@keyframes star-drop {
  0% { transform: translateY(-120px) scale(.3) rotate(-90deg); opacity: 0; }
  60% { transform: translateY(8px) scale(1.15) rotate(10deg); opacity: 1; }
  100% { transform: translateY(0) scale(1) rotate(0); }
}

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

.pin-modal { width: min(440px, 100%); display: flex; flex-direction: column; gap: 18px; }

.confirm-card { text-align: center; }
.confirm-card h3 { margin: 0 0 10px; font-size: 30px; font-weight: 800; }
.confirm-card p { margin: 0; font-size: 19px; color: var(--ink-2); line-height: 1.5; }
.privacy-list { margin: 8px 0 0; padding: 0; list-style: none; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.privacy-list li {
  position: relative;
  padding: 12px 14px 12px 44px;
  font-size: 17px;
  line-height: 1.45;
  background: var(--bg-cream);
  border: 2px solid var(--ink);
  border-radius: 16px;
}
.privacy-list li::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 16px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-mint);
  border: 2px solid var(--ink);
}

.overlay--lock {
  background: radial-gradient(circle at 50% 30%, #4B3F7A 0, #2B2350 70%);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  z-index: 60;
}
.overlay--lock::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 20%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 32% 70%, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 72% 18%, #FFE38A 50%, transparent 51%),
    radial-gradient(2px 2px at 86% 62%, #fff 50%, transparent 51%),
    radial-gradient(3px 3px at 52% 88%, #FFE38A 50%, transparent 51%),
    radial-gradient(2px 2px at 8% 86%, #fff 50%, transparent 51%);
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 50% { opacity: .4; } }
.lock-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: #fff; }
.lock-card h2 { margin: 6px 0 0; font-size: 48px; font-weight: 800; }
.lock-card p { margin: 0 0 12px; font-size: 21px; line-height: 1.6; color: rgba(255, 255, 255, .85); }
.lock-card .link-btn { color: rgba(255, 255, 255, .75); }
.moon {
  position: absolute;
  top: -70px;
  right: -110px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--c-yellow);
  box-shadow: 0 0 40px rgba(255, 210, 63, .6);
}
.moon::after { content: ""; position: absolute; top: -8px; left: 22px; width: 80px; height: 80px; border-radius: 50%; background: #3F3570; }
.zzz { position: absolute; top: 24%; left: 58%; pointer-events: none; }
.zzz span { position: absolute; font-size: 40px; font-weight: 800; color: #fff; opacity: 0; animation: zzz 3s ease-in infinite; }
.zzz span:nth-child(2) { animation-delay: 1s; font-size: 30px; }
.zzz span:nth-child(3) { animation-delay: 2s; font-size: 22px; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(60px, -90px); } }

.demo-panel {
  position: fixed;
  left: calc(var(--sal) + 20px);
  top: calc(var(--sat) + 100px);
  z-index: 45;
  width: 320px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: pop-in .3s var(--ease-pop);
}
.demo-head { display: flex; align-items: center; justify-content: space-between; font-size: 20px; }
.demo-list { display: flex; flex-direction: column; gap: 8px; }
.demo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  font-size: 18px;
  text-align: left;
  background: var(--bg-cream);
  border: 2px solid var(--ink);
  border-radius: 16px;
}
.demo-item small { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.demo-item:active { background: var(--c-yellow-l); }
.demo-tools { display: flex; gap: 8px; flex-wrap: wrap; }

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--sat) + 18px);
  z-index: 80;
  max-width: calc(100% - 40px);
  padding: 12px 22px;
  font-size: 18px;
  color: #fff;
  background: var(--ink);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  transform: translate(-50%, -140%);
  opacity: 0;
  transition: transform .35s var(--ease-pop), opacity .25s;
  pointer-events: none;
}
.toast.is-show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) and (min-aspect-ratio: 1/1) {
  .play-main { grid-template-columns: minmax(0, 1fr) 320px; }
  .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .parent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-height: 760px) and (min-aspect-ratio: 1/1) {
  :root { --mic: 120px; --topbar-h: 64px; }
  .word-card { min-height: 140px; padding: 14px 18px; }
  .word-en { font-size: 38px; }
  .mic-btn .ico { width: 52px; height: 52px; }
}

@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  :root { --mic: 88px; --topbar-h: 52px; --tap: 48px; }
  .screen { padding-top: calc(var(--sat) + 6px); padding-bottom: calc(var(--sab) + 8px); }
  .topbar { margin-bottom: 8px; }
  .icon-btn--label span, .suggest { display: none; }
  .word-card { min-height: 0; padding: 10px 14px; }
  .word-en { font-size: 28px; min-height: 0; }
  .word-zh { font-size: 16px; margin-top: 2px; }
  .speaker-btn { width: 44px; height: 44px; margin-top: -22px; }
  .mic-btn .ico { width: 40px; height: 40px; }
  .mic-label { font-size: 15px; }
  .dock {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "mic lang" "label row";
    column-gap: 12px;
    row-gap: 4px;
    align-items: center;
  }
  .mic-wrap { grid-area: mic; }
  .mic-label { grid-area: label; text-align: center; }
  .lang-mode { grid-area: lang; padding: 2px; }
  .dock-row { grid-area: row; margin-top: 0; }
  .lang-mode button { min-height: 44px; font-size: 16px; }
  .btn-follow { min-height: 46px; font-size: 16px; }
  .launch-inner { gap: 16px; }
  .logo { font-size: 56px; }
  .mascot-hero { width: 90px; height: 114px; }
  .tagline { font-size: 26px; }
  .pin-key { height: 46px; font-size: 22px; }
  .launch-pin { padding: 14px; gap: 10px; }
  .btn-enter { min-height: 52px; font-size: 20px; }
}

@media (max-aspect-ratio: 1/1) {
  :root { --mic: 112px; --topbar-h: 64px; }

  .screen { padding-left: calc(var(--sal) + 14px); padding-right: calc(var(--sar) + 14px); }

  .screen-launch { justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .launch-inner { grid-template-columns: 1fr; gap: 12px; margin: auto; padding: 6px 0 8px; }
  .logo { font-size: 56px; }
  .mascot-hero { width: 78px; height: 98px; }
  .tagline { font-size: 26px; margin-top: 2px; }
  .tagline-en { font-size: 15px; }
  .launch-pin { padding: 18px 16px 8px; gap: 12px; }
  .pin-key { height: 56px; }

  .topbar { gap: 10px; margin-bottom: 10px; }
  .brand { font-size: 26px; }
  .icon-btn--label span { display: none; }
  .icon-btn--label { padding: 0 14px; }
  .timer { height: 50px; padding: 0 14px; gap: 6px; flex: 1 1 auto; max-width: none; }
  .timer-track { display: none; }
  .timer-text { font-size: 18px; min-width: 0; flex: 1; text-align: center; white-space: nowrap; }

  .play-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--mic) + 124px);
  }
  .canvas-card { flex: none; height: max(196px, min(44vh, 78vw, calc(100vh - 450px))); }
  .bubble { font-size: 16px; padding: 8px 12px; max-width: 240px; }
  .mascot-dock { left: 10px; top: 10px; }
  .mascot-sm { width: 54px; height: 70px; }
  .stage-empty .empty-title { font-size: 24px; }
  .stage-empty .empty-sub { font-size: 16px; }
  .stage-empty::before { width: 70px; height: 70px; }

  .side-panel { gap: 14px; }
  .word-card { min-height: 128px; padding: 16px 16px 14px; }
  .word-en { font-size: 34px; }
  .word-en.is-long { font-size: 26px; }
  .word-en.is-xlong { font-size: 22px; }
  .word-zh { font-size: 18px; }
  .speaker-btn { width: 52px; height: 52px; margin-top: -26px; }
  .suggest { flex: none; overflow: visible; }
  .chip { min-height: 44px; font-size: 17px; padding: 0 14px; }

  .dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "lang lang lang" "kbd mic follow" "kbd label follow";
    align-items: center;
    row-gap: 2px;
    padding: 10px calc(var(--sar) + 14px) calc(var(--sab) + 10px) calc(var(--sal) + 14px);
    background: linear-gradient(180deg, rgba(255, 248, 231, 0) 0, rgba(255, 248, 231, .96) 30%);
  }
  .mic-wrap { grid-area: mic; }
  .mic-label { grid-area: label; font-size: 16px; }
  .lang-mode { grid-area: lang; margin-bottom: 6px; padding: 2px; }
  .lang-mode button { min-height: 44px; }
  .mic-btn .ico { width: 48px; height: 48px; }
  .dock-row { display: contents; }
  .btn-follow { grid-area: follow; justify-self: end; min-height: 54px; padding: 0 14px; font-size: 17px; gap: 6px; }
  #btn-keyboard { grid-area: kbd; justify-self: start; min-width: 56px; height: 56px; }

  .filter-chips { gap: 8px; }
  .fchip { min-height: 48px; padding: 0 16px; font-size: 18px; }

  .page-title { font-size: 26px; }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .art-en { font-size: 18px; }
  .drawer-panel { grid-template-columns: 1fr; padding: 16px; gap: 14px; overflow-y: auto; }
  .drawer-en { font-size: 30px; }

  .parent-grid { grid-template-columns: 1fr; gap: 16px; }

  .stars { height: 96px; }
  .big-star { width: 76px; height: 76px; }
  .big-star:nth-child(2) { width: 92px; height: 92px; }
  .score-target, .score-target.big { font-size: 30px; }
  .lock-card h2 { font-size: 38px; }
  .moon { right: -20px; top: -90px; }
  .demo-panel { left: 14px; right: 14px; width: auto; }
}

@media (min-width: 700px) and (max-aspect-ratio: 1/1) {
  :root { --mic: 136px; }
  .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .parent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .canvas-card { height: max(240px, min(46vh, calc(100vh - 480px))); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
