/* ==========================================================================
   CozyMove Design System & Animations
   Art Bible Tokens: Cocoa Ink (#4A3728), Oat Cream (#FDF8F0), Terracotta (#E2856E),
   Sage Leaf (#95B196), Sunbeam Honey (#F4C878), Mist Sky (#94B9CF)
   ========================================================================== */

:root {
  --ink: #4A3728;
  --ink-soft: #8A6E58;
  --cream: #FDF8F0;
  --cream-glass: rgba(253, 248, 240, 0.88);
  --cream-solid: #FFFBF4;
  --border-cocoa: rgba(74, 55, 40, 0.16);
  --border-strong: rgba(74, 55, 40, 0.3);
  --coral: #E2856E;
  --coral-hover: #D4735B;
  --sage: #95B196;
  --sage-dark: #759677;
  --honey: #F4C878;
  --sky: #94B9CF;
  --shadow-warm: 0 12px 32px rgba(74, 55, 40, 0.14);
  --shadow-soft: 0 6px 18px rgba(74, 55, 40, 0.1);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --jog-cycle: 0.666s; /* Synced dynamically to BPM (180 BPM = 0.666s per full L/R cycle) */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: #EDE0CE;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

h1, h2, h3, .font-display, .timer-digits {
  font-family: 'Fredoka', 'Nunito', sans-serif;
}

.timer-digits {
  font-variant-numeric: tabular-nums;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

/* ---- App Shell ---- */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  background: radial-gradient(circle at top, #F6E9D7 0%, #E7D5BE 100%);
  position: relative;
  padding-top: env(safe-area-inset-top, 0px);
}

/* ---- Top Cozy Header ---- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--cream-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 2px solid var(--border-cocoa);
  z-index: 40;
  flex-shrink: 0;
  min-width: 0;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--ink);
  box-shadow: 0 3px 0 rgba(74, 55, 40, 0.2);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.scene-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(74, 55, 40, 0.06);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-cocoa);
}

.pill-btn {
  border: none;
  background: transparent;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pill-btn:hover {
  color: var(--ink);
  background: rgba(253, 248, 240, 0.65);
}

.pill-btn.active {
  background: var(--cream-solid);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(74, 55, 40, 0.12);
}

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

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #FFF3D4, #FDE3A7);
  border: 2px solid var(--border-cocoa);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.coin-pill:hover {
  transform: translateY(-1px);
}

.cozy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-cocoa);
  background: var(--cream-solid);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.16s ease;
  box-shadow: 0 2px 0 rgba(74, 55, 40, 0.08);
}

.cozy-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: 0 4px 10px rgba(74, 55, 40, 0.1);
}

.cozy-btn:active {
  transform: translateY(0);
}

.cozy-btn.primary {
  background: var(--coral);
  color: #FFFDF9;
  border-color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}

.cozy-btn.primary:hover {
  background: var(--coral-hover);
}

.cozy-btn.sage {
  background: var(--sage);
  color: #FFFDF9;
  border-color: var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}

.cozy-btn.sage:hover {
  background: var(--sage-dark);
}

/* ---- Main Workspace Split Layout ---- */
.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* ---- Left / Main Virtual Town Stage ---- */
.stage-wrapper {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px 86px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.stage-frame {
  position: relative;
  /* Strictly preserve 16:9 aspect ratio so avatar mat coordinates never drift */
  width: min(100%, calc((100dvh - 168px) * 16 / 9), 1180px);
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  overflow: hidden;
  border: 3px solid var(--ink);
  box-shadow: 0 18px 46px rgba(74, 55, 40, 0.22);
  background: #E8D5BE;
  user-select: none;
  flex-shrink: 0;
}

/* Smooth Pixel-Aligned Lighting Cross-fade Layers */
.scene-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.1s ease-in-out;
  pointer-events: none;
}

.scene-layer.visible {
  opacity: 1;
}

/* Floating Stage Overlays (Top-Left Lighting + Top-Right Room Pill) */
.stage-hud-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 25;
}

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

.lighting-pills {
  display: inline-flex;
  gap: 4px;
  background: var(--cream-glass);
  backdrop-filter: blur(10px);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-cocoa);
  box-shadow: var(--shadow-soft);
}

.lighting-pills.hidden {
  display: none;
}

.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--cream-glass);
  backdrop-filter: blur(10px);
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-cocoa);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #6EBB79;
  box-shadow: 0 0 0 3px rgba(110, 187, 121, 0.28);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.22); opacity: 0.75; }
}

/* Sakura Falling Petals Layer */
.petals-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 22;
  overflow: hidden;
  display: none;
}

.petals-layer.active {
  display: block;
}

.petal {
  position: absolute;
  top: -12px;
  width: 11px;
  height: 8px;
  background: #F8C5D0;
  border: 1px solid rgba(74, 55, 40, 0.25);
  border-radius: 60% 40% 60% 40%;
  opacity: 0.85;
  animation: fallPetal linear infinite;
}

@keyframes fallPetal {
  0% {
    transform: translate3d(0, -10px, 0) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.88; }
  90% { opacity: 0.82; }
  100% {
    transform: translate3d(90px, 640px, 0) rotate(320deg);
    opacity: 0;
  }
}

/* ---- Avatars on Stage ---- */
.avatars-layer {
  position: absolute;
  inset: 0;
  z-index: 15;
}

.avatar-actor {
  position: absolute;
  transform: translate(-50%, -84%);
  width: clamp(44px, 9.5%, 114px);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: left 0.6s ease, top 0.6s ease, transform 0.2s ease;
}

.avatar-actor:hover {
  z-index: 95 !important;
}

.avatar-actor:hover .avatar-nametag {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--ink);
}

.avatar-nametag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(253, 248, 240, 0.94);
  border: 1.8px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(74, 55, 40, 0.14);
  margin-bottom: -4px;
  transition: all 0.18s ease;
  z-index: 4;
}

.avatar-nametag.is-self {
  background: linear-gradient(135deg, #FFF5DC, #FBE2A4);
  border-color: var(--ink);
}

.npc-tag {
  font-size: 0.62rem;
  background: rgba(149, 177, 150, 0.25);
  color: #4D6A4E;
  padding: 0 5px;
  border-radius: 8px;
  font-weight: 800;
}

.avatar-figure-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.cm-avatar-svg {
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 4px 4px rgba(74, 55, 40, 0.12));
}

.cm-pet-wrap {
  position: absolute;
  right: -28%;
  bottom: 4%;
  width: 56%;
  pointer-events: none;
}

.cm-pet-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* ---- SVG Workout Animations ---- */

/* 1. Slow Jogging (Synced to 180 BPM!) */
.is-moving .cm-pose-slow_jog .cm-avatar-rig {
  animation: jogBounce calc(var(--jog-cycle) / 2) ease-in-out infinite alternate;
  transform-origin: 60px 124px;
}

.is-moving .cm-pose-slow_jog .cm-shadow {
  animation: shadowPulse calc(var(--jog-cycle) / 2) ease-in-out infinite alternate;
  transform-origin: 60px 126px;
}

.is-moving .cm-pose-slow_jog .cm-jog-leg-front {
  animation: legSwingF var(--jog-cycle) ease-in-out infinite;
  transform-origin: 67px 102px;
}

.is-moving .cm-pose-slow_jog .cm-jog-leg-back {
  animation: legSwingB var(--jog-cycle) ease-in-out infinite;
  transform-origin: 52px 102px;
}

.is-moving .cm-pose-slow_jog .cm-jog-arm-front {
  animation: armSwingF var(--jog-cycle) ease-in-out infinite;
  transform-origin: 76px 80px;
}

.is-moving .cm-pose-slow_jog .cm-jog-arm-back {
  animation: armSwingB var(--jog-cycle) ease-in-out infinite;
  transform-origin: 44px 80px;
}

@keyframes jogBounce {
  0% { transform: translateY(0px) scaleY(0.97); }
  100% { transform: translateY(-6px) scaleY(1.02); }
}

@keyframes shadowPulse {
  0% { transform: scale(1.05); opacity: 0.22; }
  100% { transform: scale(0.86); opacity: 0.13; }
}

@keyframes legSwingF {
  0%, 100% { transform: rotate(-10deg); }
  50% { transform: rotate(12deg); }
}

@keyframes legSwingB {
  0%, 100% { transform: rotate(12deg); }
  50% { transform: rotate(-10deg); }
}

@keyframes armSwingF {
  0%, 100% { transform: rotate(10deg); }
  50% { transform: rotate(-14deg); }
}

@keyframes armSwingB {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}

/* 2. HIIT Jumping Jack */
.is-moving .cm-pose-hiit_jump .cm-avatar-rig {
  animation: hiitHop 0.72s ease-in-out infinite;
  transform-origin: 60px 124px;
}

.is-moving .cm-pose-hiit_jump .cm-arm-hiit-l {
  animation: armHiitL 0.72s ease-in-out infinite;
  transform-origin: 43px 80px;
}

.is-moving .cm-pose-hiit_jump .cm-arm-hiit-r {
  animation: armHiitR 0.72s ease-in-out infinite;
  transform-origin: 77px 80px;
}

@keyframes hiitHop {
  0%, 100% { transform: translateY(0px) scaleY(0.96); }
  45% { transform: translateY(-10px) scaleY(1.03); }
}

@keyframes armHiitL {
  0%, 100% { transform: rotate(-42deg); }
  45% { transform: rotate(12deg); }
}

@keyframes armHiitR {
  0%, 100% { transform: rotate(42deg); }
  45% { transform: rotate(-12deg); }
}

/* 3. Yoga Calm Breathing */
.is-moving .cm-pose-yoga_calm .cm-avatar-rig {
  animation: yogaBreathe 4.2s ease-in-out infinite;
  transform-origin: 60px 116px;
}

.is-moving .cm-pose-yoga_calm .cm-breath-ring {
  animation: auraPulse 4.2s ease-in-out infinite;
  transform-origin: 60px 86px;
}

@keyframes yogaBreathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.02, 1.04) translateY(-2px); }
}

@keyframes auraPulse {
  0%, 100% { transform: scale(0.88); opacity: 0.1; }
  50% { transform: scale(1.16); opacity: 0.26; }
}

/* 4. Rest & Hydrate Sip */
.is-moving .cm-pose-rest_water .cm-sip-arm {
  animation: sipWater 2.8s ease-in-out infinite;
  transform-origin: 44px 80px;
}

@keyframes sipWater {
  0%, 100% { transform: rotate(0deg); }
  45% { transform: rotate(14deg) translateY(-2px); }
}

/* Pet Idle & Companion Bounce */
.is-moving .cm-pet-shiba {
  animation: petTrot 0.55s ease-in-out infinite alternate;
  transform-origin: 36px 56px;
}

.is-moving .cm-pet-calico {
  animation: yogaBreathe 3.8s ease-in-out infinite;
  transform-origin: 36px 56px;
}

.is-moving .cm-pet-capy {
  animation: yogaBreathe 4.8s ease-in-out infinite;
  transform-origin: 36px 56px;
}

@keyframes petTrot {
  0% { transform: translateY(0px) rotate(-2deg); }
  100% { transform: translateY(-4px) rotate(2deg); }
}

/* ---- Cheer Popover & Floating Emote Bubbles ---- */
.cheer-popover {
  position: absolute;
  bottom: 104%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  background: var(--cream-solid);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 5px 7px;
  box-shadow: var(--shadow-warm);
  z-index: 120;
  animation: popIn 0.16s ease-out;
}

.cheer-popover.flip-below {
  bottom: auto;
  top: 26px;
}

.cheer-popover button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  background: rgba(74, 55, 40, 0.06);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease;
}

.cheer-popover button:hover {
  transform: scale(1.18);
  background: #FDE5AE;
  border-color: var(--ink);
}

.cheer-float {
  position: absolute;
  bottom: 92%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cream-solid);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  z-index: 130;
  animation: floatUpFade 2.1s ease-out forwards;
}

@keyframes floatUpFade {
  0% { transform: translate(-50%, 6px) scale(0.7); opacity: 0; }
  16% { transform: translate(-50%, -8px) scale(1.06); opacity: 1; }
  80% { transform: translate(-50%, -32px) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -48px) scale(0.95); opacity: 0; }
}

@keyframes popIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.85); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ---- Right Split-Screen Panel (Follow-Along Theater, Timer, Ambience) ---- */
.side-panel {
  width: 390px;
  background: var(--cream-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-left: 2px solid var(--border-cocoa);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transition: width 0.28s ease, transform 0.28s ease;
  flex-shrink: 0;
}

.side-panel.collapsed {
  width: 0;
  border-left-width: 0;
  overflow: hidden;
}

.panel-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 12px 14px 10px;
  border-bottom: 1.5px solid var(--border-cocoa);
}

.panel-tab {
  border: 1.5px solid transparent;
  background: rgba(74, 55, 40, 0.05);
  border-radius: 14px;
  padding: 8px 6px;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.16s ease;
}

.panel-tab.active {
  background: var(--cream-solid);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 96px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-pane.active {
  display: flex;
}

/* Cozy Cards inside Panel */
.cozy-card {
  background: var(--cream-solid);
  border: 2px solid var(--border-cocoa);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  box-shadow: 0 4px 12px rgba(74, 55, 40, 0.06);
}

.card-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-hint {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* YouTube Follow-Along Theater */
.url-row {
  display: flex;
  gap: 6px;
}

.cozy-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--border-cocoa);
  background: #FFFDF9;
  font-size: 0.82rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease;
}

.cozy-input:focus {
  border-color: var(--coral);
}

.video-shell {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #2D241E;
  position: relative;
}

.video-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  background: linear-gradient(145deg, #F6E6D4, #EAD4BC);
  color: var(--ink);
  gap: 6px;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 13px;
  border: 1.5px solid var(--border-cocoa);
  background: #FFFDF8;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.preset-item:hover {
  border-color: var(--coral);
  transform: translateX(2px);
}

.preset-item.active {
  background: #FFF2E8;
  border-color: var(--coral);
}

.preset-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preset-title {
  font-size: 0.82rem;
  font-weight: 800;
}

.preset-sub {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.preset-dur {
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(149, 177, 150, 0.24);
  color: #466647;
  padding: 3px 8px;
  border-radius: 99px;
}

/* Metronome & HIIT Controls */
.bpm-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bpm-big {
  font-size: 2rem;
  font-weight: 700;
  color: var(--coral);
  line-height: 1;
}

.beat-dots {
  display: flex;
  gap: 8px;
}

.beat-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(74, 55, 40, 0.14);
  border: 1.5px solid var(--border-cocoa);
  transition: transform 0.08s ease, background 0.08s ease;
}

.beat-dot.lit {
  background: var(--coral);
  border-color: var(--ink);
  transform: scale(1.28);
}

.beat-dot.lit.accent {
  background: var(--honey);
}

.range-slider {
  width: 100%;
  accent-color: var(--coral);
  cursor: pointer;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.mini-chip {
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-cocoa);
  background: #FFFDF8;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.14s ease;
}

.mini-chip.active {
  background: var(--sage);
  color: #FFFDF9;
  border-color: var(--ink);
}

.hiit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.hiit-field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.hiit-status-banner {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(149, 177, 150, 0.2);
  border: 1.5px solid var(--sage);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.86rem;
}

.hiit-status-banner.rest {
  background: rgba(148, 185, 207, 0.22);
  border-color: var(--sky);
}

/* Soundscape Mixer */
.mixer-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.mixer-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 800;
}

/* ---- Bottom Floating Workout Dock ---- */
.bottom-dock {
  position: fixed;
  bottom: 14px;
  /* Center cleanly under the stage area (offset for 390px desktop right panel) */
  left: calc((100% - 390px) / 2);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 13px;
  background: var(--cream-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 34px rgba(74, 55, 40, 0.22);
  z-index: 45;
  max-width: calc(100vw - 418px);
  transition: left 0.28s ease, max-width 0.28s ease;
}

.app-shell.panel-collapsed .bottom-dock {
  left: 50%;
  max-width: calc(100vw - 24px);
}

.dock-timer {
  display: flex;
  flex-direction: column;
  padding: 0 8px 0 6px;
  border-right: 1.5px solid var(--border-cocoa);
}

.dock-time-val {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.05;
}

.dock-time-sub {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sport-pills {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sport-pill {
  border: 1.5px solid transparent;
  background: rgba(74, 55, 40, 0.06);
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sport-pill.active {
  background: #FFF3DC;
  border-color: var(--ink);
}

.dock-cta {
  padding: 9px 20px;
  font-size: 0.92rem;
}

/* ---- Modals (Wardrobe/Shop, Journal, Celebration, Room/Cloud) ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(74, 55, 40, 0.42);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 24px 60px rgba(74, 55, 40, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalRise 0.2s ease-out;
}

@keyframes modalRise {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 2px solid var(--border-cocoa);
  background: var(--cream-solid);
}

.modal-head h2 {
  font-size: 1.18rem;
  min-width: 0;
  line-height: 1.2;
}

.close-x {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--border-cocoa);
  background: var(--cream);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  padding: 18px 22px 22px;
  overflow-y: auto;
}

/* Wardrobe Layout */
.wardrobe-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
}

.avatar-preview-box {
  background: linear-gradient(180deg, #FBF0DF 0%, #EFE0CB 100%);
  border: 2px solid var(--ink);
  border-radius: 22px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.preview-stage {
  position: relative;
  width: 130px;
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.wardrobe-section {
  margin-bottom: 14px;
}

.wardrobe-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--border-strong);
  cursor: pointer;
  transition: transform 0.14s ease;
}

.swatch-btn.active {
  border-color: var(--ink);
  transform: scale(1.14);
  box-shadow: 0 0 0 3px var(--honey);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.shop-item {
  border: 2px solid var(--border-cocoa);
  background: var(--cream-solid);
  border-radius: 14px;
  padding: 8px 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  transition: all 0.15s ease;
  text-align: left;
}

.shop-item:hover {
  border-color: var(--coral);
}

.shop-item.active {
  background: #FFF2E6;
  border-color: var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}

.shop-item-name {
  font-size: 0.8rem;
  font-weight: 800;
}

.shop-price {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.shop-price.locked {
  color: #B66727;
}

/* Journal Stats & Heatmap */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--cream-solid);
  border: 2px solid var(--border-cocoa);
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--coral);
}

.stat-lbl {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 5px;
  margin: 10px 0 16px;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: rgba(74, 55, 40, 0.08);
  border: 1px solid rgba(74, 55, 40, 0.08);
}

.heat-cell.lvl-1 { background: #CBE0CC; }
.heat-cell.lvl-2 { background: #95B196; }
.heat-cell.lvl-3 { background: #E2856E; }

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-radius: 14px;
  background: var(--cream-solid);
  border: 1.5px solid var(--border-cocoa);
  font-size: 0.84rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  background: var(--ink);
  color: var(--cream);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.24s ease;
  z-index: 250;
  box-shadow: var(--shadow-warm);
  max-width: calc(100vw - 24px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Account System & FocusTown-Style Monetization Modules
   ========================================================================== */

.currency-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.drops-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #FFE8C8, #F8CA82);
  border: 2px solid var(--border-cocoa);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.drops-pill:hover {
  transform: translateY(-1px);
}

.pro-pill-btn {
  background: linear-gradient(135deg, #F8D47C, #E89A68);
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}

.pro-pill-btn.is-active-pro {
  background: linear-gradient(135deg, #FCE39A, #F3BC5C);
}

.lock-mini {
  font-size: 0.72rem;
  opacity: 0.8;
}

.guest-banner {
  background: linear-gradient(135deg, #FFF4E4, #FDE3C8);
  border: 2px solid var(--coral);
  border-radius: 16px;
  padding: 11px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.oauth-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--ink);
  background: var(--cream-solid);
  font-weight: 800;
  font-size: 0.86rem;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(74, 55, 40, 0.16);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.oauth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 55, 40, 0.16);
}

.oauth-btn.apple {
  background: var(--ink);
  color: var(--cream);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
  margin: 12px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--border-cocoa);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-msg {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 12px;
  display: none;
}

.auth-msg.error {
  display: block;
  background: #FDE5E1;
  color: #9E3A2A;
  border: 1.5px solid #E2856E;
}

.auth-msg.ok {
  display: block;
  background: #E7F2E7;
  color: #3B603D;
  border: 1.5px solid #95B196;
}

.account-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
  background: var(--cream-solid);
  border: 2px solid var(--ink);
  margin-bottom: 14px;
}

/* Pro Paywall & Pricing Cards */
.pro-hero {
  text-align: center;
  padding: 6px 0 14px;
}

.pro-perks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.pro-perk {
  background: var(--cream-solid);
  border: 1.5px solid var(--border-cocoa);
  border-radius: 14px;
  padding: 9px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.plan-card {
  position: relative;
  border: 2px solid var(--border-cocoa);
  background: var(--cream-solid);
  border-radius: 18px;
  padding: 14px 11px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.16s ease;
}

.plan-card:hover {
  border-color: var(--coral);
  transform: translateY(-2px);
}

.plan-card.selected {
  border: 2.5px solid var(--ink);
  background: linear-gradient(180deg, #FFF7E8 0%, #FDECD2 100%);
  box-shadow: 0 4px 0 var(--ink);
}

.plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--coral);
  color: #FFFDF9;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1.5px solid var(--ink);
  white-space: nowrap;
}

.plan-price {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.plan-sub {
  font-size: 0.7rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.plan-gift {
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #A55E1E;
  background: rgba(244, 200, 120, 0.32);
  padding: 2px 7px;
  border-radius: 99px;
}

/* Mystery Box & Golden Drops Packs */
.mystery-stage {
  background: linear-gradient(145deg, #FFF3F6 0%, #FDF2E4 100%);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 18px 16px;
  text-align: center;
  margin-bottom: 14px;
}

.mystery-box-icon {
  font-size: 3.4rem;
  display: inline-block;
  margin-bottom: 6px;
  animation: gentleFloat 2.4s ease-in-out infinite;
}

.mystery-box-icon.shaking {
  animation: boxShake 0.45s ease-in-out infinite;
}

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

@keyframes boxShake {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-10deg) scale(1.08); }
  75% { transform: rotate(10deg) scale(1.08); }
}

.progress-track {
  width: 100%;
  height: 11px;
  border-radius: 99px;
  background: rgba(74, 55, 40, 0.12);
  overflow: hidden;
  border: 1.5px solid var(--border-cocoa);
  margin: 8px 0 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #F5B5C5, #E2856E);
  transition: width 0.35s ease;
}

.mystery-reveal {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--cream-solid);
  border: 2px solid var(--ink);
  animation: popIn 0.2s ease-out;
}

.rarity-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.rarity-Common { background: #E7EFE7; color: #4A6A4C; }
.rarity-Rare { background: #E1EEF7; color: #36627E; }
.rarity-Epic { background: #FCE8C7; color: #9C5A14; }
.rarity-Secret { background: #FADBE4; color: #9A3356; }

.mystery-checklist {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mystery-chip {
  border: 1.5px solid var(--border-cocoa);
  border-radius: 13px;
  padding: 8px;
  background: var(--cream-solid);
  text-align: center;
  font-size: 0.76rem;
  font-weight: 800;
  opacity: 0.55;
}

.mystery-chip.collected {
  opacity: 1;
  border-color: var(--ink);
  background: #FFF7F9;
}

.drops-pack-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.drops-pack-card {
  position: relative;
  border: 2px solid var(--border-cocoa);
  border-radius: 18px;
  padding: 14px 10px;
  background: var(--cream-solid);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.drops-pack-card.popular {
  border-color: var(--ink);
  background: linear-gradient(180deg, #FFF7E4, #FCE7BD);
  box-shadow: 0 4px 0 var(--ink);
}

/* Pro Weekly Analytics Chart in Journal */
.pro-chart-wrap {
  position: relative;
  background: var(--cream-solid);
  border: 2px solid var(--border-cocoa);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  height: 112px;
  padding-top: 12px;
}

.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.bar-stick {
  width: 100%;
  max-width: 28px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #E2856E, #F4C878);
  border: 1.5px solid var(--ink);
  min-height: 6px;
}

.bar-day {
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.pro-blur-lock {
  position: absolute;
  inset: 0;
  background: rgba(253, 248, 240, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 12px;
}

@media (max-width: 640px) {
  .plans-grid,
  .drops-pack-grid,
  .pro-perks-grid,
  .oauth-stack,
  .mystery-checklist {
    grid-template-columns: 1fr;
  }
}

/* Language Selector Pill in Header */
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 6px 26px 6px 11px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--border-cocoa);
  background: var(--cream-solid)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234A3728' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E")
    no-repeat right 9px center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 0 rgba(74, 55, 40, 0.08);
}

.lang-select:hover {
  border-color: var(--border-strong);
}

.lang-select:focus {
  outline: none;
  border-color: var(--coral);
}

/* ==========================================================================
   5 New No-Equipment Workout Animations
   (Jump Rope, Squats, Plank/Pilates, Baduanjin/Tai Chi, Desk Stretch)
   ========================================================================== */

/* 5. Air Jump Rope */
.is-moving .cm-pose-jump_rope .cm-avatar-rig {
  animation: ropeHop 0.44s ease-in-out infinite;
  transform-origin: 60px 124px;
}

.is-moving .cm-pose-jump_rope .cm-rope-arc {
  animation: ropeSwing 0.44s linear infinite;
  transform-origin: 60px 90px;
}

.is-moving .cm-pose-jump_rope .cm-rope-arm-l,
.is-moving .cm-pose-jump_rope .cm-rope-arm-r {
  animation: wristCircle 0.44s linear infinite;
  transform-origin: 60px 84px;
}

@keyframes ropeHop {
  0%, 100% { transform: translateY(0px) scaleY(0.96); }
  45% { transform: translateY(-9px) scaleY(1.03); }
}

@keyframes ropeSwing {
  0% { transform: scaleY(1); opacity: 0.9; }
  50% { transform: scaleY(-1.25); opacity: 0.45; }
  100% { transform: scaleY(1); opacity: 0.9; }
}

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

/* 6. Bodyweight Squats */
.is-moving .cm-pose-squat_core .cm-avatar-rig {
  animation: squatDip 1.75s ease-in-out infinite;
  transform-origin: 60px 124px;
}

.is-moving .cm-pose-squat_core .cm-squat-arms {
  animation: squatArms 1.75s ease-in-out infinite;
  transform-origin: 60px 82px;
}

@keyframes squatDip {
  0%, 100% { transform: translateY(0px) scaleY(1); }
  48%, 58% { transform: translateY(11px) scaleY(0.86) scaleX(1.06); }
}

@keyframes squatArms {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px) scaleX(1.08); }
}

/* 7. Plank & Mat Pilates */
.is-moving .cm-pose-plank_pilates .cm-plank-rig {
  animation: plankHold 1.8s ease-in-out infinite;
  transform-origin: 60px 115px;
}

.is-moving .cm-sweat-drop {
  animation: sweatSlide 1.8s ease-in-out infinite;
}

@keyframes plankHold {
  0%, 100% { transform: translateY(0px) scaleY(1); }
  50% { transform: translateY(-2px) scaleY(1.02); }
}

@keyframes sweatSlide {
  0% { transform: translateY(-2px); opacity: 0; }
  35% { opacity: 0.95; }
  100% { transform: translateY(7px); opacity: 0; }
}

/* 8. Baduanjin / Tai Chi / Qigong Flow */
.is-moving .cm-pose-taiji_baduanjin .cm-avatar-rig {
  animation: taijiRoot 3.8s ease-in-out infinite;
  transform-origin: 60px 124px;
}

.is-moving .cm-pose-taiji_baduanjin .cm-taiji-arms {
  animation: taijiCloudHands 3.8s ease-in-out infinite;
  transform-origin: 60px 84px;
}

.is-moving .cm-pose-taiji_baduanjin .cm-qi-ring {
  animation: auraPulse 3.8s ease-in-out infinite;
  transform-origin: 60px 88px;
}

@keyframes taijiRoot {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(4px) scaleY(0.97); }
}

@keyframes taijiCloudHands {
  0%, 100% { transform: translateX(-5px) rotate(-5deg); }
  50% { transform: translateX(5px) rotate(5deg); }
}

/* 9. Desk & Mobility Side Stretch */
.is-moving .cm-pose-desk_stretch .cm-stretch-upper,
.is-moving .cm-pose-desk_stretch .cm-head {
  animation: sideStretchSway 3.4s ease-in-out infinite;
  transform-origin: 60px 100px;
}

.is-moving .cm-sparkle-float {
  animation: auraPulse 2.4s ease-in-out infinite;
  transform-origin: 20px 46px;
}

@keyframes sideStretchSway {
  0%, 100% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
}

/* Scrollable Sport Mode Picker & Scene Switcher (Desktop max-width scoped so Mobile/Tablet full-width rules win) */
.sport-pills,
.scene-switcher {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sport-pills::-webkit-scrollbar,
.scene-switcher::-webkit-scrollbar {
  display: none;
}

@media (min-width: 981px) {
  .sport-pills {
    max-width: 420px;
    padding: 2px 0;
  }
  .scene-switcher {
    max-width: 480px;
  }
}

/* Falling Snow Particles (Alpine Cabin) & Floating Bamboo Leaves (Bamboo Garden) */
.ambient-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 22;
  overflow: hidden;
  display: none;
}

.ambient-particles.active {
  display: block;
}

.snow-flake {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  background: rgba(255, 252, 245, 0.9);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
  animation: fallPetal linear infinite;
}

.bamboo-leaf {
  position: absolute;
  top: -12px;
  width: 14px;
  height: 6px;
  background: #95B196;
  border: 1px solid rgba(74, 55, 40, 0.28);
  border-radius: 80% 10% 80% 10%;
  opacity: 0.8;
  animation: fallPetal linear infinite;
}

/* ---- Responsive Multi-Client Breakpoints (Laptop, Tablet, Mobile & Android APK) ---- */

/* 1. Compact Laptop (1024px - 1340px): prevent header crowding */
@media (max-width: 1340px) {
  .top-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand-sub {
    display: none;
  }
  .cozy-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  .pill-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
  .scene-switcher {
    flex: 1 1 auto;
    min-width: 0;
  }
  .side-panel {
    width: 340px;
  }
  .bottom-dock {
    left: calc((100% - 340px) / 2);
    max-width: calc(100vw - 364px);
  }
}

/* 2. Tablet & Mobile Portrait (<= 980px): 2-row scrollable header + stacked stage/theater + pinned 2-row dock */
@media (max-width: 980px) {
  .top-bar {
    flex-wrap: wrap;
    padding: 8px 10px 7px;
    gap: 7px 10px;
  }
  .brand-group {
    order: 1;
  }
  .brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .brand-title {
    font-size: 1.08rem;
  }
  .header-actions {
    order: 2;
    flex: 1 1 auto;
    justify-content: flex-end;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 1px;
  }
  .header-actions::-webkit-scrollbar {
    display: none;
  }
  .header-actions .btn-label {
    display: none;
  }
  .scene-switcher {
    order: 3;
    flex: 1 0 100%;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .scene-switcher .pill-text {
    display: inline;
  }

  .workspace {
    flex-direction: column;
  }
  .stage-wrapper {
    padding: 8px 10px;
    flex: none;
  }
  .stage-frame {
    width: min(100%, calc(42dvh * 16 / 9));
    border-radius: 18px;
    border-width: 2.5px;
  }
  .app-shell.panel-collapsed .stage-wrapper {
    flex: 1;
  }
  .app-shell.panel-collapsed .stage-frame {
    width: min(100%, calc((100dvh - 245px) * 16 / 9));
  }

  .side-panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-left: none;
    border-top: 2px solid var(--border-cocoa);
  }
  .side-panel.collapsed {
    width: 100%;
    height: 0;
    flex: 0 0 0px;
    border-top-width: 0;
  }
  .panel-body {
    padding: 12px 12px 18px;
  }

  /* Pinned non-overlapping 2-row bottom dock on Tablet & Mobile */
  .bottom-dock,
  .app-shell.panel-collapsed .bottom-dock {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: 2px solid var(--ink);
    box-shadow: 0 -6px 20px rgba(74, 55, 40, 0.12);
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 7px 10px;
    padding: 7px 12px max(8px, env(safe-area-inset-bottom, 8px));
    flex-shrink: 0;
  }
  .sport-pills {
    display: flex;
    order: 1;
    flex: 1 0 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .dock-timer {
    order: 2;
    border-right: none;
    padding: 0 4px;
  }
  .dock-cta {
    order: 3;
    padding: 8px 16px;
    font-size: 0.86rem;
  }
  .wardrobe-grid {
    grid-template-columns: 1fr;
  }
}

/* 3. Small Phones & Android APK Portrait (<= 640px) */
@media (max-width: 640px) {
  .brand-title {
    display: none;
  }
  .coin-pill,
  .drops-pill {
    padding: 4px 8px;
    font-size: 0.78rem;
    gap: 4px;
  }
  .cozy-btn {
    padding: 5px 9px;
    font-size: 0.78rem;
  }
  .lang-select {
    padding: 5px 22px 5px 8px;
    font-size: 0.74rem;
  }
  .stage-hud-top {
    top: 6px;
    left: 6px;
    right: 6px;
    gap: 4px;
    flex-wrap: wrap;
  }
  .lighting-pills {
    padding: 2px;
    border-width: 1.5px;
  }
  .lighting-pills .pill-btn {
    padding: 3px 7px;
    font-size: 0.66rem;
  }
  .online-badge {
    padding: 3px 8px;
    font-size: 0.66rem;
    border-width: 1.5px;
    gap: 5px;
  }
  .live-dot {
    width: 7px;
    height: 7px;
  }
  .avatar-nametag {
    font-size: 0.56rem;
    padding: 1px 5px;
    border-width: 1.3px;
    gap: 2px;
  }
  .npc-tag {
    display: none;
  }
  .cheer-popover button {
    width: 26px;
    height: 26px;
    font-size: 0.88rem;
  }
  .dock-time-val {
    font-size: 1.25rem;
  }
  .sport-pill {
    padding: 5px 10px;
    font-size: 0.76rem;
  }
  .modal-backdrop {
    padding: 10px;
  }
  .modal-card {
    max-height: 92dvh;
    border-radius: 22px;
  }
  .modal-head {
    padding: 12px 14px;
  }
  .modal-head h2 {
    font-size: 1.02rem;
  }
  .modal-content {
    padding: 14px 14px 18px;
  }
  /* Prevent iOS/Android WebView auto-zoom on form inputs */
  .cozy-input {
    font-size: 16px;
  }
  .toast {
    top: auto;
    bottom: 112px;
  }
}

/* 4. Landscape Phones (e.g. Android 844x390 horizontal workout mode) */
@media (max-height: 500px) and (orientation: landscape) {
  .top-bar {
    flex-wrap: nowrap;
    padding: 4px 10px;
    gap: 6px;
  }
  .brand-title {
    display: none;
  }
  .scene-switcher {
    order: 2;
    flex: 1 1 auto;
    max-width: none;
  }
  .header-actions {
    order: 3;
    flex: 0 1 auto;
  }
  .workspace {
    flex-direction: row;
  }
  .stage-wrapper {
    flex: 1;
    padding: 6px 8px;
  }
  .stage-frame {
    width: min(100%, calc((100dvh - 108px) * 16 / 9));
    border-radius: 14px;
  }
  .side-panel {
    width: 270px;
    flex: none;
    border-top: none;
    border-left: 2px solid var(--border-cocoa);
  }
  .side-panel.collapsed {
    width: 0;
    height: auto;
    border-left-width: 0;
  }
  .bottom-dock,
  .app-shell.panel-collapsed .bottom-dock {
    flex-wrap: nowrap;
    padding: 4px 10px;
    gap: 8px;
  }
  .sport-pills {
    order: 2;
    flex: 1 1 auto;
    max-width: none;
  }
  .dock-timer {
    order: 1;
  }
  .dock-time-sub {
    display: none;
  }
}
