:root {
  --bg-ink: #07090f;
  --glass: rgba(14, 17, 25, 0.68);
  --glass-strong: rgba(15, 18, 27, 0.90);
  --border: rgba(235, 186, 120, 0.20);
  --text: #f3eadc;
  --text-dim: rgba(243, 234, 220, 0.56);
  --amber: #e8a856;
  --ember: #ff5d2a;
  --vermilion: #c93b2b;
  --jade: #6fb5a4;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-ink);
  color: var(--text);
  font-family: var(--font-sans);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.film-grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: radial-gradient(rgba(255, 240, 215, 0.65) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
}

.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, transparent 46%, rgba(4, 6, 11, 0.72) 100%);
}

/* Zen mode fade */
.ui-fade {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

body.zen-mode .ui-fade {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* ========================
   TOP HUD (iOS Safe-Area)
   ======================== */
.hud-top {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
}

.hud-top > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.seal {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #cf3f2d, #8d2116);
  border: 1px solid rgba(255, 224, 196, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 13px;
  color: #fdebd6;
  box-shadow: 0 4px 14px rgba(201, 59, 43, 0.35);
}

.brand-meta {
  min-width: 0;
}

.brand-meta h1 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1.15;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
}

.brand-meta p {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ember-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: all 0.25s ease;
}

.ember-dot.lit {
  background: var(--ember);
  box-shadow: 0 0 8px var(--ember);
}

.icon-pill {
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.2s ease, background 0.2s ease;
}

.icon-pill:active {
  transform: scale(0.94);
}

.icon-pill.active {
  border-color: var(--amber);
  background: rgba(232, 168, 86, 0.22);
}

.zen-char {
  font-family: var(--font-serif);
  font-weight: 700;
  padding: 0 10px;
}

.mini-vinyl {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #d1402d 0 3px, #111 4px 7px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.mini-vinyl.spinning {
  animation: spin 2.8s linear infinite;
}

/* Mini-Game Floating Score Pill */
.game-hud {
  position: fixed;
  top: calc(56px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(18, 22, 34, 0.78);
  border: 1px solid rgba(244, 178, 86, 0.45);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  font-size: 11px;
  color: var(--text);
  z-index: 19;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.game-hud.hidden {
  display: none;
}

.game-badge {
  color: var(--amber);
  font-weight: 600;
  letter-spacing: 0.6px;
}

.g-sep {
  opacity: 0.35;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========================
   DRAG DEPTH METER
   ======================== */
.drag-hud {
  position: fixed;
  left: 50%;
  bottom: calc(168px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 18;
}

.drag-hud.visible {
  opacity: 1;
}

.drag-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: #ffd59e;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.drag-track {
  width: 148px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.drag-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #e8a856, #ff5d2a, #fff2cc);
}

/* ========================
   BOTTOM THUMB DOCK
   ======================== */
.hud-bottom {
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(94vw, 430px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 20;
}

body.zen-mode .hud-bottom {
  transform: translateX(-50%) translateY(16px);
}

.quick-pills {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}

.sub-pill .dot-ind {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}

.sub-pill.active {
  border-color: var(--jade);
  background: rgba(111, 181, 164, 0.18);
  color: #dff8f1;
}

.sub-pill.active .dot-ind {
  background: var(--jade);
  box-shadow: 0 0 8px var(--jade);
}

.pose-mini {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.pose-tab {
  padding: 4px 11px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.pose-tab.active {
  background: rgba(232, 168, 86, 0.28);
  color: #fff2dc;
  font-weight: 600;
}

.thumb-dock {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1.45fr 1fr 1fr;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.dock-btn {
  height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}

.dock-btn:active:not(:disabled) {
  transform: scale(0.93);
}

.dock-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.dock-btn.warm {
  background: linear-gradient(145deg, rgba(232, 168, 86, 0.26), rgba(201, 59, 43, 0.25));
  border-color: rgba(232, 168, 86, 0.55);
}

.dock-ico {
  font-size: 16px;
  line-height: 1;
}

.dock-txt {
  font-size: 10px;
  color: var(--text-dim);
}

/* Central Hero Hold-to-Inhale Button */
.dock-btn.main-hold {
  height: 58px;
  border-radius: 18px;
  position: relative;
  background: linear-gradient(145deg, rgba(255, 96, 44, 0.34), rgba(190, 48, 30, 0.42));
  border: 1px solid rgba(255, 134, 86, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.dock-btn.main-hold.pressed {
  transform: scale(0.95);
  background: linear-gradient(145deg, rgba(255, 118, 56, 0.62), rgba(215, 58, 36, 0.65));
  box-shadow: 0 0 22px rgba(255, 93, 42, 0.55);
}

.dock-txt-main {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #fff4e4;
}

.gesture-hint {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.4px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

/* ========================
   iOS SLIDE-UP BOTTOM SHEET
   ======================== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 10, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 30;
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 104%);
  width: min(100vw, 480px);
  max-height: 78dvh;
  border-radius: 24px 24px 0 0;
  background: var(--glass-strong);
  border-top: 1px solid rgba(235, 186, 120, 0.3);
  -webkit-backdrop-filter: blur(26px);
  backdrop-filter: blur(26px);
  padding: 0 16px calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  z-index: 35;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-sheet.open {
  transform: translate(-50%, 0%);
}

.sheet-handle-wrap {
  padding: 12px 0 10px;
  display: flex;
  justify-content: center;
  cursor: pointer;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

.sheet-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 6px;
}

.sheet-card {
  padding: 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--amber);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vinyl-lg {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle, #c93b2b 0 8px, #111 9px 10px, #1d1f26 11px 15px, #12141a 16px 19px, #21242d 20px 23px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vinyl-lg.spinning {
  animation: spin 3.2s linear infinite;
}

.vinyl-hole {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f5e6cc;
}

.track-meta {
  flex: 1;
  min-width: 0;
}

.track-title {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.play-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(232, 168, 86, 0.6);
  background: rgba(232, 168, 86, 0.2);
  color: #ffefd6;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.seg-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.seg-btn {
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.seg-btn.active {
  background: rgba(232, 168, 86, 0.22);
  border-color: var(--amber);
  color: #fff3df;
  font-weight: 600;
}

.mixer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 14px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.mix-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}

.mix-item input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
  cursor: pointer;
}

/* Zen Exit Button */
.zen-exit {
  position: fixed;
  top: calc(14px + var(--safe-top));
  right: 14px;
  z-index: 30;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(14, 17, 25, 0.52);
  border: 1px solid rgba(232, 168, 86, 0.35);
  color: var(--text);
  font-size: 12px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.zen-exit.hidden {
  display: none;
}
