/* Gym Tracker — Design Handoff (RTL, dark + lime) */

:root {
  --bg: #0d0e11;
  --bg-deep: #08090b;
  --panel: #101216;
  --card: #16181d;
  --card-2: #101216;
  --border: #23262d;
  --text: #f2f3f0;
  --muted: #8a8f98;
  --muted-2: #5f646d;
  --accent: #c6f24e;
  --accent-ink: #12140a;
  --accent-soft: rgba(198, 242, 78, 0.11);
  --accent-soft-2: rgba(198, 242, 78, 0.15);
  --accent-border: rgba(198, 242, 78, 0.35);
  --radius-lg: 18px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-chip: 10px;
  --sidebar-w: 248px;
  --header-h: 56px;
  --footer-h: 44px;
  --bottom-nav-h: 64px;
  --space-page-x: 32px;
  --space-page-y: 24px;
  --content-inset-top: 20px;
  --content-inset-bottom: 16px;
  --content-inset-x: 28px;
  --content-gap-menu: 16px;
  --space-section: 20px;
  --space-block: 14px;
  --space-card: 18px;
  --space-grid: 12px;
  --rail-w: 300px;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --body-fill: #2a2e36;
  --border-strong: #353942;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bar: 0.85s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-ring: 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body.gym-body {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.55;
  height: 100dvh;
  overflow: hidden;
  padding: 0 !important;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.gym-body button:focus-visible,
.gym-body [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Numbers line up in columns and use the display face */
.page-title,
.sidebar-logo-text strong,
.progress-ring-num,
.rail-stat-value,
.program-stat-card .value,
.score-hero-card .value,
.heat-pct,
.workout-subtab-letter,
.set-tick,
.exercise-weight,
.program-day-cell-num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* ── App shell: fixed sidebar + header / content / footer ── */
.gym-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100dvh;
  overflow: hidden;
  direction: rtl;
}

.gym-sidebar {
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 16px;
  height: 100dvh;
  overflow-y: auto;
  z-index: 40;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg { width: 21px; height: 21px; }

.sidebar-logo-text strong {
  display: block;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-logo-text span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-nav-item {
  appearance: none;
  border: none;
  background: transparent;
  color: #7a7f88;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition), color var(--transition);
  text-align: right;
  width: 100%;
}

.sidebar-nav-item svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

.sidebar-nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }

.sidebar-nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.sidebar-nav-item.active::after,
.bottom-nav-item.active::after { content: none; }

.sidebar-theme-btn {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.sidebar-theme-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--card); }

.sidebar-theme-icon { width: 21px; text-align: center; }

/* The unit switch shows its unit as text (كغ / lb) where the theme switch has an icon */
.sidebar-unit-btn .sidebar-theme-icon,
.header-unit-btn {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-progress {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.sidebar-progress-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.sidebar-progress-value {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.sidebar-progress-value em {
  font-style: normal;
  color: var(--accent);
}

.sidebar-progress-bar {
  height: 6px;
  background: var(--card-2);
  border-radius: 99px;
  overflow: hidden;
}

.sidebar-progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width var(--transition-bar);
}

.header-actions {
  display: flex;
  gap: 6px;
}

.header-icon-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: color var(--transition), border-color var(--transition);
}

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

.gym-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

/* ── Fixed header ── */
.gym-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  height: var(--header-h);
  padding: 0 var(--space-page-x);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 30;
  flex-shrink: 0;
}

.gym-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.gym-header-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

.site-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: var(--radius-chip);
  background: var(--card);
  border: 1px solid var(--border);
}

.header-stat strong {
  color: var(--text);
  font-weight: 700;
}

.header-stat.is-live {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.header-stat.is-live strong {
  color: var(--accent);
}

/* ── Scrollable content ── */
.gym-content {
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  padding-block: var(--content-inset-top) var(--content-inset-bottom);
  padding-inline-start: calc(var(--content-inset-x) + var(--content-gap-menu));
  padding-inline-end: var(--content-inset-x);
}

.gym-main-inner {
  padding: 0;
  max-width: 100%;
  width: 100%;
}

/* ── Fixed footer ── */
.gym-footer {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--footer-h);
  padding: 0 var(--space-page-x);
  background: var(--panel);
  border-top: 1px solid var(--border);
  z-index: 30;
  flex-shrink: 0;
}

.gym-footer-text {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gym-footer-sync {
  font-size: 10px;
  flex-shrink: 0;
}

/* Desktop: the sidebar already shows the page and program progress, so the header only repeats it */
@media (min-width: 961px) {
  .gym-header { display: none; }
}

/* Hide legacy chrome */
.app-tabs,
.workout-progress,
.day-select-row,
.fab { display: none !important; }

.gym-body .container {
  max-width: none;
  margin: 0;
  padding: 0 !important;
}

/* ── Page headers ── */
.page-header {
  margin-bottom: var(--space-section);
}

.page-eyebrow {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.page-title {
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
  margin-bottom: 6px;
  text-wrap: balance;
}

.page-subtitle {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
}

.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

/* ── Tab panels ── */
.app-tab-panel { display: none; }
.app-tab-panel.active { display: block; }

/* Opacity-only: a lingering transform would trap the fixed finish bar inside the panel */
.app-tab-panel { animation: tabFade 0.2s var(--ease-out) both; }

@keyframes tabFade {
  from { opacity: 0; }
}

/* ── Workout tab ── */
.workout-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.workout-page-header .session-date-row {
  margin-bottom: 0;
}

.workout-subtabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: var(--space-section);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.workout-subtab {
  appearance: none;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: right;
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.workout-subtab:hover { color: var(--text); background: var(--card); }

.workout-subtab:active { transform: scale(0.98); }

.workout-subtab.active {
  background: var(--card);
  border-color: var(--accent-border);
  color: var(--text);
}

.workout-subtab-letter {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  transition: background 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.workout-subtab.active .workout-subtab-letter {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.workout-subtab-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.workout-subtab-label,
.workout-subtab-meta {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workout-subtab-label {
  font-size: 13px;
  font-weight: 700;
}

.workout-subtab-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.workout-subtab.is-session-day .workout-subtab-meta::before {
  content: "اليوم · ";
  color: var(--accent);
  font-weight: 700;
}

.workout-preview-hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: -8px 0 var(--space-block);
}

.workout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-w);
  gap: var(--space-section);
  align-items: start;
}

.workout-main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.workout-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--space-block);
}

.workout-section-head h2 {
  font-size: 16px;
  font-weight: 700;
}

.workout-section-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.gym-body .session-date-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-section);
  padding: 0;
  border: 0;
  width: fit-content;
  max-width: 100%;
}

.gym-body .session-date-row .program-date-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
}

.gym-body .program-date-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  width: auto;
  min-width: 148px;
  max-width: 100%;
}

.active-day-banner { display: none; }

.gym-body .day-card,
.gym-body .program-section,
.gym-body .score-section,
.gym-body .body-panel,
.gym-body .schedule-section {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0;
  padding: 0;
  animation: none;
}

.day-header { display: none !important; }

.gym-body .day-body {
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: var(--space-grid);
}

.gym-body .muscle-group {
  margin: 0;
  padding: 0;
  display: contents;
}

.muscle-head { display: none !important; }

.gym-body .exercise-list {
  display: contents;
  list-style: none;
  padding: 0;
  margin: 0;
}

.gym-body .exercise-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main check"
    "controls controls";
  gap: 12px 14px;
  align-items: start;
  padding: 14px;
  min-width: 0;
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md);
  box-shadow: none !important;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
  position: relative;
  transform: none !important;
  container-type: inline-size;
}

.gym-body .exercise-card.has-thumb {
  grid-template-columns: 88px minmax(0, 1fr) auto;
  grid-template-areas:
    "thumb main check"
    "controls controls controls";
}

/* The illustrations carry their own dark tile, so the thumb stays dark in both themes */
.exercise-thumb {
  grid-area: thumb;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  overflow: hidden;
  background: #1e2229;
  position: relative;
}

.exercise-thumb-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #1e2229;
  position: relative;
}

.exercise-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  color: #8d95a1;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color var(--transition), background var(--transition);
}

.exercise-thumb-placeholder:hover,
.exercise-thumb-placeholder:focus-visible {
  color: #12140a;
  background: rgba(198, 242, 78, 0.35);
  outline: none;
}

.exercise-thumb-placeholder svg {
  width: 26px;
  height: 26px;
  opacity: 0.65;
}

.exercise-thumb-placeholder span {
  font-size: 9px;
  font-weight: 600;
}

.exercise-thumb-actions {
  position: absolute;
  inset-inline-start: 4px;
  inset-block-end: 4px;
  display: flex;
  gap: 4px;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s var(--ease-out);
}

.exercise-card:hover .exercise-thumb-actions,
.exercise-thumb:focus-within .exercise-thumb-actions { opacity: 1; }

@media (hover: none) {
  .exercise-thumb-actions { opacity: 1; }
}

.exercise-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gym-body .exercise-card:hover {
  border-color: var(--border-strong) !important;
}

.gym-body .exercise-card.is-done {
  background: linear-gradient(var(--accent-soft), var(--accent-soft)), var(--card) !important;
  border-color: var(--accent-border) !important;
}

.exercise-card.is-inactive-day {
  opacity: 0.42;
  pointer-events: none;
}

.exercise-card.is-preview-only {
  opacity: 0.72;
  pointer-events: auto;
}

.exercise-card.is-preview-only .complete-btn { visibility: hidden; }

.exercise-card.is-preview-only::before {
  content: "عرض";
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  z-index: 2;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--muted);
  border: 1px solid var(--border);
}

.exercise-card.is-done .exercise-name { color: var(--muted); }

.complete-btn {
  grid-area: check;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), transform 0.12s var(--ease-out);
  position: relative;
}

.complete-btn:active:not(:disabled) { transform: scale(0.92); }

.complete-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

.complete-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.exercise-card.is-done .complete-btn {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}

.exercise-card.is-done .complete-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 6px;
  height: 10px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.equipment-icon,
.equipment-tags,
.body-info,
.info-toggle { display: none !important; }

.exercise-main {
  grid-area: main;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exercise-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exercise-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.exercise-name .en {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.exercise-load,
.exercise-top .sets-reps {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.exercise-load {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.exercise-load .exercise-weight:not(:last-child)::after {
  content: "•";
  margin-inline-start: 6px;
  color: var(--muted-2);
  font-weight: 500;
}

.exercise-weight {
  color: var(--accent);
  font-weight: 700;
}

.exercise-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exercise-muscle-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.exercise-points {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.exercise-card.is-done .exercise-points { opacity: 0.6; }

.points-pop {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  pointer-events: none;
  animation: floatUp 0.9s ease forwards;
  z-index: 5;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-28px); }
}

/* Workout rail */
.workout-rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-block);
  position: sticky;
  top: 0;
}

.rail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-card) 20px;
}

.progress-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.progress-ring-svg {
  width: 116px;
  height: 116px;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--card-2);
  stroke-width: 10;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--transition-ring);
}

.progress-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.progress-ring-host {
  position: relative;
  width: 116px;
  height: 116px;
}

.progress-ring-num {
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.progress-ring-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.rail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rail-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  min-width: 0;
}

.rail-stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.rail-stat-value {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.rail-stat-value.accent { color: var(--accent); }

.gains-card h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
}

.gain-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.gain-row:last-child { margin-bottom: 0; }

.gain-name {
  font-size: 12px;
  font-weight: 600;
}

.gain-bar {
  height: 6px;
  background: var(--card-2);
  border-radius: 99px;
  overflow: hidden;
}

.gain-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width var(--transition-bar);
}

.gain-pts {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  min-width: 32px;
  text-align: left;
}

.gain-pts.empty { color: var(--muted-2); }

.workout-finish-btn {
  --done-pct: 0%;
  appearance: none;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  /* Fills from the start edge as exercises are completed */
  background: linear-gradient(to left, var(--accent-soft-2) var(--done-pct), var(--card) var(--done-pct));
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: not-allowed;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.12s var(--ease-out);
}

.workout-finish-btn:not(:disabled) {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  cursor: pointer;
}

.workout-finish-btn:not(:disabled):hover { filter: brightness(1.06); }

.workout-finish-btn:not(:disabled):active { transform: scale(0.98); }

/* ── Scores tab ── */
.score-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-block);
  margin-bottom: var(--space-section);
}

.score-hero-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.score-hero-card .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.score-hero-card .value {
  font-size: 28px;
  font-weight: 700;
}

.score-hero-card .value.accent { color: var(--accent); }

.score-section {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

.score-section-head,
.score-explainer,
.score-subsection:not(.score-muscles-section):not(.score-history-section),
.muscle-detail-panel { display: none !important; }

.muscle-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-block);
}

.muscle-score-card,
.muscle-score-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.muscle-score-card.is-selected,
.muscle-score-row.is-selected { border-color: var(--accent-border); }

.msr-head,
.msc-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.msr-name,
.msc-head span:first-child {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
}

.msr-level {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
}

.msr-weight,
.msc-head strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.msr-bar,
.msc-bar,
.msc-bar span {
  height: 10px;
  background: var(--card-2);
  border-radius: 99px;
  overflow: hidden;
}

.msr-bar span,
.msc-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width var(--transition-bar);
}

.muscle-score-grid.is-animating .msr-bar span,
.muscle-score-grid.is-animating .msc-bar span {
  animation: barGrow 0.85s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes barGrow {
  from { width: 0 !important; }
}

.msr-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.score-history-section {
  margin-top: var(--space-section);
  margin-bottom: var(--space-section);
}

.score-history-section .score-subtitle {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.score-history-section .score-subhint {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.score-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.score-history-totals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.score-history-pill {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  background: var(--card);
}

.score-history-pill.is-add strong { color: #4ade80; }
.score-history-pill.is-sub strong { color: #f87171; }

.score-history-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.score-history-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  flex: 1;
}

.score-history-filter span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.score-history-select {
  font-family: inherit;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.score-history-select:focus {
  outline: none;
  border-color: var(--accent-border);
}

.score-history-filters .score-history-page-btn {
  flex: 0 0 auto;
  align-self: flex-end;
}

.score-history-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  min-height: 120px;
}

.score-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--text);
}

.score-history-table thead {
  background: var(--card-2);
  border-bottom: 1px solid var(--border);
}

.score-history-table th,
.score-history-table td {
  padding: 12px 14px;
  text-align: right;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.score-history-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.score-history-table tbody tr:last-child td {
  border-bottom: none;
}

.score-history-table tbody tr:hover {
  background: rgba(198, 242, 78, 0.04);
}

.score-history-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 14px !important;
}

.score-history-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.score-history-type.action-complete {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}

.score-history-type.action-uncomplete {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}

.score-history-type.action-rest-penalty {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.08);
}

.score-history-delta {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.score-history-table tr.action-complete .score-history-delta { color: #4ade80; }
.score-history-table tr.action-uncomplete .score-history-delta { color: #fbbf24; }
.score-history-table tr.action-rest-penalty .score-history-delta { color: #f87171; }

.score-history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.score-history-page-info {
  font-size: 12px;
  color: var(--muted);
  min-width: 160px;
  text-align: center;
}

.score-history-page-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.score-history-page-btn:hover:not(:disabled) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.score-history-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.msc-session,
.msc-meta { display: none; }

/* ── Program tab ── */
.program-page-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-block);
  margin-bottom: var(--space-section);
}

.program-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  text-align: center;
}

.program-stat-card .value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.program-stat-card .value.accent { color: var(--accent); }

.program-stat-card .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.program-days-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.program-phase-block {
  padding: 14px 16px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.program-phase-block.is-current { border-color: var(--accent-border); }

.program-phase-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}

.program-phase-block.is-current .phase-card-num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.program-phase-range {
  margin-inline-start: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.program-phase-cells {
  display: grid;
  grid-template-columns: repeat(15, minmax(0, 1fr));
  gap: 6px;
}

.program-day-cell {
  appearance: none;
  font: inherit;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border-radius: 9px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s var(--ease-out), border-color var(--transition);
}

.program-day-cell-num {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.program-day-cell-type {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  opacity: 0.75;
}

.program-day-cell:hover { transform: scale(1.08); border-color: var(--accent-border); }

.program-day-cell.done {
  background: var(--accent-soft-2);
  color: var(--accent);
}

.program-day-cell.current {
  background: var(--accent);
  color: var(--accent-ink);
}

.program-day-cell.future {
  background: var(--card-2);
  color: var(--muted-2);
  border-color: var(--border);
}

.program-day-detail-card {
  padding: 1.15rem 1.2rem;
  gap: 0.95rem;
  min-height: 168px;
}

.program-day-detail-title {
  font-size: 0.98rem;
}

.program-day-date-block {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.program-day-date-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.program-day-date-badge.is-empty {
  color: var(--muted);
  font-weight: 600;
}

.program-day-tab {
  min-width: 2.85rem;
  padding: 0.48rem 0.55rem;
}

.program-day-tab-date {
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1;
  opacity: 0.82;
  white-space: nowrap;
}

.program-day-tab.is-completed .program-day-tab-date,
.program-day-tab.is-current .program-day-tab-date {
  opacity: 1;
}

.program-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.program-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.program-legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  font-style: normal;
}

.program-legend i.done { background: var(--accent-soft-2); }
.program-legend i.current { background: var(--accent); }
.program-legend i.future { background: var(--card); border: 1px solid var(--border); }

#programDaysSectionProgram,
.program-section .program-layout,
.program-section .program-ring-wrap,
.program-section-head { display: none !important; }

.program-section {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.program-admin {
  margin-top: 20px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.gym-body .data-btn {
  appearance: none;
  min-height: 34px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out), transform 0.12s var(--ease-out);
}

.gym-body .data-btn:hover { border-color: var(--border-strong); background: var(--card-2); }

.gym-body .data-btn:active { transform: scale(0.97); }

.sync-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
}

.sync-status.sync-online { color: var(--accent); background: var(--accent-soft); }
.sync-status.sync-offline { color: var(--muted); }

#progressJsonLink { display: none; }

/* ── Body heat map ── */
.body-panel-header,
.body-explorer { display: none !important; }

.body-heat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: var(--space-section);
  align-items: start;
}

.body-heat-figure {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px 16px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.heat-view {
  margin: 0;
  text-align: center;
}

.heat-view svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
}

.heat-view figcaption {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Silhouette paths live in <symbol>s; only paths without their own fill take the theme colour */
.body-base:not([fill]) { fill: var(--body-fill, #000); }

.heat-shape {
  fill: var(--accent);
  transition: opacity 0.2s var(--ease-out);
}

.body-heat-figure.has-focus .heat-shape:not(.is-focus) { opacity: 0.15; }

.heat-legend {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.heat-legend i {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(to left, var(--accent-soft-2), var(--accent));
}

.body-heat-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.body-heat-tile {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 48px;
  grid-template-areas:
    "name bar pct"
    "name level level";
  align-items: center;
  gap: 2px 14px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s var(--ease-out);
}

.body-heat-tile:hover,
.body-heat-tile:focus-visible { border-color: var(--accent-border); outline: none; }

.body-heat-tile .heat-name {
  grid-area: name;
  font-size: 14px;
  font-weight: 700;
}

.body-heat-tile .heat-pct {
  grid-area: pct;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  text-align: left;
}

.body-heat-tile .heat-bar {
  grid-area: bar;
  height: 6px;
  background: var(--card-2);
  border-radius: 99px;
  overflow: hidden;
}

.body-heat-tile .heat-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width var(--transition-bar);
}

.body-heat-tile .heat-level {
  grid-area: level;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* ── Schedule tab ── */
#programDaysSection,
.schedule-table-wrap { display: none !important; }

.schedule-week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-block);
}

.schedule-week-range {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

.schedule-week-nav #scheduleTodayWeek { margin-inline-start: auto; }

.schedule-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-block);
}

.schedule-day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  min-height: 184px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.schedule-day-card.is-today {
  background: rgba(198, 242, 78, 0.06);
  border-color: var(--accent-border);
}

.schedule-day-card .today-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.schedule-day-card .weekday {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.schedule-day-card .divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 12px;
}

.schedule-day-card .day-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.4;
}

.schedule-day-card .day-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  flex: 1;
  line-height: 1.5;
}

.schedule-day-card .day-chip-bottom {
  margin-top: auto;
  padding-top: 12px;
  font-size: 12px;
  font-weight: 700;
}

.schedule-day-card .day-chip-bottom.workout { color: var(--accent); }
.schedule-day-card .day-chip-bottom.rest { color: var(--muted-2); }
.schedule-day-card .day-chip-bottom.walk { color: var(--muted); }
.schedule-day-card .day-chip-bottom.cardio { color: var(--text); }

.week-grid { display: none; }

/* ── Home training tab ── */
.home-train-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
}

.home-train-desc {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.55;
  max-width: 52rem;
}

.home-train-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-train-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}

.home-train-pill strong {
  color: var(--accent);
  font-weight: 700;
}

.home-train-list,
.bodyweight-unlock-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-grid);
}

.home-train-card,
.bw-unlock-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border-inline-start: 3px solid var(--mc, var(--border));
  min-width: 0;
}

.home-train-card.is-locked,
.bw-unlock-card.is-locked {
  opacity: 0.78;
}

.home-train-card:not(.is-locked):hover {
  border-color: #3a3d44;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.htc-top,
.bwc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.htc-name,
.bwc-head > span:first-child {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.htc-reps-block {
  text-align: center;
  flex-shrink: 0;
}

.htc-reps,
.bwc-reps {
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.htc-reps-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.htc-prescription,
.bwc-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.htc-prescription.is-locked-text,
.bwc-locked-msg {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.htc-bar,
.bwc-bar {
  height: 6px;
  background: var(--card-2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.htc-bar span,
.bwc-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width var(--transition-bar);
}

.htc-meta,
.bwc-muscle-tag {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.htc-next,
.bwc-next,
.bwc-progress-hint {
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 500;
  margin-top: 6px;
}

.bwc-lock {
  font-size: 18px;
  opacity: 0.7;
}

/* ── Home ladders (5 levels, gate to climb) ── */
.hl-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hl-card.is-mastered {
  border-color: var(--accent-border);
}

.hl-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hl-head-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hl-ladder-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.hl-muscle {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.hl-video-tag {
  color: var(--accent);
}

.hl-level-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.hl-level-badge strong {
  color: var(--accent);
  font-size: 14px;
}

.hl-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* Ladder graphic: two rails + 5 rungs, level 1 at the bottom */
.hl-ladder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 46px;
  padding: 4px 5px;
  border-inline: 3px solid var(--border);
  border-radius: 4px;
}

.hl-rung {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 16px;
  border-radius: 4px;
  background: var(--card-2);
  border: 1px solid var(--border);
  transition: background var(--transition), box-shadow var(--transition);
}

.hl-rung i {
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted-2);
}

.hl-rung.is-passed {
  background: var(--accent);
  border-color: var(--accent);
}

.hl-rung.is-passed i {
  color: var(--accent-ink);
}

.hl-rung.is-current {
  background: var(--accent-soft-2);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hl-rung.is-current i {
  color: var(--accent);
}

.hl-ex-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.hl-ex-en {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  margin-top: 1px;
}

.hl-ex-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.hl-gate {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-chip);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.hl-gate strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  direction: ltr;
  unicode-bidi: isolate;
}

.hl-attempt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 10px;
}

.hl-attempt b {
  font-weight: 700;
}

.hl-attempt b.ok {
  color: var(--accent);
}

.hl-attempt b.short {
  color: #f97316;
}

.hl-bar {
  margin: 6px 0 0;
}

.hl-log-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.hl-log-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
}

.hl-set-input {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-chip);
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.hl-set-input::-webkit-outer-spin-button,
.hl-set-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.hl-set-input::placeholder {
  color: var(--muted-2);
  font-weight: 600;
  font-size: 12px;
}

.hl-set-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hl-log-btn {
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-chip);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter var(--transition);
}

.hl-log-btn:hover {
  filter: brightness(1.06);
}

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

.hl-mastered {
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.hl-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.hl-levels {
  flex: 1 1 auto;
  min-width: 0;
}

.hl-levels summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.hl-levels summary:hover {
  color: var(--text);
}

.hl-levels ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.hl-levels li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 8px;
}

.hl-levels li small {
  font-size: 10px;
  color: var(--muted-2);
  font-weight: 500;
}

.hl-levels li.is-passed .hl-li-mark {
  color: var(--accent);
}

.hl-levels li.is-current {
  background: var(--accent-soft);
}

.hl-levels li.is-locked {
  opacity: 0.55;
}

.hl-li-gate {
  color: var(--muted);
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

.hl-back-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  cursor: pointer;
}

.hl-back-btn:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ── Hidden tabs ── */
#tab-export { display: none !important; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: floatUp 0.4s ease;
}

/* ── Bottom nav (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  gap: 4px;
}

.bottom-nav-item {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.bottom-nav-item .bn-icon svg {
  width: 20px;
  height: 20px;
}

.bottom-nav-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Print / export (preserve) ── */
#importProgressInput { display: none; }

@media (max-width: 960px) {
  :root {
    --space-page-x: 16px;
    --space-page-y: 18px;
    --space-section: 16px;
    --rail-w: 100%;
    --header-h: 52px;
    --footer-h: 40px;
    --content-inset-top: 16px;
    --content-inset-bottom: 12px;
    --content-inset-x: 16px;
    --content-gap-menu: 0px;
  }

  .gym-app {
    grid-template-columns: 1fr;
    height: calc(100dvh - var(--bottom-nav-h));
  }

  .toast {
    top: calc(var(--header-h) + 10px);
    bottom: auto;
  }

  .gym-sidebar { display: none; }
  .gym-footer { display: none; }
  .bottom-nav { display: block; }
  .gym-header { padding: 0 var(--space-page-x); }
  .gym-footer { padding: 0 var(--space-page-x); }
  .workout-layout {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-block);
    padding-bottom: 76px;
  }
  /* Rail becomes a compact stat strip above the list */
  .workout-rail {
    order: -1;
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
  }
  .workout-rail .gains-card { display: none; }
  .workout-rail .progress-ring-wrap { padding: 8px; justify-content: center; }
  .workout-rail .progress-ring-host,
  .workout-rail .progress-ring-svg { width: 64px; height: 64px; }
  .workout-rail .progress-ring-num { font-size: 20px; }
  .workout-rail .progress-ring-label { display: none; }
  .rail-stat { padding: 10px 6px; display: flex; flex-direction: column; justify-content: center; }
  .rail-stat-value { font-size: 16px; }
  /* Finish button floats above the bottom nav and doubles as a progress bar */
  .workout-finish-btn {
    position: fixed;
    inset-inline: 12px;
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom) + 10px);
    width: auto;
    z-index: 90;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
  .workout-finish-btn:disabled { background: linear-gradient(to left, var(--accent-soft-2) var(--done-pct), var(--panel) var(--done-pct)); }
  .workout-page-header { flex-direction: column; align-items: stretch; }
  .gym-body .exercise-card.has-thumb { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .exercise-thumb { width: 72px; height: 72px; }
  .gym-body .day-body { grid-template-columns: 1fr; }
  .muscle-score-grid { grid-template-columns: 1fr; }
  .program-phase-cells { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
  .program-day-cell { aspect-ratio: auto; min-height: 40px; }
  .body-heat-layout { grid-template-columns: 1fr; }
  .body-heat-figure { position: static; max-width: 420px; width: 100%; margin-inline: auto; }
  .schedule-week-grid { grid-template-columns: repeat(2, 1fr); }
  .score-hero-grid { grid-template-columns: 1fr; }
  .program-page-stats { gap: 8px; }
  .program-stat-card { padding: 12px 8px; }
  .program-stat-card .value { font-size: 22px; }
  .workout-subtab { gap: 8px; padding: 6px 8px; }
  .workout-subtab-letter { width: 30px; height: 30px; font-size: 14px; }
  .workout-subtab-label,
  .workout-subtab-weekday { display: none; }
  .home-train-list,
  .bodyweight-unlock-grid { grid-template-columns: 1fr; }
  .bottom-nav-item { font-size: 9px; padding: 5px 4px; }
  .bottom-nav-item .bn-icon svg { width: 18px; height: 18px; }
}

/* ── Light theme ── */
[data-theme="light"] body.gym-body {
  --bg: #f4f6f8;
  --bg-deep: #e8ebef;
  --panel: #ffffff;
  --card: #ffffff;
  --card-2: #eef1f5;
  --border: #d8dde5;
  --text: #12141a;
  --muted: #5c6370;
  --muted-2: #8a919c;
  --border-strong: #c3c9d2;
  --body-fill: #dfe3e8;
  /* Deeper lime so accent text stays readable on white */
  --accent: #5f8c0c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(95, 140, 12, 0.1);
  --accent-soft-2: rgba(95, 140, 12, 0.16);
  --accent-border: rgba(95, 140, 12, 0.38);
}

[data-theme="light"] .workout-finish-btn:not(:disabled) { box-shadow: 0 10px 30px rgba(18, 20, 26, 0.12); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

.day-card.day-hidden { display: none !important; }

.exercise-image-btn,
.exercise-image-remove {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(16, 18, 22, 0.88);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.exercise-image-btn svg {
  width: 14px;
  height: 14px;
}

.exercise-image-btn:hover,
.exercise-image-remove:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: rgba(16, 18, 22, 0.96);
}

.exercise-image-remove[hidden] {
  display: none !important;
}

/* ── 3-day plan: phase note, load stepper, phase plan ── */
.page-phase-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 10px 0 0;
  max-width: 72ch;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.6;
}

.phase-chip {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-weight: 700;
}

.exercise-note {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.load-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: var(--card-2);
}

.exercise-load .load-stepper .exercise-weight::after { content: none; }

.exercise-controls {
  grid-area: controls;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.exercise-controls:empty { display: none; }

.set-ticks {
  display: flex;
  gap: 6px;
}

.set-tick {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--card-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease-out), border-color 0.18s var(--ease-out), color 0.18s var(--ease-out), transform 0.12s var(--ease-out);
}

.set-tick:hover:not(:disabled) { border-color: var(--accent-border); color: var(--text); }

.set-tick:active:not(:disabled) { transform: scale(0.92); }

.set-tick.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.set-tick:disabled { cursor: default; opacity: 0.5; }

.exercise-load-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
}

.load-stepper .exercise-weight {
  min-width: 58px;
  text-align: center;
  font-size: 13px;
}

.load-btn,
.load-top-btn {
  appearance: none;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.load-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
}

.load-top-btn {
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-chip);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.load-btn:hover,
.load-top-btn:hover {
  color: var(--accent);
  border-color: var(--accent-border);
}

.load-btn:focus-visible,
.load-top-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.load-top-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Narrow cards: the 🎯 button keeps its icon (and title) so ticks and weight share one row */
@container (max-width: 440px) {
  .load-top-label { display: none; }
}

@container (max-width: 360px) {
  .set-ticks { gap: 4px; }
  .set-tick { width: 32px; height: 32px; }
  .load-btn { width: 28px; height: 28px; }
  .load-stepper .exercise-weight { min-width: 50px; }
  .load-top-btn { height: 32px; padding: 0 8px; }
}

.phase-plan {
  display: flex;
  flex-direction: column;
  gap: var(--space-block);
  margin-top: var(--space-section);
}

.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-grid);
}

.phase-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--space-card) 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.phase-card.is-current {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.phase-card.is-done { opacity: 0.7; }

.phase-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
}

.phase-card-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}

.phase-card.is-current .phase-card-num {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.phase-card-range {
  margin-inline-start: auto;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.phase-card-focus {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.phase-card-meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.phase-card-bar {
  height: 4px;
  border-radius: 4px;
  background: var(--card-2);
  overflow: hidden;
}

.phase-card-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.phase-subtitle {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
}

.phase-week {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.phase-week-day {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
}

.phase-week-day.is-workout { border-color: var(--accent-border); }

.phase-week-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.phase-week-day.is-workout .phase-week-name { color: var(--accent); }

.phase-week-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.phase-week-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.phase-rules {
  margin: 0;
  padding: var(--space-card) 20px;
  padding-inline-start: 36px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 900px) {
  .phase-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Exercise card → details sheet trigger ── */
.exercise-main,
.exercise-thumb-media { cursor: pointer; }

.exercise-tags { flex-wrap: wrap; }

.exercise-details-btn {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 30px;
  padding-block: 4px;
  padding-inline: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.exercise-details-btn svg { width: 14px; height: 14px; }

.exercise-details-btn:hover,
.exercise-main:hover .exercise-details-btn {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

/* ── Exercise details sheet ── */
.ex-sheet {
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: hidden;
}

.ex-sheet[open] {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ex-sheet::backdrop {
  background: rgba(4, 5, 7, 0.64);
  animation: exFadeIn 0.28s ease;
}

.ex-sheet.is-closing::backdrop { animation: exFadeOut 0.2s ease forwards; }

.ex-sheet-panel {
  width: 100%;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.4);
  padding-bottom: env(safe-area-inset-bottom);
  animation: exSheetUp 0.34s var(--ease-out);
  transition: transform 0.25s var(--ease-out);
}

.ex-sheet.is-closing .ex-sheet-panel { animation: exSheetDown 0.2s ease-in forwards; }

@keyframes exSheetUp { from { transform: translateY(100%); } }
@keyframes exSheetDown { to { transform: translateY(100%); } }
@keyframes exFadeIn { from { opacity: 0; } }
@keyframes exFadeOut { to { opacity: 0; } }

.ex-sheet-drag {
  flex-shrink: 0;
  padding: 8px 18px 12px;
  border-bottom: 1px solid var(--border);
  touch-action: none;
}

.ex-sheet-grab {
  width: 40px;
  height: 4px;
  margin: 0 auto 10px;
  border-radius: 4px;
  background: var(--border-strong);
}

.ex-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ex-sheet-titles {
  flex: 1;
  min-width: 0;
}

.ex-sheet-eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.ex-sheet-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

.ex-sheet-en {
  font-size: 12.5px;
  color: var(--muted);
  text-align: right;
}

.ex-sheet-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.ex-sheet-close svg { width: 18px; height: 18px; }
.ex-sheet-close:hover { border-color: var(--border-strong); }

.ex-sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ex-sheet-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Same dark tile as the card thumbnail */
.ex-sheet-photo {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: #1e2229;
  overflow: hidden;
}

.ex-sheet-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ex-sheet-map {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: center;
  gap: 4px;
  padding: 10px 8px 6px;
  border-radius: var(--radius-md);
  background: var(--card);
  border: 1px solid var(--border);
}

.ex-sheet-hero.no-photo { grid-template-columns: minmax(0, 300px); justify-content: center; }

.ex-map-view {
  margin: 0;
  text-align: center;
}

.ex-map-view svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 210px;
}

.ex-map-view figcaption {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

.ex-sheet-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.ex-stat {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
}

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

.ex-stat-value {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ex-stat-value.accent { color: var(--accent); }

.ex-stat-sub {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Bar + plates per side (barbell) or plates-only (plate-loaded machine), under the stats */
.ex-sheet-load {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ex-sheet-load-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.ex-sheet-load strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ex-sheet-load-hint {
  font-size: 12px;
  color: var(--muted);
}

.ex-sheet-note {
  padding: 9px 12px;
  border-radius: 10px;
  border-inline-start: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.7;
}

.ex-sheet-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ex-sheet-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.ex-sheet-section h3::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
}

.ex-muscle-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ex-muscle-row-label {
  min-width: 56px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* Dot mirrors the map: solid = main muscle, faded = helpers */
.ex-muscle-row-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.ex-muscle-row.is-secondary .ex-muscle-row-label::before { opacity: 0.36; }

.ex-muscle-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft-2);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.ex-muscle-row.is-secondary .ex-muscle-chip {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}

.ex-sheet-effect {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--muted);
}

.ex-sheet-steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ex-sheet-steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  font-size: 14px;
  line-height: 1.75;
}

.ex-sheet-steps li::before {
  content: counter(step);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft-2);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
}

.ex-sheet-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ex-sheet-tips li {
  position: relative;
  padding-inline-start: 20px;
  font-size: 13.5px;
  line-height: 1.75;
}

.ex-sheet-tips li::before {
  content: "";
  position: absolute;
  inset-inline-start: 3px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.ex-video {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.ex-video-play {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
}

.ex-video-play img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  transition: opacity 0.2s var(--ease-out);
}

.ex-video-play:hover img { opacity: 1; }

.ex-video-icon {
  position: absolute;
  inset: 0;
  width: 64px;
  height: 44px;
  margin: auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #ff0033;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.ex-video-icon svg { width: 24px; height: 24px; }

.ex-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.ex-video-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: -2px;
}

.ex-video-title {
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
}

.ex-video-channel {
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
}

.ex-video-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ex-video-links a {
  flex: 1 1 140px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.ex-video-links a:hover { border-color: var(--border-strong); }

.ex-video-links a.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.ex-sheet-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ex-sheet-tags span {
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 12px;
}

/* Wider screens: a centred dialog instead of a bottom sheet */
@media (min-width: 641px) {
  .ex-sheet[open] {
    align-items: center;
    padding: 24px;
  }

  .ex-sheet-panel {
    max-width: 560px;
    max-height: min(88dvh, 880px);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding-bottom: 0;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    animation-name: exDialogIn;
  }

  .ex-sheet.is-closing .ex-sheet-panel { animation-name: exDialogOut; }

  .ex-sheet-grab { display: none; }
  .ex-sheet-drag { padding-top: 16px; }
}

@keyframes exDialogIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes exDialogOut { to { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* Own-photo controls under the illustration in the details sheet */
.ex-sheet-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ex-sheet-photo-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ex-sheet-photo-actions button:hover { color: var(--text); border-color: var(--border-strong); }
.ex-sheet-photo-actions svg { width: 15px; height: 15px; }

.sidebar-theme-icon svg,
.header-icon-btn svg { width: 18px; height: 18px; display: block; }

.gym-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gym-header-logo {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
}

.gym-header-logo svg { width: 17px; height: 17px; }

.home-train-howto {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 0 14px;
}

.home-train-howto summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.home-train-howto summary::-webkit-details-marker { display: none; }

/* Physical borders on purpose: a chevron points down in both RTL and LTR */
.home-train-howto summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  margin-top: -4px;
  transition: transform 0.2s var(--ease-out);
}

.home-train-howto[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.home-train-howto .home-train-desc { padding-bottom: 14px; }

/* ═══ Mobile layout (≤ 960px): one compact app bar, content first, thumb-sized controls ═══ */
@media (max-width: 960px) {
  /* App bar: logo + page title, session counter, theme. "Exercises today" already sits in the workout strip. */
  .gym-header-inner { gap: 10px; }
  .gym-header-title {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .site-header-meta { flex-wrap: nowrap; flex-shrink: 0; gap: 8px; }
  .header-stat.is-live { display: none; }
  .header-stat { padding: 5px 10px; font-size: 12px; white-space: nowrap; }
  .header-icon-btn { width: 38px; height: 38px; color: var(--text); }

  /* The app bar already names the page, so other tabs drop the repeated big title */
  .app-tab-panel:not(#tab-workout) > .page-header .page-title { display: none; }
  .page-header { margin-bottom: 14px; }
  .page-subtitle { font-size: 13px; line-height: 1.6; }

  /* Workout header: today's plan in a few lines, the date beside the session line, then the exercises */
  .workout-page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 10px;
    margin-bottom: 12px;
  }
  .workout-header-main { display: contents; }
  .workout-header-main > * { grid-column: 1 / -1; }
  .workout-header-main > #workoutDayMeta { grid-column: 1; grid-row: 1; }
  .workout-page-header .session-date-row { grid-column: 2; grid-row: 1; }
  .workout-page-header .session-date-row .program-date-label { display: none; }
  #tab-workout .page-eyebrow { font-size: 12px; margin-bottom: 2px; }
  #tab-workout .page-title { font-size: 22px; margin-bottom: 2px; }
  #workoutMuscleGroups { font-size: 12.5px; }
  .page-phase-note { margin-top: 8px; font-size: 11.5px; line-height: 1.55; }
  .gym-body .session-date-row { gap: 8px; margin: 0; }
  .gym-body .session-date-row .program-date-input { min-width: 0; padding: 6px 10px; font-size: 12.5px; }

  .workout-subtabs { margin-bottom: 12px; padding: 3px; border-radius: 14px; }
  .workout-subtab { justify-content: center; padding: 6px 8px; border-radius: 11px; }

  /* Session stats become one slim strip: ring + three numbers */
  .workout-rail {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }
  .workout-rail .progress-ring-wrap { padding: 0; background: none; border: 0; }
  .workout-rail .progress-ring-host,
  .workout-rail .progress-ring-svg { width: 50px; height: 50px; }
  .workout-rail .progress-ring-num { font-size: 17px; }
  .rail-stats { gap: 0; }
  .rail-stat { padding: 4px 6px; background: none; border: 0; border-radius: 0; }
  .rail-stat + .rail-stat { border-inline-start: 1px solid var(--border); }
  .rail-stat-label { font-size: 10.5px; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rail-stat-value { font-size: 15px; }

  /* Exercise cards: bigger illustration, the photo upload moves into the details sheet */
  .gym-body .exercise-card { padding: 12px; gap: 10px 12px; }
  .gym-body .exercise-card.has-thumb { grid-template-columns: 84px minmax(0, 1fr) auto; }
  .exercise-thumb { width: 84px; height: 84px; }
  .exercise-thumb-actions { display: none; }
  .complete-btn { width: 36px; height: 36px; }
  .exercise-name { font-size: 15.5px; }

  /* Scores: side-by-side totals, compact muscle tiles, history as cards */
  .score-hero-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .score-hero-card { padding: 12px 14px; }
  .score-hero-card .label { margin-bottom: 4px; }
  .score-hero-card .value { font-size: 21px; }
  .muscle-score-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .muscle-score-card { padding: 12px; }
  .muscle-score-card .msr-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "name name" "lvl kg";
    gap: 6px;
  }
  .muscle-score-card .msr-name { grid-area: name; }
  .muscle-score-card .msr-level { grid-area: lvl; }
  .muscle-score-card .msr-weight { grid-area: kg; justify-self: end; margin: 0; }
  .muscle-score-card .msr-foot span + span { display: none; }

  .score-history-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .score-history-filter { min-width: 0; }
  .score-history-select { min-height: 40px; }
  .score-history-table-wrap { border: 0; background: none; overflow: visible; }
  .score-history-table,
  .score-history-table tbody { display: block; }
  .score-history-table thead { display: none; }
  .score-history-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "type pts"
      "det det"
      "mus mus"
      "when src";
    gap: 4px 10px;
    margin-bottom: 8px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
  }
  .score-history-table tbody tr:hover { background: var(--card); }
  .score-history-table td { display: block; padding: 0; border: 0 !important; min-width: 0; }
  .score-history-table td:nth-child(1) { grid-area: when; font-size: 11px; color: var(--muted); }
  .score-history-table td:nth-child(2) { grid-area: type; }
  .score-history-table td:nth-child(3) { grid-area: det; font-size: 13.5px; font-weight: 600; }
  .score-history-table td:nth-child(4) { grid-area: mus; font-size: 12px; color: var(--muted); line-height: 1.6; }
  .score-history-table td:nth-child(5) { grid-area: src; font-size: 11px; color: var(--muted); text-align: end; }
  .score-history-table td:nth-child(6) { grid-area: pts; font-size: 17px; align-self: center; }
  .score-history-table td.score-history-empty { grid-column: 1 / -1; text-align: center; }

  /* Weekly schedule: one row per day instead of tall tiles */
  .schedule-week-nav { flex-wrap: wrap; gap: 8px; }
  .schedule-week-nav #scheduleWeekRange { order: -1; flex: 1 0 100%; text-align: center; font-size: 12.5px; }
  .schedule-week-nav #scheduleTodayWeek { margin-inline-start: 0; flex: 1; }
  .schedule-week-grid { grid-template-columns: 1fr; gap: 8px; }
  .schedule-day-card {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    grid-template-areas:
      "wd title"
      "wd sub"
      "tag chip";
    column-gap: 12px;
    row-gap: 2px;
    min-height: 0;
    padding: 12px 14px;
  }
  .schedule-day-card .weekday { grid-area: wd; margin: 0; font-size: 14px; }
  .schedule-day-card .divider { display: none; }
  .schedule-day-card .day-title { grid-area: title; margin: 0; }
  .schedule-day-card .day-sub { grid-area: sub; }
  .schedule-day-card .day-chip-bottom { grid-area: chip; padding-top: 4px; }
  .schedule-day-card .today-tag { position: static; grid-area: tag; justify-self: start; align-self: end; }

  /* Body map: smaller figure so the muscle list starts on the first screen */
  .body-heat-figure { max-width: 340px; padding: 14px 12px 12px; }
  .heat-view svg { max-height: 230px; }

  /* Bottom bar: bigger icons, frosted so content shows it scrolls underneath */
  .bottom-nav {
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--panel) 90%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .bottom-nav-item { gap: 3px; padding: 7px 2px; border-radius: 12px; font-size: 10px; }
  .bottom-nav-item .bn-icon svg { width: 21px; height: 21px; }
}

@media print {
  .gym-sidebar, .bottom-nav, .gym-header, .gym-footer, .complete-btn, .toast, .workout-rail, .set-ticks, .ex-sheet { display: none !important; }
  .gym-app { display: block; height: auto; overflow: visible; }
  .gym-main { display: block; overflow: visible; }
  .gym-content { overflow: visible; }
  body { background: #fff; color: #000; overflow: visible; height: auto; }
}
