/* WO — dark, mobile-first */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }

:root {
  --bg: #0b0d16;
  --bg-soft: #121525;
  --card: #161a2e;
  --card-edge: rgba(255, 255, 255, 0.07);
  --ink: #eef0f8;
  --ink-dim: #8b91a8;
  --ink-faint: #7a8098;
  --a: #8b7cf8;   /* session A — violet */
  --b: #2dd4bf;   /* session B — teal   */
  --c: #f5a524;   /* session C — amber  */
  --run: #a3e635;
  --rest: #7dd3fc;
  --danger: #f87171;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding-top: var(--safe-t);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

button, input { touch-action: manipulation; font-family: inherit; }

/* ---------- header ---------- */
header {
  padding: 14px 18px 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#app-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.14em;
  padding: 7px 11px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--a), #5eead4);
  color: #0b0d16;
}
#app-title[data-accent='b'] { background: linear-gradient(135deg, var(--b), #86efac); }
#app-title[data-accent='c'] { background: linear-gradient(135deg, var(--c), #fb923c); }
#app-title[data-accent='run'] { background: linear-gradient(135deg, var(--run), #4ade80); }
#app-title[data-accent='rest'] { background: linear-gradient(135deg, var(--rest), #a5b4fc); }
.head-mid { flex: 1; min-width: 0; }
#day-title { font-size: 19px; font-weight: 750; line-height: 1.15; }
#day-date { font-size: 12.5px; color: var(--ink-dim); text-transform: capitalize; margin-top: 1px; }
#week-chip {
  font-size: 11px; font-weight: 650; color: var(--ink-dim);
  border: 1px solid var(--card-edge); background: var(--bg-soft);
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
#info-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--card-edge); background: var(--bg-soft);
  color: var(--ink-dim); font-size: 15px; font-weight: 700; cursor: pointer;
  flex: none;
}

/* ---------- day strip ---------- */
#day-strip {
  display: flex; gap: 6px; padding: 10px 18px 4px;
}
.day-chip {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 0 5px; border-radius: 13px; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--ink-faint);
}
.day-chip .dc-name { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; }
.day-chip .dc-tag { font-size: 13px; font-weight: 800; }
.day-chip.today { color: var(--ink-dim); border-color: var(--card-edge); }
.day-chip.sel { background: var(--bg-soft); color: var(--ink); border-color: var(--card-edge); }
.day-chip.sel.today { box-shadow: 0 0 0 1.5px var(--a) inset; }

/* ---------- deck ---------- */
#deck {
  position: relative; flex: 1; overflow: hidden;
  touch-action: pan-y;
  margin-top: 6px;
}
.card-holder {
  position: absolute; inset: 0;
  padding: 6px 16px calc(12px);
  transition: transform 0.32s cubic-bezier(0.22, 0.9, 0.3, 1);
  will-change: transform;
  display: flex;
}
.card {
  flex: 1;
  background: linear-gradient(180deg, var(--card), #12152699);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.65);
  scrollbar-width: none;
}
.card::-webkit-scrollbar { display: none; }
.card { -webkit-user-select: none; user-select: none; }
.card input { -webkit-user-select: auto; user-select: auto; }
/* keep content reachable above the floating rest-timer pill */
body.timer-on .card { padding-bottom: 96px; }
.card { border-top: 3px solid var(--a); }
.card.ac-b, .ac-b { border-top-color: var(--b); }
.card.ac-c, .ac-c { border-top-color: var(--c); }
.card.ac-run { border-top-color: var(--run); }
.card.ac-rest { border-top-color: var(--rest); }

.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-num { font-size: 12px; font-weight: 700; color: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase; }
.chip {
  font-size: 10.5px; font-weight: 750; letter-spacing: 0.05em;
  padding: 4px 9px; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--card-edge); color: var(--ink-dim);
  white-space: nowrap;
}
.chip.core { color: var(--c); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.chip.deload { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.chip.rest { margin-left: auto; }

.ex-name { margin: 0; font-size: 24px; font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; }
.ex-sub { margin: 3px 0 0; font-size: 13.5px; color: var(--ink-dim); }

.hero-row { display: flex; align-items: baseline; gap: 10px; margin: 12px 0 4px; }
.hero-main { display: flex; align-items: baseline; gap: 6px; }
.hero-sets { font-size: 40px; font-weight: 850; letter-spacing: -0.03em; }
.hero-x { font-size: 22px; color: var(--ink-faint); font-weight: 600; }
.hero-reps { font-size: 40px; font-weight: 850; letter-spacing: -0.03em; }
.hero-row .chip.rest { align-self: center; }

/* rig / animation */
.card-anim { margin: 4px auto 2px; max-width: 300px; }
.rig-svg { width: 100%; height: auto; display: block; }
.rig-ink { stroke: var(--ink); }
.rig-ink-dim { stroke: #464d66; }
.rig-head { fill: var(--ink); }
.rig-line { stroke: #2a2f45; }
.rig-prop { stroke: #4a5170; }
.rig-prop-fill { fill: #4a5170; }
.rig-cable { stroke: #6b7394; stroke-dasharray: 3 3; }
.rig-equip { stroke: var(--a); }
.rig-equip-fill { fill: var(--a); }
.ac-b .rig-equip { stroke: var(--b); } .ac-b .rig-equip-fill { fill: var(--b); }
.ac-c .rig-equip { stroke: var(--c); } .ac-c .rig-equip-fill { fill: var(--c); }
.rig-zzz { fill: var(--ink-dim); font-size: 11px; font-weight: 700; letter-spacing: 2px; }

/* sets */
.set-row { display: flex; gap: 10px; margin: 10px 0 2px; }
.set-dot {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--card-edge); background: var(--bg-soft);
  color: var(--ink-dim); font-size: 15px; font-weight: 750; cursor: pointer;
  transition: transform 0.12s ease, background 0.15s, color 0.15s, border-color 0.15s;
}
.set-dot:active { transform: scale(0.92); }
.set-dot.done { background: var(--a); border-color: var(--a); color: #0b0d16; }
.ac-b .set-dot.done { background: var(--b); border-color: var(--b); }
.ac-c .set-dot.done { background: var(--c); border-color: var(--c); }

/* weight */
.weight-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.weight-lbl { font-size: 12.5px; font-weight: 650; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.07em; }
.weight-row input {
  width: 84px; padding: 8px 10px; border-radius: 12px;
  border: 1px solid var(--card-edge); background: var(--bg-soft);
  color: var(--ink); font-size: 16px; font-weight: 700; text-align: center;
}
.weight-row input:focus { outline: 1.5px solid var(--a); }
.weight-unit { font-size: 13px; color: var(--ink-dim); font-weight: 650; }

/* cues */
.cues { margin: 14px 0 0; padding: 0; list-style: none; }
.cues li {
  position: relative; padding: 5px 0 5px 20px;
  font-size: 14px; line-height: 1.45; color: var(--ink-dim);
}
.cues li::before {
  content: ''; position: absolute; left: 2px; top: 12px;
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--a); opacity: 0.8; transform: rotate(45deg);
}
.ac-b .cues li::before { background: var(--b); }
.ac-c .cues li::before { background: var(--c); }

.phase-note {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 14px;
  background: var(--bg-soft); border: 1px solid var(--card-edge);
  font-size: 12.5px; line-height: 1.5; color: var(--ink-dim);
}
.swipe-hint { margin: 16px 0 0; text-align: center; font-size: 13px; color: var(--ink-faint); }

/* video */
.video-box { margin-top: 14px; border-top: 1px solid var(--card-edge); padding-top: 4px; }
.video-toggle {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 2px; background: none; border: none; cursor: pointer;
  color: var(--ink-dim); font-size: 14px; font-weight: 650;
}
.vt-ico { font-size: 10px; opacity: 0.8; }
.vt-chev { margin-left: auto; transition: transform 0.2s; }
.video-box.open .vt-chev { transform: rotate(180deg); }
.video-tabs { display: flex; gap: 6px; margin: 2px 0 8px; flex-wrap: wrap; }
.video-tab {
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 650;
  border: 1px solid var(--card-edge); background: var(--bg-soft); color: var(--ink-dim); cursor: pointer;
}
.video-tab.on { color: var(--ink); border-color: var(--a); }
.video-frame { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-thumb { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; cursor: pointer; background: #000; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0.75; }
.video-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(11, 13, 22, 0.82); border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center;
  padding-left: 4px;
}

/* day cards (run/rest) + done */
.day-card .card-anim, .done-card .card-anim { max-width: 320px; margin-top: 18px; }
.day-note, .done-sum { font-size: 15px; line-height: 1.55; color: var(--ink-dim); margin: 14px 2px 0; }
.done-sum { font-size: 17px; color: var(--ink); font-weight: 650; }

/* ---------- footer nav ---------- */
footer {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 22px calc(14px + var(--safe-b));
}
#dots { flex: 1; display: flex; justify-content: center; gap: 7px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%; border: none; padding: 0;
  background: var(--ink-faint); opacity: 0.45; cursor: pointer; transition: all 0.2s;
}
.dot.on { opacity: 1; background: var(--ink); transform: scale(1.25); }
.nav-btn {
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--card-edge); background: var(--bg-soft);
  color: var(--ink); font-size: 17px; cursor: pointer; flex: none;
}
.nav-btn:disabled { opacity: 0.25; }
.hidden { display: none !important; }

/* ---------- rest timer ---------- */
#timer {
  position: fixed; left: 50%; bottom: calc(76px + var(--safe-b));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(18, 21, 37, 0.92); border: 1px solid var(--card-edge);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7);
  transition: all 0.25s ease; cursor: pointer; z-index: 40;
}
#timer.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
#timer.zero { border-color: var(--run); }
#timer-ring {
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(var(--a) calc(var(--k, 0) * 360deg), #2a2f45 0);
  mask: radial-gradient(circle 6px, transparent 98%, #000);
  -webkit-mask: radial-gradient(circle 6px, transparent 98%, #000);
}
#timer.zero #timer-ring { background: var(--run); mask: none; -webkit-mask: none; }
#timer-txt { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
#timer-lbl { font-size: 11.5px; color: var(--ink-dim); font-weight: 650; }

/* ---------- modal ---------- */
#modal {
  position: fixed; inset: 0; background: rgba(5, 6, 12, 0.7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none; align-items: flex-end; justify-content: center; z-index: 50;
}
#modal.on { display: flex; }
.modal-sheet {
  width: 100%; max-width: 480px; max-height: 82dvh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--card-edge);
  border-radius: 24px 24px 0 0; padding: 20px 22px calc(24px + var(--safe-b));
}
.modal-head { display: flex; align-items: center; margin-bottom: 4px; }
.modal-head h2 { margin: 0; font-size: 19px; flex: 1; }
#modal-close {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--card-edge);
  background: var(--bg-soft); color: var(--ink-dim); font-size: 14px; cursor: pointer;
}
#modal-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); margin: 18px 0 6px; }
#modal-body p, #modal-body li { font-size: 14px; line-height: 1.55; color: var(--ink-dim); }
#modal-body ul { padding-left: 18px; margin: 6px 0; }
#modal-body input[type='date'] {
  margin-top: 6px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--card-edge); background: var(--bg-soft); color: var(--ink);
  font-size: 16px; font-family: inherit; /* ≥16px: no iOS zoom-on-focus */
}

@media (min-width: 500px) {
  #modal { align-items: center; }
  .modal-sheet { border-radius: 24px; }
}
