/* =====================================================================
   Talking Darpon — neon-glass UI
   ===================================================================== */
:root {
  --bg: #070a1a;
  --bg-2: #0d1230;
  --ink: #f8fafc;
  --ink-2: #c7d0ea;
  --muted: #8e9ac0;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --lime: #a3e635;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --red: #fb7185;

  --glass: rgba(16, 20, 48, 0.52);
  --glass-strong: rgba(13, 16, 40, 0.86);
  --glass-line: rgba(255, 255, 255, 0.12);
  --glass-hi: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.02) 60%);
  --shadow: 0 14px 40px rgba(1, 3, 18, 0.5);
  --blur: blur(18px) saturate(160%);

  --font: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --emoji: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;

  --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);
  --gut: 12px;
  --ease-pop: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden; overscroll-behavior: none;
  background: var(--bg); color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}

button { font-family: inherit; color: inherit; }
button:focus-visible, input:focus-visible, label:focus-within {
  outline: 2px solid var(--cyan); outline-offset: 3px;
}
[hidden] { display: none !important; }

#stageCanvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: grab;
}
#stageCanvas.dragging { cursor: grabbing; }
#stageCanvas.over-darpon { cursor: pointer; }

/* ---------- glass primitive ---------- */
.glass, .brand, .status-pill, .icon-btn, .wallet-chip, .stats-badge, .rail-btn, .dock-main, .action-strip, .toast {
  background: var(--glass-hi), var(--glass);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-line);
  box-shadow: 0 10px 30px rgba(1, 3, 18, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* =====================================================================
   Loading
   ===================================================================== */
.loading {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  padding: calc(20px + var(--sat)) 20px calc(20px + var(--sab));
  background: radial-gradient(120% 80% at 50% 0%, #1a1450 0%, #0a0c22 55%, #05060f 100%);
  transition: opacity 0.6s var(--ease-out), visibility 0.6s, transform 0.6s var(--ease-out);
  overflow: hidden;
}
.loading.gone { opacity: 0; visibility: hidden; pointer-events: none; transform: scale(1.04); }

.load-sky { position: absolute; inset: 0; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.55; animation: blobFloat 12s ease-in-out infinite alternate; }
.blob.b1 { width: 52vmax; height: 52vmax; left: -18vmax; top: -14vmax; background: #6d28d9; }
.blob.b2 { width: 44vmax; height: 44vmax; right: -16vmax; top: 10vh; background: #db2777; animation-delay: -4s; opacity: 0.4; }
.blob.b3 { width: 40vmax; height: 40vmax; left: 20vw; bottom: -26vmax; background: #0891b2; animation-delay: -8s; opacity: 0.45; }
.load-grid {
  position: absolute; left: -50%; right: -50%; bottom: -10%; height: 55%;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 114, 182, 0.3) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(420px) rotateX(62deg);
  transform-origin: 50% 0%;
  mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 45%, #000 100%);
  animation: gridRun 2.4s linear infinite;
  opacity: 0.55;
}

.load-card {
  position: relative; width: min(420px, 100%);
  padding: 34px 28px 26px; border-radius: 30px; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)), rgba(10, 12, 34, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255,255,255,0.14);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  animation: cardIn 0.8s var(--ease-pop) both;
}

.logo-badge {
  width: 92px; height: 92px; margin: -78px auto 16px; border-radius: 28px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 55%, var(--pink));
  box-shadow: 0 18px 50px rgba(167, 139, 250, 0.55), 0 0 0 6px rgba(10, 12, 34, 0.9), inset 0 2px 0 rgba(255,255,255,0.45);
  animation: logoBob 3.2s ease-in-out infinite;
}
.logo-badge svg { width: 66px; height: 66px; }

.load-title {
  margin: 0; font-size: clamp(34px, 9vw, 46px); line-height: 1; font-weight: 900; letter-spacing: -0.035em;
}
.load-title span {
  background: linear-gradient(100deg, var(--cyan), var(--violet) 45%, var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.load-tag { margin: 10px 0 24px; color: var(--ink-2); font-size: 15px; font-weight: 600; }
.load-tag em { font-style: normal; color: var(--amber); }

.progress {
  position: relative; height: 12px; border-radius: 999px; overflow: hidden;
  background: rgba(255, 255, 255, 0.08); box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.progress-fill {
  position: relative; width: 0%; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink));
  box-shadow: 0 0 18px rgba(244, 114, 182, 0.7);
  transition: width 0.25s var(--ease-out);
}
.progress-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,0.55) 50%, transparent 80%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
.load-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13px; font-weight: 700; }
.load-status { color: var(--muted); text-align: left; }
.load-percent { font-variant-numeric: tabular-nums; color: var(--ink); }

.start-btn {
  margin-top: 22px; width: 100%; height: 60px; border: 0; border-radius: 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 20px; font-weight: 900; letter-spacing: -0.01em; color: #1a0624;
  background: linear-gradient(100deg, var(--amber), #fb923c 45%, var(--pink));
  box-shadow: 0 14px 34px rgba(244, 114, 182, 0.45), inset 0 2px 0 rgba(255,255,255,0.5);
  animation: startPulse 1.8s ease-in-out infinite, popIn 0.5s var(--ease-pop) both;
  transition: transform 0.15s;
}
.start-btn svg { width: 24px; height: 24px; }
.start-btn:active { transform: scale(0.96); }
.retry-btn {
  margin-top: 18px; padding: 12px 22px; border: 0; border-radius: 14px; cursor: pointer;
  font-weight: 800; color: #071019; background: linear-gradient(135deg, var(--cyan), var(--violet));
}
.load-tip { margin: 18px 0 0; min-height: 18px; color: var(--muted); font-size: 12.5px; font-weight: 600; transition: opacity 0.3s; }

/* =====================================================================
   HUD
   ===================================================================== */
.hud-top {
  position: fixed; z-index: 20;
  top: calc(10px + var(--sat)); left: calc(var(--gut) + var(--sal)); right: calc(var(--gut) + var(--sar));
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'brand . right' 'status status status';
  align-items: center; row-gap: 10px; column-gap: 8px;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }

.brand {
  grid-area: brand; display: inline-flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 14px 0 5px; border-radius: 999px;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 55%, var(--pink));
  box-shadow: 0 0 16px rgba(167, 139, 250, 0.6);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; color: var(--ink-2); }
.brand-name b { font-weight: 900; color: var(--ink); }

.status-pill {
  grid-area: status; justify-self: center;
  display: inline-flex; align-items: center; gap: 9px;
  height: 36px; padding: 0 16px 0 13px; border-radius: 999px;
  font-size: 14px; font-weight: 800; letter-spacing: 0.005em; white-space: nowrap;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s var(--ease-pop);
  --tone: var(--lime);
}
.status-pill.bump { animation: pillBump 0.4s var(--ease-pop); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 25%, transparent), 0 0 14px var(--tone); }
.status-pill[data-state='listening'] { --tone: var(--lime); border-color: rgba(163, 230, 53, 0.45); }
.status-pill[data-state='listening'] .status-dot, .status-pill[data-state='hearing'] .status-dot { animation: dotPulse 0.9s ease-in-out infinite; }
.status-pill[data-state='hearing'] { --tone: var(--pink); border-color: rgba(244, 114, 182, 0.55); }
.status-pill[data-state='talking'] { --tone: var(--cyan); border-color: rgba(34, 211, 238, 0.5); }
.status-pill[data-state='happy'], .status-pill[data-state='giggling'], .status-pill[data-state='dancing'] { --tone: var(--pink); border-color: rgba(244, 114, 182, 0.45); }
.status-pill[data-state='dizzy'], .status-pill[data-state='bored'] { --tone: var(--amber); border-color: rgba(251, 191, 36, 0.45); }
.status-pill[data-state='annoyed'] { --tone: var(--red); border-color: rgba(251, 113, 133, 0.55); }
.status-pill[data-state='game'] { --tone: var(--violet); }

.hud-right { grid-area: right; display: flex; align-items: center; gap: 7px; justify-content: flex-end; }

.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  display: inline-grid; place-items: center; cursor: pointer; padding: 0;
  transition: transform 0.18s var(--ease-pop), border-color 0.2s, color 0.2s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { border-color: rgba(255, 255, 255, 0.3); }
.icon-btn:active { transform: scale(0.88); }
.icon-btn[aria-pressed='true'] { color: var(--amber); border-color: rgba(251, 191, 36, 0.5); }
.cam-badge {
  position: absolute; right: -3px; bottom: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  font-size: 10px; font-weight: 900; line-height: 18px; text-align: center; color: #06121a;
  background: var(--cyan); box-shadow: 0 0 0 2px var(--bg);
}

.wallet-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px 0 8px; border-radius: 999px;
  cursor: pointer; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums;
  transition: transform 0.18s var(--ease-pop);
}
.wallet-chip:active { transform: scale(0.92); }
.wallet-chip.pop { animation: walletPop 0.6s var(--ease-pop); }
.coin {
  position: relative; width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff7cc 0 12%, #fde047 13% 45%, #f59e0b 46% 100%);
  box-shadow: inset 0 -2px 0 rgba(146, 64, 14, 0.6), 0 0 12px rgba(251, 191, 36, 0.55);
}
.coin::after {
  content: 'D'; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 900; color: rgba(146, 64, 14, 0.85);
}

.stats-badge { height: 30px; padding: 0 11px; border-radius: 999px; display: inline-flex; align-items: center; font-size: 11px; font-weight: 800; color: var(--cyan); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- side rail ---------- */
.side-rail {
  position: fixed; z-index: 18;
  right: calc(var(--gut) + var(--sar)); top: 50%; transform: translateY(-62%);
  display: flex; flex-direction: column; gap: 10px;
}
.rail-btn {
  width: 58px; min-height: 58px; padding: 7px 0 6px; border-radius: 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: transform 0.18s var(--ease-pop), opacity 0.2s, border-color 0.2s;
}
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.3); }
.rail-btn:active:not(:disabled) { transform: scale(0.9); }
.rail-btn:disabled { opacity: 0.38; cursor: default; }
.rail-btn.ready { border-color: rgba(34, 211, 238, 0.5); box-shadow: 0 0 22px rgba(34, 211, 238, 0.25), inset 0 1px 0 rgba(255,255,255,0.1); }
.rail-emoji { font-family: var(--emoji); font-size: 24px; line-height: 1; }
.rail-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.02em; color: var(--ink-2); max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  top: calc(108px + var(--sat));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(92vw, 440px); pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 10px 16px 10px 12px; border-radius: 16px;
  font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.3;
  background: var(--glass-hi), var(--glass-strong);
  animation: toastIn 0.38s var(--ease-pop) both;
}
.toast .t-ico { font-family: var(--emoji); font-size: 19px; line-height: 1; }
.toast.warn { border-color: rgba(251, 191, 36, 0.5); }
.toast.success { border-color: rgba(163, 230, 53, 0.5); }
.toast.coin { border-color: rgba(251, 191, 36, 0.65); box-shadow: 0 0 30px rgba(251, 191, 36, 0.3), var(--shadow); }
.toast.out { animation: toastOut 0.3s ease-in forwards; }

/* ---------- speech bubble ---------- */
.bubble {
  position: fixed; left: 0; top: 0; z-index: 15; pointer-events: none;
  max-width: min(240px, 56vw); padding: 10px 15px; border-radius: 20px 20px 20px 6px;
  font-size: 15px; font-weight: 800; line-height: 1.25; color: #10142e;
  background: linear-gradient(180deg, #ffffff, #e9ecff);
  box-shadow: 0 12px 30px rgba(3, 5, 25, 0.45), 0 0 0 3px rgba(167, 139, 250, 0.35);
  opacity: 0; transform: translate3d(var(--bx, 0px), var(--by, 0px), 0) scale(0.6);
  transform-origin: 0% 100%;
  transition: opacity 0.2s, transform 0.08s linear;
  will-change: transform;
}
.bubble.show { opacity: 1; transform: translate3d(var(--bx, 0px), var(--by, 0px), 0) scale(1); transition: opacity 0.2s, transform 0.3s var(--ease-pop); }
.bubble.show.track { transition: opacity 0.2s, transform 0.06s linear; }
.bubble::after {
  content: ''; position: absolute; left: -7px; bottom: 2px; width: 16px; height: 16px;
  background: #eef0ff; clip-path: polygon(100% 0, 0 100%, 100% 70%);
}
.bubble.flip { border-radius: 20px 20px 6px 20px; transform-origin: 100% 100%; }
.bubble.flip::after { left: auto; right: -7px; clip-path: polygon(0 0, 100% 100%, 0 70%); }

/* =====================================================================
   Dock
   ===================================================================== */
.dock {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(8px + var(--sab));
  width: min(calc(100vw - 2 * var(--gut) - var(--sal) - var(--sar)), 640px);
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.action-strip {
  display: flex; gap: 6px; padding: 6px; border-radius: 22px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 18px), transparent 100%);
}
.action-strip::-webkit-scrollbar { display: none; }
.act {
  --accent: var(--cyan);
  flex: 0 0 auto; scroll-snap-align: start;
  width: 60px; height: 60px; border-radius: 17px; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, transparent), rgba(255,255,255,0.02));
  transition: transform 0.18s var(--ease-pop), border-color 0.2s, background 0.2s;
}
.act .e { font-family: var(--emoji); font-size: 25px; line-height: 1; transition: transform 0.25s var(--ease-pop); }
.act .l { font-size: 10.5px; font-weight: 800; color: var(--ink-2); letter-spacing: 0.01em; }
.act:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.act:hover .e { transform: scale(1.15) rotate(-6deg); }
.act:active { transform: scale(0.88); }
.act.fired { animation: actFire 0.5s var(--ease-pop); border-color: var(--accent); }

.dock-main {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  height: 84px; padding: 0 12px; border-radius: 28px;
}
.side-btn {
  height: 56px; border-radius: 19px; cursor: pointer; padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 900; letter-spacing: -0.005em;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.06);
  transition: transform 0.18s var(--ease-pop), border-color 0.2s, background 0.2s;
}
.side-btn svg { width: 24px; height: 24px; flex: none; }
.side-btn:hover { border-color: rgba(255, 255, 255, 0.28); background: rgba(255,255,255,0.1); }
.side-btn:active { transform: scale(0.92); }
.side-btn[aria-expanded='true'] { border-color: var(--cyan); color: var(--cyan); }
.play-btn {
  color: #3b0a2a; border: 0;
  background: linear-gradient(110deg, var(--amber), #fb923c 40%, var(--pink));
  box-shadow: 0 10px 26px rgba(244, 114, 182, 0.42), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  position: relative; overflow: hidden;
}
.play-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.55) 50%, transparent 65%);
  transform: translateX(-120%); animation: sheen 3.6s ease-in-out infinite;
}
.play-btn:hover { background: linear-gradient(110deg, #fcd34d, #fb923c 40%, #f9a8d4); }

/* ---------- mic ---------- */
.mic-wrap { position: relative; width: 92px; height: 92px; margin-top: -40px; display: grid; place-items: center; }
.mic-viz { position: absolute; width: 168px; height: 168px; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.mic-btn {
  --c1: var(--cyan); --c2: var(--violet); --c3: var(--pink);
  position: relative; width: 92px; height: 92px; border-radius: 50%; cursor: pointer; padding: 0;
  display: grid; place-items: center; color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 32% 26%, rgba(255,255,255,0.55), transparent 42%), linear-gradient(145deg, var(--c1), var(--c2) 55%, var(--c3));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--c2) 55%, transparent), 0 0 0 6px rgba(7, 10, 26, 0.6), inset 0 -6px 14px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s var(--ease-pop), box-shadow 0.3s, background 0.3s;
  touch-action: none; -webkit-touch-callout: none;
}
.mic-btn::before {
  content: ''; position: absolute; inset: -12px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--c1) 70%, transparent);
  opacity: 0; pointer-events: none;
}
.mic-btn svg { width: 38px; height: 38px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25)); transition: transform 0.25s var(--ease-pop), opacity 0.2s; }
.mic-btn .talk-glyph { position: absolute; opacity: 0; transform: scale(0.4); }
.mic-btn:hover { transform: translateY(-2px) scale(1.04); }
.mic-btn:active, .mic-btn.pressing { transform: scale(0.92); }
.mic-btn[data-state='idle'] { animation: micBreath 3.2s ease-in-out infinite; }
.mic-btn[data-state='listening'] { --c1: #a3e635; --c2: #22c55e; --c3: #22d3ee; }
.mic-btn[data-state='listening']::before { animation: ringOut 1.6s ease-out infinite; opacity: 1; }
.mic-btn[data-state='hearing'] { --c1: #fb7185; --c2: #f472b6; --c3: #f59e0b; transform: scale(1.08); }
.mic-btn[data-state='hearing']::before { border-color: rgba(244, 114, 182, 0.8); animation: ringOut 0.8s ease-out infinite; opacity: 1; }
.mic-btn[data-state='talking'] { --c1: #22d3ee; --c2: #6366f1; --c3: #a78bfa; }
.mic-btn[data-state='talking'] .mic-glyph { opacity: 0; transform: scale(0.4); }
.mic-btn[data-state='talking'] .talk-glyph { opacity: 1; transform: scale(1); animation: eqBounce 0.5s ease-in-out infinite alternate; }

.mic-hint {
  align-self: center; margin-top: -2px; padding: 3px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.01em; color: var(--ink-2);
  background: rgba(7, 10, 26, 0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: color 0.2s;
}
.mic-hint[data-state='listening'] { color: var(--lime); }
.mic-hint[data-state='hearing'] { color: var(--pink); }
.mic-hint[data-state='talking'] { color: var(--cyan); }

/* =====================================================================
   Sheets
   ===================================================================== */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(3, 4, 16, 0.5);
  opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.scrim.show { opacity: 1; visibility: visible; }

.sheet {
  position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
  max-height: min(78vh, 720px); overflow-y: auto; overscroll-behavior: contain;
  padding: 10px calc(18px + var(--sar)) calc(20px + var(--sab)) calc(18px + var(--sal));
  border-radius: 30px 30px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.01) 120px), var(--glass-strong);
  border: 1px solid var(--glass-line); border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
  transform: translateY(105%); visibility: hidden;
  transition: transform 0.42s var(--ease-out), visibility 0.42s;
  scrollbar-width: thin;
}
.sheet.open { transform: translateY(0); visibility: visible; }
.sheet-grip { width: 44px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.sheet-head > div:first-child { flex: 1; min-width: 0; }
.sheet-title { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -0.02em; }
.sheet-sub { margin: 3px 0 0; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.sheet-close {
  flex: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--glass-line); background: rgba(255,255,255,0.06);
  font-size: 22px; line-height: 1; display: grid; place-items: center;
  transition: transform 0.18s var(--ease-pop), background 0.2s;
}
.sheet-close:hover { background: rgba(255,255,255,0.14); }
.sheet-close:active { transform: scale(0.88); }

/* chat */
.phrases { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.phrase {
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.05);
  font-size: 14px; font-weight: 700; transition: transform 0.15s var(--ease-pop), border-color 0.2s, background 0.2s;
}
.phrase:hover { border-color: rgba(34, 211, 238, 0.6); background: rgba(34, 211, 238, 0.12); }
.phrase:active { transform: scale(0.93); }
.tts-form { display: flex; gap: 10px; }
.tts-input {
  flex: 1; min-width: 0; height: 54px; padding: 0 18px; border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(3, 5, 20, 0.6);
  color: var(--ink); font-family: inherit; font-size: 16px; font-weight: 600; outline: none;
  user-select: text; -webkit-user-select: text;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tts-input::placeholder { color: #6b7699; }
.tts-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.15); }
.tts-send {
  flex: none; width: 54px; height: 54px; border: 0; border-radius: 18px; cursor: pointer;
  display: grid; place-items: center; color: #071019;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 10px 24px rgba(34, 211, 238, 0.35); transition: transform 0.15s var(--ease-pop);
}
.tts-send svg { width: 22px; height: 22px; }
.tts-send:active { transform: scale(0.9); }

/* voices */
.voice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.voice-card {
  --accent: var(--cyan);
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 14px; border-radius: 20px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 18%, transparent), rgba(255,255,255,0.03));
  transition: transform 0.18s var(--ease-pop), border-color 0.2s, box-shadow 0.2s;
}
.voice-card:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.voice-card:active { transform: scale(0.95); }
.voice-card[aria-checked='true'] { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent), 0 10px 28px color-mix(in srgb, var(--accent) 25%, transparent); }
.voice-card[aria-checked='true']::after {
  content: '✓'; position: absolute; top: 8px; right: 10px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 900; color: #071019; background: var(--accent);
}
.voice-card .ve { font-family: var(--emoji); font-size: 34px; line-height: 1; flex: none; }
.voice-card b { display: block; font-size: 15.5px; font-weight: 900; }
.voice-card small { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.voice-card .st { display: inline-block; margin-top: 5px; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 800; color: var(--accent); background: rgba(0, 0, 0, 0.3); }

/* games hub */
.hub-wallet {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 8px; border-radius: 999px;
  font-size: 15px; font-weight: 900; background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.35);
}
.game-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.game-card {
  --g1: #22d3ee; --g2: #6366f1;
  position: relative; display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center;
  padding: 12px; border-radius: 24px; cursor: pointer; text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04);
  transition: transform 0.2s var(--ease-pop), border-color 0.2s, box-shadow 0.2s;
}
.game-card:hover:not(.soon) { border-color: color-mix(in srgb, var(--g1) 70%, transparent); box-shadow: 0 14px 36px color-mix(in srgb, var(--g2) 30%, transparent); }
.game-card:active:not(.soon) { transform: scale(0.97); }
.game-art {
  position: relative; height: 104px; border-radius: 18px; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--g1), var(--g2));
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), inset 0 -10px 24px rgba(0,0,0,0.25);
}
.game-art::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.45) 0 6%, transparent 7%),
    radial-gradient(circle at 82% 28%, rgba(255,255,255,0.3) 0 4%, transparent 5%),
    repeating-linear-gradient(115deg, rgba(255,255,255,0.09) 0 8px, transparent 8px 18px);
}
.game-art .ge { position: relative; font-family: var(--emoji); font-size: 54px; line-height: 1; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.35)); animation: artBob 2.6s ease-in-out infinite; }
.game-card:nth-child(2) .ge { animation-delay: -0.8s; }
.game-card:nth-child(3) .ge { animation-delay: -1.6s; }
.game-info { min-width: 0; }
.game-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; color: var(--g1); background: color-mix(in srgb, var(--g1) 14%, transparent); }
.game-info h3 { margin: 6px 0 3px; font-size: 19px; font-weight: 900; letter-spacing: -0.015em; }
.game-info p { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.35; color: var(--ink-2); }
.game-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.game-best { font-size: 12.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.game-best b { color: var(--amber); font-variant-numeric: tabular-nums; }
.game-go {
  padding: 7px 14px; border-radius: 12px; font-size: 13px; font-weight: 900; color: #0b0720;
  background: linear-gradient(120deg, var(--g1), var(--g2)); white-space: nowrap;
}
.game-card.soon { cursor: default; opacity: 0.72; }
.game-card.soon .game-art { filter: grayscale(0.55) brightness(0.8); }
.game-card.soon .game-go { background: rgba(255,255,255,0.1); color: var(--muted); }
.game-card.loading .game-go { opacity: 0.6; }
.g-runner { --g1: #22d3ee; --g2: #6366f1; }
.g-catch { --g1: #fbbf24; --g2: #f43f5e; }
.g-copyme { --g1: #a3e635; --g2: #db2777; }

/* settings */
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.toggle-row {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 14px; border-radius: 18px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.04);
}
.toggle-row span b { display: block; font-size: 15px; font-weight: 800; }
.toggle-row span small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row i {
  flex: none; position: relative; width: 50px; height: 30px; border-radius: 15px;
  background: rgba(255, 255, 255, 0.14); transition: background 0.25s;
}
.toggle-row i::after {
  content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.35); transition: transform 0.25s var(--ease-pop);
}
.toggle-row input:checked + i { background: linear-gradient(120deg, var(--cyan), var(--violet)); }
.toggle-row input:checked + i::after { transform: translateX(20px); }
.toggle-row:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }
.settings-h { margin: 18px 0 8px; font-size: 13px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 6px; text-align: center;
  font-family: inherit; font-size: 11.5px; font-weight: 900; color: var(--ink);
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); border-bottom-width: 2px;
}

/* game layer */
.game-layer { position: fixed; inset: 0; z-index: 50; }
body.in-game .hud-top, body.in-game .dock, body.in-game .side-rail, body.in-game:not(.stage-game) .bubble { opacity: 0; visibility: hidden; pointer-events: none; }
body.in-game.stage-game .hud-top { opacity: 1; visibility: visible; }
body.in-game.stage-game .hud-top > :not(.status-pill) { visibility: hidden; pointer-events: none; }
body.in-game.stage-game .game-layer { pointer-events: none; }
body.in-game.stage-game .game-layer > * { pointer-events: auto; }
.hud-top, .dock, .side-rail { transition: opacity 0.35s, visibility 0.35s, transform 0.5s var(--ease-out); }

/* boot / reveal choreography */
body.booting .hud-top { opacity: 0; transform: translateY(-24px); }
body.booting .dock { opacity: 0; transform: translate(-50%, 40px); }
body.booting .side-rail { opacity: 0; transform: translate(30px, -62%); }
body.booting .hud-top, body.booting .dock, body.booting .side-rail { pointer-events: none; }
body.booting .hud-top > *, body.booting .dock > * { pointer-events: none; }

/* =====================================================================
   Desktop / wide
   ===================================================================== */
@media (min-width: 760px) {
  :root { --gut: 20px; }
  .hud-top { top: calc(16px + var(--sat)); grid-template-columns: 1fr auto 1fr; grid-template-areas: 'brand status right'; }
  .brand { justify-self: start; }
  .toasts { top: calc(78px + var(--sat)); }
  .dock { bottom: calc(14px + var(--sab)); }
  .action-strip { justify-content: center; }
  .act { width: 64px; height: 64px; }
  .dock-main { height: 88px; padding: 0 16px; }
  .side-btn { height: 58px; padding: 0 20px; }
  .side-rail { transform: translateY(-50%); }
  body.booting .side-rail { transform: translate(30px, -50%); }

  .sheet {
    left: 50%; right: auto; bottom: 50%; width: min(560px, calc(100vw - 40px));
    border-radius: 30px; border-bottom: 1px solid var(--glass-line);
    padding: 22px 24px 24px;
    transform: translate(-50%, 54%) scale(0.96); opacity: 0;
    transition: transform 0.4s var(--ease-pop), opacity 0.25s, visibility 0.4s;
    max-height: min(84vh, 760px);
  }
  .sheet.open { transform: translate(-50%, 50%) scale(1); opacity: 1; }
  .sheet-wide { width: min(880px, calc(100vw - 40px)); }
  .sheet-grip { display: none; }
  .game-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .game-card { grid-template-columns: 1fr; align-items: stretch; padding: 12px 12px 16px; }
  .game-art { height: 150px; }
  .game-art .ge { font-size: 72px; }
  .game-info { padding: 2px 4px 0; }
  .voice-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 370px) {
  .brand-name { display: none; }
  .brand { padding-right: 5px; }
  .side-btn span { display: none; }
}
@media (max-width: 759px) {
  .brand-name { font-size: 14px; }
  .icon-btn, .wallet-chip, .brand { height: 40px; }
  .icon-btn { width: 40px; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .brand { padding-right: 5px; }
}
@media (max-height: 640px) and (max-width: 759px) {
  .act { width: 52px; height: 52px; }
  .act .l { display: none; }
  .dock-main { height: 74px; }
  .mic-wrap, .mic-btn { width: 80px; height: 80px; }
}

/* =====================================================================
   Motion
   ===================================================================== */
@keyframes blobFloat { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vmax, 4vmax) scale(1.12); } }
@keyframes gridRun { from { background-position: 0 0; } to { background-position: 0 56px; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes logoBob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes startPulse { 0%, 100% { box-shadow: 0 14px 34px rgba(244, 114, 182, 0.45), inset 0 2px 0 rgba(255,255,255,0.5); } 50% { box-shadow: 0 14px 50px rgba(251, 191, 36, 0.7), inset 0 2px 0 rgba(255,255,255,0.5); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes pillBump { 0% { transform: scale(1); } 40% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes dotPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.45); } }
@keyframes walletPop { 0% { transform: scale(1); } 30% { transform: scale(1.25) rotate(-4deg); } 60% { transform: scale(0.95); } 100% { transform: scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px) scale(0.95); } }
@keyframes actFire { 0% { transform: scale(1); } 35% { transform: scale(1.15) rotate(-4deg); } 100% { transform: scale(1); } }
@keyframes sheen { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes micBreath { 0%, 100% { box-shadow: 0 14px 34px rgba(167, 139, 250, 0.5), 0 0 0 6px rgba(7, 10, 26, 0.6), inset 0 -6px 14px rgba(0,0,0,0.18); } 50% { box-shadow: 0 14px 44px rgba(34, 211, 238, 0.6), 0 0 0 6px rgba(7, 10, 26, 0.6), inset 0 -6px 14px rgba(0,0,0,0.18); } }
@keyframes ringOut { from { transform: scale(0.92); opacity: 0.9; } to { transform: scale(1.35); opacity: 0; } }
@keyframes eqBounce { from { transform: scaleY(0.8); } to { transform: scaleY(1.12); } }
@keyframes artBob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-7px) rotate(4deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.12s !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.12s !important;
}
