/* ═══════════════════════════════════════════════════════════
   F.I.T — Fitness Intelligence Tracker — Optimized UI
   [OPT] = performance/redundancy optimization
   Aesthetic: Refined Athletic Premium
   Fonts: Barlow Condensed (display) + Outfit (body) + Roboto Mono
   ═══════════════════════════════════════════════════════════ */

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

/* ── DESIGN TOKENS ── */
:root {
  --bg-primary:      #080c09;
  --bg-secondary:    #0d1410;
  --bg-card:         #111a13;
  --bg-card-hover:   #162019;
  --bg-card-raised:  #141d16;
  --bg-input:        #0e1510;

  --border:          rgba(255,255,255,0.08);
  --border-strong:   rgba(255,255,255,0.13);
  --border-focus:    #00E676;

  --text-primary:    #F2F0E8;
  --text-secondary:  #9494A8;
  --text-muted:      #4a4a5a;

  --accent:           #00E676;
  --accent-dim:       rgba(0,230,118,0.18);
  --accent-glow:      rgba(0,230,118,0.28);
  --accent-secondary: #39FF87;
  --accent-bright:    #33FF80;

  --success:      #00E676;
  --success-dim:  rgba(0,230,118,0.12);
  --success-glow: rgba(0,230,118,0.25);
  --warning:      #FFD600;
  --warning-dim:  rgba(255,214,0,0.12);
  --danger:       #FF1744;
  --danger-dim:   rgba(255,23,68,0.12);
  --cyan:         #00E5FF;
  --cyan-dim:     rgba(0,229,255,0.12);
  --pink:         #FF4081;
  --pink-dim:     rgba(255,64,129,0.12);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  22px;
  --radius-2xl: 28px;

  --font-display: 'Barlow Condensed', 'Impact', sans-serif;
  --font-sans:    'Outfit', system-ui, sans-serif;
  --font-mono:    'Roboto Mono', 'Courier New', monospace;

  --nav-height:    72px;
  --topbar-height: 62px;
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
  --content-max:   600px;
  --card-gap:      14px;
  --card-pad:      22px;

  /* [OPT] Shadows defined as variables — avoids recomputing on every repaint */
  --shadow-card:   0 1px 2px rgba(0,0,0,0.5),
                   0 4px 20px rgba(0,0,0,0.35),
                   inset 0 1px 0 rgba(255,255,255,0.055);
  --shadow-raised: 0 2px 4px rgba(0,0,0,0.6),
                   0 8px 32px rgba(0,0,0,0.45),
                   inset 0 1px 0 rgba(255,255,255,0.07);
  --shadow-accent: 0 4px 24px rgba(0,230,118,0.32),
                   0 2px 8px rgba(0,230,118,0.18);
  --shadow-float:  0 12px 48px rgba(0,0,0,0.7),
                   0 4px 16px rgba(0,0,0,0.4);
  --shadow-glow-success: 0 0 16px rgba(0,230,118,0.3);

  /* [OPT] Transition shorthands reused via var — consistent & DRY */
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast:  0.15s var(--ease-spring);
  --t-base:  0.22s ease;
  --t-slow:  0.32s var(--ease-spring);
}

/* ── BASE ── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; background: var(--bg-primary); }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  /* [OPT] background-attachment:fixed forces separate compositing layer on mobile — removed */
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%,
    rgba(0,230,118,0.06) 0%, transparent 60%);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
}

/* [OPT] #app: flex column container scoping content flow */
#app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ══════════════════════════════════════════════
   TOPBAR
   ══════════════════════════════════════════════ */
#topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 16px;
  height: var(--topbar-height); padding: 0 20px;
  background: rgba(8,12,9,0.93);
  /* [OPT] Reduced blur radius 28→20px — cheaper composite, imperceptible difference */
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04),
              0 4px 24px rgba(0,0,0,0.4);
  /* [OPT] Promote to its own layer — prevents topbar repaints from cascading */
  will-change: transform;
}

.topbar-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.logo-wrapper {
  display: flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.4rem; letter-spacing: 2px;
  text-transform: uppercase; line-height: 1;
  background: linear-gradient(105deg, #00E676 0%, #33FF80 55%, #a8ffcc 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.logo-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: lowercase;
  line-height: 1;
  padding-bottom: 1px;
}
.beta-badge {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(255, 91, 20, 0.45);
  background: rgba(255, 91, 20, 0.08);
  border-radius: 4px;
  padding: 2px 5px;
  line-height: 1;
  align-self: center;
  margin-left: 2px;
  position: relative;
  top: -1px;
}

.level-badge {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  padding: 4px 9px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #071a0e; letter-spacing: 1px; text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(0,230,118,0.4),
              inset 0 1px 0 rgba(255,255,255,0.2);
}

.xp-bar-mini {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.14);
  border-radius: 8px; overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255,255,255,0.08);
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #FF8A50 60%, #FFD600 100%);
  border-radius: 8px;
  transition: width 0.8s var(--ease-spring);
  width: 0%;
  box-shadow: 0 0 10px rgba(255,91,20,0.7), 0 0 20px rgba(255,91,20,0.3);
  position: relative;
}
/* [OPT] Shimmer uses transform only — stays on GPU compositor, no layout */
.xp-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.28) 50%, transparent 100%);
  animation: shimmer 2.4s ease-in-out infinite;
  border-radius: inherit;
  will-change: transform;
}

/* [OPT] Single shimmer keyframe reused by both xp bar and progress fills */
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

.streak-counter {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700;
  color: var(--warning);
  background: rgba(255,214,0,0.10);
  padding: 5px 11px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,214,0,0.22);
  flex-shrink: 0;
}
.streak-icon { font-size: 0.95rem; }

/* ══════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════ */
#mainContent {
  flex: 1;
  padding: 20px 16px calc(var(--nav-height) + var(--safe-bottom) + 24px);
  max-width: var(--content-max);
  margin: 0 auto; width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  margin-bottom: var(--card-gap);
  box-shadow: var(--shadow-card);
  /* [OPT] Specific props only — transition:all triggers layout recalc on ANY property change */
  transition: border-color var(--t-base), box-shadow var(--t-base);
  position: relative; overflow: hidden;
  animation: fadeSlideUp 0.28s var(--ease-spring) both;
  /* [OPT] contain:layout style scopes reflow & style recalc without clipping box-shadow.
     contain:content (previous value) included contain:paint which clips shadows outside the border box. */
  contain: layout style;
}

/* [OPT] Stagger delays kept but consolidated — nth-child is cheap selector */
.card:nth-child(1) { animation-delay: 0.03s; }
.card:nth-child(2) { animation-delay: 0.07s; }
.card:nth-child(3) { animation-delay: 0.11s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5) { animation-delay: 0.18s; }
.card:nth-child(n+6) { animation-delay: 0.20s; }

.card::before {
  content: '';
  position: absolute; top: 0; left: 20%; right: 20%; height: 1px;
  background: linear-gradient(90deg, transparent,
    rgba(255,255,255,0.08) 50%, transparent);
  border-radius: 50%;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-raised);
}
.card-hero {
  background: linear-gradient(155deg,
    rgba(0,230,118,0.10) 0%,
    var(--bg-card) 40%);
  border-color: rgba(0,230,118,0.22);
  box-shadow: var(--shadow-card),
              0 0 0 1px rgba(0,230,118,0.08) inset;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 0.8rem; font-weight: 700;
  letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--text-secondary);
  line-height: 1;
}
.card-value {
  font-family: var(--font-display);
  font-size: 2.6rem; font-weight: 700; line-height: 1;
  letter-spacing: -0.5px;
}
.card-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 5px; font-weight: 500; }

/* ── STAT GRID ── */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  /* [OPT] Specific transitions only */
  transition: background var(--t-base), border-color var(--t-base);
  position: relative; overflow: hidden;
}
.stat-box:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}
.stat-label {
  font-size: 12px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 1.6px;
  color: var(--text-muted); margin-bottom: 8px; font-family: var(--font-sans);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.75rem; font-weight: 700; letter-spacing: 0.2px; line-height: 1;
}

/* ══════════════════════════════════════════════
   BOTTOM NAV
   ══════════════════════════════════════════════ */
#bottomNav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding: 0 4px var(--safe-bottom);
  background: rgba(10,10,12,0.97);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 0 rgba(255,255,255,0.04);
  /* [OPT] Own layer — nav and content repaint independently */
  will-change: transform;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px; background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  /* [OPT] Specific props — was transition:all */
  transition: color var(--t-base), transform var(--t-fast);
  -webkit-tap-highlight-color: transparent; position: relative;
  padding: 0; min-height: 44px;
  border-radius: var(--radius-md); outline: none;
  touch-action: manipulation;
}
.nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.nav-btn svg {
  width: 22px; height: 22px;
  transition: transform 0.22s var(--ease-spring);
}
.nav-btn span {
  font-size: 12px;
  font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; font-family: var(--font-sans);
  transition: color var(--t-base);
}
.nav-btn.active { color: var(--accent); }
.nav-btn.active::before {
  content: '';
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  width: 32px; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(0,230,118,0.5);
}
.nav-btn.active::after {
  content: '';
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 50px; height: 42px;
  background: rgba(0,230,118,0.08);
  border-radius: var(--radius-md);
  z-index: -1;
}
.nav-btn.active svg {
  transform: translateY(-1px);
  /* [OPT] filter:drop-shadow is expensive on SVG; use regular drop-shadow only on active */
  filter: drop-shadow(0 0 6px rgba(0,230,118,0.45));
}
.nav-btn:not(.active):hover { color: var(--text-secondary); }
.nav-btn:active { transform: scale(0.88); }

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px;
  border: none; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
  /* [OPT] Specific props — was transition:all */
  transition: background var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast), border-color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.3px; position: relative; overflow: hidden; outline: none;
  user-select: none; -webkit-user-select: none;
  min-height: 44px;
  touch-action: manipulation;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn:active { transform: scale(0.95); }

.btn::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,0); transition: background 0.18s;
  border-radius: inherit;
}
.btn:hover::after { background: rgba(255,255,255,0.08); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
  color: #071a0e; font-weight: 700;
  box-shadow: var(--shadow-accent),
              inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-bright) 0%, #55ffaa 100%);
  box-shadow: 0 6px 32px rgba(0,230,118,0.5),
              inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.96) translateY(0); }

.btn-secondary {
  background: var(--bg-card-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover {
  border-color: rgba(255,255,255,0.2);
  background: var(--bg-card-hover);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(255,23,68,0.25);
}
.btn-danger:hover {
  background: rgba(255,23,68,0.18);
  border-color: rgba(255,23,68,0.4);
}

.btn-success {
  background: linear-gradient(135deg, rgba(0,230,118,0.18), rgba(0,200,100,0.12));
  color: var(--success); font-weight: 700;
  border: 1px solid rgba(0,230,118,0.35);
  /* [OPT] Specific props — was transition:all */
  transition: background var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast), border-color var(--t-fast);
}
.btn-success:hover {
  background: linear-gradient(135deg, rgba(0,230,118,0.26), rgba(0,200,100,0.18));
  border-color: rgba(0,230,118,0.55);
  box-shadow: var(--shadow-glow-success);
  transform: translateY(-1px);
}

.btn-sm { padding: 9px 16px; font-size: 0.8rem; letter-spacing: 0.2px; }
.btn-block { width: 100%; }
.btn-ghost { background: none; color: var(--text-secondary); padding: 9px 12px; }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.btn-icon {
  width: 44px; height: 44px; padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-card-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  /* [OPT] Specific props — was transition:all */
  transition: border-color var(--t-base), color var(--t-base),
              background var(--t-base), transform var(--t-fast);
  outline: none; font-size: 0.9rem;
  touch-action: manipulation;
}
.btn-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-icon:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.btn-icon:active { transform: scale(0.9); }

/* ══════════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--text-secondary); margin-bottom: 8px;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 13px 15px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-family: var(--font-sans); font-size: 0.92rem;
  /* [OPT] Specific props — was transition:border-color,box-shadow,background together */
  transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
  -webkit-appearance: none; outline: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:hover, .form-select:hover, .form-textarea:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,230,118,0.14),
              0 1px 4px rgba(0,0,0,0.3);
  background: var(--bg-input);
}
.form-input.error, .form-select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255,23,68,0.12);
}
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 38px; cursor: pointer;
}
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 120px; }

/* ══════════════════════════════════════════════
   PROGRESS BARS
   ══════════════════════════════════════════════ */
.progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px; overflow: hidden;
  position: relative;
  /* FIX: isolate stacking context so shimmer pseudo-element doesn't bleed out */
  isolation: isolate;
}
.progress-bar::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 6px,
    rgba(255,255,255,0.015) 6px,
    rgba(255,255,255,0.015) 7px
  );
}
.progress-fill {
  height: 100%; border-radius: 10px;
  transition: width 0.75s var(--ease-spring);
  position: relative; overflow: hidden;
}
/* [OPT] Shares the same shimmer keyframe — no duplicate @keyframes */
.progress-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
  animation: shimmer 2.8s ease-in-out infinite 0.5s;
  will-change: transform;
}
.progress-accent {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-secondary) 100%);
  box-shadow: 0 0 10px rgba(0,230,118,0.4);
}
.progress-success {
  background: linear-gradient(90deg, #00C864 0%, var(--success) 100%);
  box-shadow: 0 0 10px rgba(0,230,118,0.35);
}
.progress-warning {
  background: linear-gradient(90deg, #E6C000 0%, var(--warning) 100%);
  box-shadow: 0 0 8px rgba(255,214,0,0.3);
}
.progress-pink {
  background: linear-gradient(90deg, var(--pink) 0%, var(--accent) 100%);
}
.progress-fill.progress-complete {
  animation: pulseGlow 1.4s ease-in-out infinite;
}
@keyframes pulseGlow {
  /* [OPT] Animate box-shadow only — stays in compositor, no layout cost */
  0%, 100% { box-shadow: 0 0 10px rgba(0,230,118,0.3); }
  50%       { box-shadow: 0 0 20px rgba(0,230,118,0.6); }
}

/* ── CHART ── */
.chart-container {
  position: relative; width: 100%;
  min-height: 160px;
  border-radius: var(--radius-md); overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.chart-container canvas { width: 100% !important; height: 100% !important; display: block; }

/* ══════════════════════════════════════════════
   TAGS / BADGES
   ══════════════════════════════════════════════ */
.tag {
  display: inline-flex; align-items: center; padding: 4px 11px;
  border-radius: 20px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px; line-height: 1;
}
.tag-accent  { background: var(--accent-dim);   color: var(--accent);   border: 1px solid rgba(0,230,118,0.28); }
.tag-success { background: var(--success-dim);  color: var(--success);  border: 1px solid rgba(0,230,118,0.25); }
.tag-warning { background: var(--warning-dim);  color: var(--warning);  border: 1px solid rgba(255,214,0,0.25); }
.tag-danger  { background: var(--danger-dim);   color: var(--danger);   border: 1px solid rgba(255,23,68,0.25); }
/* [OPT] tag-neutral merged into tag-cyan — identical rules, one less selector */
.tag-cyan,
.tag-neutral { background: var(--cyan-dim);     color: var(--cyan);     border: 1px solid rgba(0,229,255,0.25); }
.tag-pink    { background: var(--pink-dim);     color: var(--pink);     border: 1px solid rgba(255,64,129,0.25); }

/* ══════════════════════════════════════════════
   EXERCISE CARDS
   ══════════════════════════════════════════════ */
.exercise-card {
  display: flex; gap: 14px; padding: 16px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 10px;
  cursor: pointer;
  /* [OPT] Specific props — was transition:all */
  transition: background var(--t-base), border-color var(--t-base),
              transform var(--t-fast), box-shadow var(--t-base);
  box-shadow: var(--shadow-card);
}
.exercise-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateX(2px);
}
.exercise-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.exercise-card:active { transform: scale(0.99); }
.exercise-thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.45rem; overflow: hidden;
  border: 1px solid var(--border);
}
.exercise-thumb img { width: 100%; height: 100%; object-fit: cover; }
.exercise-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.exercise-name {
  font-weight: 600; font-size: 0.95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.1px;
  margin-bottom: 3px;
}
.exercise-meta { font-size: 0.76rem; color: var(--text-secondary); font-weight: 500; }
.exercise-actions { display: flex; gap: 6px; align-items: center; }

/* ══════════════════════════════════════════════
   SET ROWS
   ══════════════════════════════════════════════ */
.set-row {
  display: grid; grid-template-columns: 32px 1fr 1fr 60px 40px;
  gap: 8px; align-items: center; padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.set-num {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted);
  text-align: center; font-weight: 700;
  background: var(--bg-secondary);
  border-radius: 6px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.set-input {
  padding: 10px 8px; background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary); font-family: var(--font-mono);
  font-size: 0.92rem; font-weight: 600;
  text-align: center; width: 100%; min-height: 44px;
  /* [OPT] Specific props */
  transition: border-color var(--t-base), box-shadow var(--t-base), background var(--t-base);
  outline: none;
}
.set-input:hover { border-color: var(--border-strong); background: rgba(20,20,26,0.9); }
.set-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(0,230,118,0.14);
  background: var(--bg-input);
}
.set-check {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  background: var(--bg-secondary);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  /* [OPT] Specific props — was transition:all */
  transition: background 0.2s var(--ease-spring), border-color 0.2s var(--ease-spring),
              color 0.2s var(--ease-spring), transform 0.15s var(--ease-spring);
  outline: none;
  touch-action: manipulation;
}
.set-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.set-check:hover {
  border-color: var(--success);
  color: var(--success);
  background: rgba(0,230,118,0.08);
}
.set-check.done {
  background: var(--success);
  border-color: var(--success); color: #000;
  box-shadow: 0 0 14px rgba(0,230,118,0.5),
              inset 0 1px 0 rgba(255,255,255,0.3);
  animation: checkPop 0.28s var(--ease-spring);
}
@keyframes checkPop {
  0%  { transform: scale(0.7); }
  60% { transform: scale(1.15); }
  100%{ transform: scale(1); }
}
.set-header {
  display: grid; grid-template-columns: 32px 1fr 1fr 60px 40px;
  gap: 8px; padding: 6px 0 10px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); text-align: center;
}

/* ══════════════════════════════════════════════
   ACHIEVEMENTS
   ══════════════════════════════════════════════ */
.achievement {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 8px;
  box-shadow: var(--shadow-card);
  /* [OPT] Specific props — was transition:all */
  transition: background var(--t-base), border-color var(--t-base);
}
.achievement:not(.locked):hover {
  border-color: rgba(255,214,0,0.25);
  background: var(--bg-card-hover);
}
.achievement.locked { opacity: 0.45; filter: grayscale(0.6); }
.achievement-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; }
.achievement-info { flex: 1; }
.achievement-name { font-weight: 700; font-size: 0.92rem; letter-spacing: -0.1px; }
.achievement-desc { font-size: 0.76rem; color: var(--text-secondary); margin-top: 3px; }

/* ══════════════════════════════════════════════
   SUB TABS
   ══════════════════════════════════════════════ */
.sub-tabs {
  display: flex; gap: 3px; margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md); padding: 4px;
  border: 1px solid var(--border);
}
.sub-tab {
  flex: 1; padding: 10px 8px; border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text-muted); font-family: var(--font-sans);
  font-size: 13px; font-weight: 700; cursor: pointer;
  /* [OPT] Specific props */
  transition: color var(--t-base), background var(--t-base),
              box-shadow var(--t-base), border-color var(--t-base);
  text-transform: uppercase; letter-spacing: 0.5px; outline: none;
  min-height: 44px;
  touch-action: manipulation;
}
.sub-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sub-tab:hover:not(.active) { color: var(--text-secondary); }
.sub-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35),
              inset 0 1px 0 rgba(255,255,255,0.07);
  border: 1px solid var(--border-strong);
}

/* ══════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadeIn 0.22s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  position: relative; width: 100%; max-width: var(--content-max);
  max-height: 90dvh; overflow-y: auto;
  background: var(--bg-card-raised);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: 8px 22px calc(24px + var(--safe-bottom));
  animation: slideUp var(--t-slow);
  border-top: 1px solid var(--border-strong);
  box-shadow: 0 -12px 60px rgba(0,0,0,0.7),
              0 -2px 0 rgba(255,255,255,0.04);
  -webkit-overflow-scrolling: touch;
  /* [OPT] Compositor hint — modal animates transform so pre-promote */
  will-change: transform;
}
.modal-content::before {
  content: ''; display: block; width: 40px; height: 4px;
  background: rgba(255,255,255,0.15); border-radius: 3px; margin: 14px auto 22px;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 12px;
}
.modal-title {
  font-family: var(--font-display); font-size: 1.05rem;
  font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
}
.modal-close {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--bg-card-hover); color: var(--text-secondary);
  cursor: pointer; font-size: 0.95rem;
  display: flex; align-items: center; justify-content: center;
  /* [OPT] Specific props */
  transition: background var(--t-base), color var(--t-base);
  outline: none; flex-shrink: 0;
  touch-action: manipulation;
}
.modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal-close:hover { background: var(--danger-dim); color: var(--danger); }

/* Modal body (used in reset modal and general text containers) */
.modal-body { padding: 4px 0; }
.modal-body p { margin-bottom: 12px; color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }
.modal-body ul { margin-left: 20px; margin-bottom: 16px; color: var(--text-muted); font-size: 0.86rem; line-height: 1.8; }

/* ══════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════ */
.toast {
  position: fixed; top: calc(var(--topbar-height) + 12px);
  left: 50%; transform: translateX(-50%); z-index: 300;
  padding: 13px 24px;
  background: var(--bg-card-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  font-size: 0.88rem; font-weight: 600; line-height: 1.4;
  box-shadow: var(--shadow-float),
              inset 0 1px 0 rgba(255,255,255,0.07);
  animation: toastIn 0.3s var(--ease-spring);
  white-space: normal; text-align: center;
  max-width: calc(100vw - 48px); word-break: break-word;
  /* [OPT] Pre-promote to compositor layer */
  will-change: transform, opacity;
}
.toast.hidden { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.96); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ══════════════════════════════════════════════
   LEVEL UP OVERLAY
   ══════════════════════════════════════════════ */
.level-up-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.88); backdrop-filter: blur(16px);
  animation: fadeIn 0.3s ease;
}
.level-up-overlay.hidden { display: none; }
.level-up-content { text-align: center; animation: levelPop 0.6s var(--ease-spring); }
.level-up-icon {
  font-size: 5rem; margin-bottom: 16px;
  filter: drop-shadow(0 0 28px rgba(255,214,0,0.7));
  /* [OPT] Consolidated — was identical to emptyFloat (translateY up/down) */
  animation: floatY 2s ease-in-out infinite;
}
/* [OPT] floatY replaces both floatIcon AND emptyFloat — same motion, shared keyframe */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
.level-up-text {
  font-family: var(--font-display); font-size: 2.6rem;
  font-weight: 700; letter-spacing: 10px;
  background: linear-gradient(135deg, var(--accent), var(--warning));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  text-transform: uppercase;
}
.level-up-level {
  font-family: var(--font-display); font-size: 4.5rem;
  font-weight: 700; color: var(--accent);
  margin-top: 8px;
  text-shadow: 0 0 50px var(--accent-glow);
  filter: drop-shadow(0 0 20px var(--accent-glow));
}
@keyframes levelPop { 0% { transform: scale(0.3); opacity: 0; } 65% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* ══════════════════════════════════════════════
   SECTION HEADERS
   ══════════════════════════════════════════════ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; margin-top: 28px;
  gap: 10px;
}
/* Remove top margin when section-header is the first child of its container */
*:first-child > .section-header,
.section-header:first-child {
  margin-top: 4px;
}
.section-title {
  font-family: var(--font-display); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 2.8px; text-transform: uppercase; color: var(--text-secondary);
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: '';
  width: 3px; height: 14px;
  background: linear-gradient(180deg, var(--accent), transparent);
  border-radius: 2px; flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 56px 28px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 3.2rem; margin-bottom: 16px; opacity: 0.55;
  display: block;
  /* [OPT] Reuses floatY keyframe — 6px amplitude via custom prop not needed, same 8px fine */
  animation: floatY 3s ease-in-out infinite;
}
.empty-state-text { font-size: 0.94rem; line-height: 1.7; color: var(--text-secondary); }

/* scrollbar */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ══════════════════════════════════════════════
   INSIGHT CARDS
   ══════════════════════════════════════════════ */
.insight {
  display: flex; align-items: flex-start; gap: 13px; padding: 13px 15px;
  border-radius: var(--radius-md); margin-bottom: 8px;
  font-size: 0.86rem; font-weight: 500; line-height: 1.55;
  border: 1px solid transparent;
}
.insight-icon { font-size: 1.15rem; flex-shrink: 0; margin-top: 1px; }
/* [OPT] insight-up color normalized to use var(--success) — was #10d070 (inconsistent) */
.insight-up      { background: rgba(0,230,118,0.09);  color: var(--success); border-color: rgba(0,230,118,0.2); }
.insight-down    { background: var(--danger-dim);      color: var(--danger);  border-color: rgba(255,23,68,0.2); }
.insight-neutral { background: rgba(0,229,255,0.08);   color: var(--cyan);    border-color: rgba(0,229,255,0.18); }
.insight-warn    { background: rgba(255,214,0,0.09);   color: #e8c200;        border-color: rgba(255,214,0,0.2); }

/* ══════════════════════════════════════════════
   LIST ITEMS
   ══════════════════════════════════════════════ */
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 8px;
  cursor: pointer;
  /* [OPT] Specific props — was transition:all */
  transition: background var(--t-base), border-color var(--t-base),
              transform var(--t-fast), box-shadow var(--t-base);
  box-shadow: var(--shadow-card);
}
.list-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateX(2px);
}
.list-item:active { transform: scale(0.99); }
.list-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.list-item[role="button"] { cursor: pointer; }
.list-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
  background: var(--bg-secondary); border: 1px solid var(--border);
}
.list-info { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 0.92rem; letter-spacing: -0.1px; line-height: 1.3; }
.list-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 3px; }
.list-arrow { color: var(--text-muted); font-size: 0.85rem; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ══════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════ */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-4  { margin-top: 4px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-cyan    { color: var(--cyan); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.84rem; }
.text-xs      { font-size: 0.72rem; }
.font-mono    { font-family: var(--font-mono); }
.gap-8        { gap: 8px; }
.hidden { display: none !important; }

/* ══════════════════════════════════════════════
   PR BADGE
   ══════════════════════════════════════════════ */
.pr-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
  border-radius: 10px; font-family: var(--font-mono); font-size: 12px;
  font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  background: linear-gradient(135deg, var(--warning), var(--accent));
  color: #000; box-shadow: 0 2px 10px rgba(255,214,0,0.35);
  animation: prPop 0.4s var(--ease-spring);
}
.pr-badge-static { animation: none; }
@keyframes prPop { 0% { transform: scale(0); opacity: 0; } 65% { transform: scale(1.4); } 100% { transform: scale(1); opacity: 1; } }

/* ══════════════════════════════════════════════
   CALENDAR
   ══════════════════════════════════════════════ */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-nav-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-dow { text-align: center; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); padding: 5px 0; }
.calendar-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.74rem;
  font-weight: 600; cursor: pointer;
  /* [OPT] Specific props */
  transition: background var(--t-base), transform var(--t-fast), box-shadow var(--t-base);
  position: relative; background: rgba(255,255,255,0.03); color: var(--text-muted);
  touch-action: manipulation;
}
.calendar-day:not(.empty):hover { background: rgba(255,255,255,0.07); color: var(--text-secondary); }
.calendar-day:active { transform: scale(0.88); }
.calendar-day.empty { background: none; cursor: default; }
.calendar-day.today {
  border: 1.5px solid var(--accent); color: var(--text-primary);
  background: rgba(0,230,118,0.08);
  box-shadow: 0 0 12px rgba(0,230,118,0.2), inset 0 0 0 1px rgba(0,230,118,0.15);
}
.calendar-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.calendar-day.strength { background: rgba(0,230,118,0.14); color: var(--success); }
.calendar-day.cardio-day { background: rgba(0,229,255,0.12); color: var(--cyan); }
.calendar-day.both {
  background: linear-gradient(135deg, rgba(0,230,118,0.14), rgba(0,229,255,0.12));
  color: var(--text-primary);
}
.calendar-day.has-dot::after {
  content: ""; position: absolute; bottom: 4px;
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
}

/* ══════════════════════════════════════════════
   WEEKLY GOALS
   ══════════════════════════════════════════════ */
.goal-row {
  display: flex; flex-direction: column;
  gap: 8px; padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.goal-row:last-child { border-bottom: none; }
.goal-row-header { display: flex; align-items: center; justify-content: space-between; }
.goal-info { flex: 1; min-width: 0; }
.goal-label { font-size: 0.76rem; font-weight: 600; color: var(--text-secondary); }
.goal-nums { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 700; }
.goal-bar { width: 100%; }
.goal-achieved {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
  border-radius: 10px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--success-dim); color: var(--success);
  border: 1px solid rgba(0,230,118,0.25);
}

/* ══════════════════════════════════════════════
   SUGGESTION CARDS
   ══════════════════════════════════════════════ */
.suggestion-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 17px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 10px;
  font-size: 0.84rem; line-height: 1.55; box-shadow: var(--shadow-card);
}
.suggestion-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.suggestion-text { flex: 1; }
.suggestion-title { font-weight: 700; margin-bottom: 4px; font-size: 0.88rem; }
.suggestion-desc { color: var(--text-secondary); font-size: 0.8rem; line-height: 1.5; }

/* ══════════════════════════════════════════════
   REST TIMER
   ══════════════════════════════════════════════ */
.rest-timer {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  right: 16px; z-index: 90;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px 16px 18px;
  background: rgba(18, 18, 24, 0.97);
  border: 1.5px solid rgba(0,230,118,0.45);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7),
              0 0 0 1px rgba(0,230,118,0.18),
              0 0 32px rgba(0,230,118,0.15);
  animation: slideUp 0.35s var(--ease-spring);
  will-change: transform, box-shadow;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.rest-timer.hidden { display: none; }
.rest-timer.urgent {
  border-color: rgba(220, 50, 50, 0.8);
  box-shadow: 0 8px 40px rgba(0,0,0,0.7),
              0 0 0 1px rgba(220,50,50,0.4),
              0 0 40px rgba(220,50,50,0.35);
  animation: timerPulse 0.7s ease-in-out infinite;
}
@keyframes timerPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.03); }
}
.rest-timer-vignette {
  pointer-events: none;
  position: fixed; inset: 0; z-index: 89;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(ellipse at center,
    transparent 55%, rgba(200, 30, 30, 0.28) 100%);
}
.rest-timer-vignette.active {
  animation: vignetteFlash 0.7s ease-in-out infinite;
}
@keyframes vignetteFlash {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 1;   }
}
.rest-timer-ring { width: 68px; height: 68px; position: relative; flex-shrink: 0; }
.rest-timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rest-timer-ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.rest-timer-ring .bg { stroke: rgba(255,255,255,0.07); }
.rest-timer-ring .fg { stroke: var(--accent); transition: stroke-dashoffset 1s linear, stroke 0.4s ease; }
.rest-timer.urgent .rest-timer-ring .fg { stroke: #dc3232; }
.rest-timer-body { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.rest-timer-label { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }
.rest-timer-time {
  font-family: var(--font-mono);
  font-size: 2rem; font-weight: 700; line-height: 1;
  min-width: 72px; color: var(--text-primary);
  transition: color 0.3s ease;
}
.rest-timer.urgent .rest-timer-time { color: #ff4444; }
.rest-timer-done .rest-timer-time { color: var(--success); font-size: 1.6rem; }
.rest-timer-done .fg { stroke: var(--success); }
.rest-timer-done {
  border-color: rgba(0,230,118,0.5);
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 32px rgba(0,230,118,0.2);
  animation: none;
}
.rest-timer-close {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.07); color: var(--text-muted);
  cursor: pointer; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-base), color var(--t-base);
  outline: none; touch-action: manipulation;
  flex-shrink: 0; align-self: flex-start;
}
.rest-timer-close:hover { background: var(--danger-dim); color: var(--danger); }
.rest-timer-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rest-presets { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.rest-preset-btn {
  padding: 10px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input);
  color: var(--text-secondary); font-family: var(--font-mono);
  font-size: 13px; font-weight: 700; cursor: pointer;
  /* [OPT] Specific props */
  transition: border-color var(--t-base), color var(--t-base),
              background var(--t-base), box-shadow var(--t-base);
  outline: none;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.rest-preset-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rest-preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.rest-preset-btn.active {
  background: var(--accent); color: #071a0e; border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(0,230,118,0.4);
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 639px) {
  .xp-bar-mini { display: none; }
}

@media (min-width: 640px) {
  #mainContent { padding: 26px 28px calc(var(--nav-height) + 30px); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 700px) {
  :root { --content-max: 720px; }
  .exercise-card { padding: 18px 20px; }
  .list-item { padding: 17px 18px; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sub-tab { padding: 12px 10px; }
}
@media (min-width: 900px) {
  :root { --content-max: 860px; }
  #mainContent { padding: 32px 40px calc(var(--nav-height) + 36px); }
  #bottomNav {
    max-width: var(--content-max);
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
@media (max-width: 360px) {
  #mainContent { padding: 16px 12px calc(var(--nav-height) + var(--safe-bottom) + 16px); }
  .card { padding: 16px 14px; }
  .set-row { grid-template-columns: 28px 1fr 1fr 54px 38px; gap: 5px; }
  .set-header { grid-template-columns: 28px 1fr 1fr 54px 38px; gap: 5px; }
  .stat-label { letter-spacing: 0.8px; }
}

/* ══════════════════════════════════════════════
   EXTENDED FEATURE STYLES
   ══════════════════════════════════════════════ */
.ex-history { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 0 12px; font-size: 0.74rem; color: var(--text-muted); }
.ex-history-label { font-weight: 700; color: var(--text-secondary); margin-right: 2px; }
.ex-history-set {
  background: var(--bg-secondary); border-radius: 5px; padding: 3px 8px;
  font-family: var(--font-mono); border: 1px solid var(--border); font-size: 0.72rem;
}
.note-row { padding: 10px 0 4px; }
.note-input {
  font-size: 0.82rem; padding: 9px 12px;
  border-color: var(--border); color: var(--text-secondary);
  background: var(--bg-secondary);
  resize: vertical;
  min-height: 44px;
  line-height: 1.5;
}
.note-input:focus { color: var(--text-primary); }
.muscle-vol-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.muscle-vol-row:last-child { border-bottom: none; }
.muscle-vol-label { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 0.84rem; font-weight: 500; }
.same-set-btn { opacity: 0.7; transition: opacity 0.15s, transform 0.1s; }
.same-set-btn:hover { opacity: 0.9; }
.same-set-btn:active { opacity: 1; transform: scale(0.96); }

/* WEIGHT SUGGESTION */
.weight-suggestion {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; margin: 0 0 14px;
  background: rgba(255,214,0,0.07);
  border: 1px solid rgba(255,214,0,0.22);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
  font-size: 0.8rem; color: var(--text-secondary); line-height: 1.55;
}
.weight-suggestion strong { color: var(--warning); font-weight: 700; }

/* WORKOUT SUMMARY */
.workout-summary { padding-bottom: 40px; }
.summary-header { text-align: center; padding: 32px 16px 26px; }
.summary-icon {
  font-size: 4rem; line-height: 1; margin-bottom: 14px;
  animation: summaryPop 0.55s var(--ease-spring);
  display: block;
  filter: drop-shadow(0 0 20px rgba(255,214,0,0.4));
}
@keyframes summaryPop { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.2) rotate(4deg); } 100% { transform: scale(1) rotate(0deg); opacity: 1; } }
.summary-title {
  font-family: var(--font-display); font-size: 2rem;
  font-weight: 700; letter-spacing: 4px; text-transform: uppercase;
  background: linear-gradient(135deg, var(--success), #00bfff);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 7px;
}
.summary-subtitle { font-size: 0.84rem; color: var(--text-muted); font-weight: 500; }
.summary-pr-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.summary-ex-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.summary-ex-row:last-child { border-bottom: none; }
.summary-ex-name { font-weight: 600; font-size: 0.92rem; margin-bottom: 4px; }
.summary-ex-meta { font-size: 0.76rem; color: var(--text-secondary); font-family: var(--font-mono); }
.summary-ex-note { font-size: 0.76rem; color: var(--text-muted); margin-top: 4px; font-style: italic; }

/* ANALYTICS */
.modal-content .stat-grid { gap: 8px; }
.modal-content .chart-container { max-height: 170px; min-height: 130px; }
.modal-content .section-title { margin-top: 18px; margin-bottom: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.modal-content .section-title:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.muscle-vol-row .font-mono { font-size: 0.8rem; font-weight: 700; }

/* TAG FILTER BAR */
.tag-filter-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; padding: 2px 0; }
.tag-chip {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color var(--t-base), color var(--t-base),
              background var(--t-base), box-shadow var(--t-base);
  text-transform: capitalize; letter-spacing: 0.3px; outline: none;
  touch-action: manipulation;
}
.tag-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tag-chip:hover { border-color: rgba(0,230,118,0.4); color: var(--accent); }
.tag-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-color: var(--accent); color: #071a0e;
  box-shadow: 0 2px 10px rgba(0,230,118,0.35);
}

/* JOURNAL */
.journal-rating-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.journal-rating-item { text-align: center; }
.journal-rating-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-secondary); margin-bottom: 10px; }
.rating-stars { display: flex; justify-content: center; gap: 3px; }
.rating-star { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); padding: 2px; transition: color 0.12s, transform 0.12s; line-height: 1; outline: none; }
.rating-star:focus-visible { outline: 2px solid var(--warning); border-radius: 2px; }
.rating-star.active { color: var(--warning); filter: drop-shadow(0 0 4px rgba(255,214,0,0.5)); }
.rating-star:hover { transform: scale(1.25); }
.journal-entry { padding: 13px 0; border-bottom: 1px solid var(--border); }
.journal-entry:last-child { border-bottom: none; }
.journal-entry-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.journal-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 5px; }
.journal-chip { padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; background: rgba(0,230,118,0.1); color: var(--accent); border: 1px solid rgba(0,230,118,0.22); }
.journal-note { font-size: 0.8rem; color: var(--text-secondary); font-style: italic; line-height: 1.55; margin-top: 5px; padding-left: 12px; border-left: 2px solid rgba(0,230,118,0.3); }

/* REMINDERS */
.toggle-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--bg-card-hover); border: 1px solid var(--border-strong); border-radius: 26px; transition: background 0.22s; }
.toggle-slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; background: var(--text-muted); border-radius: 50%; transition: transform 0.22s var(--ease-spring), background 0.22s; }
.toggle-switch input:checked + .toggle-slider { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px rgba(0,230,118,0.35); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.day-picker { display: flex; gap: 7px; flex-wrap: wrap; }
.day-chip { padding: 7px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-input); color: var(--text-secondary); font-size: 13px; font-weight: 700; cursor: pointer; transition: border-color var(--t-base), color var(--t-base), background var(--t-base), box-shadow var(--t-base); outline: none; min-height: 44px; display: inline-flex; align-items: center; touch-action: manipulation; }
.day-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.day-chip:hover { border-color: rgba(0,230,118,0.35); color: var(--accent); }
.day-chip.active { background: var(--accent); border-color: var(--accent); color: #071a0e; box-shadow: 0 2px 8px rgba(0,230,118,0.35); }

/* LIVE METRICS OVERLAY */
.metrics-overlay {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px); left: 16px;
  z-index: 88;
  background: rgba(24,24,32,0.96);
  border: 1px solid rgba(0,230,118,0.35);
  border-radius: var(--radius-md); padding: 9px 15px 9px 12px;
  box-shadow: 0 4px 28px rgba(0,0,0,0.55), 0 0 16px rgba(0,230,118,0.12);
  backdrop-filter: blur(14px);
  animation: slideUp 0.3s var(--ease-spring);
  will-change: transform;
  pointer-events: none;
}
.metrics-overlay.hidden { display: none; }
.metrics-overlay.collapsed .metrics-overlay-row { display: none; }
.metrics-overlay.collapsed { padding: 7px 10px; }
.metrics-toggle-btn {
  pointer-events: auto;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 13px; font-weight: 700;
  line-height: 1; padding: 0 0 0 6px;
  display: flex; align-items: center;
  transition: color var(--t-base);
}
.metrics-toggle-btn:hover { color: var(--accent); }
.metrics-overlay-row { display: flex; gap: 14px; align-items: center; }
.metrics-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.metrics-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.metrics-val { font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; line-height: 1; color: var(--text-primary); }

/* HEATMAP */
.heatmap-month { margin-bottom: 18px; }
.heatmap-month-label { font-family: var(--font-display); font-size: 0.82rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 9px; }
.heatmap-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.heatmap-dow { text-align: center; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); padding: 3px 0; }
.heatmap-cell { aspect-ratio: 1; border-radius: 4px; background: rgba(255,255,255,0.03); font-size: 12px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-family: var(--font-mono); transition: transform var(--t-fast); }
.heatmap-cell:not(.empty):hover { transform: scale(1.18); }
.heatmap-cell.empty { background: none; }
.heatmap-cell.min  { background: rgba(0,230,118,0.18); color: var(--accent); }
.heatmap-cell.low  { background: rgba(0,230,118,0.35); color: var(--accent); }
.heatmap-cell.med  { background: rgba(0,230,118,0.60); color: #fff; }
.heatmap-cell.high { background: var(--accent); color: #082010; box-shadow: 0 0 8px rgba(0,230,118,0.5); }
.heatmap-cell.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; justify-content: flex-end; }
.heatmap-legend .heatmap-cell { width: 14px; height: 14px; aspect-ratio: unset; border-radius: 2px; font-size: 0; }

/* ══════════════════════════════════════════════
   ONBOARDING — full-screen first-run flow
   ══════════════════════════════════════════════ */

/* Overlay sits above everything including topbar (z-index 100) */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg-primary);
  display: flex; flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 0 24px calc(48px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  transition: opacity 0.4s ease;
}
.onboarding-overlay.visible { opacity: 1; }
.onboarding-overlay.exiting {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

/* Step progress dots */
.onboarding-progress {
  display: flex; gap: 8px; align-items: center;
  padding: 32px 0 0;
  flex-shrink: 0;
}
.ob-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-strong);
  transition: background var(--t-base), width var(--t-base), border-radius var(--t-base);
}
.ob-dot.active {
  width: 24px; border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0,230,118,0.4);
}
.ob-dot.done { background: rgba(0,230,118,0.35); }

/* Content container — animates in per step */
.onboarding-container {
  width: 100%; max-width: 440px;
  padding: 36px 0 0;
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.32s var(--ease-spring),
              transform 0.32s var(--ease-spring);
}
.onboarding-container.visible { opacity: 1; transform: translateY(0); }

/* Typography */
.ob-logo {
  font-family: var(--font-display);
  font-size: 1rem; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase; margin-bottom: 36px; display: block;
  background: linear-gradient(105deg, #00E676 0%, #FF8A50 55%, #FFD600 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.ob-step-label {
  font-size: 12px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 14px; display: block;
}
.ob-headline {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  font-weight: 700; letter-spacing: -0.5px; line-height: 1.1;
  color: var(--text-primary); margin-bottom: 12px;
}
.ob-sub {
  font-size: 0.95rem; color: var(--text-secondary);
  line-height: 1.65; margin-bottom: 32px;
}
.ob-optional {
  font-size: 11px; color: var(--text-muted);
  font-weight: 400; letter-spacing: 0;
  text-transform: none;
}

/* Navigation row (back + next) */
.ob-nav {
  display: grid; grid-template-columns: 1fr 2fr;
  gap: 10px; margin-top: 24px;
}

/* Skip link */
.ob-skip {
  text-align: center; margin-top: 18px;
  font-size: 0.82rem; color: var(--text-muted);
  cursor: pointer; user-select: none;
  text-decoration: underline; text-underline-offset: 3px;
}
.ob-skip:hover { color: var(--text-secondary); }

/* ── Goal selection grid ── */
.ob-goal-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 4px;
}
.goal-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 4px; padding: 18px 16px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-lg); cursor: pointer;
  text-align: left; width: 100%;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-fast);
  box-shadow: var(--shadow-card);
}
.goal-card:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.goal-card:active { transform: scale(0.97); }
.goal-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow-card);
}
.goal-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.goal-card-icon { font-size: 1.6rem; line-height: 1; margin-bottom: 6px; }
.goal-card-label { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); line-height: 1.2; }
.goal-card-sub { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.4; margin-top: 2px; }

/* ── Template list ── */
.ob-template-list {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px;
}
.template-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer; width: 100%;
  text-align: left;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-fast);
  box-shadow: var(--shadow-card);
}
.template-card:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.template-card:active { transform: scale(0.99); }
.template-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.template-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tpl-left { display: flex; align-items: center; gap: 14px; }
.tpl-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; }
.tpl-info { display: flex; flex-direction: column; gap: 2px; }
.tpl-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.tpl-desc { font-size: 0.76rem; color: var(--text-secondary); }
.tpl-check {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #071a0e;
  font-size: 0.78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(0.4);
  transition: opacity var(--t-base), transform var(--t-base);
  flex-shrink: 0;
}
.tpl-check.visible { opacity: 1; transform: scale(1); }

/* ── Dashboard greeting card ── */
.ob-greeting-card {
  background: linear-gradient(135deg, rgba(0,230,118,0.12) 0%, var(--bg-card) 60%);
  border: 1px solid rgba(0,230,118,0.22);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  margin-bottom: var(--card-gap);
  display: flex; align-items: center; gap: 16px;
}
.ob-greeting-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: #fff;
  letter-spacing: 0;
}
.ob-greeting-text { flex: 1; min-width: 0; }
.ob-greeting-name {
  font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ob-greeting-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

@media (prefers-color-scheme: light) {
  .onboarding-overlay { background: var(--bg-primary); }
  .form-input:hover, .form-select:hover, .form-textarea:hover {
    background: var(--bg-secondary);
  }
  .set-input:hover { background: var(--bg-secondary); }
}

/* REST TIMER BACKDROP */
.rest-timer-backdrop {
  position: fixed; inset: 0;
  z-index: 89;
  background: transparent;
  cursor: default;
  pointer-events: none;
}
.rest-timer-backdrop:not(.hidden) {
  pointer-events: auto;
}

/* ══════════════════════════════════════════════
   LIGHT MODE
   ══════════════════════════════════════════════ */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary:     #EEEDE8;
    --bg-secondary:   #E4E3DC;
    --bg-card:        #FFFFFF;
    --bg-card-hover:  #F5F4F0;
    --bg-card-raised: #FAFAF7;
    --bg-input:       #EDECE6;
    --border:         rgba(0,0,0,0.08);
    --border-strong:  rgba(0,0,0,0.14);
    --border-focus:   #00E676;
    --text-primary:   #1A1A16;
    --text-secondary: #5A5A60;
    --text-muted:     #ABABAB;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.06), 0 4px 18px rgba(0,0,0,0.08),
                   inset 0 1px 0 rgba(255,255,255,0.95);
    --shadow-raised: 0 2px 4px rgba(0,0,0,0.08), 0 8px 28px rgba(0,0,0,0.1),
                     inset 0 1px 0 rgba(255,255,255,1);
  }
  body { background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,230,118,0.04) 0%, transparent 60%); }
  #topbar { background: rgba(238,237,232,0.92); }
  #bottomNav { background: rgba(238,237,232,0.97); }
  /* [OPT] card::before highlight is invisible on white — hide it */
  .card::before { display: none; }
  .chart-container { background: var(--bg-secondary); border-color: rgba(0,0,0,0.06); }
  .modal-content { background: #FAFAF7; }
  .xp-bar-mini { background: rgba(0,0,0,0.12); border-color: rgba(0,0,0,0.1); }
  .progress-bar { background: rgba(0,0,0,0.07); }
  .rest-timer { box-shadow: 0 4px 24px rgba(0,0,0,0.12); }
  .metrics-overlay { background: rgba(255,255,255,0.96); border-color: rgba(0,230,118,0.25); }
  .stat-box { background: var(--bg-secondary); }
  .set-num { background: var(--bg-secondary); }
  .heatmap-cell { background: rgba(0,0,0,0.04); }
  .heatmap-cell.min { background: rgba(0,230,118,0.12); }
  .heatmap-cell.low { background: rgba(0,230,118,0.25); }
  .heatmap-cell.med { background: rgba(0,230,118,0.50); color: #fff; }
  .heatmap-cell.high { color: #071a0e; }
  ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
  ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }
}

/* ══════════════════════════════════════════════
   REDUCED MOTION
   ══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .xp-fill { transition: width 0.15s linear; }
  .progress-fill { transition: width 0.15s linear; }
  .set-check.done { animation: none; }
  .modal-content { animation: none; }
  .toast { animation: none; }
  .level-up-content { animation: none; }
  .card { animation: none; }
}

/* ══════════════════════════════════════════════
   PROGRESSIVE OVERLOAD COACH
   Replaces the old passive .weight-suggestion banner
   ══════════════════════════════════════════════ */

.po-coach {
  margin: 0 0 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-strong);
}
.po-coach.po-increase  { border-color: rgba(0,230,118,0.35); }
.po-coach.po-hold      { border-color: rgba(0,230,118,0.28); }
.po-coach.po-first     { border-color: rgba(0,229,255,0.25); }
.po-coach.po-deload    { border-color: rgba(255,214,0,0.28); }

.po-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 14px 10px;
}
.po-coach.po-increase .po-header { background: rgba(0,230,118,0.07); }
.po-coach.po-hold     .po-header { background: rgba(0,230,118,0.07); }
.po-coach.po-first    .po-header { background: rgba(0,229,255,0.07); }
.po-coach.po-deload   .po-header { background: rgba(255,214,0,0.07); }

.po-status {
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; padding: 3px 9px;
  border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
.po-increase .po-status { background: var(--success-dim); color: var(--success); }
.po-hold     .po-status { background: var(--accent-dim);  color: var(--accent);  }
.po-first    .po-status { background: var(--cyan-dim);    color: var(--cyan);    }
.po-deload   .po-status { background: var(--warning-dim); color: var(--warning); }

.po-target {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
  justify-content: flex-end;
}
.po-target-weight {
  font-family: var(--font-display); font-size: 1.6rem;
  font-weight: 700; line-height: 1; letter-spacing: -0.5px;
}
.po-increase .po-target-weight { color: var(--success); }
.po-hold     .po-target-weight { color: var(--accent);  }
.po-first    .po-target-weight { color: var(--cyan);    }
.po-deload   .po-target-weight { color: var(--warning); }

.po-target-meta { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; line-height: 1; }

.po-body {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 14px 10px;
  border-top: 1px solid var(--border);
}
.po-reasoning { font-size: 0.77rem; color: var(--text-secondary); line-height: 1.5; flex: 1; }
.po-reasoning strong { color: var(--text-primary); font-weight: 600; }

.po-fill-btn {
  flex-shrink: 0;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.3px;
  cursor: pointer; border: none; outline: none;
  transition: background var(--t-fast), transform var(--t-fast);
  touch-action: manipulation; min-height: 36px; white-space: nowrap;
}
.po-increase .po-fill-btn { background: var(--success); color: #000; }
.po-increase .po-fill-btn:hover { background: #00ff88; }
.po-hold     .po-fill-btn { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(0,230,118,0.3); }
.po-hold     .po-fill-btn:hover { background: rgba(0,230,118,0.25); }
.po-first    .po-fill-btn { background: var(--cyan-dim); color: var(--cyan); border: 1px solid rgba(0,229,255,0.3); }
.po-first    .po-fill-btn:hover { background: rgba(0,229,255,0.2); }
.po-deload   .po-fill-btn { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(255,214,0,0.3); }
.po-fill-btn:active   { transform: scale(0.95); }
.po-fill-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.po-fill-btn.filled   { opacity: 0.55; cursor: default; pointer-events: none; }

.set-feedback {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  padding: 3px 8px; border-radius: 20px;
  margin-top: 4px; margin-left: 36px;
  opacity: 0; transform: translateY(-4px);
  transition: opacity 0.22s ease, transform 0.22s var(--ease-spring);
}
.set-feedback.visible { opacity: 1; transform: translateY(0); }
.set-feedback.fb-pr    { background: var(--warning-dim); color: var(--warning); }
.set-feedback.fb-good  { background: var(--success-dim); color: var(--success); }
.set-feedback.fb-under { background: var(--accent-dim);  color: var(--accent);  }
.set-feedback.fb-bw    { background: var(--cyan-dim);    color: var(--cyan);    }

.po-summary-section { margin-top: 4px; }
.po-summary-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.po-summary-row:last-child { border-bottom: none; }
.po-summary-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1; }
.po-summary-info { flex: 1; min-width: 0; }
.po-summary-name { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.po-summary-detail { font-size: 0.76rem; color: var(--text-secondary); margin-top: 2px; font-family: var(--font-mono); }
.po-summary-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap; flex-shrink: 0;
}
.po-summary-badge.up    { background: var(--success-dim); color: var(--success); }
.po-summary-badge.hold  { background: var(--accent-dim);  color: var(--accent);  }
.po-summary-badge.pr    { background: var(--warning-dim); color: var(--warning); }
.po-summary-badge.first { background: var(--cyan-dim);    color: var(--cyan);    }

@media (prefers-color-scheme: light) {
  .po-coach.po-increase .po-header { background: rgba(0,180,90,0.06); }
  .po-coach.po-hold     .po-header { background: rgba(0,230,118,0.05); }
  .po-coach.po-first    .po-header { background: rgba(0,180,220,0.06); }
  .po-coach.po-deload   .po-header { background: rgba(200,165,0,0.06); }
  .po-increase .po-fill-btn { background: var(--success); color: #000; }
}

/* ══════════════════════════════════════════════
   LIGHT MODE — toggled via [data-theme="light"] on <html>
   All tokens override the dark defaults above.
   ══════════════════════════════════════════════ */
html[data-theme="light"] {
  --bg-primary:      #f0f7f2;
  --bg-secondary:    #e4f0e9;
  --bg-card:         #ffffff;
  --bg-card-hover:   #f0f9f4;
  --bg-card-raised:  #ffffff;
  --bg-input:        #e8f4ed;

  --border:          rgba(0,0,0,0.09);
  --border-strong:   rgba(0,0,0,0.15);
  --border-focus:    #00994d;

  /* Green text throughout in light mode */
  --text-primary:    #00662b;
  --text-secondary:  #008a3a;
  --text-muted:      #5aaa7a;

  --accent:           #00994d;
  --accent-dim:       rgba(0,153,77,0.12);
  --accent-glow:      rgba(0,153,77,0.2);
  --accent-secondary: #00b85a;
  --accent-bright:    #00cc66;

  --success:      #00994d;
  --success-dim:  rgba(0,153,77,0.1);
  --success-glow: rgba(0,153,77,0.18);
  --warning:      #c27e00;
  --warning-dim:  rgba(194,126,0,0.1);

  --shadow-card:   0 1px 2px rgba(0,0,0,0.06),
                   0 4px 20px rgba(0,0,0,0.08),
                   inset 0 1px 0 rgba(255,255,255,0.9);
  --shadow-raised: 0 2px 4px rgba(0,0,0,0.07),
                   0 8px 32px rgba(0,0,0,0.1),
                   inset 0 1px 0 rgba(255,255,255,1);
  --shadow-accent: 0 4px 24px rgba(0,153,77,0.22),
                   0 2px 8px rgba(0,153,77,0.12);
  --shadow-float:  0 8px 32px rgba(0,0,0,0.12),
                   0 2px 8px rgba(0,0,0,0.08);
  --shadow-glow-success: 0 0 16px rgba(0,153,77,0.2);

  /* Force bg on the html element itself so iOS overscroll shows correct color */
  background-color: #f0f7f2;
}

/* ── Light: specific element overrides ── */
html[data-theme="light"] body {
  background-color: #f0f7f2;
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%,
    rgba(0,153,77,0.06) 0%, transparent 60%);
}
html[data-theme="light"] #topbar {
  background: rgba(240,247,242,0.94);
  box-shadow: 0 1px 0 rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.07);
}
html[data-theme="light"] #bottomNav {
  background: rgba(240,247,242,0.97);
}
html[data-theme="light"] .modal-backdrop {
  background: rgba(0,0,0,0.35);
}
html[data-theme="light"] .modal-content {
  box-shadow: 0 -8px 40px rgba(0,0,0,0.12), 0 -2px 0 rgba(0,0,0,0.05);
}
html[data-theme="light"] .logo {
  background: linear-gradient(105deg, #007a3d 0%, #00994d 55%, #00b85a 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
html[data-theme="light"] .level-badge { color: #071a0e; }
html[data-theme="light"] .xp-fill {
  background: linear-gradient(90deg, var(--accent) 0%, #00b85a 60%, #00cc66 100%);
  box-shadow: 0 0 8px rgba(0,153,77,0.3);
}
html[data-theme="light"] .btn-primary { color: #071a0e; }
html[data-theme="light"] .btn-primary:hover {
  background: linear-gradient(135deg, #00b85a 0%, #00cc66 100%);
}
html[data-theme="light"] .card::before { display: none; }
html[data-theme="light"] .set-input:hover { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .set-check.done {
  box-shadow: 0 0 10px rgba(0,153,77,0.25), inset 0 1px 0 rgba(255,255,255,0.3);
}
html[data-theme="light"] .rest-timer {
  background: #ffffff;
  border-color: rgba(0,153,77,0.3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,153,77,0.1);
}
html[data-theme="light"] .rest-timer.urgent {
  border-color: rgba(220,50,50,0.7);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 28px rgba(220,50,50,0.18);
}
html[data-theme="light"] .rest-timer-vignette {
  background: radial-gradient(ellipse at center, transparent 55%, rgba(200,30,30,0.12) 100%);
}
html[data-theme="light"] .rest-timer-time { color: var(--text-primary); }
html[data-theme="light"] .rest-timer.urgent .rest-timer-time { color: #cc2222; }
html[data-theme="light"] .rest-timer-close { background: rgba(0,0,0,0.06); }
html[data-theme="light"] .metrics-overlay {
  background: rgba(255,255,255,0.97);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1), 0 0 10px rgba(0,153,77,0.06);
}
html[data-theme="light"] .tag-warning { color: #8a6800; }
html[data-theme="light"] .heatmap-cell { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .heatmap-cell.low { background: rgba(0,153,77,0.25); color: #004d26; }
html[data-theme="light"] .heatmap-cell.med { background: rgba(0,153,77,0.55); color: #082010; }
html[data-theme="light"] .heatmap-cell.high { color: #071a0e; }
html[data-theme="light"] .rest-preset-btn.active { color: #071a0e; }
html[data-theme="light"] .day-chip.active { color: #071a0e; }
html[data-theme="light"] .nav-btn { color: var(--text-muted); }
html[data-theme="light"] .level-up-overlay {
  background: rgba(10,30,15,0.85);
}
html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
html[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ── Theme toggle button ── */
.theme-toggle {
  width: 36px; height: 36px;
  border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem; line-height: 1;
  transition: background var(--t-base), color var(--t-base),
              border-color var(--t-base), transform var(--t-fast),
              box-shadow var(--t-base);
  flex-shrink: 0;
  outline: none;
  touch-action: manipulation;
}
.theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
  box-shadow: 0 0 12px var(--accent-glow);
}
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
