/* ================================================================
   BREATHETIMER v5.0 — 3-Mode Animated Background + Glassmorphism
   Color Modes: cosmos | aurora | sunrise
================================================================ */

/* ---- Font ---- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

/* ---- Shared tokens ---- */
:root {
  --accent-green:    #22c55e;
  --accent-green-dk: #16a34a;
  --accent-red:      #ef4444;
  --accent-red-dk:   #dc2626;
  --accent-warning:  #f59e0b;
  --r-full: 9999px;
  --r-xl:   24px;
  --r-lg:   16px;
  --r-md:   12px;
  --r-sm:   8px;
  --font:   'Outfit', system-ui, sans-serif;
  --ease:   0.25s ease;
  --slow:   0.4s ease;
}

/* ================================================================
   MODE 1 — COSMOS (deep violet/purple, like the reference image)
================================================================ */
[data-colormode="cosmos"] {
  --g1: #06010f;
  --g2: #3b1480;
  --g3: #130a38;
  --g4: #0d0530;
  --surface:       rgba(16, 6, 44, 0.74);
  --surface-solid: #0e041e;
  --border:        rgba(196, 160, 255, 0.16);
  --text:          #ede9ff;
  --text-muted:    #b0a0d0;
  --accent-primary: #a78bfa;
  --accent-hover:   #8b5cf6;
  --circle-fill:   rgba(167, 139, 250, 0.17);
  --circle-stroke: rgba(167, 139, 250, 0.6);
  --shadow:        0 8px 32px rgba(0,0,0,0.65);
  --glow:          0 0 60px rgba(167,139,250,0.28);
  --star-alpha:    0.8;
}

/* Floating orb overlay only in cosmos mode */
[data-colormode="cosmos"] body::before {
  content: '';
  position: fixed;
  inset: -60px;
  background:
    radial-gradient(circle 50vw at 15% 25%, rgba(167,139,250,0.35) 0%, transparent 70%),
    radial-gradient(circle 45vw at 85% 75%, rgba(139,92,246,0.3) 0%, transparent 70%),
    radial-gradient(circle 40vw at 50% 15%, rgba(20,184,166,0.2) 0%, transparent 65%),
    radial-gradient(circle 35vw at 25% 85%, rgba(236,72,153,0.18) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  filter: blur(32px);
  animation: orbDrift 14s ease-in-out infinite alternate;
}

@keyframes orbDrift {
  0%   { opacity: 0.75; transform: scale(1) translate(0, 0) rotate(0deg); }
  50%  { opacity: 0.9;  transform: scale(1.15) translate(6%, -5%) rotate(3deg); }
  100% { opacity: 1;    transform: scale(1.3) translate(-4%, 6%) rotate(-5deg); }
}

/* ================================================================
   MODE 2 — AURORA (dark teal/navy — default)
================================================================ */
[data-colormode="aurora"] {
  --g1: #05091a;
  --g2: #0b1f3e;
  --g3: #042820;
  --g4: #130b30;
  --surface:       rgba(13, 20, 40, 0.72);
  --surface-solid: #0d1428;
  --border:        rgba(148, 163, 184, 0.13);
  --text:          #f1f5f9;
  --text-muted:    #94a3b8;
  --accent-primary: #14b8a6;
  --accent-hover:   #0d9488;
  --circle-fill:   rgba(20, 184, 166, 0.14);
  --circle-stroke: rgba(20, 184, 166, 0.55);
  --shadow:        0 8px 32px rgba(0,0,0,0.55);
  --glow:          0 0 50px rgba(20,184,166,0.18);
  --star-alpha:    0.5;
}

/* ================================================================
   MODE 3 — SUNRISE (warm soft pastels — light mode)
================================================================ */
[data-colormode="sunrise"] {
  --g1: #ffecd2;
  --g2: #c2e9fb;
  --g3: #e0c3fc;
  --g4: #d4fc79;
  --surface:       rgba(255, 255, 255, 0.75);
  --surface-solid: #ffffff;
  --border:        rgba(120, 80, 200, 0.12);
  --text:          #1a1035;
  --text-muted:    #64748b;
  --accent-primary: #7c3aed;
  --accent-hover:   #6d28d9;
  --circle-fill:   rgba(124, 58, 237, 0.09);
  --circle-stroke: rgba(124, 58, 237, 0.38);
  --shadow:        0 8px 32px rgba(0,0,0,0.1);
  --glow:          0 0 40px rgba(124,58,237,0.12);
  --star-alpha:    0.12;
}

/* ================================================================
   RESET
================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ================================================================
   ANIMATED GRADIENT BODY
================================================================ */
body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: color var(--slow);
  position: relative;

  background: linear-gradient(
    -45deg,
    var(--g1), var(--g2), var(--g3), var(--g4)
  );
  background-size: 400% 400%;
  animation: auroraFlow 9s ease infinite;
}

body.anim-paused { animation-play-state: paused; }

@keyframes auroraFlow {
  0%   { background-position: 0%   50%; }
  25%  { background-position: 100% 0%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0%   100%; }
  100% { background-position: 0%   50%; }
}

/* Star canvas — sits above gradient, below everything */
#starfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Everything else stacks above stars */
.app-header, .app-main, .app-footer, .modal, .toast {
  position: relative;
  z-index: 1;
}

/* ================================================================
   HEADER
================================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.4rem;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 24px rgba(0,0,0,0.22);
  flex-wrap: wrap;
}

/* Breadcrumb — schema handled by JSON-LD, hidden visually */
.breadcrumb { display: none; }

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
  transition: opacity var(--ease);
}
.logo-link:hover { opacity: 0.82; }

.logo-text {
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, var(--text) 25%, var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-logo { color: var(--accent-primary); flex-shrink: 0; }

/* ---- Search Overlay (Expanding from Icon) ---- */
.header-search-overlay {
  position: absolute;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%) scale(1);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--glow), var(--shadow);
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 320px;
  max-width: calc(100vw - 2.8rem);
  opacity: 1;
  transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.header-search-overlay.hidden {
  opacity: 0;
  transform: translateY(-50%) scale(0.92);
  pointer-events: none;
}

.search-overlay-content {
  display: flex;
  align-items: center;
  padding: 0.38rem 0.5rem 0.38rem 0.95rem;
  position: relative;
}

.search-icon-inner {
  color: var(--text-muted);
  margin-right: 0.55rem;
  flex-shrink: 0;
}

.search-input-overlay {
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.86rem;
  outline: none;
  width: 100%;
  padding-right: 0.4rem;
}
.search-input-overlay::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.close-search-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 0.42rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--ease);
  line-height: 1;
  height: 22px;
  width: 22px;
  border-radius: 50%;
}
.close-search-btn:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: var(--shadow);
}
.search-results-dropdown[hidden] { display: none; }

.search-result-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background var(--ease);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--circle-fill); color: var(--accent-primary); }
.search-result-item .result-tag {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
  margin-bottom: 0.1rem;
}

/* ================================================================
   HEADER ICON BUTTONS — Icon + Label (vertical)
================================================================ */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  flex-shrink: 0;
}

.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--r-sm);
  width: 52px;
  height: 52px;
  padding: 5px 4px;
  transition: all var(--ease);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  color: var(--text-muted);
  transition: color var(--ease);
  line-height: 1;
}

.icon-btn:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.icon-btn:hover .btn-label { color: var(--accent-primary); }

.icon-btn.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--circle-fill);
}
.icon-btn.active .btn-label { color: var(--accent-primary); }

/* Color mode button: shows current mode badge */
.icon-btn .mode-badge {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

/* Effects active/inactive state cut-bar SVG toggles */
#anim-btn #effects-off-icon { display: none; }
#anim-btn #effects-on-icon { display: block; }
#anim-btn.active #effects-off-icon { display: block; }
#anim-btn.active #effects-on-icon { display: none; }

/* Color mode button wrapper & sub-badge style */
.color-mode-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.theme-hint-badge {
  font-size: 0.48rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.4);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-family: var(--font);
  animation: badgeGlow 2.5s ease-in-out infinite alternate;
}
@keyframes badgeGlow {
  from { box-shadow: 0 0 4px var(--accent-primary); opacity: 0.9; }
  to { box-shadow: 0 0 10px var(--accent-primary); opacity: 1; }
}

/* Bell active pulse */
.icon-btn.bell-active {
  color: var(--accent-warning);
  border-color: var(--accent-warning);
  background: rgba(245,158,11,0.1);
  animation: bellPulse 2s ease-in-out infinite;
}
.icon-btn.bell-active .btn-label { color: var(--accent-warning); }
@keyframes bellPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
  50%      { box-shadow: 0 0 0 7px rgba(245,158,11,0); }
}

/* ================================================================
   MAIN LAYOUT
================================================================ */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.25rem 3rem;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
  gap: 2rem;
}

/* ================================================================
   TIMER CIRCLE
================================================================ */
.timer-container {
  position: relative;
  width: 300px;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  cursor: pointer;
  background: var(--surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow), var(--glow);
  transition: transform var(--ease), box-shadow var(--ease);
  user-select: none;
  flex-shrink: 0;
}
.timer-container:hover {
  transform: scale(1.035);
  box-shadow: var(--shadow), 0 0 70px rgba(167,139,250,0.22);
}
.timer-container:active { transform: scale(0.965); }

/* Pulsing ring when running */
.timer-container.is-running::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  animation: ringPulse 2.2s ease-out infinite;
  pointer-events: none;
}

/* Second outer ring for extra drama */
.timer-container.is-running::before {
  content: '';
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  border: 1px solid var(--accent-primary);
  animation: ringPulse 2.2s ease-out 0.7s infinite;
  pointer-events: none;
  opacity: 0.5;
}

/* Container glow pulses when running */
.timer-container.is-running {
  animation: containerGlow 3s ease-in-out infinite alternate;
}
@keyframes containerGlow {
  from { box-shadow: var(--shadow), 0 0 65px var(--circle-stroke); }
  to   { box-shadow: var(--shadow), 0 0 145px var(--circle-stroke), 0 0 240px var(--circle-fill); }
}
@keyframes ringPulse {
  0%   { opacity: 0.95; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1.25); }
}

.circle-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  overflow: hidden;
}

.breathing-circle {
  position: absolute;
  width: 48%;
  height: 48%;
  border-radius: 50%;
  background: var(--circle-fill);
  border: 2px solid var(--circle-stroke);
  transition: transform 1s linear;
  box-shadow:
    0 0 65px var(--circle-fill),
    0 0 110px var(--circle-fill),
    0 0 160px rgba(167,139,250,0.22),
    inset 0 0 45px var(--circle-fill);
}

.timer-content {
  position: absolute;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  padding: 0 1rem;
}

#phase-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 0.2rem;
}

#countdown-text {
  font-size: 4rem;
  font-weight: 300;
  line-height: 1;
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

#instruction-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 170px;
  margin: 0 auto;
  line-height: 1.4;
}

.timer-click-hint {
  position: absolute;
  bottom: 20px;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.5;
  letter-spacing: 0.4px;
  pointer-events: none;
  z-index: 3;
}
.timer-container.is-running .timer-click-hint { opacity: 0.25; }

/* ================================================================
   QUICK CONFIG — always 2 columns
================================================================ */
.quick-config-panel { width: 100%; }

.quick-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

/* ================================================================
   SETTINGS CARDS
================================================================ */
.settings-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.settings-card h3,
.settings-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
  color: var(--accent-primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.42rem;
}

.settings-section { margin-bottom: 0.8rem; }
.settings-section:last-child { margin-bottom: 0; }

.settings-section > label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

select, input[type="number"] {
  width: 100%;
  padding: 0.58rem 0.85rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  backdrop-filter: blur(6px);
  transition: border-color var(--ease), box-shadow var(--ease);
  appearance: auto;
}
select:focus, input[type="number"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--circle-fill);
}

.custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.input-group { display: flex; flex-direction: column; gap: 0.25rem; }
.input-group label { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 0; }

.radio-group { display: flex; flex-direction: column; gap: 0.6rem; }
.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 0;
}
.radio-group input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* ================================================================
   CONTROLS
================================================================ */
.controls-container {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  font-family: var(--font);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: var(--r-full);
  padding: 0.78rem 2.2rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow var(--ease), opacity var(--ease);
}
button:active   { transform: scale(0.95); }
button:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }

.primary-btn {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.primary-btn:hover:not(:disabled) {
  box-shadow: 0 6px 28px rgba(0,0,0,0.35);
  transform: translateY(-2px);
}

.secondary-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.secondary-btn:hover:not(:disabled) { border-color: var(--accent-primary); transform: translateY(-2px); }

/* Stop Button Custom Styling (Crimson Red / High Contrast Visibility) */
#stop-btn {
  background: rgba(239, 68, 68, 0.05);
  border: 1.5px solid rgba(239, 68, 68, 0.35);
  color: rgba(239, 68, 68, 0.7);
  font-weight: 700;
  transition: all 0.25s ease;
}
#stop-btn:disabled {
  opacity: 0.35;
  background: rgba(239, 68, 68, 0.02);
  border-color: rgba(239, 68, 68, 0.18);
  color: rgba(239, 68, 68, 0.4);
}
#stop-btn:not(:disabled) {
  background: rgba(239, 68, 68, 0.16) !important;
  border-color: var(--accent-red) !important;
  color: #fff !important;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.35);
  animation: pulseStopBtn 2.5s infinite;
}
#stop-btn:hover:not(:disabled) {
  background: var(--accent-red) !important;
  border-color: var(--accent-red-dk) !important;
  color: #fff !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.65) !important;
  transform: translateY(-2px);
}

@keyframes pulseStopBtn {
  0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 22px rgba(239, 68, 68, 0.55), border-color: var(--accent-red-dk); }
}

.tertiary-btn {
  background: rgba(245,158,11,0.12);
  color: var(--accent-warning);
  border: 1px solid rgba(245,158,11,0.28);
}
.tertiary-btn:hover:not(:disabled) { background: rgba(245,158,11,0.22); transform: translateY(-2px); }

/* ================================================================
   PROGRESS
================================================================ */
.progress-container {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.92rem;
  color: var(--text-muted);
}

#round-tracker, #time-tracker {
  background: var(--surface);
  backdrop-filter: blur(8px);
  padding: 0.42rem 1.1rem;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 500;
}

/* ================================================================
   VOICE PANEL
================================================================ */
.settings-panel { width: 100%; }
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* ================================================================
   ON / OFF BUTTONS  (fully rebuilt — NO checkbox/slider)
================================================================ */
.toggles {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.toggle-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
}

/* The pill button */
.onoff-btn {
  position: relative;
  width: 80px;
  height: 34px;
  border-radius: 17px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  overflow: hidden;
  flex-shrink: 0;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Sliding knob */
.onoff-knob {
  position: absolute;
  top: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.28);
  transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}

/* Label inside */
.onoff-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: white;
  z-index: 1;
  pointer-events: none;
  transition: left 0.3s ease, right 0.3s ease;
}

/* === ON state === Green, knob on right */
.onoff-btn[data-state="on"] {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 0 18px rgba(34,197,94,0.5);
}
.onoff-btn[data-state="on"] .onoff-knob { left: calc(100% - 29px); }
.onoff-btn[data-state="on"] .onoff-text { left: 10px; }

/* === OFF state === Red, knob on left */
.onoff-btn[data-state="off"] {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 14px rgba(239,68,68,0.45);
}
.onoff-btn[data-state="off"] .onoff-knob { left: 5px; }
.onoff-btn[data-state="off"] .onoff-text { right: 8px; left: auto; }

/* Hover glow */
.onoff-btn:hover {
  filter: brightness(1.1);
}

/* ================================================================
   VOICE SLIDERS
================================================================ */
.voice-sliders {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.slider-group { display: flex; flex-direction: column; gap: 0.38rem; }
.slider-label { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-muted); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  transition: transform 0.1s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.3); }
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

/* ================================================================
   RELATED CONTENT
================================================================ */
.related-content { width: 100%; }

.section-title { font-size: 1.45rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text); }
.section-desc  { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.2rem; line-height: 1.6; }

.related-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 0.9rem;
}

.related-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: var(--text);
  transition: all var(--ease);
  box-shadow: var(--shadow);
}
.related-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow), 0 0 22px rgba(0,0,0,0.15);
}

.related-icon { font-size: 1.5rem; flex-shrink: 0; }
.related-info strong { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 0.15rem; }
.related-info span   { font-size: 0.76rem; color: var(--text-muted); }

/* ================================================================
   FAQ ACCORDION
================================================================ */
.faq-section { width: 100%; }

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.faq-item {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--ease);
}
.faq-item.open { border-color: rgba(167,139,250,0.38); }
[data-colormode="aurora"] .faq-item.open { border-color: rgba(20,184,166,0.42); }
[data-colormode="sunrise"] .faq-item.open { border-color: rgba(124,58,237,0.35); }

.faq-question {
  width: 100%;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0.95rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
  gap: 0.75rem;
}
.faq-question:hover      { color: var(--accent-primary); background: var(--circle-fill); }
.faq-item.open .faq-question { color: var(--accent-primary); }

/* Chevron */
.faq-chevron { display: inline-flex; width: 20px; height: 20px; flex-shrink: 0; position: relative; }
.faq-chevron::before, .faq-chevron::after {
  content: '';
  position: absolute;
  top: 50%;
  height: 2px; width: 9px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.faq-chevron::before { left: 1px;  transform: translateY(-50%) rotate(45deg); }
.faq-chevron::after  { right: 1px; transform: translateY(-50%) rotate(-45deg); }
.faq-item.open .faq-chevron::before { transform: translateY(-50%) rotate(-45deg); }
.faq-item.open .faq-chevron::after  { transform: translateY(-50%) rotate(45deg); }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 1.1rem;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1), padding 0.35s ease;
}
.faq-item.open .faq-answer { max-height: 450px; padding-bottom: 1rem; }

.faq-answer p       { color: var(--text-muted); font-size: 0.9rem; line-height: 1.72; }
.faq-answer strong  { color: var(--text); }

/* ================================================================
   MODAL
================================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(7px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity var(--ease);
}
.modal.hidden { opacity: 0; pointer-events: none; }

.modal-content {
  background: var(--surface-solid);
  border-radius: var(--r-xl);
  padding: 2rem;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transform: translateY(0);
  transition: transform var(--ease);
}
.modal.hidden .modal-content { transform: translateY(22px); }

/* Onboarding Modal Styles */
.onboarding-content {
  max-width: 500px;
  width: 95%;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  padding: 2.2rem;
  border-radius: var(--r-xl);
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  max-height: 90vh;
  overflow-y: auto;
}
.onboarding-title {
  font-size: 1.45rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.onboarding-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.onboarding-features {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.8rem;
}
.feature-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.8rem;
  background: var(--circle-fill);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: transform 0.25s ease;
}
.feature-item:hover {
  transform: translateX(4px);
  border-color: var(--accent-primary);
}
.feature-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--surface);
  border-radius: 50%;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.feature-details h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.feature-details p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.onboarding-footer {
  display: flex;
  justify-content: center;
}
.onboarding-btn {
  width: 100%;
  padding: 0.9rem;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  box-shadow: 0 0 20px var(--circle-stroke);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.4rem;
}
.modal-header h2 { font-size: 1.22rem; font-weight: 700; color: var(--text); }

.modal-header .icon-btn {
  border: none; font-size: 1.4rem; padding: 0.2rem;
  width: auto; height: auto; border-radius: var(--r-sm);
  flex-direction: row; gap: 0;
}

.stats-summary { display: flex; gap: 1rem; margin-bottom: 1.25rem; }

.stat-box {
  background: var(--circle-fill);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--r-md);
  text-align: center;
  flex: 1;
}
.stat-box span  { display: block; font-size: 2rem; font-weight: 700; color: var(--accent-primary); }
.stat-box label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.2rem; display: block; }

/* Stats Analysis Grid */
.stats-analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 0.8rem;
}
.analysis-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 0.85rem 1rem;
  border-radius: var(--r-md);
  text-align: left;
}
.analysis-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}
.analysis-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1.2;
}
.analysis-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.history-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.history-list li {
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  align-items: center;
  color: var(--text);
}
.history-list li:last-child { border-bottom: none; }

/* Weekly Activity Tracker Bubble */
.tracker-day-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  max-width: 44px;
}
.tracker-day-bubble.active {
  background: linear-gradient(135deg, var(--circle-stroke, var(--accent-primary)), var(--accent-primary));
  border: 1px solid var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 8px var(--circle-stroke);
  font-weight: 800;
}
.tracker-day-bubble.today {
  border: 1.5px solid var(--accent-primary);
}
.tracker-day-bubble.today:not(.active) {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  animation: pulseActiveBorder 2.5s infinite;
}
.tracker-day-bubble .day-label {
  font-size: 0.52rem;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  margin-bottom: 2px;
  opacity: 0.75;
}
.tracker-day-bubble.active .day-label {
  opacity: 0.95;
  color: rgba(255, 255, 255, 0.9);
}
.tracker-day-bubble .day-num {
  font-size: 0.82rem;
}
@keyframes pulseActiveBorder {
  0%, 100% { border-color: rgba(255, 255, 255, 0.2); }
  50% { border-color: var(--accent-primary); }
}

/* Preset breakdown styling */
.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-md);
}
.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}
.breakdown-name {
  font-weight: 600;
  color: var(--text);
}
.breakdown-time {
  color: var(--text-muted);
  font-size: 0.74rem;
}
.breakdown-bar-bg {
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.breakdown-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--circle-stroke, var(--accent-primary)), var(--accent-primary));
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

/* Weekly difference styles */
.analysis-weekly-diff {
  font-size: 0.72rem;
  margin-top: 0.2rem;
  font-weight: 500;
}
.analysis-weekly-diff.positive {
  color: #10b981;
}
.analysis-weekly-diff.negative {
  color: #f43f5e;
}

/* Red alert keyframe */
@keyframes pulseRed {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.8)); }
}

/* ================================================================
   TOAST
================================================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 1.6rem;
  border-radius: var(--r-full);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 1001;
  backdrop-filter: blur(12px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}
.toast[hidden] {
  opacity: 0;
  transform: translateX(-50%) translateY(16px);
  pointer-events: none;
  display: block !important;
}

/* ================================================================
   FOOTER
================================================================ */
.app-footer {
  padding: 2rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-top: auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color var(--ease);
}
.footer-links a:hover { color: var(--accent-primary); }

.copyright-note { font-size: 0.83rem; color: var(--text); margin-bottom: 0.45rem; font-weight: 500; }
.copyright-note a { color: var(--accent-primary); text-decoration: none; }
.copyright-note a:hover { text-decoration: underline; }
.privacy-note { font-size: 0.75rem; color: var(--text-muted); max-width: 600px; margin: 0 auto; line-height: 1.5; }

/* ================================================================
   STATIC PAGES
================================================================ */
.page-container {
  max-width: 820px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex: 1;
}

.page-container h1 { margin-bottom: 1.4rem; color: var(--accent-primary); font-size: 1.9rem; font-weight: 700; border-bottom: 2px solid var(--border); padding-bottom: 0.7rem; }
.page-container h2 { margin: 1.8rem 0 0.9rem; font-size: 1.2rem; font-weight: 600; color: var(--text); }
.page-container p  { margin-bottom: 1rem; line-height: 1.72; color: var(--text-muted); font-size: 0.94rem; }
.page-container ul, .page-container ol { margin: 0 0 1.2rem 1.5rem; color: var(--text-muted); line-height: 1.7; }
.page-container li { margin-bottom: 0.45rem; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform var(--ease);
}
.back-link:hover { transform: translateX(-4px); text-decoration: underline; }

/* ================================================================
   FAQ PAGE (faq.html)
================================================================ */
.faq-page-main {
  flex: 1;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.faq-page-hero { text-align: center; padding: 1rem 1rem 0.5rem; }
.faq-page-hero h1 {
  font-size: 2.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text) 25%, var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.65rem;
  line-height: 1.2;
}
.faq-page-hero p { font-size: 0.95rem; color: var(--text-muted); line-height: 1.65; max-width: 560px; margin: 0 auto; }

.faq-category-tabs { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.faq-tab {
  padding: 0.5rem 1.2rem;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease);
  backdrop-filter: blur(8px);
}
.faq-tab:hover, .faq-tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.faq-page-block {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.faq-page-block h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.faq-cta {
  text-align: center;
  padding: 1.5rem;
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}
.faq-cta h2 { font-size: 1.3rem; margin-bottom: 0.6rem; color: var(--text); }
.faq-cta p  { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.2rem; }

/* ================================================================
   UTILITIES
================================================================ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-center { text-align: center; }

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 640px) {
  .app-header { padding: 0.65rem 1rem; gap: 0.4rem; flex-wrap: wrap; }

  .header-search-overlay {
    right: 1rem;
    width: 290px;
  }

  .logo-text { font-size: 1.1rem; }

  .icon-btn { width: 46px; height: 46px; }
  .btn-label { font-size: 0.5rem; }

  .app-main { padding: 1.5rem 1rem 2.5rem; gap: 1.4rem; }

  .timer-container { width: 255px; height: 255px; }
  #countdown-text  { font-size: 3.4rem; }
  #phase-text      { font-size: 1rem; letter-spacing: 2px; }

  .quick-config-grid { grid-template-columns: 1fr; }
  .related-cards     { grid-template-columns: 1fr 1fr; }

  button { padding: 0.7rem 1.8rem; font-size: 0.92rem; }
  .page-container { margin: 1rem; padding: 1.5rem; }
  .faq-page-main  { padding: 1.5rem 1rem 2.5rem; }
  .faq-page-hero h1 { font-size: 1.65rem; }
}

@media (max-width: 380px) {
  .related-cards  { grid-template-columns: 1fr; }
  .timer-container { width: 225px; height: 225px; }
  #countdown-text  { font-size: 3rem; }
  .header-controls { gap: 0.2rem; }
  .icon-btn { width: 40px; height: 40px; }
}
