:root { --grain-opacity: 0.6; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: #F4FBF7;
  background-image:
    radial-gradient(at 8% -2%, rgba(110, 231, 183, 0.35) 0, transparent 45%),
    radial-gradient(at 92% 12%, rgba(132, 204, 22, 0.18) 0, transparent 50%),
    radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.12) 0, transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
  color: #0F172A;
}
.dark body {
  background-color: #060A09;
  background-image:
    radial-gradient(at 8% -2%, rgba(16, 185, 129, 0.22) 0, transparent 45%),
    radial-gradient(at 92% 12%, rgba(132, 204, 22, 0.10) 0, transparent 50%),
    radial-gradient(at 50% 100%, rgba(6, 182, 212, 0.08) 0, transparent 55%);
  color: #E2E8F0;
}

.font-display { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.01em; }

.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.dark .glass {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.glass-strong {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.dark .glass-strong {
  background: rgba(11, 18, 17, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.glass-tint {
  background: linear-gradient(140deg, rgba(255,255,255,0.85), rgba(236,253,245,0.7));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(16,185,129,0.12);
}
.dark .glass-tint {
  background: linear-gradient(140deg, rgba(16,185,129,0.10), rgba(6,182,212,0.06));
  border: 1px solid rgba(110,231,183,0.12);
}

.ring-progress { transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring-progress circle { transition: stroke-dashoffset 700ms cubic-bezier(0.22, 1, 0.36, 1); }

/* Apple Fitness-style concentric rings */
.fitness-rings { position: relative; aspect-ratio: 1; }
.fitness-rings svg { width: 100%; height: 100%; transform: rotate(-90deg); transform-origin: 50% 50%; }
.fitness-rings .ring-track { fill: none; opacity: 0.18; }
.fitness-rings .ring-fill { fill: none; stroke-linecap: round; transition: stroke-dashoffset 1000ms cubic-bezier(0.22, 1, 0.36, 1); }

/* Calendar heatmap cells */
.day-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  cursor: pointer; transition: transform 150ms ease, border-color 150ms ease;
  border: 1px solid transparent;
  position: relative;
}
.day-cell:hover { transform: scale(1.06); border-color: #10B981; }
.day-cell.empty { background: rgba(15,23,42,0.04); color: #94A3B8; cursor: default; }
.day-cell.empty:hover { transform: none; border-color: transparent; }
.dark .day-cell.empty { background: rgba(255,255,255,0.04); color: #475569; }
.day-cell.tier-1 { background: rgba(16,185,129,0.22); color: #047857; }
.day-cell.tier-2 { background: rgba(16,185,129,0.42); color: #064E3B; }
.day-cell.tier-3 { background: rgba(16,185,129,0.65); color: white; }
.day-cell.tier-4 { background: rgba(16,185,129,0.90); color: white; }
.day-cell.today { outline: 2px solid #10B981; outline-offset: 1px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 200ms ease;
}

.scrollbar-thin::-webkit-scrollbar { height: 6px; width: 6px; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.15); border-radius: 999px; }
.dark .scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); }

.focus-ring:focus-visible { outline: 2px solid #10B981; outline-offset: 2px; border-radius: 12px; }

.gradient-text {
  background: linear-gradient(120deg, #059669 0%, #10B981 40%, #84CC16 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sidebar nav items */
.nav-item {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #64748B;
  transition: all 200ms ease;
  cursor: pointer;
  position: relative;
}
.nav-item:hover { color: #047857; background: rgba(16,185,129,0.08); }
.dark .nav-item { color: #94A3B8; }
.dark .nav-item:hover { color: #6EE7B7; background: rgba(255,255,255,0.04); }
.nav-item.active { color: #047857; background: rgba(16,185,129,0.15); }
.dark .nav-item.active { color: #6EE7B7; background: rgba(16,185,129,0.18); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 24px; background: #10B981; border-radius: 0 4px 4px 0;
}

/* Form controls */
.input, .select, .textarea {
  width: 100%;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(15,23,42,0.10);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  color: #0F172A;
  transition: all 150ms ease;
  font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; background: white; border-color: #10B981;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}
.dark .input, .dark .select, .dark .textarea {
  background: rgba(255,255,255,0.04); color: #E2E8F0; border-color: rgba(255,255,255,0.1);
}
.dark .input:focus, .dark .select:focus, .dark .textarea:focus {
  background: rgba(255,255,255,0.06); border-color: #34D399;
}
.input::placeholder, .textarea::placeholder { color: #94A3B8; }

.label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.dark .label { color: #94A3B8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  border: 1px solid transparent;
  font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, #10B981, #059669); color: white; box-shadow: 0 8px 24px -8px rgba(16,185,129,0.45); }
.btn-primary:hover { box-shadow: 0 12px 30px -8px rgba(16,185,129,0.6); transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.7); color: #0F172A; border-color: rgba(15,23,42,0.10); }
.btn-secondary:hover { background: white; border-color: #10B981; color: #047857; }
.dark .btn-secondary { background: rgba(255,255,255,0.05); color: #E2E8F0; border-color: rgba(255,255,255,0.1); }
.dark .btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: #34D399; color: #6EE7B7; }
.btn-danger { background: rgba(244,63,94,0.1); color: #DC2626; border-color: rgba(244,63,94,0.2); }
.btn-danger:hover { background: #DC2626; color: white; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: rgba(15,23,42,0.05); color: #047857; }
.dark .btn-ghost { color: #94A3B8; }
.dark .btn-ghost:hover { background: rgba(255,255,255,0.05); color: #6EE7B7; }

/* Slider */
input[type="range"].brand-range {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #10B981 var(--val, 50%), rgba(15,23,42,0.08) var(--val, 50%));
  outline: none;
}
.dark input[type="range"].brand-range {
  background: linear-gradient(to right, #34D399 var(--val, 50%), rgba(255,255,255,0.08) var(--val, 50%));
}
input[type="range"].brand-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 18px; width: 18px;
  border-radius: 50%;
  background: white;
  border: 2px solid #10B981;
  box-shadow: 0 4px 14px rgba(16,185,129,0.4);
  cursor: pointer;
  transition: transform 150ms ease;
}
input[type="range"].brand-range::-webkit-slider-thumb:hover { transform: scale(1.1); }

/* Method active button */
.method-active {
  background: linear-gradient(135deg, #10B981, #059669) !important;
  color: white !important;
  box-shadow: 0 8px 24px -8px rgba(16,185,129,0.6);
}
.dark .method-active { background: linear-gradient(135deg, #10B981, #047857) !important; }

/* Animations */
@keyframes fade-up { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes pop { 0% { transform: scale(0.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.animate-fade-up { animation: fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.animate-pop { animation: pop 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Toast */
.toast {
  pointer-events: auto;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 12px 30px -8px rgba(15,23,42,0.18);
  font-size: 14px;
  min-width: 220px;
  animation: pop 0.25s ease both;
}
.dark .toast { background: rgba(11,18,17,0.95); color: #E2E8F0; border-color: rgba(255,255,255,0.07); }
.toast-success { border-left: 3px solid #10B981; }
.toast-error { border-left: 3px solid #EF4444; }
.toast-info { border-left: 3px solid #3B82F6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Tables */
.table-row { transition: background-color 150ms ease; }
.table-row:hover { background: rgba(16,185,129,0.04); }
.dark .table-row:hover { background: rgba(255,255,255,0.03); }

/* Tooltip-like cooking note */
.method-note { transition: opacity 250ms ease, transform 250ms ease; }

/* Method btn base */
.method-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 12px 8px; border-radius: 16px;
  border: 1px solid rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 200ms ease;
  font-family: inherit;
  text-align: center;
}
.method-btn:hover { border-color: #10B981; }
.dark .method-btn { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); color: #E2E8F0; }

/* Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; background: #CBD5E1; border-radius: 999px; transition: 200ms; cursor: pointer; }
.switch-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 200ms; }
.switch input:checked + .switch-slider { background: #10B981; }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.dark .switch-slider { background: #475569; }

/* Progress bar fills */
.bar-fill { transition: width 600ms cubic-bezier(0.22, 1, 0.36, 1); }

/* Language buttons */
.lang-btn { background: transparent; color: #64748B; transition: all 150ms ease; padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 600; }
.lang-btn:hover { color: #047857; }
.lang-btn.active { background: white; color: #047857; box-shadow: 0 1px 3px rgba(15,23,42,0.1); }
.dark .lang-btn { color: #94A3B8; }
.dark .lang-btn.active { background: rgba(255,255,255,0.12); color: #6EE7B7; }

/* Star rating */
.star { color: #CBD5E1; cursor: pointer; transition: color 120ms ease; }
.star.filled { color: #F59E0B; }
.star:hover { transform: scale(1.1); }
.dark .star { color: #475569; }
.dark .star.filled { color: #FBBF24; }
