/* ============================================================
   沉浸式自习系统 — Apple 设计语言风格
   ============================================================ */

/* ---------- CSS 自定义属性 ---------- */
:root {
  --primary: #2d5a27;
  --primary-light: #4a8c3f;
  --primary-glow: rgba(45, 90, 39, 0.25);
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.35);
  --glass-bg: rgba(0, 0, 0, 0.32);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  /* ========== z-index 层级系统 ========== */
  --z-bg: 0;
  --z-particles: 1;
  --z-app: 10;
  --z-quote: 50;
  --z-stats: 100;
  --z-focus-panel: 100;
  --z-dropdown: 200;
  --z-modal-backdrop: 300;
  --z-modal: 301;
  --z-menu: 400;
  --z-celebration: 500;
  --z-focus-hint: 600;
  --z-startup: 1000;

  /* ========== 情绪系统基础变量（被 body.mood-xxx 覆盖）========== */
  --mood-filter: none;
  --mood-contrast: 1;
  --mood-saturation: 1;
}

/* ========== 情绪主题 ========== */

/* 默认中性态（等于是 root 的默认值） */
body.mood-neutral {
  --mood-filter: none;
}

/* 专注态：冷静蓝色调 */
body.mood-focus {
  --primary: #0055AA;
  --primary-light: #3388DD;
  --primary-glow: rgba(0, 85, 170, 0.25);
  --glass-bg: rgba(0, 0, 0, 0.38);
}

/* 疲劳态：暖橙色调 + 轻微柔焦，提示需要休息 */
body.mood-fatigue {
  --primary: #BB6600;
  --primary-light: #DD8833;
  --primary-glow: rgba(187, 102, 0, 0.25);
  --glass-bg: rgba(0, 0, 0, 0.38);
  --mood-filter: blur(0.4px);
}

/* 分心态：低饱和度 + 灰调，视觉上"褪色"以产生心理暗示 */
body.mood-distracted {
  --primary: #777777;
  --primary-light: #999999;
  --primary-glow: rgba(100, 100, 100, 0.15);
  --mood-contrast: 0.85;
  --mood-saturation: 0.7;
}

/* 应用到 body 的滤镜效果（平滑过渡） */
body {
  filter: var(--mood-filter) contrast(var(--mood-contrast)) saturate(var(--mood-saturation));
  transition: filter 1.2s cubic-bezier(0.25, 0.1, 0.25, 1),
              background-color 1.2s ease;
}

/* 全局变量过渡（确保颜色变化平滑）*/
body.mood-focus,
body.mood-fatigue,
body.mood-distracted {
  transition: filter 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: transparent;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 300;
  font-size: 15px;
  line-height: 1.5;
}

::selection {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.hidden {
  display: none !important;
}

/* ---------- Canvas ---------- */
.particle-canvas {
  position: fixed;
  inset: 0;
  z-index: var(--z-particles);
  pointer-events: none;
}

/* ---------- 应用容器 ---------- */
.app-container {
  position: relative;
  z-index: var(--z-app);
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 36px;
}

/* ============================================================
   顶部栏 — 极简
   ============================================================ */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.clock {
  font-size: 1.05rem;
  font-weight: 300;
  letter-spacing: 2px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.top-actions {
  display: flex;
  gap: 6px;
}

.top-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.top-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.top-icon-btn:active {
  transform: scale(0.92);
}

.top-icon-btn:focus-visible {
  outline: 1px solid var(--text-secondary);
  outline-offset: 2px;
}

/* ============================================================
   Welcome Screen — Apple HIG 标准
   ============================================================ */

/* ===== 整体遮罩 ===== */
.startup-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-startup);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #1a1512;
  transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
              visibility 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.startup-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* ===== 两层背景结构 ===== */

/* Layer 1: 真实照片背景 — blur + scale 半抽象 + 暖色渐变兜底 */
.welcome-bg {
  position: absolute;
  inset: 0;
  background:
    /* 用户自定义背景图（优先） */
    url('../assets/1781498172498.png') center/cover no-repeat,
    /* 图片加载失败时暖色渐变兜底 */
    linear-gradient(175deg, #1f1814 0%, #1a1512 30%, #181310 60%, #12100e 100%);
  filter: blur(0px);
  transform: scale(1.05);
  animation: welcome-drift 40s ease-in-out infinite;
  will-change: transform, filter;
}

@keyframes welcome-drift {
  0%, 100% {
    transform: scale(1.05) translate(0, 0);
  }
  25% {
    transform: scale(1.05) translate(-0.6%, 0.3%);
  }
  50% {
    transform: scale(1.05) translate(0.3%, -0.4%);
  }
  75% {
    transform: scale(1.05) translate(-0.2%, 0.3%);
  }
}

/* Layer 2: 暗色遮罩 — 20% 压暗 */
.welcome-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

/* ===== 欢迎卡片 — 左侧黄金分割布局 ===== */
.welcome-card {
  position: relative;
  z-index: 2;
  width: 360px;
  max-width: 90vw;
  padding: 44px 40px 36px;
  border-radius: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  /* Apple 玻璃材质 */
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 8px 24px rgba(0, 0, 0, 0.08);
  /* 入场动画 */
  opacity: 0;
  transform: translateY(24px);
  animation: welcome-card-enter 0.9s cubic-bezier(0.33, 1, 0.68, 1) 0.2s forwards;
}

@keyframes welcome-card-enter {
  0% { opacity: 0; transform: translateY(24px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== Logo ===== */
.welcome-logo {
  margin-bottom: 28px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.95;
}

.welcome-logo svg {
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.06));
}

/* ===== 标题 ===== */
.welcome-title {
  font-family: var(--font-sans);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.welcome-subtitle {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  margin: 8px 0 0;
  letter-spacing: 0.3px;
}

/* ===== 情绪/身份认同胶囊 ===== */
.welcome-capsules {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 28px 0 32px;
  padding: 0;
}

.welcome-capsule {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 16px;
}

.welcome-capsule-icon {
  font-size: 20px;
  line-height: 1.2;
  opacity: 0.8;
}

.welcome-capsule-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.welcome-capsule-divider {
  width: 0.5px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
}

/* ===== 进入按钮 — Apple 风格胶囊 + 磁吸效果 ===== */
.welcome-btn {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: #111111;
  transition: background 0.25s cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 0.15s ease-out,
              box-shadow 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  position: relative;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

.welcome-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translate(var(--mx, 0px), calc(var(--my, 0px) - 2px));
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.welcome-btn:active {
  transform: scale(0.98);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition-duration: 0.08s;
}

.welcome-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.3);
  outline-offset: 3px;
}

.welcome-btn-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

/* ===== 底部提示 ===== */
.welcome-footer {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.35);
  margin: 18px 0 0;
  letter-spacing: 0.3px;
}

/* ===== 第5层：粒子 Canvas（保持在原位置） ===== */

/* ============================================================
   毛玻璃面板（通用）
   ============================================================ */
.glass {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: background var(--transition), border-color var(--transition);
}

/* ============================================================
   「更多」下拉菜单 — Apple 风格
   ============================================================ */
.more-menu {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: var(--z-menu);
  min-width: 200px;
  padding: 6px 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92) translateY(-6px);
  transition: opacity 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1),
              transform 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.more-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1) translateY(0);
}

@media (prefers-color-scheme: dark) {
  .more-menu {
    background: rgba(40, 40, 45, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

.more-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 14px;
  font-weight: 400;
  color: #3A3A3C;
}

@media (prefers-color-scheme: dark) {
  .more-menu-item {
    color: #FFFFFF;
  }
}

.more-menu-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  .more-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}

.more-menu-item:active {
  background: rgba(0, 0, 0, 0.08);
}

.menu-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.menu-label {
  flex: 1;
}

.menu-toggle-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #30D158;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.menu-toggle-indicator.on {
  opacity: 1;
}

.more-menu-divider {
  height: 0.5px;
  margin: 4px 12px;
  background: rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  .more-menu-divider {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* ============================================================
   双背景层（GPU 合成层交叉淡入）
   ============================================================ */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  opacity: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  /* 强制独立 GPU 合成层，避免 compositor cache 误复用旧纹理 */
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  /* 过渡由 JS 通过 CSS transition 驱动 */
  transition: opacity 2s cubic-bezier(0.33, 1, 0.68, 1);
}

/* ============================================================
   键盘快捷键 Modal
   ============================================================ */
.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 4px;
  font-size: 14px;
  color: var(--text-primary);
}

.shortcut-row kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 2px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  text-align: center;
}

.shortcut-row span {
  color: var(--text-secondary);
}

/* ============================================================
   分享卡片（用于截图生成，平时隐藏）
   ============================================================ */
.share-card {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 400px;
  padding: 0;
  background: #FFFFFF;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.share-card-inner {
  padding: 28px 24px 24px;
}

.share-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.share-icon {
  font-size: 28px;
}

.share-date {
  font-size: 14px;
  font-weight: 500;
  color: #8E8E93;
  letter-spacing: 0.5px;
}

.share-body {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  margin-bottom: 20px;
}

.share-stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.share-stat-block .share-num {
  font-size: 36px;
  font-weight: 700;
  color: #1C1C1E;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.share-stat-block .share-label {
  font-size: 11px;
  font-weight: 400;
  color: #8E8E93;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.share-footer {
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  color: #AEAEB2;
  padding-top: 12px;
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
}

/* 分享操作按钮组 */
.share-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.share-action-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 12px;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  background: #007AFF;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.share-action-btn:hover {
  opacity: 0.85;
}

.share-action-btn.secondary {
  background: #F2F2F7;
  color: #3A3A3C;
}

@media (prefers-color-scheme: dark) {
  .share-action-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
  }
}

/* ============================================================
   沉浸模式（Focus Shade）
   ============================================================ */

/* ---- 沉浸时隐藏的元素（带过渡）---- */
.focus-mode .top-icon-btn,
.focus-mode .panel-header,
.focus-mode .progress-section,
.focus-mode .panel-divider,
.focus-mode .timer-controls,
.focus-mode .timer-presets,
.focus-mode #quote-card,
.focus-mode #stats-page,
.focus-mode #music-panel,
.focus-mode .side-panel {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

/* 沉浸时计时器面板：第一阶段——仅视觉过渡（背景渐变透明） */
.focus-mode .timer-panel {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* 第二阶段——布局跃迁（下一帧执行，不与背景过渡同帧） */
.focus-layout .timer-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-focus-panel);
  border-radius: 0;
  padding: 0;
}

/* 移除面板边缘高光（避免全屏时顶部白线） */
.focus-mode .timer-panel::before,
.focus-mode .timer-panel::after {
  display: none;
}

/* 沉浸时倒计时文字放大居中 */
.focus-mode .timer-display {
  font-size: 6rem;
  font-weight: 600;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  letter-spacing: 8px;
  animation: none;
}

.focus-mode .timer-colon {
  animation: none;
}

/* 沉浸时顶部栏仅保留时钟 */
.focus-mode .top-actions {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---- 沉浸模式提示条 ---- */
.focus-hint {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: var(--z-focus-hint);
  padding: 8px 20px;
  border-radius: 50px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

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

/* 移动端适配 */
@media (max-width: 640px) {
  .focus-mode .timer-display {
    font-size: 3rem;
    letter-spacing: 4px;
  }
}

/* ---- 防烧屏目标基础过渡 ---- */
.anti-burn-target {
  transition: transform 0.8s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  will-change: transform;
}

/* ============================================================
   主内容布局
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   左侧计时器面板（主面板）
   ============================================================ */
.timer-panel {
  width: 360px;
  min-width: 340px;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  /* 沉浸模式进出时背景/边框/阴影平滑过渡 */
  transition: background 0.35s ease,
              border-color 0.35s ease,
              box-shadow 0.35s ease;
}

/* 边缘高光 */
.timer-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

/* ---- Panel Header ---- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.panel-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 2.5px;
  color: var(--text-secondary);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8E8E93;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.status-dot.active {
  background: #30d158;
  box-shadow: 0 0 8px rgba(48, 209, 88, 0.5);
}

.status-dot.paused {
  background: #FF9F0A;
  box-shadow: 0 0 8px rgba(255, 159, 10, 0.4);
}

.status-dot.idle {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.status-text {
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

/* ---- 倒计时 ---- */
.timer-display {
  font-size: 5.5rem;
  font-weight: 200;
  text-align: center;
  letter-spacing: 6px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.timer-colon {
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

/* ---- 进度条 ---- */
.progress-section {
  margin-bottom: 20px;
}

.progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 100%;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-label-text {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}

.progress-percent {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* ---- 分隔线 ---- */
.panel-divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 16px 0;
}

/* ============================================================
   专注目标选择器（Apple 风格下拉）
   ============================================================ */
.goal-picker-row {
  margin-bottom: 8px;
}

.goal-picker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.goal-picker-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
}

.goal-select-wrapper {
  position: relative;
}

.goal-select-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  transition: all 0.2s ease;
}

.goal-select-btn:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
}

.goal-select-btn.has-goal {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

.goal-select-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.goal-select-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-select-chevron {
  flex-shrink: 0;
  opacity: 0.4;
  transition: transform 0.2s ease;
}

/* 选中目标时提示锁定 */
.goal-picker-row.locked .goal-select-btn {
  opacity: 0.7;
  cursor: default;
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
}

.goal-picker-row.locked .goal-select-btn:hover {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.goal-picker-row.locked .goal-select-chevron {
  display: none;
}

/* ---- 下拉菜单 ---- */
.goal-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: var(--z-dropdown);
  border-radius: 12px;
  background: rgba(40, 40, 45, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.96);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.goal-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.goal-dropdown-list {
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 0;
}

.goal-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.12s ease;
}

.goal-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

.goal-option.selected {
  background: rgba(255, 255, 255, 0.04);
  color: #FFFFFF;
}

.goal-option.disabled {
  color: rgba(255, 255, 255, 0.3);
  cursor: default;
  font-style: italic;
}

.goal-option-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.goal-option-name {
  flex: 1;
}

.goal-option-check {
  font-size: 14px;
  color: #30D158;
  flex-shrink: 0;
}

.goal-option-delete {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
  opacity: 0;
}

.goal-option:hover .goal-option-delete {
  opacity: 1;
}

.goal-option-delete:hover {
  color: #FF453A !important;
  background: rgba(255, 69, 58, 0.12);
}

/* ---- 新建目标按钮 ---- */
.goal-add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.goal-add-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.goal-add-btn svg {
  opacity: 0.5;
}

/* ---- 新建输入行 ---- */
.goal-create-row {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.goal-create-row.visible {
  max-height: 60px;
}

.goal-create-inner {
  display: flex;
  gap: 4px;
  padding: 6px 14px 10px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.06);
}

.goal-create-input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.goal-create-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.goal-create-input:focus {
  border-color: #007AFF;
}

.goal-create-confirm {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: #007AFF;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.goal-create-confirm:hover {
  opacity: 0.85;
}

/* 深色模式（倒置——已是最暗，保持原样）*/
.goal-dropdown {
  background: rgba(40, 40, 45, 0.95);
}

/* ============================================================
   目标统计（按目标聚合的迷你条图）
   ============================================================ */
.goal-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 4px;
}

.goal-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #3A3A3C;
}

@media (prefers-color-scheme: dark) {
  .goal-stat-row { color: #E5E5EA; }
}

.goal-stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.goal-stat-name {
  width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.goal-stat-bar-bg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

@media (prefers-color-scheme: dark) {
  .goal-stat-bar-bg { background: rgba(255, 255, 255, 0.06); }
}

.goal-stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.goal-stat-value {
  width: 50px;
  text-align: right;
  font-weight: 500;
  color: #8E8E93;
  font-variant-numeric: tabular-nums;
}

.goal-stat-count {
  width: 30px;
  text-align: right;
  font-size: 10px;
  color: #AEAEB2;
}

/* 展开/收起状态 */
#stats-goal-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

#stats-goal-container.expanded {
  max-height: 400px;
}

.stats-goal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
  font-size: 12px;
  color: #8E8E93;
}

.stats-goal-header:hover {
  background: rgba(0, 0, 0, 0.03);
}

@media (prefers-color-scheme: dark) {
  .stats-goal-header:hover {
    background: rgba(255, 255, 255, 0.04);
  }
}

.stats-goal-header .chart-header-arrow {
  transition: transform 0.25s cubic-bezier(0.33, 1, 0.68, 1);
}

.stats-goal-header.collapsed .chart-header-arrow {
  transform: rotate(90deg);
}

/* ---- 控制按钮 ---- */
.timer-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.ctrl-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  text-align: center;
}

.ctrl-btn:hover:not(:disabled) {
  border-color: var(--glass-border-hover);
  color: var(--text-primary);
}

.ctrl-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.ctrl-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.ctrl-btn.primary-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  color: var(--text-primary);
  font-weight: 450;
}

.ctrl-btn.primary-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
}

.ctrl-btn:focus-visible {
  outline: 1px solid var(--text-secondary);
  outline-offset: 2px;
}

/* ---- 预设时间 ---- */
.timer-presets {
  display: flex;
  align-items: center;
  gap: 12px;
}

.presets-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  flex-shrink: 0;
}

.presets-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.preset-btn:hover {
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
}

.preset-btn.active {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.preset-btn:focus-visible {
  outline: 1px solid var(--text-secondary);
  outline-offset: 2px;
}

.preset-sm {
  padding: 5px 10px;
  font-size: 0.7rem;
}

.preset-custom {
  display: flex;
  align-items: center;
  gap: 4px;
}

.custom-input {
  width: 60px;
  padding: 4px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  text-align: center;
  outline: none;
  transition: border-color var(--transition);
}

.custom-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.custom-input:focus {
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

/* 去掉 number input 箭头 */
.custom-input::-webkit-outer-spin-button,
.custom-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.custom-input[type=number] {
  -moz-appearance: textfield;
}

/* ============================================================
   统计数据中心 — 浮动面板
   ============================================================ */
.stats-page {
  position: fixed;
  inset: 0;
  z-index: var(--z-stats);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.stats-page.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- 点击面板外关闭 ---- */
.stats-page-close-area {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ---- 居中玻璃面板 ---- */
.stats-page-scroll {
  position: relative;
  z-index: 2;
  width: 520px;
  max-width: calc(100vw - 48px);
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 44px 28px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: rgba(20, 20, 24, 0.92);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  transform: scale(0.95) translateY(8px);
  transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.stats-page.open .stats-page-scroll {
  transform: scale(1) translateY(0);
}

.stats-page-scroll::-webkit-scrollbar {
  width: 4px;
}
.stats-page-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.stats-page-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

/* ---- 关闭按钮（面板内右上角） ---- */
.st-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 3;
}

.st-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  transform: scale(1.05);
}

/* ============================================================
   Layer 1 — Hero 主数字
   ============================================================ */
.st-hero {
  text-align: center;
  padding: 4px 0 10px;
  width: 100%;
}

.st-hero-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.st-hero-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.st-hero-minutes {
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  animation: st-count-up 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) both;
}

.st-hero-unit {
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  margin-left: 4px;
}

.st-hero-delta {
  font-size: 13px;
  font-weight: 400;
  color: #30D158;
  margin-top: 4px;
  min-height: 18px;
}

.st-hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 10px;
}

.st-hero-meta strong {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.st-dot {
  opacity: 0.3;
}

@keyframes st-count-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Layer 2 — 可折叠模块
   ============================================================ */
.st-section {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  overflow: hidden;
}

.st-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.5px;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.st-section-header:hover {
  color: rgba(255, 255, 255, 0.85);
}

.st-section-title {
  text-transform: uppercase;
}

.st-section-arrow {
  font-size: 9px;
  opacity: 0.4;
  transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1);
}

.st-section-arrow.expanded {
  transform: rotate(90deg);
}

.st-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.33, 1, 0.68, 1);
}

.st-section-body.expanded {
  max-height: 600px;
}

.st-section-body-inner {
  padding: 0 16px 14px;
}

/* ============================================================
   2a — 本周趋势柱状图
   ============================================================ */
.st-trend-chart {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}

.st-trend-chart svg {
  display: block;
}

.st-trend-bar {
  transition: fill 0.3s ease;
}

.st-trend-group:hover .st-trend-bar {
  opacity: 0.8;
}

.st-trend-summary {
  text-align: center;
  font-size: 10px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.3);
  padding: 4px 0 2px;
}

/* ============================================================
   2b — 时段分布环形图
   ============================================================ */
.st-dist-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
}

.st-dist-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-dist-center {
  position: absolute;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.st-dist-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 0 4px;
}

.st-dist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.st-dist-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.st-dist-label {
  flex: 1;
}

.st-dist-val {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Layer 3 — 专注目标（Apple Fitness 风格）
   ============================================================ */
.st-goals-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 2px;
}

.st-goal-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.st-goal-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.st-goal-name {
  width: 52px;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.st-goal-bar-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.st-goal-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.st-goal-pct {
  width: 30px;
  text-align: right;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.3);
  font-variant-numeric: tabular-nums;
}

.st-goals-empty {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  padding: 6px 0;
  text-align: center;
}

/* ============================================================
   底部 — 分享按钮
   ============================================================ */
.st-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2px 0 8px;
}

.st-footer-btn {
  padding: 9px 24px;
  border-radius: 12px;
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 132, 255, 0.12);
  color: #0A84FF;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.3px;
  -webkit-tap-highlight-color: transparent;
}

.st-footer-btn:hover {
  background: rgba(10, 132, 255, 0.22);
  transform: translateY(-1px);
}

.st-footer-btn:active {
  transform: scale(0.97);
}

/* ---- 移动端适配 ---- */
@media (max-width: 640px) {
  .stats-page-scroll {
    width: calc(100vw - 32px);
    max-height: 85vh;
    padding: 36px 18px 24px;
    border-radius: 22px;
    gap: 12px;
  }
  .st-hero-minutes {
    font-size: 48px;
  }
  .st-hero-unit {
    font-size: 14px;
  }
  .st-close-btn {
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .st-section-header {
    padding: 10px 14px;
    font-size: 11px;
  }
  .st-section-body-inner {
    padding: 0 14px 12px;
  }
}

/* ============================================================
   背景风格选择 Modal
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal-backdrop);
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-inner {
  width: 60vw;
  min-width: 420px;
  max-width: 820px;
  max-height: 80vh;
  border-radius: var(--radius-lg);
  padding: 32px 32px 28px;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  transform: scale(0.95) translateY(8px);
  transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.modal.open .modal-inner {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.modal-title {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 2.5px;
  color: var(--text-secondary);
}

.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0 4px;
}

/* ===== 背景选择面板 — Vision Pro 环境空间 ===== */
.bg-modal-inner {
  width: 72vw;
  max-width: 660px;
  min-width: 420px;
  max-height: 80vh;
  border-radius: 32px !important;
  background: rgba(24, 24, 28, 0.82) !important;
  backdrop-filter: blur(60px) saturate(1.2);
  -webkit-backdrop-filter: blur(60px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.bg-modal-inner .modal-header {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.bg-modal-inner .modal-title {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.45);
}

.bg-modal-inner .modal-body {
  padding: 16px 0 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.bg-modal-inner .modal-body::-webkit-scrollbar {
  width: 3px;
}

.bg-modal-inner .modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

/* ===== 环境分类系统 ===== */
.bg-categories {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding-bottom: 8px;
}

.bg-category {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bg-category-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}

.bg-category-name {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
}

.bg-category-desc {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.3px;
}

/* 横向滑动卡片容器 */
.bg-env-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 3px 2px 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.bg-env-scroll::-webkit-scrollbar {
  height: 2px;
}

.bg-env-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

.bg-env-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* 环境预览卡片 */
.bg-env-card {
  flex: 0 0 200px;
  scroll-snap-align: start;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1),
              border-color 0.25s ease,
              box-shadow 0.25s ease;
  outline: none;
  font-family: inherit;
  text-align: left;
  padding: 0;
}

.bg-env-card:hover {
  transform: scale(1.02) translateY(-1px);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.bg-env-card:active {
  transform: scale(0.99);
}

.bg-env-card.active {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.12), 0 8px 30px rgba(0, 0, 0, 0.2);
}

.bg-env-card-preview {
  width: 100%;
  height: 110px;
  border-radius: 14px 14px 0 0;
  transition: filter 0.3s ease, transform 0.3s ease;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(0.92) contrast(1.02);
}

.bg-env-card:hover .bg-env-card-preview {
  filter: saturate(1) contrast(1.04) brightness(1.06);
}

.bg-env-card.active .bg-env-card-preview {
  filter: saturate(1) contrast(1.02) brightness(1.04);
}

.bg-env-card-name {
  display: block;
  padding: 10px 12px 10px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.45);
  transition: color 0.25s ease;
}

.bg-env-card.active .bg-env-card-name {
  color: rgba(255, 255, 255, 0.8);
}

/* 分类级上传按钮（在横向滚动末尾） */
.bg-env-upload-card {
  flex: 0 0 80px;
  scroll-snap-align: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.2);
  min-height: 110px;
}

.bg-env-upload-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.4);
}

.bg-env-upload-icon {
  font-size: 16px;
  font-weight: 200;
  line-height: 1;
  opacity: 0.6;
}

.bg-env-upload-label {
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.3px;
}

/* ============================================================
   侧边面板（音乐）
   ============================================================ */
.side-panel {
  width: 280px;
  border-radius: var(--radius-md);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
  position: absolute;
  right: 0;
  top: 0;
  opacity: 0;
  transform: translateX(12px) scale(0.97);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.side-panel.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.side-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-panel-title {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition);
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* ---- 音乐控件 ---- */
.music-info {
  text-align: center;
  padding: 8px 0;
}

.music-track {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--text-primary);
}

.music-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.music-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.music-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.music-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}

.music-play-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  color: var(--text-tertiary);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  transition: transform var(--transition);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: rgba(255, 255, 255, 0.5);
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
}

/* ---- 风格选择 ---- */
.style-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.style-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  text-align: center;
}

.style-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.style-item.active {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.style-preview {
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.style-name {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  padding-bottom: 8px;
  font-family: var(--font-sans);
}

.style-item.active .style-name {
  color: var(--text-secondary);
}

/* ============================================================
   每日名言卡片
   ============================================================ */
.quote-card {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-quote);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 12px 18px;
  border-radius: 50px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: min(600px, 80vw);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.quote-content {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.quote-mark {
  flex-shrink: 0;
  color: var(--text-tertiary);
  opacity: 0.4;
}

.quote-text {
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.quote-author {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  opacity: 0.6;
  white-space: nowrap;
  flex-shrink: 0;
}

.quote-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.quote-refresh:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.quote-refresh:active {
  transform: rotate(180deg);
}

.quote-refresh.loading svg {
  animation: spin 0.8s linear infinite;
}

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

/* ============================================================
   专注完成庆祝动画
   ============================================================ */
.celebration {
  position: fixed;
  inset: 0;
  z-index: var(--z-celebration);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.celebration.show {
  opacity: 1;
  pointer-events: auto;
}

.celebration-content {
  text-align: center;
  padding: 40px 48px;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transform: scale(0.9);
  transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.celebration.show .celebration-content {
  transform: scale(1);
}

.celebration-icon {
  color: #30d158;
  margin-bottom: 16px;
  opacity: 0.9;
}

.celebration-title {
  font-size: 1.6rem;
  font-weight: 200;
  letter-spacing: 4px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.celebration-desc {
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 1px;
}


/* ---- 上传 ---- */
.upload-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--text-tertiary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  justify-content: center;
}

.upload-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.upload-hint {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  opacity: 0.5;
}

/* ============================================================
   响应式
   ============================================================ */
/* 平板 */
@media (max-width: 820px) {
  .app-container {
    padding: 20px;
  }

  .timer-panel {
    width: 340px;
    min-width: 300px;
    padding: 28px 24px;
  }

  .timer-display {
    font-size: 4.5rem;
  }

  .side-panel {
    width: 260px;
  }
}

/* 平板 */
@media (max-width: 820px) {
  .modal-inner {
    width: 85vw;
    min-width: 0;
    padding: 24px 20px;
  }

  .style-modal-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }

  .style-card-preview {
    height: 64px;
  }
}

/* 手机横屏 / 小屏 */
@media (max-width: 640px) {
  .quote-card {
    bottom: 16px;
    padding: 10px 14px 10px 12px;
    max-width: 92vw;
    border-radius: 30px;
  }

  .quote-text {
    font-size: 0.7rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .celebration-content {
    padding: 28px 24px;
    margin: 0 20px;
  }

  .celebration-title {
    font-size: 1.3rem;
  }
  .app-container {
    padding: 14px;
  }

  .top-bar {
    margin-bottom: 16px;
  }

  .main-content {
    flex-direction: column;
    align-items: stretch;
  }

  .timer-panel {
    width: 100%;
    min-width: 0;
    padding: 24px 20px;
    border-radius: var(--radius-md);
  }

  .timer-display {
    font-size: 3.8rem;
    letter-spacing: 4px;
  }

  .timer-controls {
    gap: 6px;
  }

  .ctrl-btn {
    font-size: 0.75rem;
    padding: 10px 0;
  }

  .side-panel {
    width: 100%;
    position: relative;
    right: auto;
    top: auto;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    max-height: 0;
    overflow: hidden;
    padding: 0 20px;
    transition: all 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  .side-panel.visible {
    max-height: 400px;
    padding: 20px;
    transform: translateY(0) scale(1);
  }

  .welcome-card {
    padding: 36px 28px 28px;
    border-radius: 28px;
  }
  .welcome-title {
    font-size: 26px;
  }
  .welcome-capsules {
    gap: 0;
    margin: 24px 0 28px;
  }
  .welcome-capsule {
    padding: 0 12px;
  }
  .welcome-capsule-icon {
    font-size: 18px;
  }
  .welcome-capsule-label {
    font-size: 10px;
  }

}

/* 手机 */
@media (max-width: 500px) {
  .modal-inner {
    width: 92vw;
    min-width: 0;
    max-height: 90vh;
    padding: 20px 16px;
  }

  .style-modal-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .style-card-preview {
    height: 56px;
  }

  .welcome-card {
    padding: 32px 20px 24px;
    border-radius: 24px;
    width: 92%;
  }
  .welcome-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 22px;
  }
  .welcome-logo svg {
    width: 48px;
    height: 48px;
  }
  .welcome-title {
    font-size: 24px;
  }
  .welcome-subtitle {
    font-size: 12px;
  }
  .welcome-capsules {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    margin: 20px 0 24px;
  }
  .welcome-capsule {
    padding: 0 10px;
    min-width: 0;
    flex: 0 1 auto;
  }
  .welcome-capsule-icon {
    font-size: 16px;
  }
  .welcome-capsule-label {
    font-size: 9px;
  }
  .welcome-capsule-divider {
    height: 22px;
  }
  .welcome-btn {
    height: 46px;
    font-size: 15px;
  }
  .welcome-footer {
    margin-top: 16px;
    font-size: 9px;
  }
}

/* 极小屏 */
@media (max-width: 400px) {
  .timer-display {
    font-size: 3rem;
  }

  .presets-group {
    gap: 4px;
  }

  .preset-btn {
    padding: 4px 10px;
    font-size: 0.7rem;
  }

  .custom-input {
    width: 48px;
  }
}

/* ============================================================
   滚动条
   =========