/* Counter Sync - Dark Minimalist Theme */

/* 預設主題：靛藍 (Indigo) */
:root, [data-theme="indigo"] {
  --bg: #0f172a;
  --bg-translucent: rgba(15, 23, 42, 0.9);
  --surface: #1e293b;
  --surface-hover: #334155;
  --primary: #6366f1;
  --primary-hover: #5558e3;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --primary-bg: rgba(99, 102, 241, 0.1);
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-bg: rgba(244, 63, 94, 0.1);
  --success: #10b981;
  --text: #f1f5f9;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;
  --border: #334155;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 翠綠主題 (Emerald) */
[data-theme="emerald"] {
  --bg: #022c22;
  --bg-translucent: rgba(2, 44, 34, 0.9);
  --surface: #064e3b;
  --surface-hover: #065f46;
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.3);
  --primary-bg: rgba(16, 185, 129, 0.1);
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-bg: rgba(245, 158, 11, 0.1);
  --success: #34d399;
  --text: #ecfdf5;
  --text-muted: #6ee7b7;
  --text-on-primary: #ffffff;
  --border: #065f46;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 玫瑰主題 (Rose) */
[data-theme="rose"] {
  --bg: #1c1917;
  --bg-translucent: rgba(28, 25, 23, 0.9);
  --surface: #292524;
  --surface-hover: #44403c;
  --primary: #f43f5e;
  --primary-hover: #e11d48;
  --primary-glow: rgba(244, 63, 94, 0.3);
  --primary-bg: rgba(244, 63, 94, 0.1);
  --accent: #fb923c;
  --accent-hover: #f97316;
  --accent-bg: rgba(251, 146, 60, 0.1);
  --success: #4ade80;
  --text: #fef2f2;
  --text-muted: #a8a29e;
  --text-on-primary: #ffffff;
  --border: #44403c;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 琥珀主題 (Amber) */
[data-theme="amber"] {
  --bg: #1c1917;
  --bg-translucent: rgba(28, 25, 23, 0.9);
  --surface: #292524;
  --surface-hover: #44403c;
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-glow: rgba(245, 158, 11, 0.3);
  --primary-bg: rgba(245, 158, 11, 0.1);
  --accent: #ef4444;
  --accent-hover: #dc2626;
  --accent-bg: rgba(239, 68, 68, 0.1);
  --success: #22c55e;
  --text: #fefce8;
  --text-muted: #a8a29e;
  --text-on-primary: #1c1917;
  --border: #44403c;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 天藍主題 (Sky) */
[data-theme="sky"] {
  --bg: #0c4a6e;
  --bg-translucent: rgba(12, 74, 110, 0.9);
  --surface: #075985;
  --surface-hover: #0369a1;
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-glow: rgba(14, 165, 233, 0.3);
  --primary-bg: rgba(14, 165, 233, 0.1);
  --accent: #f472b6;
  --accent-hover: #ec4899;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #4ade80;
  --text: #f0f9ff;
  --text-muted: #7dd3fc;
  --text-on-primary: #ffffff;
  --border: #0369a1;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 紫羅蘭主題 (Violet) */
[data-theme="violet"] {
  --bg: #2e1065;
  --bg-translucent: rgba(46, 16, 101, 0.9);
  --surface: #4c1d95;
  --surface-hover: #5b21b6;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-glow: rgba(139, 92, 246, 0.3);
  --primary-bg: rgba(139, 92, 246, 0.1);
  --accent: #ec4899;
  --accent-hover: #db2777;
  --accent-bg: rgba(236, 72, 153, 0.1);
  --success: #34d399;
  --text: #f5f3ff;
  --text-muted: #c4b5fd;
  --text-on-primary: #ffffff;
  --border: #5b21b6;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 淡藍主題 (Light Blue) */
[data-theme="light-blue"] {
  --bg: #f0f9ff;
  --bg-translucent: rgba(240, 249, 255, 0.95);
  --surface: #e0f2fe;
  --surface-hover: #bae6fd;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.2);
  --primary-bg: rgba(2, 132, 199, 0.1);
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-bg: rgba(244, 63, 94, 0.1);
  --success: #059669;
  --text: #0c4a6e;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;
  --border: #bae6fd;
  --overlay: rgba(0, 0, 0, 0.5);
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

/* 淡紫主題 (Light Purple) */
[data-theme="light-purple"] {
  --bg: #faf5ff;
  --bg-translucent: rgba(250, 245, 255, 0.95);
  --surface: #f3e8ff;
  --surface-hover: #e9d5ff;
  --primary: #9333ea;
  --primary-hover: #7e22ce;
  --primary-glow: rgba(147, 51, 234, 0.2);
  --primary-bg: rgba(147, 51, 234, 0.1);
  --accent: #f472b6;
  --accent-hover: #ec4899;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #059669;
  --text: #4c1d95;
  --text-muted: #7c3aed;
  --text-on-primary: #ffffff;
  --border: #e9d5ff;
  --overlay: rgba(0, 0, 0, 0.5);
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

/* 粉紅主題 (Pink) */
[data-theme="pink"] {
  --bg: #1f1218;
  --bg-translucent: rgba(31, 18, 24, 0.9);
  --surface: #3d1f2e;
  --surface-hover: #5c2d44;
  --primary: #ec4899;
  --primary-hover: #db2777;
  --primary-glow: rgba(236, 72, 153, 0.3);
  --primary-bg: rgba(236, 72, 153, 0.1);
  --accent: #f472b6;
  --accent-hover: #f9a8d4;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #4ade80;
  --text: #fdf2f8;
  --text-muted: #f9a8d4;
  --text-on-primary: #ffffff;
  --border: #5c2d44;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 淡粉主題 (Light Pink) */
[data-theme="light-pink"] {
  --bg: #fdf2f8;
  --bg-translucent: rgba(253, 242, 248, 0.95);
  --surface: #fce7f3;
  --surface-hover: #fbcfe8;
  --primary: #ec4899;
  --primary-hover: #db2777;
  --primary-glow: rgba(236, 72, 153, 0.2);
  --primary-bg: rgba(236, 72, 153, 0.1);
  --accent: #f472b6;
  --accent-hover: #f9a8d4;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #059669;
  --text: #831843;
  --text-muted: #be185d;
  --text-on-primary: #ffffff;
  --border: #fbcfe8;
  --overlay: rgba(0, 0, 0, 0.5);
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

/* 青色主題 (Teal) */
[data-theme="teal"] {
  --bg: #042f2e;
  --bg-translucent: rgba(4, 47, 46, 0.9);
  --surface: #134e4a;
  --surface-hover: #115e59;
  --primary: #14b8a6;
  --primary-hover: #0d9488;
  --primary-glow: rgba(20, 184, 166, 0.3);
  --primary-bg: rgba(20, 184, 166, 0.1);
  --accent: #f472b6;
  --accent-hover: #ec4899;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #34d399;
  --text: #f0fdfa;
  --text-muted: #5eead4;
  --text-on-primary: #ffffff;
  --border: #115e59;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 青藍主題 (Cyan) */
[data-theme="cyan"] {
  --bg: #083344;
  --bg-translucent: rgba(8, 51, 68, 0.9);
  --surface: #164e63;
  --surface-hover: #155e75;
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --primary-glow: rgba(6, 182, 212, 0.3);
  --primary-bg: rgba(6, 182, 212, 0.1);
  --accent: #fbbf24;
  --accent-hover: #f59e0b;
  --accent-bg: rgba(251, 191, 36, 0.1);
  --success: #34d399;
  --text: #ecfeff;
  --text-muted: #67e8f9;
  --text-on-primary: #083344;
  --border: #155e75;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 萊姆綠主題 (Lime) */
[data-theme="lime"] {
  --bg: #1a2e05;
  --bg-translucent: rgba(26, 46, 5, 0.9);
  --surface: #365314;
  --surface-hover: #3f6212;
  --primary: #84cc16;
  --primary-hover: #65a30d;
  --primary-glow: rgba(132, 204, 22, 0.3);
  --primary-bg: rgba(132, 204, 22, 0.1);
  --accent: #f472b6;
  --accent-hover: #ec4899;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #4ade80;
  --text: #f7fee7;
  --text-muted: #bef264;
  --text-on-primary: #1a2e05;
  --border: #3f6212;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 橙色主題 (Orange) */
[data-theme="orange"] {
  --bg: #1c1917;
  --bg-translucent: rgba(28, 25, 23, 0.9);
  --surface: #292524;
  --surface-hover: #44403c;
  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-glow: rgba(249, 115, 22, 0.3);
  --primary-bg: rgba(249, 115, 22, 0.1);
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-bg: rgba(6, 182, 212, 0.1);
  --success: #22c55e;
  --text: #fff7ed;
  --text-muted: #fdba74;
  --text-on-primary: #ffffff;
  --border: #44403c;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 紅色主題 (Red) */
[data-theme="red"] {
  --bg: #1c1917;
  --bg-translucent: rgba(28, 25, 23, 0.9);
  --surface: #292524;
  --surface-hover: #44403c;
  --primary: #ef4444;
  --primary-hover: #dc2626;
  --primary-glow: rgba(239, 68, 68, 0.3);
  --primary-bg: rgba(239, 68, 68, 0.1);
  --accent: #fbbf24;
  --accent-hover: #f59e0b;
  --accent-bg: rgba(251, 191, 36, 0.1);
  --success: #22c55e;
  --text: #fef2f2;
  --text-muted: #fca5a5;
  --text-on-primary: #ffffff;
  --border: #44403c;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 石墨灰主題 (Slate) */
[data-theme="slate"] {
  --bg: #0f172a;
  --bg-translucent: rgba(15, 23, 42, 0.9);
  --surface: #1e293b;
  --surface-hover: #334155;
  --primary: #64748b;
  --primary-hover: #475569;
  --primary-glow: rgba(100, 116, 139, 0.3);
  --primary-bg: rgba(100, 116, 139, 0.1);
  --accent: #f472b6;
  --accent-hover: #ec4899;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #10b981;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-on-primary: #ffffff;
  --border: #334155;
  --overlay: rgba(0, 0, 0, 0.8);
  --hover-overlay: rgba(255, 255, 255, 0.05);
}

/* 淡綠主題 (Light Green) */
[data-theme="light-green"] {
  --bg: #f0fdf4;
  --bg-translucent: rgba(240, 253, 244, 0.95);
  --surface: #dcfce7;
  --surface-hover: #bbf7d0;
  --primary: #16a34a;
  --primary-hover: #15803d;
  --primary-glow: rgba(22, 163, 74, 0.2);
  --primary-bg: rgba(22, 163, 74, 0.1);
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-bg: rgba(244, 63, 94, 0.1);
  --success: #059669;
  --text: #14532d;
  --text-muted: #16a34a;
  --text-on-primary: #ffffff;
  --border: #bbf7d0;
  --overlay: rgba(0, 0, 0, 0.5);
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

/* 淡橙主題 (Light Orange) */
[data-theme="light-orange"] {
  --bg: #fff7ed;
  --bg-translucent: rgba(255, 247, 237, 0.95);
  --surface: #ffedd5;
  --surface-hover: #fed7aa;
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --primary-glow: rgba(234, 88, 12, 0.2);
  --primary-bg: rgba(234, 88, 12, 0.1);
  --accent: #06b6d4;
  --accent-hover: #0891b2;
  --accent-bg: rgba(6, 182, 212, 0.1);
  --success: #059669;
  --text: #7c2d12;
  --text-muted: #c2410c;
  --text-on-primary: #ffffff;
  --border: #fed7aa;
  --overlay: rgba(0, 0, 0, 0.5);
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

/* 淡青主題 (Light Cyan) */
[data-theme="light-cyan"] {
  --bg: #ecfeff;
  --bg-translucent: rgba(236, 254, 255, 0.95);
  --surface: #cffafe;
  --surface-hover: #a5f3fc;
  --primary: #0891b2;
  --primary-hover: #0e7490;
  --primary-glow: rgba(8, 145, 178, 0.2);
  --primary-bg: rgba(8, 145, 178, 0.1);
  --accent: #f472b6;
  --accent-hover: #ec4899;
  --accent-bg: rgba(244, 114, 182, 0.1);
  --success: #059669;
  --text: #164e63;
  --text-muted: #0891b2;
  --text-on-primary: #ffffff;
  --border: #a5f3fc;
  --overlay: rgba(0, 0, 0, 0.5);
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

/* 淡灰主題 (Light Gray) */
[data-theme="light-gray"] {
  --bg: #f8fafc;
  --bg-translucent: rgba(248, 250, 252, 0.95);
  --surface: #f1f5f9;
  --surface-hover: #e2e8f0;
  --primary: #475569;
  --primary-hover: #334155;
  --primary-glow: rgba(71, 85, 105, 0.2);
  --primary-bg: rgba(71, 85, 105, 0.1);
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-bg: rgba(244, 63, 94, 0.1);
  --success: #059669;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;
  --border: #e2e8f0;
  --overlay: rgba(0, 0, 0, 0.5);
  --hover-overlay: rgba(0, 0, 0, 0.05);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

/* ==================== Main Content ==================== */

.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.page {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}

.page.active {
  display: flex;
}

.page-header {
  padding: 24px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ==================== Counter Page ==================== */

.page-counter {
  justify-content: space-between;
  padding: 0;
}

.counter-display {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 60px;
}

.counter-value {
  font-size: 9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 0 60px var(--primary-glow);
}

.counter-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding-bottom: 40px;
}

.btn-add {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: var(--text-on-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 60px var(--primary-glow);
  transition: transform 0.1s, box-shadow 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-add:active {
  transform: scale(0.95);
  background: var(--primary-hover);
}

.btn-add:hover {
  box-shadow: 0 0 80px var(--primary-glow);
}

.secondary-controls {
  display: flex;
  gap: 80px;
}

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

.btn-secondary:hover {
  color: var(--text);
  background: var(--hover-overlay);
}

.btn-secondary:active {
  transform: scale(0.9);
}

/* Progress Bar */
.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--surface);
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
  transition: width 0.3s ease-out;
  width: 0%;
}

/* ==================== History Page ==================== */

.history-list {
  list-style: none;
  padding: 0 24px 100px;
}

.history-list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.history-list li:last-child {
  border-bottom: none;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item .history-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item .datetime {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.history-item .note {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.history-item .count {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.history-item .count.positive {
  color: var(--text);
}

.history-item .count.negative {
  color: var(--accent);
}

.no-history {
  color: var(--text-muted);
  text-align: center;
  padding: 60px 0 !important;
  border: none !important;
}

/* ==================== Stats Page ==================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 0 24px 100px;
}

.stat-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==================== Settings Page ==================== */

.settings-form {
  padding: 0 24px 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.form-group input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.connection-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  margin-top: 16px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  transition: background 0.3s;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

#group-id {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==================== Bottom Navigation ==================== */

.bottom-nav {
  height: 80px;
  background: var(--bg-translucent);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-btn {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.nav-btn.active {
  color: var(--primary);
  background: var(--primary-bg);
}

.nav-btn svg {
  transition: stroke-width 0.2s;
}

.nav-btn.active svg {
  stroke-width: 2.5;
}

/* ==================== Button Icon ==================== */

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: none;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--surface-hover);
}

.btn-icon.btn-danger {
  color: var(--accent);
}

.btn-icon.btn-danger:hover {
  background: var(--accent-bg);
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* ==================== Modal ==================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: 24px 24px 24px 24px;
  padding: 32px 24px;
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-cancel,
.btn-confirm {
  flex: 1;
  padding: 16px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel {
  background: var(--border);
  color: var(--text);
}

.btn-cancel:hover {
  background: var(--surface-hover);
}

.btn-confirm {
  background: var(--primary);
  color: var(--text-on-primary);
}

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

.btn-confirm.btn-danger {
  background: var(--accent);
}

.btn-confirm.btn-danger:hover {
  background: var(--accent-hover);
}

.modal-text {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}

/* Goal Modal */
.goal-content {
  text-align: center;
}

.goal-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.goal-content p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.goal-content .btn-confirm {
  width: 100%;
}

/* ==================== Responsive ==================== */

@media (max-width: 380px) {
  .counter-value {
    font-size: 7rem;
  }

  .btn-add {
    width: 140px;
    height: 140px;
  }

  .btn-add svg {
    width: 50px;
    height: 50px;
  }

  .secondary-controls {
    gap: 60px;
  }
}

/* ==================== Scrollbar ==================== */

::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ==================== No Scrollbar Utility ==================== */

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ==================== Theme Selector ==================== */

.theme-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.theme-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.theme-btn:hover {
  transform: scale(1.1);
}

.theme-btn.active {
  border-color: var(--text);
}

.theme-btn.active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
}

/* 深色主題按鈕 */
.theme-btn[data-theme="indigo"] { background: #6366f1; }
.theme-btn[data-theme="emerald"] { background: #10b981; }
.theme-btn[data-theme="rose"] { background: #f43f5e; }
.theme-btn[data-theme="amber"] { background: #f59e0b; }
.theme-btn[data-theme="sky"] { background: #0ea5e9; }
.theme-btn[data-theme="violet"] { background: #8b5cf6; }
.theme-btn[data-theme="pink"] { background: #ec4899; }
.theme-btn[data-theme="teal"] { background: #14b8a6; }
.theme-btn[data-theme="cyan"] { background: #06b6d4; }
.theme-btn[data-theme="lime"] { background: #84cc16; }
.theme-btn[data-theme="orange"] { background: #f97316; }
.theme-btn[data-theme="red"] { background: #ef4444; }
.theme-btn[data-theme="slate"] { background: #64748b; }

/* 淡色主題按鈕 */
.theme-btn[data-theme="light-blue"] {
  background: linear-gradient(135deg, #bae6fd 0%, #0284c7 100%);
}
.theme-btn[data-theme="light-purple"] {
  background: linear-gradient(135deg, #e9d5ff 0%, #9333ea 100%);
}
.theme-btn[data-theme="light-pink"] {
  background: linear-gradient(135deg, #fbcfe8 0%, #ec4899 100%);
}
.theme-btn[data-theme="light-green"] {
  background: linear-gradient(135deg, #bbf7d0 0%, #16a34a 100%);
}
.theme-btn[data-theme="light-orange"] {
  background: linear-gradient(135deg, #fed7aa 0%, #ea580c 100%);
}
.theme-btn[data-theme="light-cyan"] {
  background: linear-gradient(135deg, #a5f3fc 0%, #0891b2 100%);
}
.theme-btn[data-theme="light-gray"] {
  background: linear-gradient(135deg, #e2e8f0 0%, #475569 100%);
}

/* 淡色主題下選中按鈕的內圈顏色 */
[data-theme="light-blue"] .theme-btn.active::after,
[data-theme="light-purple"] .theme-btn.active::after,
[data-theme="light-pink"] .theme-btn.active::after,
[data-theme="light-green"] .theme-btn.active::after,
[data-theme="light-orange"] .theme-btn.active::after,
[data-theme="light-cyan"] .theme-btn.active::after,
[data-theme="light-gray"] .theme-btn.active::after {
  background: #1e293b;
}
