/* Gym Routine – "Athletic Dark" design system */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('../fonts/Inter-variable.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/BarlowCondensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/BarlowCondensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/BarlowCondensed-800.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 800; font-display: swap; src: url('../fonts/BarlowCondensed-800italic.woff2') format('woff2'); }

:root {
  --bg: #000;
  --surface: #0d0d0e;
  --surface-2: #151517;
  --surface-3: #1e1e21;
  --line: #1f1f23;
  --line-2: #2c2c31;
  --text: #f4f4f1;
  --muted: #8d8d94;
  --faint: #56565d;
  --lime: #c6ff3d;
  --lime-2: #a9e61f;
  --lime-dim: rgba(198, 255, 61, 0.12);
  --lime-ink: #0b1000;
  --ok: var(--lime);
  --ok-dim: var(--lime-dim);
  --bad: #ff4d4d;
  --bad-dim: rgba(255, 77, 77, 0.12);
  --warn: #ffb020;
  --radius: 18px;
  --radius-s: 13px;
  --tabbar: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:active { transform: scale(0.98); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.display { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; }
.num-font { font-family: var(--display); font-variant-numeric: tabular-nums; }

/* ---------- top bar & tabs ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(#000 70%, rgba(0, 0, 0, 0.85));
  backdrop-filter: blur(12px);
  padding-top: var(--safe-t);
}
.topbar-inner { max-width: 640px; margin: 0 auto; padding: 12px 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-title { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; text-transform: uppercase; letter-spacing: 0.01em; }
.topbar-sub { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

.view { max-width: 640px; margin: 0 auto; padding: 6px 16px calc(var(--tabbar) + var(--safe-b) + 100px); outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(0, 0, 0, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tab { position: relative; background: none; border: 0; color: var(--faint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.tab.active { color: var(--lime); }
.tab.active::before { content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--lime); box-shadow: 0 0 14px rgba(198, 255, 61, 0.6); }
.tab svg { width: 24px; height: 24px; }

/* ---------- basics ---------- */
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); display: inline-grid; place-items: center; color: var(--text); flex: none; }
.icon-btn.light { background: rgba(0, 0, 0, 0.45); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.icon-btn.done { border-color: var(--lime); color: var(--lime-ink); background: var(--lime); box-shadow: 0 0 18px rgba(198, 255, 61, 0.35); }

.btn { min-height: 48px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-family: var(--display); font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: 0.05em; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); box-shadow: 0 8px 24px rgba(198, 255, 61, 0.22); }
.btn.ghost { background: transparent; }
.btn.light { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.btn.danger { color: var(--bad); border-color: rgba(255, 77, 77, 0.4); background: transparent; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; box-shadow: none; }
.btn svg { width: 20px; height: 20px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card-title { font-weight: 700; margin: 0 0 4px; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }
.section-h { font-family: var(--display); font-size: 15px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; margin: 22px 2px 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--muted); }
.pill.ok { color: var(--lime); border-color: rgba(198, 255, 61, 0.35); background: var(--lime-dim); }
.pill.warn { color: var(--warn); border-color: rgba(255, 176, 32, 0.35); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.lime { color: var(--lime); }

/* ---------- hero (today) ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 18px 18px 16px; margin: 4px 0 14px;
  background: radial-gradient(120% 90% at 100% 0%, rgba(198, 255, 61, 0.16), transparent 55%), linear-gradient(160deg, #141416, #070707 70%);
  border: 1px solid var(--line-2);
}
.hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(198, 255, 61, 0.05); pointer-events: none; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hero-main { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 6px 0 14px; }
.hero-title { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 64px; line-height: 0.9; text-transform: uppercase; margin: 6px 0 6px; letter-spacing: -0.01em; }
.hero-sub { color: var(--muted); font-size: 13.5px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hero-meta span { font-size: 11.5px; font-weight: 600; color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-2); padding: 4px 9px; border-radius: 999px; }
.hero .warn-line { color: var(--warn); font-size: 12.5px; margin-top: 8px; font-weight: 600; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring .track { stroke: rgba(255, 255, 255, 0.08); stroke-width: 9; }
.ring .fill { stroke: var(--lime); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); filter: drop-shadow(0 0 6px rgba(198, 255, 61, 0.5)); }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.ring .label b { font-family: var(--display); font-size: 30px; font-weight: 800; display: block; }
.ring .label span { font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.checked-row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--lime-dim); border: 1px solid rgba(198, 255, 61, 0.35); }
.checked-row .grow { flex: 1; min-width: 0; }
.checked-row b { font-family: var(--display); font-size: 20px; text-transform: uppercase; color: var(--lime); letter-spacing: 0.02em; }

/* ---------- today ---------- */
.checkin-card { display: flex; align-items: center; gap: 12px; }
.checkin-card img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; }
.checkin-card .grow { flex: 1; min-width: 0; }
.phase { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-left: 3px solid var(--lime); border-radius: 14px; }
.phase.deload { border-left-color: var(--warn); }
.phase .card-title { font-family: var(--display); font-size: 17px; text-transform: uppercase; letter-spacing: 0.04em; margin: 0; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: 4px 0 14px; }
.seg button { border: 0; background: transparent; border-radius: 999px; min-height: 40px; font-family: var(--display); font-weight: 700; font-size: 16px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); position: relative; }
.seg button.active { background: var(--lime); color: var(--lime-ink); }
.seg button .dot { position: absolute; top: 5px; right: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.seg button.active .dot { background: var(--lime-ink); box-shadow: none; }

.progress { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--lime-2), var(--lime)); width: 0; transition: width 0.4s ease; box-shadow: 0 0 10px rgba(198, 255, 61, 0.5); }
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 8px; }
.list-head b { font-family: var(--display); font-size: 20px; text-transform: uppercase; letter-spacing: 0.03em; }

details.warm { padding: 0; }
details.warm summary { list-style: none; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; font-family: var(--display); font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
details.warm summary::-webkit-details-marker { display: none; }
details.warm summary svg { transition: transform 0.2s; }
details.warm[open] summary svg { transform: rotate(180deg); }
details.warm .warm-body { padding: 0 16px 16px; }
.ramp { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 6px; margin-top: 8px; }
.ramp div { background: var(--surface-2); border-radius: 12px; padding: 8px 6px; text-align: center; border: 1px solid var(--line); }
.ramp b { display: block; font-family: var(--display); font-size: 19px; }
.ramp span { font-size: 11px; color: var(--muted); }

.ex-list { display: flex; flex-direction: column; gap: 8px; }
.ex { display: grid; grid-template-columns: 30px 58px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 10px 10px; position: relative; }
.ex.done { border-color: rgba(198, 255, 61, 0.4); background: linear-gradient(90deg, rgba(198, 255, 61, 0.07), var(--surface) 60%); }
.ex .ex-num { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 26px; color: var(--faint); text-align: center; line-height: 1; }
.ex.main .ex-num { color: var(--lime); }
.ex .thumb { width: 58px; height: 58px; border-radius: 12px; background: #fff; object-fit: cover; }
.ex .num { display: none; }
.ex .name { font-weight: 650; font-size: 15px; line-height: 1.25; }
.ex .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.ex .tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; color: var(--lime); }
.ex .state { min-width: 40px; display: grid; place-items: center; }
.mini-ring { width: 36px; height: 36px; position: relative; }
.mini-ring svg { width: 36px; height: 36px; transform: rotate(-90deg); }
.mini-ring .track { stroke: var(--surface-3); stroke-width: 4; }
.mini-ring .fill { stroke: var(--lime); stroke-width: 4; stroke-linecap: round; }
.mini-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 13px; color: var(--muted); }
.done-badge { width: 36px; height: 36px; border-radius: 50%; background: var(--lime); color: var(--lime-ink); display: grid; place-items: center; box-shadow: 0 0 14px rgba(198, 255, 61, 0.4); }
.done-badge svg { width: 20px; height: 20px; stroke-width: 2.6; }
.superset-link { font-size: 11.5px; color: var(--lime); margin: -2px 0 0 44px; font-weight: 600; letter-spacing: 0.02em; }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; animation: slide-up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet.closing { animation: slide-down 0.22s ease forwards; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) 14px 10px; border-bottom: 1px solid var(--line); background: #000; }
.sheet-title { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.01em; }
.sheet-title small { display: block; color: var(--muted); font-family: var(--body); font-weight: 600; font-size: 11.5px; letter-spacing: 0.06em; margin-top: 3px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px 16px calc(40px + var(--safe-b) + 90px); max-width: 640px; width: 100%; margin: 0 auto; -webkit-overflow-scrolling: touch; }

.media { position: relative; background: #fff; border-radius: var(--radius); overflow: hidden; aspect-ratio: 1; max-width: 340px; margin: 0 auto; }
.media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.media .credit { position: absolute; right: 8px; bottom: 6px; font-size: 9.5px; color: #777; }
.media .offline { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: #444; font-size: 13px; background: #f1f1f1; }

.presc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 14px 0; }
.presc div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px 8px; text-align: center; }
.presc b { display: block; font-family: var(--display); font-size: 28px; font-weight: 800; line-height: 1; }
.presc span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }

.hint { border-radius: 14px; padding: 11px 13px; font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; }
.hint.up { background: var(--lime-dim); border-color: rgba(198, 255, 61, 0.35); color: #e6ffb0; }

.sets { display: flex; flex-direction: column; gap: 7px; }
.set { display: grid; grid-template-columns: 46px 1fr 1fr 52px; gap: 7px; align-items: center; }
.set label { font-family: var(--display); font-size: 16px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.set input { width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); padding: 0 10px; font-family: var(--display); font-size: 26px; font-weight: 700; text-align: center; }
.set input:focus { outline: 2px solid var(--lime); outline-offset: -1px; }
.set .unit { font-size: 10px; color: var(--faint); text-align: center; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.set .tick { width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.set .tick svg { stroke-width: 2.4; }
.set.done .tick { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); box-shadow: 0 0 16px rgba(198, 255, 61, 0.35); }
.set.done input { border-color: rgba(198, 255, 61, 0.45); color: var(--lime); }
.set-head { display: grid; grid-template-columns: 46px 1fr 1fr 52px; gap: 7px; font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; text-align: center; }

ol.steps, ul.cues, ul.mistakes { margin: 0; padding-left: 0; list-style: none; counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding: 10px 0 10px 40px; border-bottom: 1px solid var(--line); }
ol.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 8px; font-family: var(--display); font-style: italic; font-weight: 800; font-size: 20px; color: var(--lime); }
ul.cues li, ul.mistakes li { position: relative; padding: 8px 0 8px 30px; }
ul.cues li::before { content: ""; position: absolute; left: 4px; top: 14px; width: 11px; height: 6px; border-left: 2.5px solid var(--lime); border-bottom: 2.5px solid var(--lime); transform: rotate(-45deg); }
ul.mistakes li::before, ul.mistakes li::after { content: ""; position: absolute; left: 3px; top: 17px; width: 15px; height: 2.5px; background: var(--bad); transform: rotate(45deg); border-radius: 2px; }
ul.mistakes li::after { transform: rotate(-45deg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.swap { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px 8px 8px; }
.swap img { width: 48px; height: 48px; border-radius: 10px; background: #fff; object-fit: cover; }
.hist { font-size: 13.5px; }
.hist div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---------- rest timer ---------- */
.timer { position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabbar) + var(--safe-b) + 10px); z-index: 60; max-width: 620px; margin: 0 auto; background: var(--lime); color: var(--lime-ink); border-radius: 22px; overflow: hidden; box-shadow: 0 12px 40px rgba(198, 255, 61, 0.25), 0 10px 30px rgba(0, 0, 0, 0.6); animation: pop-in 0.25s ease; }
.timer.over { background: #fff; }
.timer-bar { height: 5px; background: rgba(0, 0, 0, 0.15); }
.timer-bar span { display: block; height: 100%; background: var(--lime-ink); width: 100%; transition: width 0.25s linear; }
.timer-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 10px; }
.timer-label { font-size: 11px; font-weight: 800; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.1em; }
.timer-time { font-family: var(--display); font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 0.95; }
.timer-actions { display: flex; gap: 8px; }
.timer .btn { background: var(--lime-ink); color: var(--lime); border-color: var(--lime-ink); box-shadow: none; }
.timer .btn.ghost { background: transparent; color: var(--lime-ink); border-color: rgba(0, 0, 0, 0.3); }
body.sheet-open .timer { bottom: calc(var(--safe-b) + 12px); }

/* ---------- calendar ---------- */
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.cal-nav h2 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 10px; }
.stat b { display: block; font-family: var(--display); font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat:first-child b { color: var(--lime); }
.stat span { font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-week div { text-align: center; font-size: 11px; font-weight: 800; color: var(--faint); padding-bottom: 4px; letter-spacing: 0.06em; }
.cell { position: relative; aspect-ratio: 1; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2); display: grid; place-items: center; padding: 0; }
.cell .n { position: absolute; top: 4px; left: 6px; font-family: var(--display); font-size: 13px; font-weight: 700; color: var(--muted); }
.cell svg.mark { position: absolute; width: 54%; height: 54%; left: 23%; top: 32%; stroke-width: 3.2; }
.cell.blank { background: transparent; }
.cell.none { background: transparent; opacity: 0.35; }
.cell.future { background: transparent; border-color: var(--line); }
.cell.future .n { color: var(--faint); }
.cell.due { border: 2px solid var(--lime); animation: due-pulse 1.8s ease-in-out infinite; }
.cell.due .n { color: var(--lime); }
.cell.done { background: var(--lime); border-color: var(--lime); box-shadow: 0 0 12px rgba(198, 255, 61, 0.25); }
.cell.done .n { color: var(--lime-ink); }
.cell.done svg.mark { stroke: var(--lime-ink); }
.cell.missed { background: var(--bad-dim); border-color: rgba(255, 77, 77, 0.3); }
.cell.missed .n { color: var(--bad); }
.cell.missed svg.mark { stroke: var(--bad); }
.cell.today .n { font-weight: 800; }
.cell.rest { background: rgba(255, 255, 255, 0.05); border: 1px dashed #3d3d44; }
.cell.rest .n { color: var(--muted); }
.cell svg.rest-mark { stroke: #b9b9c2; fill: rgba(185, 185, 194, 0.15); stroke-width: 1.8; }

.cal-grid.cascade .cell:not(.blank) { animation: cell-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; animation-delay: calc(var(--i) * 22ms); }
.cal-grid.cascade .cell.none { animation-name: cell-in-faint; }
.cal-grid.cascade .cell.missed svg.mark path, .cal-grid.cascade .cell.done svg.mark path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 0.35s ease forwards; animation-delay: calc(var(--i) * 22ms + 250ms); }
.cell.stamp { z-index: 2; animation: stamp 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) both !important; animation-delay: var(--stamp-delay, 0ms) !important; }
.cell.stamp svg.mark path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 0.45s ease forwards !important; animation-delay: calc(var(--stamp-delay, 0ms) + 250ms) !important; }
.cell.stamp::after { content: ""; position: absolute; inset: -2px; border-radius: 13px; border: 3px solid var(--lime); opacity: 0; animation: ripple 0.9s ease-out forwards; animation-delay: calc(var(--stamp-delay, 0ms) + 150ms); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin: 14px 2px 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }
.legend .l-done { background: var(--lime); }
.legend .l-missed { background: var(--bad-dim); border: 1px solid var(--bad); }
.legend .l-today { border: 2px solid var(--lime); }
.legend .l-rest { background: rgba(255, 255, 255, 0.08); border: 1px dashed #55555c; }

.banner { border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; background: var(--lime-dim); border: 1px solid rgba(198, 255, 61, 0.4); animation: pop-in 0.35s ease; }
.banner.warn { background: rgba(255, 176, 32, 0.08); border-color: rgba(255, 176, 32, 0.4); }
.month-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.month-row:last-child { border-bottom: 0; }
.month-row .acts { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.month-row .acts .btn { white-space: nowrap; }

/* ---------- camera & viewer ---------- */
.camera, .viewer { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; }
.camera video, .camera #cam-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera video.mirror { transform: scaleX(-1); }
.camera #cam-preview { object-fit: contain; background: #000; }
.cam-top, .viewer-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(12px + var(--safe-t)) 14px 12px; display: flex; align-items: center; gap: 12px; background: linear-gradient(rgba(0, 0, 0, 0.7), transparent); z-index: 3; }
.cam-hint, .viewer-cap { font-size: 14px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.cam-msg { position: absolute; left: 20px; right: 20px; top: 40%; text-align: center; background: rgba(0, 0, 0, 0.75); padding: 16px; border-radius: 16px; font-size: 14.5px; }
.cam-controls { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 24px calc(28px + var(--safe-b)); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); }
#cam-confirm { justify-content: center; }
.cam-spacer { width: 44px; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid var(--lime); background: rgba(198, 255, 61, 0.2); box-shadow: inset 0 0 0 4px #000, 0 0 24px rgba(198, 255, 61, 0.4); }
.shutter:active { background: var(--lime); }
.viewer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.viewer-actions { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(24px + var(--safe-b)); display: flex; gap: 10px; justify-content: center; background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); z-index: 3; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.viewer-nav.prev { left: 10px; }
.viewer-nav.next { right: 10px; }
.viewer-nav:disabled { opacity: 0.2; }
.viewer-cap { line-height: 1.35; }
.viewer { touch-action: pan-y; }
.flash { position: fixed; inset: 0; background: #fff; z-index: 90; pointer-events: none; animation: flash 0.35s ease forwards; }

/* ---------- photos, progress, settings ---------- */
.reminder { border-color: var(--line-2); }
.seg.two { grid-template-columns: 1fr 1fr; margin-top: 0; }
.photo-btn { padding: 0; border: 0; background: none; border-radius: 12px; flex: none; }
.photo-btn img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; display: block; }
.link { background: none; border: 0; padding: 0; color: var(--lime); text-decoration: underline; font-weight: 700; }
.month-head { display: flex; justify-content: space-between; align-items: center; margin: 20px 2px 10px; }
.month-head b { font-family: var(--display); font-size: 20px; text-transform: uppercase; letter-spacing: 0.03em; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ph { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; aspect-ratio: 3 / 4; background: var(--surface); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-none { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.ph-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 7px 6px; font-size: 10.5px; color: #fff; text-align: left; line-height: 1.2; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85)); }
.ph-cap b { font-family: var(--display); font-size: 17px; text-transform: uppercase; display: block; }
.archive-card { margin-top: 8px; padding-top: 4px; padding-bottom: 4px; }
.mini-del { width: 30px; height: 30px; border-radius: 9px; border: 1px solid rgba(255, 77, 77, 0.35); background: transparent; color: var(--bad); font-size: 12px; line-height: 1; flex: none; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 18px); transform: translateX(-50%) translateY(20px); background: var(--text); color: #000; padding: 11px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: 0.25s ease; z-index: 100; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.field { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field input[type=date] { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 10px; min-height: 42px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--lime); width: 0; transition: width 0.3s; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.spark { width: 100%; height: 44px; margin-top: 4px; }
.spark path { stroke: var(--lime); stroke-width: 2; fill: none; }
.spark circle { fill: var(--lime); stroke: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-transform: capitalize; }

/* ---------- exercise media: photo loop + animation ---------- */
.media-toggle { max-width: 260px; margin: 0 auto 10px; }
.media.photo { aspect-ratio: 3 / 2; max-width: 600px; background: #111; cursor: pointer; }
.media.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media.photo img.b { animation: xfade 3.2s ease-in-out infinite; }
.media.photo .phase-tag { position: absolute; left: 10px; top: 10px; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.media.photo .phase-tag i { font-style: normal; position: absolute; left: 0; top: 0; white-space: nowrap; padding: 4px 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.65); color: #fff; }
.media.photo .phase-tag .e { background: var(--lime); color: var(--lime-ink); }
.media.photo .phase-tag .s { animation: xfade-inv 3.2s ease-in-out infinite; }
.media.photo .phase-tag .e { animation: xfade 3.2s ease-in-out infinite; }
.media.photo .credit { color: rgba(255, 255, 255, 0.75); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
.media.photo.paused img.b, .media.photo.paused .phase-tag i { animation-play-state: paused; }
.media.anim { max-width: 260px; }
.media-hint { text-align: center; margin-top: 6px; }

/* ---------- monthly gym edit ---------- */
.edit-card { position: relative; overflow: hidden; border-radius: 24px; padding: 16px; margin: 4px 0 14px; background: linear-gradient(160deg, #1a1f0a, #050505 60%); border: 1px solid rgba(198, 255, 61, 0.35); }
.edit-card h3 { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 30px; line-height: 1; text-transform: uppercase; margin: 6px 0 4px; }
.edit-video { display: block; width: 100%; max-width: 300px; aspect-ratio: 9 / 16; margin: 12px auto; border-radius: 18px; background: #000; object-fit: cover; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }
.edit-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.edit-progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.edit-progress span { display: block; height: 100%; width: 0; background: var(--lime); transition: width 0.3s linear; }
.tpl-grid { display: grid; gap: 10px; }
.tpl { text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 14px; }
.tpl.active { border-color: var(--lime); background: linear-gradient(160deg, rgba(198, 255, 61, 0.1), var(--surface) 60%); }
.tpl b { font-family: var(--display); font-style: italic; font-weight: 800; font-size: 24px; text-transform: uppercase; display: block; line-height: 1; }
.tpl .bpm { float: right; font-size: 11px; font-weight: 800; color: var(--lime); letter-spacing: 0.08em; }
.tpl p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.music-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.music-opts label { display: block; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; padding: 12px; font-size: 13px; }
.music-opts input { accent-color: var(--lime); }
.edit-live canvas { display: block; width: 100%; max-width: 230px; aspect-ratio: 9 / 16; margin: 12px auto 0; border-radius: 16px; background: #000; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); }
.edit-card .row .icon-btn { font-size: 14px; }

@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-down { to { transform: translateY(40px); opacity: 0; } }
@keyframes pop-in { from { transform: translateY(10px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cell-in { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cell-in-faint { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 0.35; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes stamp { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 60% { transform: scale(0.92); } 100% { transform: scale(1); } }
@keyframes ripple { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes due-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(198, 255, 61, 0.45); } 50% { box-shadow: 0 0 0 6px rgba(198, 255, 61, 0); } }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }
@keyframes xfade { 0%, 38% { opacity: 0; } 50%, 88% { opacity: 1; } 100% { opacity: 0; } }
@keyframes xfade-inv { 0%, 38% { opacity: 1; } 50%, 88% { opacity: 0; } 100% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
@media (min-width: 700px) {
  .view { padding-top: 16px; }
}

/* ---------- rest day + action sheet ---------- */
.rest-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px dashed #3d3d44; }
.rest-row .grow { flex: 1; min-width: 0; }
.rest-row b { font-family: var(--display); font-size: 20px; text-transform: uppercase; letter-spacing: 0.02em; }
.rest-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: #d6d6de; flex: none; }
.asheet { position: fixed; inset: 0; z-index: 95; display: flex; align-items: flex-end; justify-content: center; }
.asheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade-in 0.2s ease; }
.asheet-card { position: relative; width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 20px 16px calc(18px + var(--safe-b)); animation: slide-up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.asheet-title { font-family: var(--display); font-weight: 800; font-size: 26px; text-transform: uppercase; line-height: 1.05; }
.asheet-sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 16px; }
.asheet-actions { display: grid; gap: 8px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* camera flip button with label */
.flip-btn { background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; }
.flip-btn .icon-btn { width: 52px; height: 52px; }
.flip-label { font-family: var(--display); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.cam-spacer { width: 52px; }
