/* ═══════════════════════════════════════════════════════════
   GarageGainz – dark garage-gym PWA stylesheet
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg:          #0C0D0F;
  --bg-card:     #131416;
  --bg-raised:   #191B1D;
  --bg-input:    #191B1D;
  --border:      rgba(255,255,255,0.07);
  --border-focus:rgba(0,194,255,0.6);
  --accent:      #00C2FF;
  --accent-dim:  rgba(0,194,255,0.12);
  --accent-glow: rgba(0,194,255,0.25);
  --red:         #e03d3d;
  --green:       #3dba6b;
  --text:        #F5F6F7;
  --text-muted:  #A0A3A8;
  --text-hint:   #5C5F65;
  --r-sm:        8px;
  --r-md:        12px;
  --r-lg:        18px;
  --r-xl:        24px;
  --topbar-h:    56px;
  --font:        'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display:'Barlow Condensed', sans-serif;
  --transition:  0.18s ease;

  /* Fluid spacing scale */
  --sp-xs:  clamp(4px,  1vw,  6px);
  --sp-sm:  clamp(8px,  2vw, 12px);
  --sp-md:  clamp(12px, 3vw, 16px);
  --sp-lg:  clamp(16px, 4vw, 24px);
  --sp-xl:  clamp(24px, 5vw, 32px);

  /* Fluid type scale */
  --text-xs:   clamp(10px, 2.5vw, 11px);
  --text-sm:   clamp(11px, 2.8vw, 13px);
  --text-base: clamp(13px, 3.5vw, 15px);
  --text-md:   clamp(14px, 3.8vw, 16px);
  --text-lg:   clamp(16px, 4.2vw, 20px);
  --text-xl:   clamp(20px, 5vw,   24px);
  --text-2xl:  clamp(24px, 6vw,   32px);

  /* Screen available height (svh accounts for mobile browser chrome) */
  --screen-h: calc(100svh - var(--topbar-h));

  /* Body SVG diagram width */
  --body-svg-w: clamp(88px, 22vw, 120px);
}

/* Topbar shrink on very short screens */
@media (max-height: 650px) {
  :root {
    --topbar-h: 48px;
  }
}

/* ── Reset / base ───────────────────────────────────────────*/
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }
html, body {
  height: 100%;
  overflow: hidden;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button { cursor: pointer; font: inherit; border: none; background: none; }
input, select, textarea { font: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
}
.topbar-brand { display: flex; align-items: center; cursor: pointer; user-select: none; }
.topbar-logo { display: none; }
.topbar-wordmark {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
}
.topbar-wordmark span { color: var(--accent); }
.topbar-nav { display: flex; gap: 4px; }
.nav-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn:hover { background: var(--bg-raised); color: var(--text); }
.nav-btn.active { color: var(--accent); }

/* Profile + gym nav buttons removed from UI — kept in DOM for JS */
#navProfileBtn, #navGarageBtn { display: none !important; }

/* ── App main ────────────────────────────────────────────── */
.app-main {
  padding-top: var(--topbar-h);
  height: 100svh;          /* border-box: content area = 100svh - topbar-h */
  overflow: hidden;
  position: relative;
}

/* ── Screen transitions ──────────────────────────────────── */
.screen {
  display: none;
  height: 100%;            /* fill app-main content area exactly */
  overflow: hidden;
  padding: 0;
  animation: fadeUp 0.22s ease;
  position: relative;
}
.screen.active { display: block; }
.screen.screen--scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Screen header ───────────────────────────────────────── */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: clamp(10px, 2vh, 16px) var(--sp-md) clamp(6px, 1vh, 8px);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-md);
}
.screen-header h2 { font-size: var(--text-lg); font-weight: 700; flex: 1; }
.screen-title-display {
  font-family: var(--font-display) !important;
  font-weight: 900 !important;
  font-size: clamp(20px, 5vw, 26px) !important;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Back-only header — no title in bar, content below */
.screen-header--back-only { border-bottom: none; padding-bottom: 0; margin-bottom: 0; min-height: 44px; }

/* Centred title variant — title is truly centred to full header width */
.screen-header--centered { position: relative; }
.screen-header--centered h2 {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
}
.back-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.back-btn svg { width: 20px; height: 20px; }
.back-btn:hover { background: var(--bg-raised); color: var(--text); }

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(10px, 2.5vw, 16px);
  margin: 0 var(--sp-md) clamp(8px, 1.5vh, 14px);
}
.card-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.card-hint { font-size: 13px; color: var(--text-hint); margin-bottom: 12px; }
.collapsible-header {
  width: 100%; text-align: left; background: none; border: none; padding: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: clamp(4px, 1vh, 6px); margin-bottom: clamp(10px, 2vh, 14px); }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.form-group label svg { width: 14px; height: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.form-row .form-group { margin-bottom: 0; }

input[type="text"],
input[type="number"],
input[type="email"],
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: clamp(8px, 2vh, 11px) 14px;
  color: var(--text);
  font-size: var(--text-base);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
input[type="month"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: clamp(8px, 2vh, 11px) 14px;
  color: var(--text);
  font-size: var(--text-base);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(1) brightness(1.2) sepia(0.8) hue-rotate(25deg) saturate(2);
}
input[type="month"]::-moz-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(1) brightness(1.2) sepia(0.8) hue-rotate(25deg) saturate(2);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23888' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 36px;
}
.form-msg {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  margin-top: 10px;
  display: none;
}
.form-msg.success { display: block; background: rgba(61,186,107,0.12); color: var(--green); border: 1px solid rgba(61,186,107,0.25); }
.form-msg.error   { display: block; background: rgba(224,61,61,0.12);  color: var(--red);   border: 1px solid rgba(224,61,61,0.25);  }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--r-md);
  padding: clamp(8px, 2vh, 11px) clamp(14px, 3.5vw, 20px);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--accent);
  color: #000;
  box-shadow: none;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.btn--primary:hover { filter: brightness(1.1); }
.btn--primary:not(#startBtn) { background: var(--accent); }
.btn--primary:not(#startBtn):hover { filter: brightness(1.1); }

#start30Btn, #generateBtn, #gainz30GenBtn {
  background: var(--accent);
  color: #000;
  box-shadow: none;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#start30Btn { padding: clamp(10px, 2vh, 14px) 24px; font-size: var(--text-md); }
#start30Btn:hover, #generateBtn:hover, #gainz30GenBtn:hover { filter: brightness(1.1); }

.btn--ghost {
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: #262626; }

.btn--accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
}
.btn--accent:hover { background: var(--accent-dim); filter: brightness(1.15); }

.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--outline:hover { background: var(--bg-raised); border-color: rgba(255,255,255,0.2); }

.btn--full { width: 100%; }
.btn--lg { padding: clamp(11px, 2.5vh, 15px) 24px; font-size: var(--text-md); border-radius: var(--r-lg); }
.btn--sm { padding: clamp(5px, 1.2vh, 7px) 14px; font-size: var(--text-sm); }

/* ── Section title ───────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0;
  margin: 0 0 12px;
}

/* ── HOME ───────────────────────────────────────────────── */
/* ── Home week hero ──────────────────────────────────────── */
.home-week-hero {
  padding: var(--sp-md) var(--sp-md) var(--sp-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.home-hero-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}
.home-count-group {
  display: flex;
  align-items: baseline;
  gap: 2px;
  line-height: 1;
}
.home-week-num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(64px, 18vw, 84px);
  line-height: 0.9;
  color: var(--text);
  letter-spacing: -0.02em;
}
.home-week-denom {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 8vw, 36px);
  color: var(--text-muted);
  letter-spacing: -0.01em;
  padding-bottom: 6px;
}
.home-hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding-bottom: 6px;
}
.home-hero-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-hint);
}
.home-hero-status {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.home-total-row { margin-top: 2px; }
.home-total-num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.home-total-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-left: 4px;
}
.home-week-dots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}
.home-day-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.home-day-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.home-day-circle.done {
  background: var(--accent);
  border-color: var(--accent);
}
.home-day-circle.done svg { color: #000; }
.home-day-circle.today { border-color: var(--accent); }
.home-day-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-hint);
}
.home-day-label.today { color: var(--accent); }
.home-week-progress-bar {
  height: 3px;
  background: var(--bg-raised);
  border-radius: 2px;
}
.home-week-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.home-cards {
  padding: 0 var(--sp-md);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: clamp(4px, 1vh, 8px);
}
.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition);
}
.home-card:hover { background: var(--bg-raised); border-color: rgba(255,255,255,0.12); }
.home-card-icon {
  width: 32px; height: 32px;
  background: var(--bg-raised);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}
.home-card-icon svg { width: 16px; height: 16px; }
.home-card-body { display: flex; flex-direction: column; gap: 3px; }
.home-card-label { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-hint); }
.home-card-value { font-family: var(--font-display); font-size: 15px; font-weight: 800; line-height: 1.2; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text); }
.home-card-msg { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.home-card-streak { font-size: 12px; font-weight: 600; color: var(--accent); display: none; }
.home-card-streak.visible { display: inline; }
.home-card-weekly { display: none; margin-top: 6px; }
.home-card-weekly.visible { display: block; }
.home-card-arrow {
  position: absolute;
  top: 10px; right: 10px;
  width: 24px; height: 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-hint);
}

/* ── GARAGE ──────────────────────────────────────────────── */
.tag-input-row { display: flex; gap: 8px; }
.tag-input-row input { flex: 1; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; min-height: 36px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}
.tag-remove {
  width: 16px; height: 16px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-hint);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: background var(--transition), color var(--transition);
}
.tag-remove:hover { background: var(--red); color: #fff; }

/* ── Selector screens ──────────────────────────────────── */
.select-empty {
  color: var(--text-hint);
  font-size: 13px;
  padding: 12px 0;
  text-align: center;
}
.select-view-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.profile-stat {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.profile-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-hint); }
.profile-stat-value { font-size: 15px; font-weight: 700; }

#screen-profile-select.active,
#screen-garage-select.active {
  display: flex;
  flex-direction: column;
}

/* ── Athlete / Gym list (select screens) ─────────────────── */
.athlete-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 var(--sp-md) var(--sp-md);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.athlete-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.athlete-card:hover { background: var(--bg-raised); border-color: rgba(255,255,255,0.12); }
.athlete-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.athlete-initials {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  color: var(--accent);
  text-transform: uppercase;
  flex-shrink: 0;
}
.athlete-card.active .athlete-initials {
  background: rgba(0,194,255,0.1);
  border-color: var(--accent);
}

.athlete-body { flex: 1; min-width: 0; }
.athlete-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.athlete-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.athlete-actions { display: flex; gap: 6px; flex-shrink: 0; }

.btn-icon {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
.btn-icon--danger:hover {
  color: var(--red);
  border-color: rgba(224,61,61,0.35);
  background: rgba(224,61,61,0.08);
}

/* Keep old garage-select-list as alias in case referenced elsewhere */
.garage-select-list { display: flex; flex-direction: column; gap: 8px; padding: 0 var(--sp-md) var(--sp-md); overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }

.garage-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; }
.garage-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.garage-item:hover { border-color: var(--accent); }
.garage-item.selected { border-color: var(--accent); background: var(--accent-dim); }
.garage-item-body { flex: 1; }
.garage-item-name { font-weight: 600; font-size: 15px; }
.garage-item-equip { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── CONFIG – Context row (athlete + equipment) ──────────── */
.config-context-row {
  display: flex; align-items: center;
  margin: 0 16px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.config-context-item {
  flex: 1; display: flex; align-items: center; gap: 7px;
  padding: 10px 14px;
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted);
}
.config-context-item svg { flex-shrink: 0; color: var(--text-hint); }
.config-context-divider { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }
.config-equip-wrap {
  position: relative; display: flex; align-items: center; gap: 4px; flex: 1;
}
.config-equip-select {
  background: none; border: none; color: var(--text-muted);
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; outline: none; flex: 1;
  -webkit-appearance: none; appearance: none;
  padding: 0 16px 0 0;
}
.config-equip-arrow {
  pointer-events: none; color: var(--text-hint); flex-shrink: 0;
}

/* ── CONFIG – Sections ───────────────────────────────────── */
.config-section {
  padding: 20px 16px 0;
}
.config-section + .config-section {
  border-top: 1px solid var(--border);
  margin-top: 20px;
}
.config-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.config-section-header .section-title { margin-bottom: 0; }

/* ── CONFIG – Duration display ───────────────────────────── */
.duration-display {
  display: flex; align-items: baseline; gap: 6px;
  margin: 8px 0 12px;
}
.duration-num {
  font-family: var(--font-display);
  font-weight: 900; font-size: 56px; line-height: 1;
  color: var(--text); letter-spacing: -0.02em;
}
.duration-unit {
  font-family: var(--font-display);
  font-weight: 700; font-size: 20px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.duration-range {
  width: 100%; display: block; margin-bottom: 6px;
}
.range-bounds {
  display: flex; justify-content: space-between;
  margin-bottom: 8px;
}

/* ── CONFIG – Athlete strip (legacy, kept for compat) ──── */
.config-athlete {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
}
.config-athlete-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.config-athlete-name { font-size: 15px; font-weight: 600; }
.config-athlete-detail { font-size: 12px; color: var(--text-muted); }

/* ── CONFIG – Body selector ──────────────────────────────── */
.card--holo {
  background: #020c14;
  border-color: rgba(0,210,255,0.15);
  overflow: hidden;
}
.card--holo .card-title { color: #00d2ff; text-shadow: 0 0 8px rgba(0,210,255,0.5); }
.card--holo .card-hint  { color: rgba(0,210,255,0.5); }

.body-selector {
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 12px);
  background: #020c14;
  background-image:
    linear-gradient(rgba(0,210,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,210,255,0.06) 1px, transparent 1px);
  background-size: 14px 14px;
  border-radius: var(--r-sm);
  padding: clamp(6px, 1.5vh, 12px) 4px;
}
.body-svg-wrap { display: flex; flex-direction: column; align-items: center; gap: clamp(2px, 0.5vh, 5px); }
.body-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #00d2ff;
  text-shadow: 0 0 8px rgba(0,210,255,0.9);
}
.body-svg { width: var(--body-svg-w); height: auto; overflow: visible; }

.silhouette {
  fill: rgba(0, 30, 48, 0.82);
  stroke: #00d2ff;
  stroke-width: 0.65;
}

/* internal wireframe mesh lines */
.body-line {
  fill: none;
  stroke: rgba(0, 210, 255, 0.28);
  stroke-width: 0.45;
  stroke-linecap: round;
  pointer-events: none;
}

/* Interactive muscle regions */
.muscle {
  fill: rgba(0, 210, 255, 0);
  stroke: rgba(0, 210, 255, 0.5);
  stroke-width: 0.75;
  cursor: pointer;
  transition: fill 0.14s ease, stroke 0.14s ease, filter 0.14s ease;
}
.muscle:hover {
  fill: rgba(0, 210, 255, 0.18);
  stroke: #00d2ff;
  filter: drop-shadow(0 0 4px rgba(0, 210, 255, 0.7));
}
.muscle.selected {
  fill: rgba(0, 194, 255, 0.32);
  stroke: var(--accent);
  stroke-width: 1;
  filter: drop-shadow(0 0 6px rgba(0,194,255,0.8)) drop-shadow(0 0 12px rgba(0,194,255,0.35));
}

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; min-height: 28px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  border-radius: 100px;
  padding: 4px 10px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

/* ── Muscle chip selector ────────────────────────────────── */
.muscle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.muscle-header .card-title { margin-bottom: 0; }
.muscle-group-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-bottom: 12px;
  margin-top: 20px;
}
.muscle-chip-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
}
/* Override SVG-specific .muscle styles for button usage */
button.muscle {
  fill: unset;
  stroke: unset;
  filter: unset;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  aspect-ratio: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
}
button.muscle:hover {
  fill: unset;
  stroke: unset;
  filter: unset;
  border-color: rgba(255,255,255,0.2);
  color: var(--text);
  background: var(--bg-raised);
}
button.muscle.selected {
  fill: unset;
  stroke: unset;
  filter: unset;
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Equipment chip selector ─────────────────────────────── */
.equip-section {
  padding: var(--sp-md) var(--sp-md) 0;
}
.equip-section + .equip-section { margin-top: 4px; }
.equip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.equip-chip {
  padding: 6px 14px;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
}
.equip-chip:hover { color: var(--text); border-color: rgba(255,255,255,0.2); }
.equip-chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.equip-add-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.equip-add-row input { flex: 1; }

/* ── CONFIG – Range slider ───────────────────────────────── */
.range-row { display: flex; align-items: center; gap: 12px; }
.range-val { font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; min-width: 52px; text-align: right; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: rgba(0, 210, 255, 0.25);
  border-radius: 2px;
  outline: none;
  border: none;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  cursor: pointer;
  border: none;
}

/* ── CONFIG – Toggle switch ──────────────────────────────── */
.toggles-card .toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggles-card .toggle-row+.toggle-row { margin-top: 0; padding-top: 12px; border-top: 1px solid var(--border); }
.toggle-info { display: flex; flex-direction: column; gap: 2px; }
.toggle-label { font-family: var(--font); font-size: 14px; font-weight: 500; color: var(--text); }
.toggle-hint { font-size: var(--text-xs); color: var(--text-muted); }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { display: none; }
.slider {
  position: absolute; inset: 0;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: background var(--transition);
  cursor: pointer;
}
.slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 20px; height: 20px;
  background: #666;
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}
.switch input:checked + .slider { background: var(--accent-dim); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); background: var(--accent); }

/* ── History screen ───────────────────────────────────── */
.history-athlete-badge {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  color: var(--accent); opacity: 0.8;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ── History filter tabs ─────────────────────────────────── */
.history-filter-tabs {
  display: flex; gap: 8px; padding: 0 16px 12px;
}
.history-tab {
  flex: 0 0 auto; padding: 6px 16px; border-radius: 20px;
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.history-tab.active {
  background: var(--bg-raised); border-color: rgba(255,255,255,0.12); color: var(--text);
}

.history-list { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.history-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition);
}
.history-card-header:hover { background: var(--bg-raised); }
.history-date, .history-card-date {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted);
}
.history-title, .history-card-type {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--text); line-height: 1.1; margin-top: 2px;
}
.history-chevron {
  color: var(--text-hint); flex-shrink: 0; margin-left: 10px;
  transition: transform var(--transition);
}
.history-card.open .history-chevron { transform: rotate(180deg); }
.history-card-exercises {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border);
}
.history-card.open .history-card-exercises { display: flex; }

/* exercise list inside history card */
.history-exercise-list {
  padding: 10px 16px;
  display: flex; flex-direction: column;
}
.history-exercise-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.history-exercise-row:last-child { border-bottom: none; }
.history-ex-name, .history-exercise-name {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text);
}
.history-ex-detail, .history-exercise-sets {
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted); flex-shrink: 0; margin-left: 8px;
}
.history-weight-pills {
  display: flex; gap: 4px; flex-wrap: wrap; padding-left: 2px; margin-top: 2px;
}
.history-weight-pill {
  font-size: 10px; font-weight: 700; color: var(--accent);
  background: var(--accent-dim); border-radius: 4px; padding: 1px 5px;
}

/* ── History card actions ─────────────────────────────────── */
.history-actions, .history-card-actions {
  display: flex; border-bottom: 1px solid var(--border);
}
.history-action,
.history-fav-btn, .history-repeat-btn, .history-delete-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 8px;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border: none; border-right: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}
.history-action:last-child,
.history-fav-btn:last-child,
.history-repeat-btn:last-child,
.history-delete-btn:last-child { border-right: none; }
.history-action:hover,
.history-fav-btn:hover,
.history-repeat-btn:hover { background: var(--bg-raised); color: var(--text); }
.history-fav-btn.active { color: #f5c518; }
.history-action.danger:hover,
.history-delete-btn:hover { background: rgba(224,61,61,0.15); color: var(--red); }
.history-loader {
  display: flex; justify-content: center; padding: 32px;
}
.history-loader.hidden { display: none; }
.spinner-sm {
  width: 24px; height: 24px;
  border: 2px solid var(--bg-raised);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Loader (legacy) ───────────────────────────────────────── */
.loader { display: none; }
.loader.hidden { display: none; }
.spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── AI Loading Overlay ──────────────────────────────────── */
.ai-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5, 8, 14, 0.97);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
}
.ai-overlay.hidden { display: none; }

.ai-overlay-inner {
  display: flex; flex-direction: column; align-items: center; gap: 32px;
}

.ai-logo-wrap {
  position: relative;
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
}

.ai-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
  animation: aiSpin 1.4s linear infinite;
}
.ai-ring:nth-child(1) {
  border-top-color: var(--accent);
  animation-duration: 1.4s;
}
.ai-ring:nth-child(2) {
  inset: 12px;
  border-right-color: rgba(0,194,255,0.4);
  animation-duration: 2s;
  animation-direction: reverse;
}
.ai-ring:nth-child(3) {
  inset: 24px;
  border-bottom-color: rgba(0,194,255,0.2);
  animation-duration: 1.8s;
}
@keyframes aiSpin { to { transform: rotate(360deg); } }

.ai-logo-inner {
  position: absolute; inset: 36px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 900; font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.ai-status-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  animation: aiPulse 2s ease-in-out infinite;
}
@keyframes aiPulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

.ai-dots {
  display: flex; gap: 8px; align-items: center;
}
.ai-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent-glow);
  animation: aiDot 1.2s ease-in-out infinite;
}
.ai-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40%           { transform: scale(1.3); opacity: 1; background: var(--accent); }
}

/* ── RESULTS screen layout ───────────────────────────────── */
#screen-results.active {
  display: flex;
  flex-direction: column;
}
#screen-results .screen-header {
  position: static; /* no sticky needed — it's a fixed flex child */
  flex-shrink: 0;
}
#screen-results #planOutput {
  flex: 1;
  min-height: 0;        /* critical: allows flex child to shrink & scroll */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
#screen-results .results-actions {
  flex-shrink: 0;
}

/* ── RESULTS ─────────────────────────────────────────────── */
.result-duration-badge {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}
/* ── Results screen header ───────────────────────────────── */
.results-header {
  padding: 16px 16px 12px;
}
.results-header .label {
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 4px;
}
.results-header h2 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 900;
  text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--text); line-height: 1.1;
}
.workout-meta-row {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  flex-wrap: wrap;
}
.workout-tag {
  padding: 4px 10px; border-radius: 4px;
  background: var(--bg-raised); border: 1px solid var(--border);
  font-family: var(--font-display); font-weight: 700;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}
.workout-tag--lime, .workout-tag.lime {
  background: var(--accent-dim); border-color: rgba(0,194,255,0.25); color: var(--accent);
}

/* ── Exercise cards ──────────────────────────────────────── */
.exercise-list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; }
.exercise-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  flex-shrink: 0;
}
.exercise-card-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}
.exercise-num {
  font-family: var(--font-display);
  font-weight: 900; font-size: 34px; line-height: 1;
  color: #2A2C30; letter-spacing: -0.02em;
  min-width: 28px; flex-shrink: 0;
}
.exercise-info { flex: 1; padding-left: 12px; min-width: 0; }
.exercise-name {
  font-family: var(--font-display);
  font-weight: 800; font-size: 17px;
  text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--text); line-height: 1.1;
  cursor: pointer;
  transition: color var(--transition);
}
.exercise-name:hover { color: var(--accent); }
.exercise-muscle {
  font-size: 12px; color: var(--text-muted); margin-top: 3px;
}
.exercise-badge {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; align-self: flex-start;
}
.badge {
  padding: 3px 9px; border-radius: 4px;
  font-family: var(--font-display); font-weight: 700;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
.badge-sets {
  background: var(--bg-raised); border: 1px solid var(--border); color: var(--text-muted);
}
.badge-rest {
  background: var(--accent-dim); border: 1px solid rgba(0,194,255,0.25); color: var(--accent);
  display: flex; align-items: center; gap: 4px;
  max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rest-edit-wrap {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--accent-dim); border: 1px solid rgba(0,194,255,0.25);
  border-radius: 4px; padding: 0 7px; color: var(--accent);
  white-space: nowrap; height: 22px; overflow: hidden;
}
.rest-edit-wrap svg { flex-shrink: 0; opacity: 0.7; }
.rest-edit-input {
  width: 24px; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--accent); font-size: 12px; font-weight: 700; font-family: var(--font-display);
  letter-spacing: 0.06em; text-transform: uppercase;
  text-align: center; padding: 0; margin: 0; height: 22px; line-height: 22px;
  -moz-appearance: textfield; box-sizing: border-box; display: block;
}
.rest-edit-input::-webkit-outer-spin-button,
.rest-edit-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rest-edit-s { font-size: 12px; font-weight: 700; opacity: 0.7; letter-spacing: 0.06em; font-family: var(--font-display); }
.exercise-notes { font-size: 12px; color: var(--text-hint); font-style: italic; margin-top: 3px; }
.exercise-footer { display: flex; justify-content: flex-end; }
.swap-btn, .history-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-sm);
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid var(--accent-glow);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.swap-btn svg { width: 13px; height: 13px; }
.swap-btn:hover, .history-btn:hover { background: var(--accent-dim); filter: brightness(1.15); border-color: var(--accent); }
.swap-btn.swapping { opacity: 0.5; pointer-events: none; }
.rest-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(0,194,255,0.25);
  border-radius: 6px; padding: 3px 8px;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; margin-top: 4px;
}
.exercise-card-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

/* ── Exercise complete & rest timer ─────────────────────────── */
.exercise-actions {
  display: flex; align-items: center; gap: 10px;
  padding-top: 8px; border-top: 1px solid var(--border);
  margin-top: 8px;
}
.complete-ex-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(61,186,107,0.15);
  color: var(--green);
  border: 1px solid rgba(61,186,107,0.3);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.complete-ex-btn:hover { background: rgba(61,186,107,0.25); border-color: var(--green); filter: brightness(1.15); }
.complete-ex-btn:active { transform: scale(0.98); }
.complete-ex-btn.completing {
  background: var(--green);
  color: black;
  border-color: var(--green);
}
.exercise-timer {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
  background: rgba(61,186,107,0.1);
  border-radius: var(--r-sm);
  border: 1px solid rgba(61,186,107,0.25);
}
.timer-display {
  font-size: 18px; font-weight: 700;
  color: var(--green);
}
.timer-value {
  font-size: 20px; font-weight: 700;
  display: inline-block;
  min-width: 2.5em;
}
.skip-rest-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: opacity var(--transition), color var(--transition), border-color var(--transition);
}
.skip-rest-btn:hover { color: var(--accent); border-color: var(--accent); }
.skip-rest-btn:active { transform: scale(0.98); }

.results-actions { padding: 20px 16px 8px; display: flex; flex-direction: column; gap: 10px; }

/* ── Per-set weight logging rows ─────────────────────────── */
.set-rows { border-top: 1px solid var(--border); padding: 10px 16px; }
.set-row {
  display: grid; grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.set-row:last-child { border-bottom: none; }
.set-num {
  font-family: var(--font-display);
  font-weight: 800; font-size: 13px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
}
/* keep .set-label for backward compat */
.set-label {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase;
}
.set-reps {
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px; color: var(--text);
}
.set-weight-wrap { display: flex; align-items: center; gap: 5px; }
.set-weight-input {
  width: 72px;
  padding: 5px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  transition: border-color var(--transition);
  -moz-appearance: textfield;
}
.set-weight-input::-webkit-outer-spin-button,
.set-weight-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-weight-input:focus { outline: none; border-color: var(--accent); }
.set-weight-input::placeholder { color: var(--text-hint); font-weight: 400; }
.set-weight-unit { font-size: 12px; color: var(--text-hint); width: 18px; }
.set-weight-input[data-suggestion="1"],
.set-reps-input[data-suggestion="1"] { color: var(--text-muted); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 18px; font-size: 14px; font-weight: 500;
  white-space: nowrap; z-index: 9999;
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error   { color: var(--red);   border-color: rgba(224,61,61,0.3); }
.toast.success { color: var(--green); border-color: rgba(61,186,107,0.3); }
/* ── Auth Overlay ────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex;
  align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-box {
  width: min(340px, 90vw);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 36px 28px;
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.auth-title {
  font-size: 1.5rem; font-weight: 800;
  background: linear-gradient(90deg, #f1f5f9, #94a3b8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin: 0;
}
.auth-sub { font-size: .83rem; color: var(--text-muted); margin: 0; text-align: center; }
.auth-input {
  width: 100%; padding: 11px 14px;
  background: var(--bg-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: .95rem; outline: none; transition: border-color .2s;
  box-sizing: border-box;
}
.auth-input:focus { border-color: var(--accent); }
.auth-error { color: #f87171; font-size: .8rem; min-height: 18px; width: 100%; text-align: center; }
.auth-btn {
  width: 100%; padding: 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-sm);
  font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: opacity .15s;
}
.auth-btn:hover { opacity: .88; }
.auth-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Garage 30 Mode ──────────────────────────────────────── */
.hero-buttons { display: flex; flex-direction: column; gap: clamp(6px, 1.5vh, 12px); margin-top: var(--sp-md); width: 100%; padding: 0 var(--sp-md); box-sizing: border-box; }
.hero-buttons #start30Btn { background: var(--accent); color: #000; box-shadow: none; padding: clamp(10px, 2vh, 14px) 24px; font-size: var(--text-md); font-family: var(--font-display); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.hero-buttons #start30Btn:hover { filter: brightness(1.1); }

/* ── Mode Selector (Segmented Control) ───────────────────── */
.mode-selector {
  display: flex;
  gap: 4px;
  background: transparent;
  border-radius: 0;
  padding: 0;
  width: 100%;
  justify-content: stretch;
  box-sizing: border-box;
}

.mode-btn {
  flex: 1;
  padding: 10px 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 8px;
  color: var(--text-muted);
  transition: var(--transition);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  cursor: pointer;
  margin: 0;
  white-space: nowrap;
  text-align: center;
}

.mode-btn:hover:not(.active) {
  color: var(--text);
  background: #1a1a1a;
}

.mode-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: none;
  border-color: var(--accent);
  font-weight: 700;
}


.sport-pill {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.sport-pill:hover:not(.active) {
  color: var(--text);
  background: #1a1a1a;
}
.sport-pill.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

.slot-desc {
  display: none;
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(249, 93, 0, 0.1);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  animation: slotDescIn 0.2s ease;
}
.slot-desc.visible {
  display: block;
}
@keyframes slotDescIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.garage30-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  padding: clamp(8px, 2vh, 12px) var(--sp-md);
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
}

.garage30-display {
  text-align: center;
  margin-bottom: 8px;
  font-size: 18px;
  color: var(--text-muted);
}

.garage30-display h2 {
  font-size: 32px;
  margin-bottom: 4px;
  color: var(--text);
}

.garage30-timer-section {
  text-align: center;
  margin-bottom: 16px;
}

.garage30-timer {
  font-size: clamp(60px, 15vw, 120px);
  font-weight: 600;
  font-family: 'Monaco', 'Courier New', monospace;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(0,194,255,0.5), 0 0 40px rgba(0,194,255,0.2);
  font-variant-numeric: tabular-nums;
}

.garage30-progress {
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  width: 240px;
  margin: 0 auto;
  overflow: hidden;
  position: relative;
}

.garage30-progress::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease-out;
  box-shadow: 0 0 12px rgba(0,194,255,0.5);
}

@keyframes progress-step {
  from { width: 0; }
  to { width: 100%; }
}

.garage30-exercise {
  background: linear-gradient(135deg, var(--bg-raised), var(--bg-card));
  border: 2px solid var(--accent-dim);
  border-radius: var(--r-lg);
  padding: clamp(12px, 3vw, 20px);
  margin-bottom: clamp(8px, 2vh, 16px);
  text-align: center;
  width: 100%;
  max-width: clamp(300px, 90vw, 500px);
  box-shadow: 0 4px 16px rgba(0,194,255,0.06);
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.garage30-exercise > div:first-child {
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.garage30-exercise > div:last-child {
  font-size: clamp(11px, 2.5vw, 13px);
  color: var(--text-muted);
  font-weight: 500;
}

.garage30-next {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.garage30-rest {
  font-size: 16px;
  color: var(--green);
  font-weight: 600;
  text-align: center;
  padding: 12px 16px;
  background: rgba(61, 186, 107, 0.12);
  border: 1px solid rgba(61, 186, 107, 0.3);
  border-radius: 8px;
  width: 100%;
  max-width: 300px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ── Gainz 30 Preview Cards ─────────────────────────────── */
.g30-preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  flex-shrink: 0;
}
.g30-preview-round {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--border);
}
.g30-preview-exercises {
  display: flex;
  flex-direction: column;
}
.g30-preview-ex {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.g30-preview-ex:last-child { border-bottom: none; }
.g30-preview-ex-type {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 72px;
}
.g30-preview-ex-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--text);
  letter-spacing: 0.02em;
  flex: 1;
}
.g30-ex-link {
  cursor: pointer;
  color: var(--accent);
  transition: opacity 0.15s;
}
.g30-ex-link:hover { opacity: 0.75; }
.g30-preview-ex-detail {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.g30-swap-btn {
  display: inline-flex; align-items: center;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.g30-swap-btn:hover { background: var(--accent-dim); filter: brightness(1.15); border-color: var(--accent); }

/* ── Garage 30 Preview (legacy, keep for backward compat) ── */
.garage30-preview-triad {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  transition: all 0.2s ease;
}

.garage30-preview-triad:hover {
  border-color: var(--accent);
  background: rgba(249, 93, 0, 0.05);
}

.garage30-preview-round {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.garage30-preview-exercise {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.garage30-preview-exercise:last-child {
  margin-bottom: 0;
}

.garage30-preview-exercise-type {
  min-width: 50px;
  font-weight: 600;
  color: var(--accent);
  font-size: 12px;
}

.garage30-preview-exercise-name {
  flex: 1;
  color: var(--text);
}

.garage30-preview-exercise-detail {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

/* ── Gainz 30 Config ─────────────────────────────────────── */
#g30ConfigBody {
  padding-bottom: 24px;
}
#g30ConfigActions {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 16px;
  display: flex;
  gap: 10px;
}
.g30-section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: -8px 0 12px;
}
.g30-slots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  position: relative;
}
/* Slot description tooltip — flows inline inside its column */
.g30-slot-item .slot-desc {
  margin-top: 6px;
}
.g30-slot-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.g30-slot-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── Gainz 30 Preview ────────────────────────────────────── */
.g30-preview-header {
  padding: 4px 16px 12px;
  text-align: center;
  flex-shrink: 0;
}
.g30-preview-subtitle {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.g30-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
}
.g30-preview-actions {
  padding: 12px 16px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Gainz 30 Execution ──────────────────────────────────── */
.g30-screen-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0 16px 16px;
  overflow: hidden;
}

.g30-timer-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0 16px;
  flex-shrink: 0;
}

.g30-progress-ring {
  position: relative;
  width: 200px;
  height: 200px;
}

.g30-progress-ring svg {
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg-raised);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear;
}

.ring-outer-fill {
  stroke-dasharray: 597;
  stroke-dashoffset: 0;
  stroke: var(--text-hint);
}

.ring-inner-fill {
  stroke-dasharray: 408;
  stroke: var(--accent);
}

.ring-fill.rest { stroke: var(--text-hint); }

.g30-timer-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.g30-timer-num {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 48px;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}

.g30-timer-phase {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.g30-exercise-display {
  margin-top: 14px;
  text-align: center;
}

.g30-current-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.g30-current-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.1;
}
.g30-current-reps {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.g30-round-bar {
  margin: 0 0 12px;
  flex-shrink: 0;
}

.g30-round-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.g30-round-label span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.g30-round-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}
.g30-round-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  width: 0%;
  transition: width 0.4s ease;
}

/* Slot display */
.slot-display {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.slot-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 8px;
  text-align: center;
}

.slot-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.slot-card.done {
  opacity: 0.4;
}

.slot-type {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 4px;
}
.slot-card.active .slot-type { color: var(--accent); }
.slot-ex-link { cursor: pointer; }
.slot-ex-link:active { opacity: 0.7; }

.slot-exercise {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.2;
}

/* Controls */
.g30-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.ctrl-btn-primary {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0C0D0F;
  justify-self: center;
  transition: all 0.15s;
}
.ctrl-btn-primary:hover { filter: brightness(1.08); }
.ctrl-btn-primary:active { transform: scale(0.96); }
.ctrl-btn-primary.paused { background: var(--bg-raised); border: 1px solid var(--border); color: var(--accent); }

.ctrl-btn-secondary {
  height: 46px;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all 0.15s;
}
.ctrl-btn-secondary:hover { color: var(--text); }
.ctrl-btn-secondary:disabled { opacity: 0.35; cursor: default; }

/* ── Confirm Modal (End Workout etc.) ───────────────────── */
.confirm-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.confirm-modal.active { display: flex; }
.confirm-modal-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px 24px;
  width: min(340px, 90vw);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
/* ── Swap Picker ─────────────────────────────────────────── */
.swap-picker-list { display: flex; flex-direction: column; gap: 6px; }
.swap-picker-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-display); font-size: 15px;
  font-weight: 700; letter-spacing: 0.04em; text-align: left;
  cursor: pointer; transition: background var(--transition), border-color var(--transition);
}
.swap-picker-item:hover { background: var(--bg-raised); border-color: var(--accent-glow); }
.swap-picker-original { border-color: rgba(255,255,255,0.12); opacity: 0.6; }
.swap-picker-original:hover { opacity: 1; }
.swap-picker-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap;
}

/* ── Mode info popout ────────────────────────────────────── */
.mode-info-card { position: relative; }
.mode-info-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none;
  color: var(--text-muted); font-size: 22px; line-height: 1;
  cursor: pointer; padding: 2px 6px;
  transition: color var(--transition);
}
.mode-info-close:hover { color: var(--text); }
.mode-info-title {
  font-family: var(--font-display);
  font-weight: 900; font-size: 22px;
  text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--accent); margin: 0 0 12px; padding-right: 28px;
}
.mode-info-desc {
  margin: 0; font-size: 14px;
  color: var(--text-muted); line-height: 1.6;
}

.confirm-modal-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
  margin: 0 0 10px;
}
.confirm-modal-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 24px;
}
.confirm-modal-actions {
  display: flex;
  gap: 10px;
}

/* ── Video Modal ─────────────────────────────────────────── */
.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.video-modal.open {
  opacity: 1;
  pointer-events: all;
}
.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.video-modal-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text);
}
.video-modal-close, .video-modal-refresh {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.video-modal-close:hover { color: var(--text); }
.video-modal-refresh:hover { color: var(--accent); border-color: var(--accent); }
.video-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  flex-shrink: 0;
}
.video-player-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-hint);
}
.video-placeholder svg { opacity: 0.4; }
.video-placeholder-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.video-loading {
  text-align: center;
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-muted);
  display: none;
}
.video-error {
  text-align: center;
  padding: 12px 0;
  font-size: 13px;
  color: var(--red);
  display: none;
}
.video-thumbnails {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  overflow-y: auto;
}
.video-thumb {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid transparent;
  aspect-ratio: 16/9;
  cursor: pointer;
  transition: border-color 0.15s;
  background: var(--bg-card);
}
.video-thumb:hover { border-color: var(--accent); }
.video-thumb.active { border-color: var(--accent); }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── MODAL (Equipment Selector) ──────────────────────────── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active {
  display: flex;
}
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.modal-content {
  position: relative;
  z-index: 1001;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg-raised);
}
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.equipment-search {
  margin-bottom: 16px;
}
.equipment-search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition), background var(--transition);
}
.equipment-search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: #1f1f1f;
}
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.equipment-item {
  padding: 12px;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  user-select: none;
  word-wrap: break-word;
  word-break: break-word;
}
.equipment-item:hover {
  border-color: var(--accent);
  background: #252525;
}
.equipment-item.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(249, 93, 0, 0.3);
}
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-footer .btn {
  flex: 1;
}

/* ── Workout Pause/End Buttons ─────────────────────────── */
#garage30PauseBtn, #garage30EndBtn, #footy30PauseBtn, #footy30EndBtn {
  padding: 8px 0;
  font-size: 13px;
  min-height: 36px;
  width: 130px !important;
  flex: none !important;
  justify-content: center;
}

/* ── Utilities ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────────────────── */
/* Very short screens: allow config screen to scroll */
@media (max-height: 650px) {
  #screen-config {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  :root {
    --body-svg-w: clamp(72px, 19vw, 88px);
  }
}

/* Small phones: ultra-compact to ensure everything fits */
@media (max-height: 700px) {
  .garage30-exercise {
    padding: 10px 12px;
    margin-bottom: 6px;
  }
  .garage30-exercise > div:first-child {
    font-size: clamp(12px, 3vw, 14px);
    margin-bottom: 6px;
  }
  .garage30-exercise > div:last-child {
    font-size: clamp(10px, 2vw, 11px);
  }
  .garage30-display { margin-bottom: 6px; }
  .garage30-timer-section { margin-bottom: 12px; }
}

/* Large phones/tablets: expand vertically */
@media (min-height: 701px) {
  .garage30-exercise {
    padding: 20px 16px;
    margin-bottom: 16px;
  }
  .garage30-exercise > div:first-child {
    font-size: clamp(14px, 4vw, 18px);
    margin-bottom: 12px;
  }
  .garage30-exercise > div:last-child {
    font-size: clamp(11px, 2.5vw, 13px);
  }
  .garage30-display { margin-bottom: 12px; }
  .garage30-timer-section { margin-bottom: 20px; }
}

@media (min-width: 600px) {
  .app-main { max-width: 640px; margin: 0 auto; }
  .topbar { max-width: 640px; left: 50%; transform: translateX(-50%); right: auto; width: 640px; }
}

@media (min-width: 768px) {
  .home-cards { flex-direction: row; }
  .home-card { flex: 1; }
  .body-svg { width: clamp(100px, 14vw, 140px); }
  .app-main { max-width: 760px; }
  .topbar { max-width: 760px; width: 760px; }
}

@media (min-width: 1024px) {
  .app-main { max-width: 900px; }
  .topbar { max-width: 900px; width: 900px; }
}

/* Trash icon button in screen headers */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn--danger:hover { color: var(--red); background: rgba(255,59,48,0.1); }

/* Profile screen — flex layout, Save button pinned at bottom */
#screen-profile.active {
  display: flex;
  flex-direction: column;
}
#screen-profile .screen-header { flex-shrink: 0; position: static; }
#profileScrollBody { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#profileActions { flex-shrink: 0; padding: var(--sp-sm) var(--sp-md) var(--sp-md); }

/* Garage screen — flex layout, Save button pinned at bottom */
#screen-garage.active {
  display: flex;
  flex-direction: column;
}
#screen-garage .screen-header { flex-shrink: 0; position: static; }
#garageScrollBody { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#garageActions { flex-shrink: 0; padding: var(--sp-sm) var(--sp-md) var(--sp-md); }

/* Config screen — flex layout so Generate button stays pinned at bottom */
#screen-config.active {
  display: flex;
  flex-direction: column;
}
#screen-config .screen-header { flex-shrink: 0; position: static; }
#configScrollBody {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 24px;
}
#configActions {
  flex-shrink: 0;
  padding: var(--sp-sm) var(--sp-md) var(--sp-md);
}

/* Gainz30 preview — flex layout so Start button stays pinned at bottom */
#screen-gainz30-preview.active {
  display: flex;
  flex-direction: column;
  overflow: hidden; /* inner container scrolls, not the screen */
}
#screen-gainz30-preview .screen-header { flex-shrink: 0; position: static; }
#gainz30PreviewContainer { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#gainz30Actions { flex-shrink: 0; }

/* Gainz30 config screen headings */
#screen-gainz30-config > div:first-of-type {
  padding: clamp(10px, 2vh, 16px);
  text-align: center;
}
#screen-gainz30-config > div:first-of-type h1 {
  font-size: var(--text-2xl);
  margin-bottom: clamp(4px, 1vh, 8px);
}
#screen-gainz30-config > div:first-of-type p {
  font-size: var(--text-sm);
  margin-bottom: clamp(12px, 3vh, 24px);
}