/* ═══════════════════════════════════════════════════════════
   Pomodoro Lern-App – Premium Design System
   Farben: Dunkelblau, Weiß, Gelb
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties (Dark Theme) ─── */
:root {
  /* Colors – Dark Blue Base */
  --bg-primary: #0a1628;
  --bg-secondary: #0d1b2a;
  --bg-card: #132238;
  --bg-card-hover: #1a2d48;
  --bg-glass: rgba(13, 27, 42, 0.8);
  --bg-input: #0f1e33;

  --text-primary: #e8ecf2;
  --text-secondary: #8899aa;
  --text-muted: #506070;

  /* Accent: Gold/Yellow */
  --accent: #f0c040;
  --accent-light: #ffd557;
  --accent-glow: rgba(240, 192, 64, 0.25);
  --accent-subtle: rgba(240, 192, 64, 0.08);

  --success: #00d2a0;
  --success-glow: rgba(0, 210, 160, 0.2);
  --warning: #ffa502;
  --danger: #ff4757;

  /* Timer colors */
  --work-color: #f0c040;
  --work-glow: rgba(240, 192, 64, 0.3);
  --break-color: #48dbfb;
  --break-glow: rgba(72, 219, 251, 0.3);
  --long-break-color: #00d2a0;
  --long-break-glow: rgba(0, 210, 160, 0.3);

  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.12);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

  --nav-height: 70px;
  --header-height: 56px;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s ease;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── Light Theme ─── */
[data-theme="light"] {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f8fc;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-input: #edf1f7;

  --text-primary: #0d1b2a;
  --text-secondary: #506070;
  --text-muted: #8899aa;

  --accent: #d4a520;
  --accent-light: #c89a18;
  --accent-glow: rgba(212, 165, 32, 0.2);
  --accent-subtle: rgba(212, 165, 32, 0.08);

  --border: rgba(0, 0, 0, 0.07);
  --border-light: rgba(0, 0, 0, 0.12);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── App Shell ─── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

@media (min-width: 768px) {
  #app {
    max-width: 480px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* ─── Header ─── */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 12px;
  height: auto;
  min-height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

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

.logo {
  font-size: 24px;
  line-height: 1;
}

#app-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  transition: background var(--transition);
}

.sync-dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

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

/* Theme toggle icons */
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ─── Views Container ─── */
#views-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.view {
  display: none;
  padding: 20px;
  min-height: calc(100dvh - var(--header-height) - var(--nav-height));
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

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

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

.view-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ═══════════════════════════════════════════════════════════
   TIMER VIEW
   ═══════════════════════════════════════════════════════════ */

.timer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-top: 10px;
}

/* Timer Ring */
.timer-ring-wrapper {
  position: relative;
  width: 240px;
  height: 240px;
}

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

.timer-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--work-color);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 565.48;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s ease, stroke var(--transition);
  filter: drop-shadow(0 0 8px var(--work-glow));
}

.timer-ring-progress.break {
  stroke: var(--break-color);
  filter: drop-shadow(0 0 8px var(--break-glow));
}

.timer-ring-progress.long_break {
  stroke: var(--long-break-color);
  filter: drop-shadow(0 0 8px var(--long-break-glow));
}

.timer-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timer-type {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
}

.timer-time {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.timer-round {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Timer Controls */
.timer-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer-btn {
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  border-radius: 50%;
}

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

.timer-btn.primary {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.timer-btn.primary:hover {
  box-shadow: 0 6px 28px var(--accent-glow);
  transform: scale(1.05);
}

.timer-btn.primary .icon-pause { display: none; }
.timer-btn.primary.running .icon-play { display: none; }
.timer-btn.primary.running .icon-pause { display: block; }

.timer-btn.secondary {
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.timer-btn.secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

/* Task (Module) Selector */
.timer-task-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  width: 100%;
  max-width: 340px;
}

.timer-task-selector label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.timer-task-selector select {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.timer-task-selector select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Active Task Info */
.active-task-info {
  width: 100%;
  max-width: 340px;
}

.active-task-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}

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

.active-task-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-task-hours {
  font-size: 12px;
  color: var(--accent-light);
  font-weight: 700;
  white-space: nowrap;
  background: var(--accent-subtle);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Task hours in project cards */
.task-hours {
  font-size: 11px;
  color: var(--accent-light);
  font-weight: 600;
  white-space: nowrap;
  background: var(--accent-subtle);
  padding: 2px 7px;
  border-radius: 5px;
}

.project-hours {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  margin-left: auto;
  margin-right: 8px;
  white-space: nowrap;
}

/* Today's Progress */
.today-progress {
  width: 100%;
  max-width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 500;
}

.progress-header span:first-child {
  color: var(--text-secondary);
}

.progress-header span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0%;
  max-width: 100%;
}

.progress-goal {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════
   PROJECTS VIEW
   ═══════════════════════════════════════════════════════════ */

.add-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-subtle);
  color: var(--accent-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.add-btn:hover {
  background: var(--accent);
  color: white;
}

.add-btn:active {
  transform: scale(0.93);
}

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}

.project-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.project-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.project-color {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.project-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.project-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.project-btn:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.project-btn.delete:hover {
  background: rgba(255, 71, 87, 0.1);
  color: var(--danger);
}

.project-chevron {
  transition: transform var(--transition);
  color: var(--text-muted);
}

.project-card.expanded .project-chevron {
  transform: rotate(180deg);
}

.project-tasks {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card.expanded .project-tasks {
  max-height: 1000px;
}

.tasks-inner {
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  transition: opacity var(--transition-fast);
}

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

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border-light);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
}

.task-checkbox:checked {
  background: var(--success);
  border-color: var(--success);
}

.task-checkbox:checked::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.task-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
  word-break: break-word;
}

.task-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.task-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-subtle);
  color: var(--accent-light);
  font-weight: 600;
}

.task-delete {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

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

.task-delete:hover {
  color: var(--danger);
  background: rgba(255, 71, 87, 0.1);
}

.add-task-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.add-task-form input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

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

.add-task-form input::placeholder {
  color: var(--text-muted);
}

.add-task-form button {
  padding: 8px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.add-task-form button:hover {
  background: var(--accent-light);
}

/* Empty State */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state.show {
  display: flex;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-sub {
  font-size: 14px !important;
  font-weight: 400 !important;
  color: var(--text-muted) !important;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   STATS VIEW
   ═══════════════════════════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 28px;
  line-height: 1;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Chart */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

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

.chart-wrapper {
  position: relative;
  width: 100%;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: auto !important;
}

/* Project Stats */
.project-stats-container h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.project-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.project-stat-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.project-stat-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.project-stat-hours {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-light);
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS VIEW
   ═══════════════════════════════════════════════════════════ */

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.settings-group h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-item:first-of-type {
  padding-top: 0;
}

.setting-item label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.setting-item input[type="number"] {
  width: 70px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color var(--transition-fast);
}

.setting-item input[type="number"]:focus {
  border-color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 2px;
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* Settings Actions */
.setting-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  min-width: 120px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-subtle);
}

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

/* ═══════════════════════════════════════════════════════════
   BOTTOM NAVIGATION
   ═══════════════════════════════════════════════════════════ */

#bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  position: sticky;
  bottom: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 24px;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
  transition: transform var(--transition);
}

.nav-btn.active {
  color: var(--accent-light);
}

.nav-btn.active::before {
  transform: translateX(-50%) scaleX(1);
}

.nav-btn:active {
  transform: scale(0.93);
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

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

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

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

.modal-body label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-body input[type="text"],
.modal-body select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.modal-body input[type="text"]:focus,
.modal-body select:focus {
  border-color: var(--accent);
}

.modal-body input[type="text"]::placeholder {
  color: var(--text-muted);
}

.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-option:hover {
  transform: scale(1.15);
}

.color-option.selected {
  border-color: white;
  box-shadow: 0 0 0 2px var(--accent);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: var(--radius-xs);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-actions button:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border) !important;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 4px 16px rgba(255, 71, 87, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 90%;
  width: 400px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.info {
  border-left: 3px solid var(--accent);
}

.toast-icon {
  font-size: 18px;
}

.toast-message {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
}

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

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

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 360px) {
  .timer-ring-wrapper {
    width: 200px;
    height: 200px;
  }

  .timer-time {
    font-size: 44px;
  }

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

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
