/* ============================================================
   Deep Focus Studio - Main Stylesheet
   A neuroscience-backed productivity focus tool
   ============================================================ */

/* -------------------------------------------------------
   1. CSS Variables / Design Tokens
   ------------------------------------------------------- */
:root {
  --genre-bg: 10, 10, 25;
  --bg-primary: #06060b;
  --bg-secondary: rgba(12, 12, 20, 0.4);
  --bg-tertiary: rgba(20, 20, 35, 0.3);
  --bg-glass: rgba(15, 15, 25, 0.35);
  --text-primary: #e8e8ec;
  --text-secondary: #9090a0;
  --text-muted: #606070;
  --accent: #6366f1;
  --accent-dim: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --success: #10b981;
  --warning: #f59e0b;
  --border: rgba(255, 255, 255, 0.06);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* -------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #030308;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

input, textarea, button, select {
  font: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

/* Ultra-responsive buttons — desktop-like instant feedback */
button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
button:active { transition: none !important; }

/* -------------------------------------------------------
   3. Custom Scrollbar
   ------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}

/* -------------------------------------------------------
   4. Animated Background
   ------------------------------------------------------- */
.bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(135deg, #06060b 0%, #0f0a1e 25%, #0a0e1f 50%, #100a20 75%, #06060b 100%);
  background-size: 400% 400%;
  animation: bgShift 30s ease infinite;
  transition: background 4s ease;
}

/* Genre-reactive background overlay — updates via CSS var set by JS */
.bg-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(var(--genre-bg), 0.22) 0%,
    rgba(var(--genre-bg), 0.08) 45%,
    transparent 70%);
  transition: background 3s ease;
  pointer-events: none;
  z-index: 0;
}

/* More vivid overlay on focus screen */
body:has(#screen-focus.active) .bg-canvas::before {
  background: radial-gradient(ellipse at 50% 50%,
    rgba(var(--genre-bg), 0.35) 0%,
    rgba(var(--genre-bg), 0.15) 50%,
    transparent 72%);
}

.bg-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.bg-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  pointer-events: none;
}

/* -------------------------------------------------------
   4b. Screen Visibility System
   ------------------------------------------------------- */
.screen {
  display: none;
  min-height: 100vh;
  width: 100%;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}
.screen.active {
  display: flex;
}

/* -------------------------------------------------------
   5. Welcome / Intent Screen
   ------------------------------------------------------- */
#screen-welcome {
  justify-content: center;
  min-height: 100vh;
  animation: fadeIn 0.8s ease;
}

#screen-welcome h1 {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.goal-input {
  width: 100%;
  max-width: 520px;
  font-size: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: rgba(15, 15, 25, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.3s ease;
  resize: none;
  overflow: hidden;
}

.goal-input::placeholder { color: var(--text-muted); }
.goal-input:focus { border-color: var(--accent); }

/* Preset grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 520px;
  width: 100%;
  margin: 2rem 0;
}

.preset-card {
  background: rgba(12, 12, 20, 0.3);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.preset-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1);
}

.preset-card.active,
.preset-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.preset-card .icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.preset-card .title { font-weight: 600; margin-bottom: 0.25rem; }
.preset-card .subtitle { font-size: 0.85rem; color: var(--text-secondary); }
.preset-card .time { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }

/* Timer presets */
.timer-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1.5rem 0;
}

.timer-preset-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  background: rgba(12, 12, 20, 0.25);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.timer-preset-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.timer-preset-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Welcome screen section label hint */
.section-label-opt {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 0.4rem;
  text-transform: none;
}

/* Welcome track picker — genre tabs */
.welcome-track-genres {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 0.5rem;
}

.welcome-genre-tab {
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.welcome-genre-tab:hover { color: var(--text-primary); border-color: var(--accent); }

.welcome-genre-tab.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}

/* Welcome track list */
.welcome-track-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  padding-right: 2px;
}

.welcome-track-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.welcome-track-item:hover {
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.07);
}

.welcome-track-item.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: var(--accent);
  color: var(--text-primary);
}

.welcome-track-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.welcome-track-genre-badge {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Neural / binaural preset — collapsible on welcome screen */
.welcome-preset-details {
  margin-bottom: 1.5rem;
}

.welcome-preset-summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-muted);
  list-style: none;
  padding: 0.3rem 0;
  user-select: none;
}

.welcome-preset-summary::-webkit-details-marker { display: none; }

.welcome-preset-summary:hover { color: var(--text-secondary); }

.welcome-preset-details[open] .welcome-preset-summary { color: var(--text-secondary); }

/* Smaller preset cards inside the collapsed section */
.welcome-preset-details .preset-card {
  padding: 0.6rem 0.75rem;
}

.welcome-preset-details .preset-name { font-size: 0.82rem; }
.welcome-preset-details .preset-desc { font-size: 0.72rem; }

/* Begin button */
.btn-begin {
  margin-top: 2rem;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-xl);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-begin:hover {
  transform: scale(1.03);
  box-shadow: 0 0 30px var(--accent-glow);
}

.btn-begin.ready { animation: pulse 2s ease-in-out infinite; }

/* -------------------------------------------------------
   6. Main Focus Screen
   ------------------------------------------------------- */
#screen-focus {
  justify-content: flex-start;
  overflow-y: auto;
  padding-top: 1rem;
  animation: fadeIn 0.5s ease;
}

/* Nav tabs */
.nav-tabs {
  display: flex;
  gap: 0.25rem;
  background: rgba(12, 12, 20, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 0.25rem;
  width: fit-content;
  margin: 0 auto 2rem;
}

.nav-tab {
  padding: 0.5rem 1.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-tab:hover { color: var(--text-primary); }
.nav-tab.active {
  background: var(--accent);
  color: #fff;
}

/* Timer */
.timer-section {
  text-align: center;
  padding: 2rem 0;
  background: rgba(8, 8, 15, 0.5);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

.timer-display {
  font-size: 5rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  text-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

.timer-mode-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.timer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.timer-progress {
  width: 100%;
  max-width: 300px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  margin: 1rem auto 0;
  overflow: hidden;
}

.timer-progress .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s linear;
}

/* Session goal */
.session-goal {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  font-style: italic;
}

/* -------------------------------------------------------
   7. Audio Controls Grid
   ------------------------------------------------------- */
.audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.audio-card {
  background: rgba(12, 12, 20, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: border-color 0.3s ease;
}

.audio-card:hover { border-color: rgba(99, 102, 241, 0.15); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(20, 20, 35, 0.4);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s ease;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform 0.3s ease, background 0.3s ease;
}

.toggle-switch.active { background: var(--accent); }
.toggle-switch.active::after {
  transform: translateX(20px);
  background: #fff;
}

/* Brain states */
.brain-states {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.state-btn {
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: all 0.3s ease;
}

.state-btn:hover { border-color: var(--accent); }
.state-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
}

.state-btn .freq {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.state-btn .desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Sliders */
.slider-group {
  margin-bottom: 0.75rem;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

/* Range input styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(20, 20, 35, 0.3);
  border-radius: 3px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  cursor: pointer;
  transition: box-shadow 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 10px var(--accent-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
}

/* Nature types - horizontal scroll pills */
.nature-types {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.nature-types::-webkit-scrollbar { display: none; }

.nature-btn {
  flex-shrink: 0;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--bg-tertiary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.nature-btn:hover { color: var(--text-primary); border-color: var(--accent); }
.nature-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* EDM presets */
.edm-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.preset-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.preset-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* -------------------------------------------------------
   8. Master Section & Visualizer
   ------------------------------------------------------- */
.master-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: rgba(12, 12, 20, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.master-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.master-btn:hover { transform: scale(1.07); box-shadow: 0 0 20px var(--accent-glow); }
.master-btn.playing { background: var(--success); }
.master-btn.playing:hover { box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }

.visualizer {
  flex: 1;
  height: 60px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.viz-bar {
  flex: 1;
  min-width: 3px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transition: height 0.15s ease;
  animation: barPulse 1.2s ease-in-out infinite alternate;
}

.viz-bar:nth-child(2n) { animation-delay: 0.15s; }
.viz-bar:nth-child(3n) { animation-delay: 0.3s; }
.viz-bar:nth-child(5n) { animation-delay: 0.45s; }

/* -------------------------------------------------------
   9. Tasks Section
   ------------------------------------------------------- */
.tasks-section {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.task-input {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.task-input input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-primary);
  transition: border-color 0.3s ease;
}

.task-input input:focus { border-color: var(--accent); }

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background 0.3s ease;
}

.task-item:hover { background: rgba(255, 255, 255, 0.03); }

.task-item input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.task-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-item input[type="checkbox"]:checked::after {
  content: "\2713";
  position: absolute;
  top: -1px;
  left: 2px;
  font-size: 0.75rem;
  color: #fff;
}

.task-item .task-text { flex: 1; font-size: 0.9rem; }

.task-item.done .task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-item .delete-btn {
  opacity: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.task-item:hover .delete-btn { opacity: 1; }
.task-item .delete-btn:hover { color: #ef4444; }

/* Session notes */
.session-notes {
  width: 100%;
  min-height: 60px;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  resize: vertical;
  transition: border-color 0.3s ease;
  margin-bottom: 1.5rem;
}

.session-notes:focus { border-color: var(--accent); }

/* Shortcuts hint */
.shortcuts-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 1rem 0;
}

.shortcuts-hint span,
.shortcuts-hint kbd {
  padding: 0.15rem 0.4rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: inherit;
}

/* -------------------------------------------------------
   10. Breathing Exercise Overlay
   ------------------------------------------------------- */
.breathing-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 11, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: fadeIn 0.5s ease;
}

.breathing-overlay.active {
  display: flex;
}

.breathing-circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.breathing-circle.inhale { animation: breatheIn 4s ease-in-out forwards; }
.breathing-circle.hold { transform: scale(1.5); }
.breathing-circle.exhale { animation: breatheOut 4s ease-in-out forwards; }

.breathing-text {
  font-size: 1.25rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.breathing-skip {
  position: absolute;
  bottom: 2rem;
  padding: 0.5rem 1.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.breathing-skip:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* -------------------------------------------------------
   11. Session Complete Screen
   ------------------------------------------------------- */
#screen-complete {
  justify-content: center;
  text-align: center;
  animation: fadeIn 0.6s ease;
  overflow: hidden;
}

#screen-complete h2 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--success), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Confetti particles */
#screen-complete::before,
#screen-complete::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
}

#screen-complete::before {
  background: var(--accent);
  animation: confetti 3s ease-out 0.2s forwards;
  top: 0;
  left: 30%;
}

#screen-complete::after {
  background: var(--success);
  animation: confetti 3.5s ease-out 0.5s forwards;
  top: 0;
  left: 60%;
}

.stats-summary {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
  justify-content: center;
}

.stats-summary .stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  min-width: 120px;
}

.stats-summary .stat-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stats-summary .stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#screen-complete textarea {
  width: 100%;
  max-width: 480px;
  min-height: 80px;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  resize: vertical;
  margin-bottom: 1.5rem;
}

#screen-complete .actions,
#screen-complete .complete-actions {
  display: flex;
  gap: 1rem;
}

/* -------------------------------------------------------
   12. Dashboard Screen
   ------------------------------------------------------- */
#screen-dashboard {
  animation: fadeIn 0.5s ease;
}

.stats-overview {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stats-overview .stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.stats-overview .stat-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stats-overview .stat-card .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Chart */
.chart-container {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.chart-container h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  height: 160px;
}

.chart-bar {
  flex: 1;
  background: linear-gradient(to top, var(--accent-dim), var(--accent));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.6s ease;
  position: relative;
}

.chart-label {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.3s ease;
}

.history-item:hover { border-color: rgba(255, 255, 255, 0.1); }
.history-item .date { font-size: 0.8rem; color: var(--text-muted); min-width: 90px; }
.history-item .duration { font-weight: 600; min-width: 60px; }
.history-item .goal { flex: 1; color: var(--text-secondary); font-size: 0.9rem; }
.history-item .tags { display: flex; gap: 0.35rem; }

.export-btn {
  margin-top: 1.5rem;
}

/* -------------------------------------------------------
   13. Common Buttons
   ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

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

.btn-primary:hover { background: var(--accent-dim); box-shadow: 0 0 20px var(--accent-glow); }

.btn-secondary {
  background: rgba(20, 20, 35, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-icon:hover { color: var(--text-primary); border-color: var(--accent); }

/* -------------------------------------------------------
   14. Badge, Modal, Toast, Tooltip
   ------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 6, 11, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.modal {
  position: fixed;
  z-index: 201;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: slideUp 0.3s ease;
}

.modal-content {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  min-width: 320px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}

/* Upload genre modal */
.upload-genre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.upload-genre-btn {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}
.upload-genre-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}
.upload-genre-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.upload-genre-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Toast */
.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  padding: 0.75rem 1.25rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tooltip:hover::after { opacity: 1; }

/* -------------------------------------------------------
   15. Focus Ring / Accessibility
   ------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible,
.btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* -------------------------------------------------------
   16. Utility: animate-in
   ------------------------------------------------------- */
.animate-in {
  animation: slideUp 0.4s ease both;
}

/* -------------------------------------------------------
   16b. Missing Class Definitions
   ------------------------------------------------------- */

/* Welcome screen layout */
.welcome-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.welcome-header {
  text-align: center;
  margin-bottom: 2rem;
}

.app-title {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.tip-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(12, 12, 20, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  width: 100%;
  max-width: 520px;
}

.tip-card svg {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 2px;
}

.goal-section {
  width: 100%;
  max-width: 520px;
  margin-bottom: 1.5rem;
}

.goal-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.preset-icon {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.preset-info {}

.preset-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.preset-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Focus screen layout */
.focus-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card-icon {
  display: inline;
  vertical-align: middle;
  margin-right: 0.35rem;
}

.card-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Task input row (HTML uses .task-input-row + .task-input as separate elements) */
.task-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.task-input-row .task-input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-primary);
  transition: border-color 0.3s ease;
}

.task-input-row .task-input:focus {
  border-color: var(--accent);
}

.task-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.task-remove {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: opacity 0.3s ease, color 0.3s ease;
  padding: 0.25rem;
}

.task-item:hover .task-remove {
  opacity: 1;
}

.task-remove:hover {
  color: #ef4444;
}

/* Small button variant */
.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

/* Music Centre */
.music-centre {
  grid-column: 1 / -1; /* span full width */
}

.genre-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.section-sublabel {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.section-sublabel:first-of-type {
  margin-top: 0;
}

/* Music preset buttons */
.music-preset-btn {
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: var(--bg-tertiary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.music-preset-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.music-preset-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Arp pattern buttons */
.arp-pattern-grid {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.arp-pattern-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.arp-pattern-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.arp-pattern-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.param-select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  cursor: pointer;
  outline: none;
}

.param-select:focus {
  border-color: var(--accent);
}

.key-select-row {
  width: 100%;
}

.melody-style-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.melody-style-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.melody-style-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.arp-pattern-btns {
  display: flex;
  gap: 0.4rem;
}

.arp-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
}

.arp-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.arp-btn.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* Master volume row */
.master-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.master-volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.vol-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Notes section */
.notes-section {
  margin-bottom: 1.5rem;
}

/* Notice row */
.notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.notice svg {
  flex-shrink: 0;
}

/* Breathing overlay content */
.breathing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Session Complete screen */
.complete-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(8, 8, 15, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.06);
}

.complete-header {
  text-align: center;
  margin-bottom: 2rem;
}

.complete-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.complete-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.complete-stat {
  background: rgba(15, 15, 25, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  text-align: center;
  min-width: 140px;
}

.complete-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.complete-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.complete-goal-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.complete-goal-label {
  font-weight: 600;
  color: var(--text-muted);
}

.complete-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Dashboard screen */
.dashboard-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  background: rgba(8, 8, 15, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.06);
}

.dashboard-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.stat-card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Gamification Hero */
.gamification-hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.daily-goal-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.goal-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.goal-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 8;
}

.goal-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.goal-ring-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.goal-ring-percent {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.level-info {
  flex: 1;
}

.rank-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  color: #fff;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.level-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.xp-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent), #818cf8);
  border-radius: 4px;
  transition: width 1s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

.xp-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.total-xp-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Achievements */
.achievements-section {
  margin-bottom: 2rem;
}

.achievements-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.achievements-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
}

.achievement-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.85rem 0.5rem;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  transition: transform 0.2s, border-color 0.3s;
  cursor: default;
}

.achievement-card.unlocked {
  border-color: rgba(99, 102, 241, 0.3);
}

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

.achievement-card.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

.achievement-icon {
  font-size: 1.6rem;
}

.achievement-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

/* Chart section */
.chart-section {
  margin-bottom: 2rem;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Timer progress track (the outer track) */
.timer-progress-track {
  width: 100%;
  max-width: 300px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  margin: 1rem auto 0;
  overflow: hidden;
}

.timer-progress-track .timer-progress {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s linear;
}

/* History section */
.history-section {
  margin-bottom: 2rem;
}

.history-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-duration {
  font-weight: 600;
}

.history-goal {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.preset-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-size: 0.9rem;
}

.btn-export {
  margin-top: 1.5rem;
}

/* Zen mode */
.zen-mode .nav-tabs,
.zen-mode .shortcuts-hint,
.zen-mode .notes-section,
.zen-mode .notice {
  display: none !important;
}

/* Theme variants */
.theme-theta .bg-canvas {
  background: linear-gradient(135deg, #060810 0%, #0a1828 25%, #06101c 50%, #0a1828 75%, #060810 100%);
  background-size: 400% 400%;
  animation: bgShift 30s ease infinite;
}

.theme-alpha .bg-canvas {
  background: linear-gradient(135deg, #06060e 0%, #100c22 25%, #0a0e24 50%, #120c26 75%, #06060e 100%);
  background-size: 400% 400%;
  animation: bgShift 30s ease infinite;
}

.theme-beta .bg-canvas {
  background: linear-gradient(135deg, #070608 0%, #1c0e08 25%, #0e1808 50%, #1c0e08 75%, #070608 100%);
  background-size: 400% 400%;
  animation: bgShift 30s ease infinite;
}

.theme-gamma .bg-canvas {
  background: linear-gradient(135deg, #060608 0%, #1c081c 25%, #22081a 50%, #1c081c 75%, #060608 100%);
  background-size: 400% 400%;
  animation: bgShift 30s ease infinite;
}

/* Mood Grid */
.mood-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  background: var(--bg-tertiary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.mood-btn:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
}

.mood-btn.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.mood-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.mood-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mood-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Genre details (collapsible) */
.genre-details {
  margin-bottom: 1rem;
}

.genre-summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.genre-summary::-webkit-details-marker {
  display: none;
}

.genre-summary::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}

.genre-details[open] .genre-summary::before {
  transform: rotate(45deg);
}

.genre-details[open] .genre-grid,
.genre-details[open] .slider-group {
  animation: slideUp 0.3s ease;
}

/* Regenerate button */
.btn-regenerate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-regenerate:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-regenerate svg {
  transition: transform 0.3s;
}

.btn-regenerate:hover svg {
  transform: rotate(180deg);
}

/* -------------------------------------------------------
   17. Keyframe Animations
   ------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes breatheIn {
  from { transform: scale(1); }
  to { transform: scale(1.5); }
}

@keyframes breatheOut {
  from { transform: scale(1.5); }
  to { transform: scale(1); }
}

@keyframes confetti {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}

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

@keyframes barPulse {
  0% { height: 15%; }
  100% { height: 85%; }
}

/* -------------------------------------------------------
   FOCUS SESSION - Immersive Layout
   ------------------------------------------------------- */

/* Top bar - minimal, translucent */
.focus-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  z-index: 10;
  background: rgba(6, 6, 11, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.focus-goal {
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.7;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-topbar-actions {
  display: flex;
  gap: 0.5rem;
}

/* Floating timer - centered on screen */
.focus-timer-float {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 5;
  pointer-events: none;
}

.focus-timer-float .timer-display {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 6.5rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  /* Layered glow: cyan core → indigo halo — matches the particle/tunnel palette */
  color: rgba(200, 240, 255, 0.92);
  text-shadow:
    0 0 8px  rgba(0, 210, 255, 0.9),
    0 0 20px rgba(0, 180, 255, 0.6),
    0 0 50px rgba(60, 120, 255, 0.35),
    0 0 100px rgba(99, 102, 241, 0.2);
  line-height: 1;
  margin-bottom: 0.75rem;
  /* Subtle scanline flicker suggestion */
  animation: timerPulse 4s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% { opacity: 0.92; text-shadow: 0 0 8px rgba(0,210,255,0.9), 0 0 20px rgba(0,180,255,0.6), 0 0 50px rgba(60,120,255,0.35), 0 0 100px rgba(99,102,241,0.2); }
  50%       { opacity: 1;    text-shadow: 0 0 12px rgba(0,220,255,1),   0 0 30px rgba(0,200,255,0.8), 0 0 70px rgba(60,140,255,0.45), 0 0 140px rgba(99,102,241,0.3); }
}

/* Wall-clock mode: larger single display */
.focus-timer-float.clock-mode .timer-display {
  font-size: 7.5rem;
  letter-spacing: 0.08em;
  color: rgba(180, 235, 255, 0.88);
}

/* Elapsed mode: slightly dimmer to differentiate */
.focus-timer-float.elapsed-mode .timer-display {
  color: rgba(160, 215, 255, 0.75);
  text-shadow:
    0 0 6px  rgba(0, 180, 220, 0.7),
    0 0 18px rgba(0, 150, 200, 0.5),
    0 0 50px rgba(60, 100, 220, 0.25);
}

.focus-timer-float .timer-mode-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(0, 210, 255, 0.7);
  background: rgba(0, 20, 40, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 20px;
  border: 1px solid rgba(0, 180, 255, 0.2);
  margin-bottom: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.focus-timer-float .timer-progress-track {
  width: 220px;
  height: 2px;
  background: rgba(0, 180, 255, 0.1);
  border-radius: 2px;
  margin: 0 auto;
  overflow: hidden;
}

.focus-timer-float .timer-progress {
  height: 100%;
  background: linear-gradient(90deg, rgba(0,180,255,0.6), rgba(99,102,241,0.8));
  border-radius: 2px;
  transition: width 1s linear;
  box-shadow: 0 0 8px rgba(0, 200, 255, 0.6);
}

/* Format toggle button */
.timer-format-btn {
  pointer-events: all;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  padding: 0.3rem 0.85rem;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.55rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: rgba(0, 200, 255, 0.5);
  background: rgba(0, 20, 40, 0.35);
  border: 1px solid rgba(0, 180, 255, 0.15);
  border-radius: 20px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.timer-format-btn:hover {
  color: rgba(0, 220, 255, 0.9);
  border-color: rgba(0, 200, 255, 0.4);
  background: rgba(0, 30, 60, 0.55);
}

/* Bottom action bar */
.focus-action-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(10, 10, 18, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  z-index: 10;
}

.fab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  min-width: 50px;
}

.fab-btn:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
}

.fab-btn:active {
  transform: scale(0.95);
}

.fab-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.fab-end {
  color: var(--text-muted);
}
.fab-end:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Slide panels */
.slide-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 420px;
  max-width: 92vw;
  background: rgba(8, 8, 14, 0.88);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  resize: horizontal;
  min-width: 320px;
  border: 1px solid rgba(255,255,255,0.06);
  z-index: 100;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.slide-panel-right {
  right: 0;
  transform: translateX(100%);
  border-left: 1px solid rgba(99, 102, 241, 0.1);
}

.slide-panel-left {
  left: 0;
  transform: translateX(-100%);
  border-right: 1px solid rgba(99, 102, 241, 0.1);
}

.slide-panel.open {
  transform: translateX(0);
}

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

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-close {
  color: var(--text-muted);
  cursor: pointer;
}
.panel-close:hover {
  color: var(--text-primary);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.panel-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.panel-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.panel-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Compact mood grid for panel */
.mood-grid-compact {
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.mood-grid-compact .mood-btn {
  padding: 0.5rem 0.25rem;
}

.mood-grid-compact .mood-emoji {
  font-size: 1.2rem;
}

.mood-grid-compact .mood-name {
  font-size: 0.65rem;
}

.mood-grid-compact .mood-desc {
  display: none;
}

/* Panel mood grid */
.mood-grid-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin: 0.75rem 0;
}

.mood-grid-panel .mood-btn {
  padding: 0.6rem 0.25rem;
  gap: 0.2rem;
}

.mood-grid-panel .mood-emoji {
  font-size: 1.3rem;
}

.mood-grid-panel .mood-name {
  font-size: 0.65rem;
}

.mood-grid-panel .mood-desc {
  display: none;
}

/* Regen row */
.regen-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-regen {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.15);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-regen:hover {
  background: rgba(99, 102, 241, 0.2);
}

.btn-regen:hover svg {
  transform: rotate(180deg);
}

.btn-regen svg {
  transition: transform 0.3s;
}

/* Inline slider (for header volume) */
.panel-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.slider-sm {
  width: 80px;
  height: 4px;
}

.slider-value-sm {
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 20px;
}

/* Ambience section */
.ambience-toggles {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.ambience-toggles:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Brain states compact */
.brain-states-compact {
  display: flex;
  gap: 0.4rem;
  margin: 0.5rem 0;
}

.brain-states-compact .state-btn {
  flex: 1;
  padding: 0.4rem;
  text-align: center;
  font-size: 0.7rem;
}

.brain-states-compact .state-btn .desc {
  display: none;
}

/* Collapsible panel sections */
.panel-section-collapsible {
  padding: 0;
  margin-bottom: 0.75rem;
}

.panel-section-collapsible > .genre-summary {
  padding: 0.75rem 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.mix-sliders {
  padding-bottom: 0.5rem;
}

/* Audio Layer Cards */
.panel-layer {
  margin-bottom: 0.5rem;
  padding: 1rem;
  background: rgba(15, 15, 25, 0.3);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-md);
}

.layer-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.layer-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.layer-badge-music { background: rgba(99, 102, 241, 0.25); color: var(--accent); }
.layer-badge-tracks { background: rgba(245, 158, 11, 0.2); color: #f59e0b; font-size: 0.8rem; }
.layer-badge-ambient { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.layer-badge-neural { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }

/* ── Track Player ── */
.track-genre-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.track-genre-tab {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.track-genre-tab:hover { background: rgba(255,255,255,0.08); }
.track-genre-tab.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}
.track-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  background: var(--glass-bg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.track-item:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border);
}
.track-item.playing {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
}
.track-item-play {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  border: none;
  color: #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 0.65rem;
  transition: background 0.15s;
}
.track-item-play:hover { background: rgba(245, 158, 11, 0.3); }
.track-item.playing .track-item-play {
  background: #f59e0b;
  color: #000;
}
.track-item-info {
  flex: 1;
  min-width: 0;
}
.track-item-name {
  font-size: 0.75rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-item-genre {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Track item remove button (custom tracks) ── */
.track-item-remove {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: none;
  color: #ef4444;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.1s;
  flex-shrink: 0;
}
.track-item:hover .track-item-remove { opacity: 1; }
.track-item-remove:hover { background: rgba(239, 68, 68, 0.3); }

/* ── Track item drag handle ── */
.track-item-drag {
  cursor: grab; color: var(--text-muted); opacity: 0;
  transition: opacity 0.1s; flex-shrink: 0; font-size: 0.7rem;
  user-select: none; -webkit-user-select: none;
}
.track-item:hover .track-item-drag { opacity: 0.6; }
.track-item-drag:active { cursor: grabbing; }
.track-item.dragging { opacity: 0.4; }
.track-item.drag-over { border-color: var(--accent) !important; }

/* ── Music Suggestion ── */
.music-suggestion {
  display: flex; align-items: flex-start; gap: 0.4rem;
  padding: 0.4rem 0.5rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 6px;
  font-size: 0.65rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}
.music-suggestion svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }

/* ── Now Playing ── */
.now-playing {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 6px;
  margin-bottom: 0.4rem;
  animation: nowPlayingPulse 2s ease-in-out infinite;
}
@keyframes nowPlayingPulse {
  0%, 100% { border-color: rgba(245, 158, 11, 0.2); }
  50% { border-color: rgba(245, 158, 11, 0.4); }
}
.now-playing-title {
  font-size: 0.75rem; color: #f59e0b; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.now-playing-genre {
  font-size: 0.55rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── Player Transport ── */
.player-transport {
  display: flex; align-items: center; justify-content: center;
  gap: 0.25rem; margin-bottom: 0.5rem;
}
.player-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: none;
  will-change: transform, background;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
.player-btn:active { transform: scale(0.9); }
.player-btn-sm { width: 32px; height: 32px; }
.player-btn-play {
  width: 40px; height: 40px;
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}
.player-btn:hover { background: rgba(255, 255, 255, 0.1); }
.player-btn-play:hover { background: rgba(245, 158, 11, 0.25); }
.player-btn.active { color: var(--accent); border-color: rgba(99, 102, 241, 0.4); }
.player-btn-play.playing svg polygon { display: none; }
.player-btn-play.playing::after {
  content: ''; display: block;
  width: 12px; height: 14px;
  border-left: 4px solid #f59e0b;
  border-right: 4px solid #f59e0b;
}
/* Loop mode indicator */
.player-btn.loop-all { color: var(--accent); border-color: rgba(99, 102, 241, 0.4); }
.player-btn.loop-one { color: var(--accent); border-color: rgba(99, 102, 241, 0.4); position: relative; }
.player-btn.loop-one::after {
  content: '1'; position: absolute; font-size: 0.5rem; font-weight: 700;
  color: var(--accent); bottom: 3px; right: 5px;
}

/* ── Track toolbar ── */
.track-toolbar {
  display: flex; align-items: center; gap: 0.35rem;
  margin-bottom: 0.4rem; flex-wrap: wrap;
}
.track-toolbar .track-genre-tabs { flex: 1; margin-bottom: 0; }
.player-btn-add {
  border-radius: 4px !important;
  width: auto !important; height: auto !important;
  padding: 0.2rem 0.4rem;
  font-size: 0.65rem;
  gap: 0.2rem;
  display: flex; align-items: center;
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--accent);
}
.player-btn-add:hover { background: rgba(99, 102, 241, 0.2); }

.layer-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.layer-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  flex: 1;
}

.layer-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0 0 0.75rem 0;
  padding: 0.5rem 0.6rem;
  background: rgba(99, 102, 241, 0.05);
  border-radius: 6px;
  border-left: 2px solid rgba(99, 102, 241, 0.15);
}

/* Panel backdrop */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}

.panel-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Btn icon small variant */
.btn-icon-sm {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  background: rgba(15, 15, 25, 0.3);
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.2s;
}

.btn-icon-sm:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
}

#btn-mic-viz.mic-active {
  color: #f87171;
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.12);
  animation: micPulse 1.4s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(248, 113, 113, 0); }
}

/* When focus screen is active, hide the old elements */
#screen-focus .audio-grid,
#screen-focus .master-section,
#screen-focus .notes-section,
#screen-focus .focus-container {
  display: none;
}

/* Responsive */
@media (max-width: 640px) {
  .focus-timer-float .timer-display {
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: 3.5rem;
    letter-spacing: 0.03em;
  }

  .focus-action-bar {
    bottom: 1rem;
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
  }

  .fab-btn {
    padding: 0.5rem 0.5rem;
    min-width: 40px;
  }

  .fab-label {
    font-size: 0.5rem;
  }

  .slide-panel {
    width: 100%;
    max-width: 100%;
  }

  .mood-grid-compact {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* -------------------------------------------------------
   18. Responsive - Tablet (1024px)
   ------------------------------------------------------- */
@media (max-width: 1024px) {
  #screen-focus,
  #screen-dashboard {
    padding: 1rem;
  }

  .audio-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

/* -------------------------------------------------------
   19. Responsive - Mobile (640px)
   ------------------------------------------------------- */
@media (max-width: 640px) {
  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  #screen-welcome .app-title {
    font-size: 2rem;
  }

  .audio-grid {
    grid-template-columns: 1fr;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }

  .gamification-hero {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
  }

  .level-info {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .achievements-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .stats-overview {
    flex-direction: column;
  }

  .stats-summary {
    flex-direction: column;
    align-items: center;
  }

  .master-section {
    flex-wrap: wrap;
    justify-content: center;
  }

  .visualizer {
    width: 100%;
    min-width: 0;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .chart-bars {
    height: 120px;
  }

  .modal-content {
    min-width: auto;
    margin: 1rem;
  }

  #screen-complete .actions,
  #screen-complete .complete-actions {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
  }
}

/* -------------------------------------------------------
   20. Print Styles
   ------------------------------------------------------- */
/* -------------------------------------------------------
   Pause Overlay
   ------------------------------------------------------- */
.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 11, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
  pointer-events: none;
}

.pause-overlay.visible {
  display: flex;
}

.pause-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.pause-label {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pause-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* -------------------------------------------------------
   End Session Confirmation Dialog
   ------------------------------------------------------- */
.confirm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 11, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}

.confirm-dialog-backdrop.visible {
  display: flex;
}

.confirm-dialog {
  background: rgba(20, 20, 35, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 380px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.3s ease;
}

.confirm-dialog h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.confirm-dialog p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.confirm-dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.confirm-dialog-actions .btn {
  flex: 1;
}

/* -------------------------------------------------------
   Breathing Exercise Intro
   ------------------------------------------------------- */
.breathing-intro {
  text-align: center;
  margin-bottom: 2rem;
  max-width: 340px;
  animation: fadeIn 0.6s ease;
}

.breathing-intro h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.breathing-intro p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.breathing-steps-hint {
  font-size: 0.75rem !important;
  color: var(--accent) !important;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* -------------------------------------------------------
   Toast Notifications
   ------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  padding: 0.65rem 1.1rem;
  background: rgba(20, 20, 35, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.8rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease forwards;
  pointer-events: auto;
}

.toast-item.toast-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* -------------------------------------------------------
   Task Empty State
   ------------------------------------------------------- */
.task-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.task-empty-state svg {
  opacity: 0.3;
}

.task-empty-state p {
  font-size: 0.8rem;
  line-height: 1.4;
}

/* -------------------------------------------------------
   Session Complete Confetti
   ------------------------------------------------------- */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  z-index: 10;
  pointer-events: none;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.5); }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .bg-canvas,
  #screen-welcome,
  #screen-focus,
  #screen-complete,
  .breathing-overlay,
  .nav-tabs,
  .toast,
  .modal,
  .modal-backdrop,
  .shortcuts-hint {
    display: none !important;
  }

  #screen-dashboard {
    display: block !important;
  }

  .stats-overview .stat-card {
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #000;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .stats-overview .stat-card .value { color: #000; }
  .stats-overview .stat-card .label { color: #666; }
}

/* -------------------------------------------------------
   Sound Panel Tabs
   ------------------------------------------------------- */
.panel-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1rem 0;
  background: rgba(10, 10, 20, 0.5);
  border-bottom: 1px solid var(--border);
}

.panel-tab {
  flex: 1;
  padding: 0.45rem 0.25rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  text-align: center;
}

.panel-tab:hover { color: var(--text-primary); }

.panel-tab.active {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--border);
  border-bottom-color: transparent;
}

/* Tab content visibility — only active pane shown */
.panel-tab-content { display: none; }
.panel-tab-content.active { display: block; }

/* -------------------------------------------------------
   Audio Resume Banner (shown after reload when autoplay is blocked)
   ------------------------------------------------------- */
.audio-resume-banner {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: toastIn 0.4s ease forwards;
  white-space: nowrap;
}
.audio-resume-banner:hover {
  background: rgba(99, 102, 241, 0.28);
  border-color: var(--accent);
}
