:root {
  --bg: #0d0d0f; --card: #17171b; --card2: #1f1f25; --ink: #f3f1ec; --muted: #9a978f; --line: #2a2a31;
  --gold: #d8b25a; --gold-ink: #17130a; --green: #4cc38a; --red: #ef6461; --blue: #5b9cf0;
  --r: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { padding: calc(env(safe-area-inset-top) + 8px) 0 calc(84px + env(safe-area-inset-bottom)); }
main { max-width: 640px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 30px; letter-spacing: -.02em; margin: 10px 0 2px; }
h2 { font-size: 20px; margin: 22px 0 10px; }
.sub { color: var(--muted); font-size: 14px; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.gold { color: var(--gold); }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.pill.gold { background: rgba(216,178,90,.16); color: var(--gold); }
.pill.green { background: rgba(76,195,138,.15); color: var(--green); }

/* countdown hero */
.hero { background: linear-gradient(135deg, #2a2213, #17171b 60%); border: 1px solid #3a3020; }
.hero .big { font-size: 54px; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--gold); }
.hero .lbl { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stats3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 14px; }
.stats3 div { background: rgba(0,0,0,.25); border-radius: 12px; padding: 8px 10px; }
.stats3 b { display: block; font-size: 18px; }
.stats3 span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* day chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 99px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }

/* exercise */
.ex { background: var(--card); border-radius: var(--r); padding: 14px 14px 10px; margin-bottom: 10px; }
.ex.done { outline: 1px solid rgba(76,195,138,.4); }
.ex-name { font-weight: 700; font-size: 17px; }
.ex-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.hint { font-size: 13px; margin: 8px 0 4px; padding: 8px 10px; border-radius: 10px; background: var(--card2); }
.hint.up { background: rgba(216,178,90,.13); color: var(--gold); }
.sets { margin-top: 8px; }
.set { display: grid; grid-template-columns: 26px 1fr 1fr 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.set .n { color: var(--muted); font-size: 13px; text-align: center; }
.set input { width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 10px; font: inherit; font-size: 17px; text-align: center; }
.set input::placeholder { color: #5d5b56; }
.set input:focus { outline: 2px solid var(--gold); border-color: transparent; }
.chk { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); color: var(--muted); font-size: 20px; }
.chk.on { background: var(--green); border-color: var(--green); color: #06170e; }
.set-labels { display: grid; grid-template-columns: 26px 1fr 1fr 44px; gap: 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; text-align: center; }
.linkbtn { background: none; border: 0; color: var(--gold); font: inherit; font-size: 14px; font-weight: 600; padding: 6px 0; cursor: pointer; }

.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px; font: inherit; font-weight: 700; font-size: 16px; background: var(--gold); color: var(--gold-ink); cursor: pointer; margin-top: 10px; }
.btn.ghost { background: var(--card2); color: var(--ink); }
.btn.danger { background: none; color: var(--red); border: 1px solid var(--line); }
.btn:disabled { opacity: .45; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
input.f, select.f, textarea.f { width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--ink); border-radius: 12px; padding: 12px; font: inherit; }
textarea.f { min-height: 90px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* chart */
.chart { width: 100%; height: 160px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* list */
.list .li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.list .li:last-child { border-bottom: 0; }

/* photos */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo { aspect-ratio: 3/4; border-radius: 12px; background: var(--card2) center/cover; position: relative; overflow: hidden; }
.photo span { position: absolute; left: 6px; bottom: 6px; font-size: 11px; background: rgba(0,0,0,.6); padding: 2px 6px; border-radius: 6px; }

/* posing timer */
.timer { text-align: center; padding: 26px 16px; }
.timer .pose { font-size: 26px; font-weight: 800; margin: 6px 0; }
.timer .count { font-size: 96px; font-weight: 800; letter-spacing: -.04em; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.timer .phase { text-transform: uppercase; letter-spacing: .12em; font-size: 13px; color: var(--muted); }
.timer.rest .count { color: var(--blue); }
.progress { height: 6px; background: var(--card2); border-radius: 9px; overflow: hidden; margin-top: 16px; }
.progress div { height: 100%; background: var(--gold); transition: width .3s; }

/* checklist */
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.check:last-child { border-bottom: 0; }
.box { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 14px; margin-top: 1px; }
.check.on .box { background: var(--green); border-color: var(--green); color: #06170e; }
.check.on .t { color: var(--muted); text-decoration: line-through; }
.check .w { font-size: 12px; color: var(--gold); }

/* tabbar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(13,13,15,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
.tabbar button { flex: 1; background: none; border: 0; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px; cursor: pointer; }
.tabbar .ico { font-size: 22px; filter: grayscale(1) opacity(.6); }
.tabbar button.on { color: var(--gold); }
.tabbar button.on .ico { filter: none; }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 90vh; overflow: auto; background: #121215; border-radius: 22px 22px 0 0; padding: 8px 18px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .22s ease; z-index: 11; max-width: 640px; margin: 0 auto; }
.sheet.open { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 6px auto 12px; }
.x { position: sticky; top: 0; float: right; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--card2); color: var(--ink); z-index: 2; }
.toast { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -150%); background: var(--gold); color: var(--gold-ink); font-weight: 700; padding: 10px 18px; border-radius: 99px; transition: transform .2s; z-index: 20; font-size: 14px; }
.toast.show { transform: translate(-50%, 0); }
.empty { text-align: center; color: var(--muted); padding: 24px 10px; }
