/* ═══════════════════════════════════════════════════════
   VibeSpace+ — Design System v2
   Default: Light mode (clean white)
   Toggle:  Dark / Night mode via [data-theme="dark"]
   Typography: Sora + JetBrains Mono
   ═══════════════════════════════════════════════════════ */

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

/* ─── LIGHT MODE (default) ─── */
:root {
  --bg:           #f5f5f7;
  --surface-1:    #ffffff;
  --surface-2:    #f0f0f4;
  --surface-3:    #e4e4ea;
  --border:       rgba(0,0,0,0.08);
  --border-hover: rgba(0,0,0,0.16);

  --accent:       #ff6b35;
  --accent-light: #ff8c5a;
  --accent-muted: rgba(255, 107, 53, 0.12);
  --accent-glow:  rgba(255, 107, 53, 0.25);

  --text-primary:   #1a1a22;
  --text-secondary: #606070;
  --text-tertiary:  #a0a0b0;

  --topbar-bg:    rgba(245,245,247,0.88);
  --shadow-sm:    0 1px 4px rgba(0,0,0,0.08), 0 2px 10px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.14);

  /* Spacing (8pt grid) */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;
  --sp-4: 16px;  --sp-5: 20px;  --sp-6: 24px;
  --sp-8: 32px;  --sp-10: 40px; --sp-12: 48px;

  /* Radius */
  --r-sm: 8px;  --r-md: 14px;  --r-lg: 20px;  --r-xl: 28px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Theme transition */
  --theme-transition: background 0.35s ease, color 0.35s ease,
                      border-color 0.35s ease, box-shadow 0.35s ease;
}

/* ─── DARK MODE ─── */
[data-theme="dark"] {
  --bg:           #0f0f11;
  --surface-1:    #18181c;
  --surface-2:    #242428;
  --surface-3:    #2e2e34;
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);

  --accent-muted: rgba(255, 107, 53, 0.18);
  --accent-glow:  rgba(255, 107, 53, 0.35);

  --text-primary:   #f0f0f2;
  --text-secondary: #9090a0;
  --text-tertiary:  #5a5a6a;

  --topbar-bg:    rgba(15,15,17,0.88);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.6);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: var(--theme-transition);
}

/* ═══════════════════════ SPLASH ═══════════════════════ */
.splash {
  position: fixed;
  inset: 0;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.splash.fade-out {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}
#splash-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-8) var(--sp-6);
  width: 100%;
}
.logo-svg {
  width: clamp(220px, 55vw, 520px);
  height: auto;
  filter: drop-shadow(0 4px 24px rgba(0,0,0,0.2));
}
.splash-tagline {
  font-size: clamp(12px, 2vw, 16px);
  font-weight: 400;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s 0.8s ease, transform 0.6s 0.8s ease;
  text-align: center;
}
.splash-tagline.visible { opacity: 1; transform: translateY(0); }
.splash-bar {
  width: clamp(160px, 40vw, 300px);
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 99px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s 1s ease;
}
.splash-bar.visible { opacity: 1; }
.splash-bar-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 99px;
  transition: width 1.8s 1.1s var(--ease-out);
}
.splash-bar-fill.full { width: 100%; }

/* ═══════════════════════ APP SHELL ═══════════════════════ */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.app.hidden { opacity: 0; pointer-events: none; }
.app.visible {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.5s ease;
}

/* ═══════════════════════ TOP BAR ═══════════════════════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: var(--theme-transition);
}
.topbar-left {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex: 0 0 auto;
  min-width: 0;
}
.topbar-logo {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}
.topbar-logo .plus { color: var(--accent); }
.topbar-device {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* NAV — desktop: icon+label; mobile: icon only */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 12px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
  min-width: 0;
}
.nav-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.nav-btn.active { color: var(--accent); background: var(--accent-muted); }
.nav-btn svg { flex-shrink: 0; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 0 0 auto;
}

/* Battery widget */
.battery-widget {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: default;
  color: var(--text-secondary);
  transition: var(--theme-transition);
}
.battery-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #16a34a;
}
[data-theme="dark"] .battery-pct { color: #4ade80; }
.battery-label {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* Theme toggle button */
.theme-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.25s var(--ease-out);
  flex-shrink: 0;
}
.theme-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-muted);
  transform: rotate(15deg);
}
/* Show correct icon per mode */
.theme-btn .icon-moon { display: block; }
.theme-btn .icon-sun  { display: none; }
[data-theme="dark"] .theme-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-btn .icon-sun  { display: block; }

/* Connection dot */
.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 5px #16a34a80;
  animation: pulse-dot 2.4s infinite;
  flex-shrink: 0;
}
[data-theme="dark"] .connection-dot { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ═══════════════════════ MOBILE BOTTOM NAV ═══════════════════════ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  transition: var(--theme-transition);
}
.mobile-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-btn.active { color: var(--accent); }
.mobile-nav-btn svg { width: 22px; height: 22px; }

/* ═══════════════════════ SECTIONS ═══════════════════════ */
.section { display: none; flex: 1; animation: section-in 0.35s var(--ease-out); }
.section.active { display: flex; flex-direction: column; }
@keyframes section-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
}
.section-title {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-2);
}
.section-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
}

/* ═══════════════════════ CONTROL — HERO ═══════════════════════ */
.hero-area {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  margin-bottom: var(--sp-6);
  padding: var(--sp-6) 0;
}
.hero-img {
  width: 460px;
  max-width: 78vw;
  height: auto;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 16px 48px var(--accent-glow));
  animation: hero-float 4s ease-in-out infinite;
  transition: filter 0.35s ease;
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}
.hero-glow {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 60px;
  background: radial-gradient(ellipse at center, var(--accent-glow), transparent 70%);
  z-index: 1;
  pointer-events: none;
}
.hero-labels { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.feature-callout {
  position: absolute;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.feature-callout.right-callout { flex-direction: row-reverse; }
.callout-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent);
}
.callout-line {
  width: 28px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.right-callout .callout-line { background: linear-gradient(270deg, var(--accent), transparent); }
.callout-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
  text-align: right;
}
.right-callout .callout-label { text-align: left; }

/* ═══════════════════════ CARDS ═══════════════════════ */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
}
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-5);
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s, background 0.35s;
  box-shadow: var(--shadow-sm);
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-wide { grid-column: span 2; }
.card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.card-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}
.card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--sp-4);
}

/* ─── SLIDERS ─── */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.slider-min, .slider-max {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 5px;
  background: var(--surface-3);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s;
  min-width: 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted), var(--shadow-sm);
  cursor: grab;
  transition: box-shadow 0.2s, transform 0.15s;
}
.slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.18);
  box-shadow: 0 0 0 6px var(--accent-muted), var(--shadow-sm);
}
.slider-kelvin {
  background: linear-gradient(90deg, #ff9329 0%, #fff5e0 40%, #cce8ff 100%);
}
.slider-kelvin::-webkit-slider-thumb {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}

/* ─── MODE CHIPS ─── */
.card-modes {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
}
.mode-chip {
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-chip:hover, .mode-chip.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── LIGHTING ─── */
.lighting-controls { display: flex; flex-direction: column; gap: var(--sp-4); }
.light-row { display: flex; align-items: center; gap: var(--sp-3); }
.light-label { font-size: 13px; color: var(--text-secondary); width: 36px; flex-shrink: 0; }
.light-presets { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.preset-btn {
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.preset-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.preset-btn.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }

/* ─── TOGGLE ─── */
.toggle {
  position: relative;
  display: inline-block;
  width: 42px; height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background 0.25s, border-color 0.25s;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: transform 0.25s var(--ease-out), background 0.25s;
}
.toggle input:checked + .toggle-track { background: var(--accent-muted); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); background: var(--accent); }

/* ─── BREAK TIMER ─── */
.break-timer-display { display: flex; align-items: center; gap: var(--sp-5); }
.timer-ring-wrap { position: relative; width: 76px; height: 76px; flex-shrink: 0; }
.timer-ring { width: 76px; height: 76px; }
.timer-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.timer-min {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px; font-weight: 700;
  color: var(--text-primary); line-height: 1;
}
.timer-unit { font-size: 9px; color: var(--text-tertiary); margin-top: 2px; }
.timer-meta { flex: 1; min-width: 0; }
.timer-status { font-size: 13px; color: var(--text-secondary); margin-bottom: var(--sp-2); }
.timer-interval-row { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.interval-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  border-radius: var(--r-sm);
  padding: 3px 8px;
  cursor: pointer;
  outline: none;
  transition: var(--theme-transition);
}
.interval-select:focus { border-color: var(--accent); }

/* ─── RGB ─── */
.rgb-colors { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.color-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}
.color-dot:hover { transform: scale(1.2); }
.color-dot.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--accent-muted); }
.color-picker {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.rgb-note { font-size: 11px; color: var(--text-tertiary); line-height: 1.5; }

/* ─── TILT ─── */
.tilt-intensity { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.tilt-label { font-size: 13px; color: var(--text-secondary); }
.tilt-btns { display: flex; gap: var(--sp-2); }
.tilt-btn {
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.tilt-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.tilt-btn.active { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════ HEALTH SECTION ═══════════════════════ */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-3);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.25s, transform 0.25s, background 0.35s;
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--stat-color) 12%, transparent);
  color: var(--stat-color);
  display: flex; align-items: center; justify-content: center;
}
.stat-body { display: flex; flex-direction: column; gap: 2px; }
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-bar { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 99px; transition: width 1s var(--ease-out); }

/* Chart */
.chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: background 0.35s, border-color 0.35s;
}
.chart-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-5); flex-wrap: wrap; gap: var(--sp-3);
}
.chart-title { font-size: 15px; font-weight: 600; }
.chart-legend { display: flex; align-items: center; gap: var(--sp-4); font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; }
.chart-wrap { overflow: hidden; border-radius: var(--r-sm); }
.chart-wrap canvas { max-width: 100%; display: block; }

/* Posture card */
.posture-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  display: flex; gap: var(--sp-8); align-items: center;
  box-shadow: var(--shadow-sm);
  transition: background 0.35s, border-color 0.35s;
  flex-wrap: wrap;
}
.posture-ring-wrap { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.posture-ring { width: 110px; height: 110px; }
.posture-score-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.posture-score-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1;
}
.posture-score-label { font-size: 10px; color: var(--text-secondary); margin-top: 3px; text-align: center; }
.posture-right { flex: 1; min-width: 200px; }
.posture-title { font-size: 15px; font-weight: 600; margin-bottom: var(--sp-4); }
.posture-list { list-style: none; display: flex; flex-direction: column; gap: var(--sp-2); }
.posture-item { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; color: var(--text-secondary); }
.pi-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.posture-item.good .pi-dot { background: #16a34a; }
.posture-item.warn .pi-dot { background: var(--accent); }
[data-theme="dark"] .posture-item.good .pi-dot { background: #4ade80; }

/* ═══════════════════════ SCENES SECTION ═══════════════════════ */
.scenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-4);
}
.scene-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s var(--ease-out);
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.scene-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.scene-card.active { border-color: var(--accent); background: var(--accent-muted); }
.scene-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scene-icon {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-4);
  transition: background 0.25s;
}
.scene-card.active .scene-icon { background: var(--accent); color: #fff; }
.scene-name { font-size: 15px; font-weight: 700; margin-bottom: var(--sp-3); }
.scene-params { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.scene-params li { font-size: 12px; color: var(--text-secondary); }
.scene-badge {
  position: absolute; top: var(--sp-4); right: var(--sp-4);
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.scene-add { border-style: dashed; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.add-icon { color: var(--text-tertiary); background: var(--surface-2); margin-bottom: var(--sp-3); }
.scene-add-hint { font-size: 12px; color: var(--text-tertiary); }

/* ═══════════════════════ HELP SECTION ═══════════════════════ */
.help-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--sp-5);
  align-items: start;
}
.help-sidebar {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  position: sticky;
  top: 76px;
  box-shadow: var(--shadow-sm);
  transition: background 0.35s, border-color 0.35s;
}
.help-sidebar-title {
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--sp-3);
  padding: 0 var(--sp-2);
}
.help-nav { display: flex; flex-direction: column; gap: 2px; }
.help-nav-item {
  width: 100%;
  padding: 8px var(--sp-3);
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.help-nav-item:hover { background: var(--surface-2); color: var(--text-primary); }
.help-nav-item.active { background: var(--accent-muted); color: var(--accent); }

.help-content {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  line-height: 1.8;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: background 0.35s, border-color 0.35s;
}
.help-content h2 {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.help-content h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: var(--sp-6) 0 var(--sp-3); }
.help-content p { margin-bottom: var(--sp-4); font-size: 14px; }
.help-content ul, .help-content ol { margin-left: var(--sp-6); margin-bottom: var(--sp-4); }
.help-content li { font-size: 14px; margin-bottom: var(--sp-2); }
.help-content strong { color: var(--text-primary); font-weight: 600; }
.help-tip {
  background: var(--accent-muted);
  border: 1px solid rgba(255,107,53,0.25);
  border-radius: var(--r-sm);
  padding: var(--sp-4);
  margin: var(--sp-5) 0;
  font-size: 13px;
}
.help-tip strong { color: var(--accent); }
.help-step { display: flex; gap: var(--sp-4); margin-bottom: var(--sp-5); align-items: flex-start; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.step-body { flex: 1; }
.step-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.step-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* ═══════════════════════ TOAST ═══════════════════════ */
.toast {
  position: fixed;
  bottom: max(var(--sp-8), calc(env(safe-area-inset-bottom) + var(--sp-4)));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px var(--sp-6);
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
  z-index: 500;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════════════════════ RESPONSIVE — TABLET ═══════════════════════ */
@media (max-width: 900px) {
  .topbar { padding: 0 var(--sp-5); }
  .topbar-device { display: none; }
  .battery-label { display: none; }
  .card-wide { grid-column: span 1; }
  .section-inner { padding: var(--sp-6) var(--sp-5) var(--sp-10); }
  .hero-area { min-height: 220px; padding: var(--sp-5) 0; }
  .hero-img { width: 340px; }
  .hero-labels { display: none; }
  .help-layout { grid-template-columns: 1fr; }
  .help-sidebar { position: static; }
  .help-nav { flex-direction: row; flex-wrap: wrap; }
  .help-nav-item { width: auto; }
  .posture-card { flex-direction: column; }
  .controls-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ═══════════════════════ RESPONSIVE — MOBILE ═══════════════════════ */
@media (max-width: 640px) {
  /* Show mobile bottom nav, hide desktop top nav */
  .topbar-nav { display: none; }
  .mobile-nav { display: block; }

  /* Adjust body bottom padding for bottom nav */
  body { padding-bottom: 72px; }

  /* Toast clears bottom nav */
  .toast { bottom: calc(72px + 12px + env(safe-area-inset-bottom)); }

  .topbar { height: 52px; padding: 0 var(--sp-4); gap: var(--sp-3); }
  .topbar-logo { font-size: 17px; }
  .battery-widget { padding: 4px 8px; }
  .battery-label { display: none; }
  .theme-btn { width: 32px; height: 32px; }

  .section-inner { padding: var(--sp-4) var(--sp-4) var(--sp-6); }
  .section-title { font-size: 20px; }

  /* Hero on mobile */
  .hero-area { min-height: 180px; padding: var(--sp-4) 0; margin-bottom: var(--sp-4); }
  .hero-img { width: 70vw; max-width: 280px; }
  .hero-labels { display: none; }
  .hero-glow { width: 180px; height: 40px; }

  /* Cards 1-col on mobile */
  .controls-grid { grid-template-columns: 1fr; gap: var(--sp-3); }
  .card { padding: var(--sp-4); }
  .card-wide { grid-column: span 1; }

  /* Health */
  .health-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .stat-num { font-size: 18px; }

  /* Scenes 2-col */
  .scenes-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .scene-icon { width: 42px; height: 42px; }
  .scene-name { font-size: 13px; }
  .scene-params { display: none; }

  /* Help: full width sidebar on top */
  .help-layout { grid-template-columns: 1fr; gap: var(--sp-3); }
  .help-sidebar { position: static; }
  .help-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .help-nav-item { width: auto; font-size: 12px; padding: 6px 10px; }
  .help-content { padding: var(--sp-5); }
  .help-content h2 { font-size: 17px; }

  /* Timer layout */
  .break-timer-display { gap: var(--sp-4); }
  .timer-min { font-size: 18px; }

  /* Mode chips scroll */
  .card-modes { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .mode-chip { flex-shrink: 0; }

  /* Posture card */
  .posture-card { flex-direction: column; padding: var(--sp-4); gap: var(--sp-4); }
  .posture-right { min-width: unset; }
}

@media (max-width: 380px) {
  .health-grid { grid-template-columns: 1fr; }
  .scenes-grid { grid-template-columns: 1fr; }
  .hero-img { width: 85vw; }
}

/* ═══════════════════════ REDUCED MOTION ═══════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .hero-img { animation: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
