@font-face { font-family: 'Outfit'; src: url('../fonts/outfit.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #121315;
  --surface: #1b1d20;
  --surface-2: #24272b;
  --line: #2e3236;
  --text: #eeeae2;
  --muted: #a3a09a;
  --faint: #6f6d69;
  --accent: #e0a84a;      /* brass */
  --accent-ink: #1a1408;
  --ok: #8fbf8a;
  --warn: #e2876b;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
body {
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 18px; line-height: 1.5; min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p { margin: 0; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }

/* ---------- generic ---------- */
.screen { padding: calc(20px + var(--safe-top)) 22px calc(28px + var(--safe-bottom)); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; animation: rise .45s var(--ease) both; }
.screen.with-tabs { padding-bottom: calc(110px + var(--safe-bottom)); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }

.eyebrow { font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.title { font-size: 30px; line-height: 1.12; font-weight: 650; letter-spacing: -0.02em; }
.title-lg { font-size: 38px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; }
.sub { color: var(--muted); font-size: 17px; max-width: 34ch; }
.small { font-size: 15px; color: var(--muted); }
.tiny { font-size: 13px; color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mt32 { margin-top: 32px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; width: 100%; border-radius: 16px; font-size: 19px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  transition: transform .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(0.98) translateY(1px); }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.line { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.slim { min-height: 48px; font-size: 16px; border-radius: 14px; }
.link { color: var(--accent); font-weight: 600; font-size: 16px; padding: 10px 0; }

.icon { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 18px; height: 18px; }
.icon.lg { width: 30px; height: 30px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.divide > * + * { border-top: 1px solid var(--line); }
.pill { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-size: 14px; color: var(--muted); }
.pill.accent { background: rgba(224,168,74,.14); color: var(--accent); }

/* exercise line art: white-on-black alpha masks blended onto dark surfaces */
.art { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; mix-blend-mode: screen; opacity: .92; }
.art-wrap { background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }

/* ---------- quiz ---------- */
.quiz-top { display: flex; align-items: center; gap: 14px; height: 48px; }
.back { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); margin-left: -10px; }
.progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s var(--ease); }
.step-count { font-size: 14px; color: var(--faint); min-width: 44px; text-align: right; }

.options { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 16px; text-align: left;
  min-height: 68px; padding: 14px 18px; border-radius: 16px; background: var(--surface);
  box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s, background .2s, transform .2s var(--ease);
}
.opt:active { transform: scale(0.985); }
.opt .o-main { flex: 1; }
.opt .o-label { font-size: 19px; font-weight: 550; display: block; }
.opt .o-hint { font-size: 15px; color: var(--muted); display: block; margin-top: 2px; }
.opt .o-mark { width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 2px var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.opt.single .o-mark { border-radius: 50%; }
.opt.on { background: rgba(224,168,74,.10); box-shadow: inset 0 0 0 1.5px var(--accent); }
.opt.on .o-mark { background: var(--accent); box-shadow: none; color: var(--accent-ink); }
.opt .o-lead { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); font-weight: 700; font-size: 17px; flex: none; }
.opt.on .o-lead { background: rgba(224,168,74,.18); }

.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--surface); border-radius: 16px; padding: 18px 14px; text-align: left; min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: inset 0 0 0 1.5px transparent; transition: box-shadow .2s, background .2s, transform .2s var(--ease); }
.tile:active { transform: scale(0.98); }
.tile .t-big { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.tile .t-small { font-size: 15px; color: var(--muted); }
.tile.on { background: rgba(224,168,74,.10); box-shadow: inset 0 0 0 1.5px var(--accent); }
.tile.on .t-big { color: var(--accent); }

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.field label { font-size: 15px; color: var(--muted); font-weight: 500; }
.input-wrap { display: flex; align-items: center; background: var(--surface); border-radius: 14px; padding: 0 18px; box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow .2s; }
.input-wrap:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.input-wrap input { flex: 1; min-width: 0; width: 100%; height: 60px; background: transparent; border: 0; outline: 0; font-size: 22px; font-weight: 600; }
.input-wrap .unit { color: var(--muted); font-size: 17px; }
.err { color: var(--warn); font-size: 15px; min-height: 20px; }

.fact { border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; }
.fact p + p { margin-top: 10px; }
.big-figure { width: 62%; margin: 8px auto 0; }

/* loader */
.ring { width: 180px; height: 180px; margin: 30px auto 10px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; font-weight: 700; letter-spacing: -0.03em; }
.checklist { display: grid; gap: 14px; margin-top: 26px; }
.checklist .ci { display: flex; gap: 14px; align-items: center; color: var(--faint); transition: color .3s; font-size: 17px; }
.checklist .ci .dot { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); display: grid; place-items: center; color: transparent; flex: none; transition: all .3s; }
.checklist .ci.done { color: var(--text); }
.checklist .ci.done .dot { background: var(--accent); color: var(--accent-ink); box-shadow: none; }

/* summary chart */
.chart { width: 100%; height: auto; display: block; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--surface); border-radius: 16px; padding: 16px; }
.stat .s-val { font-size: 22px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.stat .s-lab { font-size: 14px; color: var(--muted); }

/* ---------- app: tabs ---------- */
.tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(10px + var(--safe-bottom));
  background: rgba(18,19,21,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); z-index: 20;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; color: var(--faint); font-size: 13px; font-weight: 500; border-radius: 12px; }
.tab.on { color: var(--accent); }

/* today */
.hero-day { position: relative; overflow: hidden; padding: 22px; }
.hero-day .art { position: absolute; right: -26px; bottom: -20px; width: 58%; opacity: .5; }
.hero-day .hd-body { position: relative; max-width: 64%; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { min-height: 46px; border-radius: 11px; font-weight: 600; color: var(--muted); transition: background .2s, color .2s; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

.ex-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.ex-row .thumb { width: 58px; height: 58px; border-radius: 12px; background: var(--surface-2); flex: none; overflow: hidden; }
.ex-row .thumb img { width: 100%; height: 100%; mix-blend-mode: screen; }
.ex-row .ex-name { font-weight: 550; font-size: 17px; }
.ex-row .ex-dose { color: var(--muted); font-size: 15px; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { aspect-ratio: 1 / 1.25; border-radius: 12px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; color: var(--muted); }
.wd b { font-size: 17px; color: var(--text); font-weight: 650; }
.wd.done { background: rgba(143,191,138,.14); color: var(--ok); }
.wd.done b { color: var(--ok); }
.wd.now { box-shadow: inset 0 0 0 1.5px var(--accent); }
.wd.rest b { color: var(--faint); }

/* plan */
.week-block + .week-block { margin-top: 28px; }
.day-list { display: grid; gap: 8px; margin-top: 12px; }
.day-item { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 14px; padding: 12px 16px; text-align: left; width: 100%; }
.day-item .dn { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none; }
.day-item.done .dn { background: rgba(143,191,138,.16); color: var(--ok); }
.day-item.now .dn { background: var(--accent); color: var(--accent-ink); }
.day-item .dt { flex: 1; }
.day-item .dt b { display: block; font-weight: 550; }
.day-item .dt span { font-size: 14px; color: var(--muted); }
.day-item.rest { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

/* progress */
.empty { padding: 22px; border-radius: var(--radius); border: 1.5px dashed var(--line); }

/* ---------- player ---------- */
.player { padding: calc(14px + var(--safe-top)) 20px calc(22px + var(--safe-bottom)); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.player .art-wrap { margin-top: 12px; }
.player .art { max-height: 27vh; }
@media (max-height: 700px) {
  .player { padding-bottom: calc(12px + var(--safe-bottom)); }
  .player .art { max-height: 14vh; }
  .count-big { font-size: 48px; }
  .player .title { font-size: 24px; }
  .cues { margin-top: 10px; gap: 2px; }
  .cues li { font-size: 14px; line-height: 1.4; }
  .player .btn.slim { min-height: 42px; }
  .player .btn, .round-btn { min-height: 54px; height: 54px; }
}
.count-big { font-size: 72px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.count-unit { font-size: 22px; color: var(--muted); font-weight: 500; }
.cues { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.cues li { display: flex; gap: 10px; color: var(--muted); font-size: 16px; }
.cues li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 10px; flex: none; }
.ctrl { display: grid; grid-template-columns: 64px 1fr 64px; gap: 12px; align-items: center; }
.round-btn { width: 64px; height: 60px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; }
.round-btn:active { transform: scale(.96); }
.timebar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.timebar > i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.rest-screen { background: linear-gradient(180deg, #1d1a14, var(--bg) 60%); }

.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rate button { background: var(--surface); border-radius: 14px; min-height: 84px; padding: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-weight: 600; box-shadow: inset 0 0 0 1.5px transparent; }
.rate button span { font-size: 13px; color: var(--muted); font-weight: 400; }
.rate button.on { box-shadow: inset 0 0 0 1.5px var(--accent); background: rgba(224,168,74,.1); }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; animation: fade .25s both; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; background: var(--surface); border-radius: 22px 22px 0 0; padding: 22px 22px calc(26px + var(--safe-bottom)); z-index: 41; animation: up .35s var(--ease) both; max-height: 88vh; overflow: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translate(-50%, 40px); opacity: 0; } }
.toast { position: fixed; left: 50%; top: calc(16px + var(--safe-top)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; z-index: 60; animation: rise .3s var(--ease) both; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* small phones (320-360 px wide) */
@media (max-width: 360px) {
  .title-lg { font-size: 31px; }
  .title { font-size: 26px; }
  .screen { padding-left: 18px; padding-right: 18px; }
  .count-big { font-size: 60px; }
}

/* easier / harder swap, beside the exercise name */
.swap { display: grid; gap: 6px; flex: none; }
.swap button { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; font-weight: 600; color: var(--text); }
.swap button:active { transform: scale(0.97); }
