/* ========================================================
   TimeFlow (时迹) - Harmonious Typography & Dual-Theme System
   Linear / Apple / Vercel Industrial Design Standards
   ======================================================== */

:root {
  /* Dark Theme Palette (Default - Midnight Obsidian) */
  --bg-primary: #090c15;
  --bg-secondary: #0e1322;
  --bg-card: rgba(17, 24, 39, 0.78);
  --bg-card-hover: rgba(26, 36, 56, 0.88);
  --bg-surface-elevated: #151d2f;
  --bg-input: rgba(10, 14, 24, 0.65);
  --bg-capsule: rgba(255, 255, 255, 0.06);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);
  --border-focus: rgba(99, 102, 241, 0.55);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-inverted: #0f172a;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);

  /* Semantic Category Palettes (Dark Theme - Luminous & Refined) */
  --color-work: #60a5fa;
  --cat-work-bg: rgba(59, 130, 246, 0.14);
  --cat-work-border: rgba(96, 165, 250, 0.3);

  --color-study: #a78bfa;
  --cat-study-bg: rgba(139, 92, 246, 0.14);
  --cat-study-border: rgba(167, 139, 250, 0.3);

  --color-health: #34d399;
  --cat-health-bg: rgba(16, 185, 129, 0.14);
  --cat-health-border: rgba(52, 211, 153, 0.3);

  --color-chores: #fbbf24;
  --cat-chores-bg: rgba(245, 158, 11, 0.14);
  --cat-chores-border: rgba(251, 191, 36, 0.3);

  --color-entertainment: #fb7185;
  --cat-entertainment-bg: rgba(244, 63, 94, 0.14);
  --cat-entertainment-border: rgba(251, 113, 133, 0.3);

  --color-rest: #22d3ee;
  --cat-rest-bg: rgba(6, 182, 212, 0.14);
  --cat-rest-border: rgba(34, 211, 238, 0.3);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 12px 32px -4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 32px var(--accent-glow);

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s var(--ease-spring);
}

/* Light Theme Palette (Calibrated Apple/Vercel Light - High Legibility & Crisp Contrast) */
[data-theme="light"] {
  --bg-primary: #f6f8fb;
  --bg-secondary: #edf2f7;
  --bg-card: rgba(255, 255, 255, 0.96);
  --bg-card-hover: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-input: #f8fafc;
  --bg-capsule: #e2e8f0;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.16);
  --border-focus: rgba(79, 70, 229, 0.5);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --text-inverted: #f8fafc;

  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-glow: rgba(79, 70, 229, 0.2);

  /* Semantic Category Palettes (Light Theme - Rich Contrast, WCAG AAA Compliance) */
  --color-work: #1d4ed8;
  --cat-work-bg: #eff6ff;
  --cat-work-border: rgba(29, 78, 216, 0.25);

  --color-study: #6d28d9;
  --cat-study-bg: #f5f3ff;
  --cat-study-border: rgba(109, 40, 217, 0.25);

  --color-health: #047857;
  --cat-health-bg: #ecfdf5;
  --cat-health-border: rgba(4, 120, 87, 0.25);

  --color-chores: #b45309;
  --cat-chores-bg: #fffbeb;
  --cat-chores-border: rgba(180, 83, 9, 0.25);

  --color-entertainment: #be123c;
  --cat-entertainment-bg: #fff1f2;
  --cat-entertainment-border: rgba(190, 18, 60, 0.25);

  --color-rest: #0e7490;
  --cat-rest-bg: #ecfeff;
  --cat-rest-border: rgba(14, 116, 144, 0.25);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 8px 24px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* Global Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.58;
  letter-spacing: -0.011em;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, .card-linear-title, .modal-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "PingFang SC", "Hiragino Sans GB", sans-serif;
  letter-spacing: -0.022em;
  font-weight: 600;
  color: var(--text-main);
}

/* Background Atmosphere */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.14) 0%, transparent 60%),
    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 15% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 45%);
}

[data-theme="light"] .ambient-grid {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
}

.ambient-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 80%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 80%);
}

[data-theme="light"] .ambient-grid-overlay {
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
}

/* App Layout */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 20px 100px;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  .app-container {
    padding: 32px 36px 60px;
  }
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.brand-name {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "PingFang SC", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-capsule {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 6px;
  box-shadow: var(--shadow-sm);
}

.btn-icon-subtle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.btn-icon-subtle:hover {
  background: rgba(128, 128, 128, 0.15);
  color: var(--text-main);
}

.date-text-btn {
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  padding: 4px 10px;
  cursor: pointer;
}

/* Nav Floating Island */
.nav-island {
  display: flex;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  padding: 5px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  gap: 6px;
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-island::-webkit-scrollbar {
  display: none;
}

@media (max-width: 767px) {
  .nav-island {
    display: none;
  }
}

.nav-tab-item {
  flex: 1;
  min-width: 90px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.nav-tab-item svg {
  width: 17px;
  height: 17px;
}

.nav-tab-item:hover {
  color: var(--text-main);
  background: rgba(128, 128, 128, 0.08);
}

.nav-tab-item.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

@media (min-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

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

.metric-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.metric-badge.neutral {
  background: var(--bg-capsule);
  color: var(--text-dim);
}

.metric-badge.work {
  background: var(--cat-work-bg);
  color: var(--color-work);
  border: 1px solid var(--cat-work-border);
}

.metric-badge.entertainment {
  background: var(--cat-entertainment-bg);
  color: var(--color-entertainment);
  border: 1px solid var(--cat-entertainment-border);
}

.metric-badge.health {
  background: var(--cat-health-bg);
  color: var(--color-health);
  border: 1px solid var(--cat-health-border);
}

.metric-val {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "SF Mono", ui-monospace, sans-serif;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1.1;
  color: var(--text-main);
}

.metric-desc {
  font-size: 0.74rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Card Surface */
.card-linear {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  transition: border-color var(--transition-fast);
}

.card-linear:hover {
  border-color: var(--border-hover);
}

.card-linear-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-linear-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 24-Hour Timeline Bar */
.timeline-strip-container {
  margin: 12px 0 16px;
}

.timeline-strip-bar {
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-capsule);
  display: flex;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  position: relative;
}

.timeline-strip-block {
  height: 100%;
  cursor: pointer;
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.timeline-strip-block:hover {
  transform: scaleY(1.08);
  filter: brightness(1.2);
  z-index: 10;
}

.timeline-strip-block.active {
  transform: scaleY(1.15);
  filter: brightness(1.3);
  outline: 2px solid #ffffff;
  outline-offset: -1px;
  z-index: 20;
}

.timeline-detail-card {
  margin-top: 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
  animation: slideDownFade 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.timeline-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* Hero Timer */
.timer-hero-box {
  text-align: center;
  padding: 36px 20px 32px;
  position: relative;
}

.segmented-mode-capsule {
  display: inline-flex;
  background: var(--bg-capsule);
  border: 1px solid var(--border-subtle);
  padding: 4px;
  border-radius: var(--radius-full);
  margin-bottom: 28px;
}

.seg-btn {
  padding: 6px 18px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.seg-btn:hover {
  color: var(--text-main);
}

.seg-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.timer-dial-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-dial-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  stroke: rgba(128, 128, 128, 0.15);
}

.timer-ring-progress {
  stroke: url(#timer-accent-gradient);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s var(--ease-spring);
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.4));
}

.timer-center-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-digits {
  font-size: 3.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", ui-monospace, "SF Mono", "Roboto Mono", monospace;
}

.timer-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-capsule);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-top: 10px;
  border: 1px solid var(--border-subtle);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
}

.timer-pulse-badge.active .pulse-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Inputs & Category Chips */
.timer-details-box {
  max-width: 480px;
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-linear, .form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
  transition: all var(--transition-fast);
}

.input-linear {
  text-align: center;
}

.input-linear:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.category-pills-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.cat-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.cat-chip:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
}

.cat-chip.active {
  color: var(--text-main);
  border-color: var(--cat-color, var(--accent-primary));
  box-shadow: 0 0 0 1px var(--cat-color, var(--accent-primary));
}

[data-theme="dark"] .cat-chip.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

[data-theme="light"] .cat-chip.active {
  background: #ffffff;
  color: #0f172a;
}

.cat-chip .chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

/* Action Controls */
.timer-action-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.btn-tactile-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-tactile-circle:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-tactile-circle:active {
  transform: translateY(1px);
}

.btn-play-hero {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
  transition: all var(--transition-fast);
}

.btn-play-hero:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6);
}

.btn-play-hero:active {
  transform: scale(0.96);
}

.btn-play-hero svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* Activity Items */
.activity-stream {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

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

.activity-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.activity-color-bar {
  width: 4px;
  height: 36px;
  border-radius: var(--radius-full);
}

.activity-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.activity-time-range {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.activity-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.activity-duration {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "SF Mono", ui-monospace, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--text-main);
}

.activity-del-btn {
  opacity: 0.4;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  transition: all var(--transition-fast);
}

.activity-item:hover .activity-del-btn {
  opacity: 1;
}

.activity-del-btn:hover {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.15);
}

/* Grids */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 880px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  outline: none;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn:active, 
.btn-tactile-circle:active, 
.cat-chip:active, 
.seg-btn:active, 
.nav-tab-item:active, 
.dock-item:active {
  transform: scale(0.93) translateY(1px);
  transition: transform 0.08s ease;
}

.btn-play-hero:active {
  transform: scale(0.90);
  transition: transform 0.08s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Touch Ripple Effect */
.touch-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 70%);
  transform: scale(0);
  animation: rippleSpread 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 10;
}

[data-theme="light"] .touch-ripple {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(99, 102, 241, 0) 70%);
}

@keyframes rippleSpread {
  to {
    transform: scale(1);
    opacity: 0;
  }
}

/* Hero Button Shockwave */
.shockwave-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  animation: shockwaveExpand 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 5;
}

@keyframes shockwaveExpand {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
    box-shadow: 0 0 18px var(--accent-primary);
  }
  100% {
    transform: translate(-50%, -50%) scale(2.4);
    opacity: 0;
  }
}

/* Micro Particle Burst */
.particle-dot {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: particleBurst 0.75s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes particleBurst {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* Spring Pop */
@keyframes springPop {
  0% { transform: scale(0.92); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.spring-pop {
  animation: springPop 0.25s var(--ease-spring);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.22);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 480px;
  padding: 26px;
  box-shadow: var(--shadow-card);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s var(--ease-spring);
}

.modal-overlay.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 11px 22px;
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s var(--ease-spring);
  z-index: 300;
}

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

/* Mobile Bottom Dock */
.mobile-dock {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
  z-index: 100;
}

@media (min-width: 768px) {
  .mobile-dock {
    display: none;
  }
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  gap: 4px;
  cursor: pointer;
  padding: 4px 8px;
}

.dock-item svg {
  width: 20px;
  height: 20px;
}

.dock-item.active {
  color: var(--accent-primary);
}

/* ========================================================
   Precision Instrument Ticks (Omega / Rolex Chronograph aesthetic)
   ======================================================== */
.timer-ring-ticks {
  stroke: rgba(148, 163, 184, 0.22);
  stroke-dasharray: 2 10.04;
}

[data-theme="light"] .timer-ring-ticks {
  stroke: rgba(71, 85, 105, 0.16);
}

/* ========================================================
   Bento Grid & Aceternity UI Dynamic Spotlight System
   ======================================================== */
.bento-grid-dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 900px) {
  .bento-grid-dashboard {
    grid-template-columns: 1.55fr 1fr;
    align-items: stretch;
  }
}

.bento-hero {
  margin-bottom: 0 !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bento-side-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.bento-mini-card {
  margin-bottom: 0 !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 24px !important;
}

.bento-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.bento-badge {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bento-status-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.bento-status-pill.status-flow {
  background: var(--cat-health-bg);
  color: var(--color-health);
  border: 1px solid var(--cat-health-border);
}

.bento-status-pill.status-steady {
  background: var(--cat-work-bg);
  color: var(--color-work);
  border: 1px solid var(--cat-work-border);
}

.bento-status-pill.status-starting {
  background: var(--cat-chores-bg);
  color: var(--color-chores);
  border: 1px solid var(--cat-chores-border);
}

.bento-status-pill.status-idle {
  background: var(--bg-capsule);
  color: var(--text-dim);
  border: 1px solid var(--border-subtle);
}

.bento-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 10px 0 6px;
  text-align: center;
}

.bento-stat-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  transition: all var(--transition-fast);
}

.bento-stat-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.bento-stat-num {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "SF Mono", ui-monospace, sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--text-main);
  line-height: 1.1;
}

.bento-stat-lbl {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 5px;
  font-weight: 500;
}

.bento-quick-tasks-box {
  min-height: 230px;
}

.bento-quick-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 155px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 4px;
}

.bento-quick-tasks-list::-webkit-scrollbar {
  width: 4px;
}

.bento-quick-tasks-list::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}

.bento-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: all var(--transition-fast);
}

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

.bento-task-item.completed {
  opacity: 0.5;
}

.bento-task-item.completed .bento-task-title {
  text-decoration: line-through;
}

.bento-task-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.bento-task-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.bento-task-act-btn {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.28);
  color: #818cf8;
  border-radius: var(--radius-xs);
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.bento-task-act-btn:hover {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.bento-quote-bar {
  font-size: 0.76rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

/* Aceternity UI Spotlight Border & Hover Glow */
.bento-spotlight {
  position: relative;
  overflow: hidden;
}

.bento-spotlight::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  background: radial-gradient(
    480px circle at var(--mouse-x, -300px) var(--mouse-y, -300px),
    rgba(99, 102, 241, 0.14),
    transparent 65%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 1;
}

[data-theme="light"] .bento-spotlight::before {
  background: radial-gradient(
    480px circle at var(--mouse-x, -300px) var(--mouse-y, -300px),
    rgba(99, 102, 241, 0.08),
    transparent 65%
  );
}

.bento-spotlight:hover::before {
  opacity: 1;
}

.bento-spotlight::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    280px circle at var(--mouse-x, -300px) var(--mouse-y, -300px),
    rgba(99, 102, 241, 0.45),
    transparent 60%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 0;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
}

.bento-spotlight:hover::after {
  opacity: 1;
}

.bento-spotlight > * {
  position: relative;
  z-index: 2;
}

/* ========================================================
   Ambient Sound Flow Capsule (Web Audio Engine)
   ======================================================== */
.ambient-sound-capsule {
  margin-top: 20px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.ambient-sound-capsule.active {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.2);
}

.ambient-sound-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ambient-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all var(--transition-fast);
}

.ambient-sound-capsule.active .ambient-pulse-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-ring 1.8s infinite;
}

.ambient-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.ambient-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.ambient-select option {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.ambient-sound-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ambient-slider {
  width: 65px;
  height: 4px;
  -webkit-appearance: none;
  background: var(--bg-capsule);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

.ambient-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}

.btn-ambient-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-capsule);
  border: none;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-ambient-play:hover {
  background: var(--accent-primary);
  color: #fff;
}

.btn-ambient-play svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ========================================================
   Focus Heatmap (GitHub-style 16-Week Consistency Matrix)
   ======================================================== */
.focus-heatmap-wrap {
  overflow-x: auto;
  padding: 12px 0 8px;
  scrollbar-width: thin;
}

.focus-heatmap-svg {
  display: block;
  min-width: 540px;
  width: 100%;
}

.heatmap-cell {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  rx: 2.5px;
  ry: 2.5px;
}

.heatmap-cell:hover {
  transform: scale(1.2);
  filter: brightness(1.25);
  stroke: var(--text-main);
  stroke-width: 1px;
}

.heatmap-cell.lv-0 {
  fill: var(--bg-capsule);
}

.heatmap-cell.lv-1 {
  fill: #065f46;
}

.heatmap-cell.lv-2 {
  fill: #059669;
}

.heatmap-cell.lv-3 {
  fill: #10b981;
}

.heatmap-cell.lv-4 {
  fill: #34d399;
}

[data-theme="light"] .heatmap-cell.lv-1 {
  fill: #a7f3d0;
}

[data-theme="light"] .heatmap-cell.lv-2 {
  fill: #6ee7b7;
}

[data-theme="light"] .heatmap-cell.lv-3 {
  fill: #10b981;
}

[data-theme="light"] .heatmap-cell.lv-4 {
  fill: #047857;
}

.heatmap-legend-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.heatmap-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.heatmap-swatch.lv-0 { background: var(--bg-capsule); }
.heatmap-swatch.lv-1 { background: #065f46; }
.heatmap-swatch.lv-2 { background: #059669; }
.heatmap-swatch.lv-3 { background: #10b981; }
.heatmap-swatch.lv-4 { background: #34d399; }

[data-theme="light"] .heatmap-swatch.lv-1 { background: #a7f3d0; }
[data-theme="light"] .heatmap-swatch.lv-2 { background: #6ee7b7; }
[data-theme="light"] .heatmap-swatch.lv-3 { background: #10b981; }
[data-theme="light"] .heatmap-swatch.lv-4 { background: #047857; }

.heatmap-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ========================================================
   Shortcuts Modal & Keycaps
   ======================================================== */
.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 480px) {
  .shortcuts-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.shortcut-keys kbd {
  display: inline-block;
  padding: 3px 7px;
  font-size: 0.76rem;
  font-family: -apple-system, BlinkMacSystemFont, "SF Mono", ui-monospace, monospace;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xs);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.shortcut-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ========================================================
   Zen Fullscreen Focus Mode
   ======================================================== */
.zen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 32px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.zen-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.zen-header {
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zen-task-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.zen-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto 0;
}

.zen-canvas-wrap {
  position: relative;
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .zen-canvas-wrap {
    width: 440px;
    height: 440px;
  }
}

.zen-audio-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.zen-center-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.zen-digits {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Mono", monospace;
  font-size: 4.8rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--text-main);
  line-height: 1;
  margin-bottom: 12px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

@media (min-width: 640px) {
  .zen-digits {
    font-size: 6.8rem;
  }
}

.zen-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 24px;
}

.zen-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}

.zen-footer {
  width: 100%;
  max-width: 720px;
  text-align: center;
}

.zen-motto {
  font-size: 0.96rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.6;
}

.zen-hints {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ========================================================
   Shareable Focus Card Modal
   ======================================================== */
.share-card-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  background: var(--bg-base);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin: 16px 0;
  overflow: hidden;
}

.share-card-canvas {
  max-width: 100%;
  height: auto;
  max-height: 520px;
  border-radius: var(--radius-sm);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* ========================================================
   Weekly Trends & Smart Diagnostics
   ======================================================== */
.weekly-bar-group {
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.weekly-bar-group:hover {
  filter: brightness(1.18);
}

.diagnostics-metric-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.diagnostics-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
}


