/* ── tokens ── */
:root {
  --font-sans: 'Inter', system-ui, sans-serif;
  --color-bg: #0A1628;
  --color-surface: #122036;
  --color-surface-2: #1A2B45;
  --color-border: #243B5C;
  --color-border-light: #1C2E4A;
  --color-text-primary: #E6EDF7;
  --color-text-secondary: #95A8C4;
  --color-text-tertiary: #647691;
  --color-blue: #4A9EFF;
  --color-blue-bg: #1A2F4D;
  --color-blue-dark: #93C5FD;
  --color-purple: #8B82E8;
  --color-purple-bg: #1F2547;
  --color-purple-dark: #B4ADF0;
  --color-teal: #2DD4BF;
  --color-teal-bg: #112E36;
  --color-teal-dark: #7EE8DB;
  --color-green-bg: #14321F;
  --color-green-dark: #86EFAC;
  --color-orange-bg: #3A2410;
  --color-orange-dark: #FDBA74;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
}

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

/* ── base ── */
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── page wrapper ── */
.page-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* ── header ── */
.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 2rem;
}

.header-icon {
  width: 48px;
  height: 48px;
  background: var(--color-purple-bg);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.header-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.2;
}

.header-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 3px;
}

/* ── plan container ── */
.plan { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── week grid ── */
.week-grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.week-grid-scroll::-webkit-scrollbar { display: none; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(72px, 1fr));
  gap: 6px;
  min-width: 504px;
}

.day-tab {
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
  box-shadow: var(--shadow-card);
}

.day-tab:hover {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(55,138,221,0.1);
}

.day-tab.active {
  border: 2px solid var(--color-blue);
  background: var(--color-blue-bg);
  box-shadow: 0 0 0 3px rgba(55,138,221,0.15);
}

.day-tab .day-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.day-tab .day-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.day-tab .day-type {
  font-size: 10px;
  font-weight: 500;
  margin-top: 4px;
  padding: 2px 0;
}

.day-tab.lift .day-type { color: var(--color-purple); }
.day-tab.run  .day-type { color: var(--color-teal); }
.day-tab.rest .day-type { color: var(--color-text-tertiary); }

.day-tab.active .day-label { color: var(--color-blue-dark); opacity: 0.7; }
.day-tab.active .day-name  { color: var(--color-blue-dark); }
.day-tab.active.lift .day-type { color: var(--color-purple-dark); }
.day-tab.active.run  .day-type { color: var(--color-teal-dark); }

/* ── session card ── */
.session-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.session-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}

.session-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.session-icon.lift { background: var(--color-purple-bg); }
.session-icon.run  { background: var(--color-teal-bg); }
.session-icon.rest { background: var(--color-surface-2); }

.session-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.session-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 3px;
}

/* ── exercise list ── */
.exercise-list { display: flex; flex-direction: column; gap: 6px; }

.exercise-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 14px;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: border-color 0.12s, background 0.12s;
}

.exercise-row:hover {
  background: #213655;
  border-color: var(--color-border);
}

.ex-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  min-width: 20px;
  padding-top: 2px;
}

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

.ex-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.4;
}

.ex-detail {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 3px;
}

.ex-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.badge-main { background: var(--color-purple-bg); color: var(--color-purple-dark); }
.badge-acc  { background: var(--color-blue-bg);   color: var(--color-blue-dark); }
.badge-core { background: var(--color-green-bg);  color: var(--color-green-dark); }
.badge-calf { background: var(--color-orange-bg); color: var(--color-orange-dark); }

/* ── run card ── */
.run-card {
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--color-border-light);
}

.run-detail {
  font-size: 14px;
  color: var(--color-text-primary);
  line-height: 1.55;
  margin-bottom: 10px;
}

.tip-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.tip-row i {
  color: var(--color-teal);
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── rest card ── */
.rest-card {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
}

.rest-card i {
  font-size: 36px;
  display: block;
  margin-bottom: 10px;
  color: var(--color-text-tertiary);
}

.rest-card p {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ── key rules ── */
.key-rules-section { }

.rules-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  margin-bottom: 10px;
}

.key-rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rule-pill {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--color-text-secondary);
  border: 1.5px solid var(--color-border);
  border-left: 3px solid;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
  box-shadow: var(--shadow-card);
}

.rule-pill i {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.rule-pill.purple { border-left-color: var(--color-purple); }
.rule-pill.purple i { color: var(--color-purple); }
.rule-pill.teal   { border-left-color: var(--color-teal); }
.rule-pill.teal   i { color: var(--color-teal); }

/* ── timer config strip ── */
.timer-config {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--color-border-light);
}

.timer-config-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: 4px;
  white-space: nowrap;
}

.timer-config-label i { font-size: 14px; }

.timer-presets {
  display: flex;
  gap: 5px;
}

.timer-preset {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.timer-preset:hover,
.timer-preset.selected {
  border-color: var(--color-blue);
  background: var(--color-blue-bg);
  color: var(--color-blue-dark);
}

.timer-custom-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.timer-custom-input {
  width: 56px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  text-align: center;
  outline: none;
  transition: border-color 0.12s;
}

.timer-custom-input:focus { border-color: var(--color-blue); }

.timer-custom-unit {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.timer-custom-apply {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}

.timer-custom-apply:hover {
  border-color: var(--color-blue);
  background: var(--color-blue-bg);
  color: var(--color-blue-dark);
}

/* ── set dots ── */
.set-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 2px;
}

.set-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
  padding: 0;
}

.set-dot:hover { border-color: var(--color-blue); transform: scale(1.1); }

.set-dot.active {
  border-color: var(--color-blue);
  background: var(--color-blue-bg);
}

.set-dot.filled {
  border-color: var(--color-teal);
  background: var(--color-teal);
}

/* exercise row done state */
.exercise-row.ex-done {
  opacity: 0.55;
}

.exercise-row.ex-done .set-dot.filled {
  border-color: var(--color-teal-dark);
  background: var(--color-teal);
}

/* ── rest timer bar ── */
.rest-timer-bar {
  position: fixed;
  bottom: -100px;
  left: 0; right: 0;
  z-index: 100;
  background: #1A1F2E;
  color: #fff;
  transition: bottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
}

.rest-timer-bar.visible { bottom: 0; }

.timer-progress-track {
  height: 3px;
  background: rgba(255,255,255,0.12);
}

.timer-progress-fill {
  height: 100%;
  background: var(--color-teal);
  width: 0%;
  transition: width 1s linear;
}

.timer-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 1.25rem;
  max-width: 720px;
  margin: 0 auto;
}

.timer-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}

.timer-display {
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  flex: 1;
}

.timer-actions { display: flex; gap: 8px; }

.timer-pause-btn,
.timer-skip-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s, transform 0.1s;
}

.timer-pause-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.timer-pause-btn:hover { background: rgba(255,255,255,0.25); }

.timer-skip-btn {
  background: transparent;
  color: rgba(255,255,255,0.45);
}

.timer-skip-btn:hover { color: rgba(255,255,255,0.8); }

/* done flash */
.rest-timer-bar.timer-done .timer-display { color: #6EE7B7; }
.rest-timer-bar.timer-done .timer-progress-fill { background: #6EE7B7; }

/* ── mobile ── */
@media (max-width: 480px) {
  .page-wrapper { padding: 1.25rem 1rem 3rem; }

  .page-header { margin-bottom: 1.5rem; }
  .header-title { font-size: 18px; }

  .key-rules { grid-template-columns: 1fr; }

  .session-card { padding: 1rem; }
  .session-header { gap: 10px; margin-bottom: 1rem; }
  .session-icon { width: 40px; height: 40px; font-size: 20px; }
  .session-title { font-size: 15px; }

  .exercise-row { padding: 10px 12px; gap: 10px; }
  .ex-name { font-size: 13px; }

  .run-card { padding: 1rem; }

  .timer-config { gap: 6px; }
  .timer-custom-wrap { margin-left: 0; }

  .timer-display { font-size: 24px; }

  .set-dot { width: 26px; height: 26px; }
}
