:root {
  color-scheme: dark;
  --bg: #080d18;
  --surface: #111827;
  --surface-2: #182234;
  --line: #29364b;
  --text: #f7f8fb;
  --muted: #9aa8bb;
  --accent: #63e6a8;
  --accent-2: #33b87c;
  --warm: #ffca67;
  --danger: #ff8b8b;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 80% -10%, #163b38 0, transparent 28rem), var(--bg); color: var(--text); }
body.dialog-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(100%, 720px); min-height: 100dvh; margin: 0 auto; padding: 0 20px 116px; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; padding-top: env(safe-area-inset-top); }
.topbar h1 { margin: 2px 0 0; font-size: 1.35rem; letter-spacing: -.03em; }
.eyebrow { margin: 0; color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0; font-size: clamp(1.7rem, 8vw, 2.65rem); line-height: 1.02; letter-spacing: -.055em; max-width: 15ch; }
h3 { margin-bottom: 0; font-size: 1rem; }
.view { display: none; animation: enter .22s ease-out; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin: 16px 0 26px; }
.section-heading .eyebrow { margin-bottom: 9px; }
.privacy-pill { white-space: nowrap; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 8px 11px; font-size: .74rem; }
.next-card { position: relative; overflow: hidden; background: linear-gradient(135deg, #1b5949, #10332f); border: 1px solid #347b69; border-radius: 28px; padding: 24px; box-shadow: 0 20px 60px #0007; }
.next-card::after { content: ""; position: absolute; width: 140px; height: 140px; right: -46px; bottom: -62px; border: 24px solid #ffffff0d; border-radius: 50%; pointer-events: none; }
.next-card .tag { display: inline-flex; background: #071a17aa; border-radius: 99px; padding: 7px 10px; color: #baf8dc; font-size: .75rem; font-weight: 750; }
.next-card h3 { font-size: 1.75rem; margin: 22px 0 7px; letter-spacing: -.035em; }
.next-card p { color: #c6e7dc; margin-bottom: 22px; line-height: 1.5; }
.next-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.next-meta strong { color: var(--accent); }
.quick-button { border: 0; background: var(--accent); color: #062117; border-radius: 14px; min-height: 45px; padding: 0 16px; font-weight: 850; }
.stats-grid { display: grid; grid-template-columns: 1.45fr 1fr 1fr; gap: 10px; margin: 14px 0; }
.stat-card { min-height: 118px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 15px; display: flex; align-items: center; gap: 13px; }
.stat-card.compact { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; }
.stat-card p { margin: 0; color: var(--muted); font-size: .75rem; }
.stat-card strong { display: block; margin: 3px 0; font-size: 1.06rem; }
.stat-card.compact strong { font-size: 1.8rem; color: var(--accent); }
.stat-card small { color: var(--muted); font-size: .7rem; }
.ring { --p: 0deg; flex: 0 0 64px; height: 64px; display: grid; place-items: center; background: conic-gradient(var(--accent) var(--p), #263449 0); border-radius: 50%; position: relative; }
.ring::before { content: ""; position: absolute; inset: 7px; background: var(--surface); border-radius: inherit; }
.ring span { position: relative; font-size: .76rem; font-weight: 850; }
.quote-card { border-left: 3px solid var(--warm); margin: 18px 4px 28px; padding: 4px 0 4px 16px; }
.quote-card span { color: var(--warm); font-size: .7rem; font-weight: 850; letter-spacing: .1em; }
.quote-card p { margin: 6px 0 0; color: #d9e0eb; line-height: 1.45; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.text-button { border: 0; color: var(--accent); background: transparent; padding: 6px 0; font-weight: 750; }
.records-list { display: grid; gap: 10px; margin-top: 14px; }
.record { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); background: #0d1523; border-radius: 16px; }
.record-icon { width: 42px; height: 42px; display: grid; place-items: center; background: #17352f; color: var(--accent); border-radius: 13px; font-weight: 900; }
.record strong { display: block; margin-bottom: 4px; }
.record small { color: var(--muted); }
.record .delete-log { opacity: .7; border: 0; background: transparent; color: var(--danger); font-size: 1.1rem; padding: 8px; }
.empty-state { border: 1px dashed var(--line); color: var(--muted); text-align: center; padding: 26px; border-radius: 18px; line-height: 1.5; }
.form-card, .history-card, .data-card, .chart-card, .plan-intro { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.form-card { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: #cdd6e4; font-size: .85rem; font-weight: 720; }
input, select, textarea { width: 100%; border: 1px solid #344258; border-radius: 13px; background: #0a111e; color: var(--text); padding: 13px 14px; min-height: 48px; }
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 3px solid #63e6a82b; border-color: var(--accent); }
.two-columns, .three-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three-columns { grid-template-columns: repeat(3, 1fr); }
.effort-field { border: 0; padding: 0; margin: 0; }
.effort-field legend { width: 100%; color: #cdd6e4; font-size: .85rem; font-weight: 720; margin-bottom: 8px; }
.effort-field legend span { float: right; color: var(--accent); }
input[type="range"] { padding: 0; min-height: 30px; accent-color: var(--accent); }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .7rem; }
.primary-button, .secondary-button, .outline-button, .danger-button { border-radius: 14px; min-height: 48px; padding: 0 16px; font-weight: 850; }
.primary-button { border: 0; background: var(--accent); color: #062117; }
.secondary-button { min-height: 40px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.outline-button { border: 1px solid #3b4a61; color: var(--text); background: transparent; display: inline-grid; place-items: center; }
.danger-button { border: 1px solid #6e3e48; color: var(--danger); background: transparent; }
.full { width: 100%; margin-top: 12px; }
.gentle-note { color: var(--muted); font-size: .8rem; line-height: 1.5; padding: 0 8px; margin: 14px 0; }
.run-scan-card { display: grid; gap: 14px; background: linear-gradient(145deg, #14233a, #101a2b); border: 1px solid #385172; border-radius: 18px; padding: 16px; }
.run-scan-card h3 { margin: 8px 0 5px; }
.run-scan-card p { color: var(--muted); font-size: .78rem; line-height: 1.45; margin: 0; }
.scan-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #233650; color: var(--accent); font-size: 1.25rem; }
.photo-button { min-height: 48px; display: grid; place-items: center; border-radius: 14px; background: #22334d; color: var(--text); cursor: pointer; }
.photo-button input { display: none; }
#runPhotoPreview { width: 100%; max-height: 260px; object-fit: contain; border-radius: 14px; background: #070c14; }
.scan-status { color: var(--accent); font-size: .8rem; min-height: 0; }
.scan-results { display: grid; gap: 12px; padding-top: 4px; }
.scan-results label { font-size: .72rem; }
#scanCheck { color: var(--warm); }
.plan-intro { margin-bottom: 14px; }
.plan-intro strong { color: var(--accent); }
.plan-intro p { color: var(--muted); line-height: 1.5; margin: 7px 0 0; }
.plan-list { display: grid; gap: 10px; }
.plan-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 13px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.day-chip { text-align: center; color: var(--accent); font-size: .72rem; font-weight: 900; }
.day-chip strong { display: block; font-size: 1.1rem; }
.plan-item h3 { margin-bottom: 5px; }
.plan-item p { color: var(--muted); font-size: .76rem; margin: 0; line-height: 1.35; }
.plan-item button { border: 0; background: transparent; color: var(--muted); font-size: 1.25rem; padding: 10px; }
.plan-actions { display: flex; align-items: center; gap: 3px; }
.plan-actions .start-plan { width: 42px; height: 42px; border-radius: 13px; background: #183a31; color: var(--accent); font-size: 1rem; font-weight: 900; }
.optional-badge { display: inline-block; color: var(--warm); margin-left: 6px; font-size: .65rem; text-transform: uppercase; }
.chart-card { margin-bottom: 12px; }
.chart-title { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; }
.bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; height: 180px; align-items: end; margin-top: 20px; }
.bar-column { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bar-track { width: min(42px, 70%); height: 130px; display: flex; align-items: flex-end; background: #1d293b; border-radius: 12px; overflow: hidden; }
.bar-fill { width: 100%; min-height: 3px; background: linear-gradient(var(--accent), var(--accent-2)); border-radius: 12px 12px 0 0; transition: height .3s ease; }
.bar-column small { color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.summary-card { background: var(--surface-2); border-radius: 16px; padding: 15px; }
.summary-card span { color: var(--muted); font-size: .72rem; }
.summary-card strong { display: block; color: var(--accent); font-size: 1.25rem; margin-top: 5px; }
.history-card { margin-bottom: 12px; }
.history-card .section-row span { color: var(--muted); font-size: .8rem; }
.data-card { display: grid; gap: 18px; }
.data-card p { color: var(--muted); margin: 7px 0 0; line-height: 1.5; }
.data-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.file-button { cursor: pointer; }
.file-button input { display: none; }
.bottom-nav { position: fixed; z-index: 10; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 28px), 680px); min-height: 74px; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; background: #111927ee; border: 1px solid #334158; border-radius: 22px; padding: 7px; backdrop-filter: blur(18px); box-shadow: 0 14px 50px #0009; }
.nav-item { border: 0; background: transparent; color: var(--muted); min-height: 58px; border-radius: 16px; display: grid; place-items: center; align-content: center; gap: 3px; font-size: .69rem; font-weight: 750; }
.nav-item span { font-size: 1.2rem; line-height: 1; }
.nav-item.active { background: #1d2a3d; color: var(--accent); }
.nav-item.primary-nav { color: #0b231a; background: var(--accent); }
.nav-item.primary-nav.active { box-shadow: 0 0 0 3px #63e6a830; }
.icon-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 44px; height: 44px; border-radius: 14px; font-size: 1.35rem; }
dialog { width: min(calc(100% - 28px), 560px); border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--text); padding: 0; z-index: 50; }
dialog::backdrop { background: #02050bd9; backdrop-filter: blur(4px); }
.dialog-card { padding: 20px; display: grid; gap: 16px; }
.dialog-actions { display: flex; justify-content: space-between; gap: 10px; }
.check-row { display: flex; align-items: center; }
.check-row input { width: 20px; height: 20px; min-height: auto; accent-color: var(--accent); }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 104px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #e9fff5; color: #09241a; padding: 12px 18px; border-radius: 99px; font-weight: 800; box-shadow: 0 12px 40px #0008; transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.workout-dialog, .exercise-dialog { position: fixed; inset: 0; width: min(100%, 720px); max-width: 720px; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; margin: 0 auto; background: var(--bg); overflow: auto; }
.workout-sheet, .exercise-sheet { min-height: 100%; padding: max(18px, env(safe-area-inset-top)) 18px max(30px, env(safe-area-inset-bottom)); }
.workout-header, .exercise-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-bottom: 20px; }
.workout-header h2 { font-size: 1.65rem; margin-top: 3px; }
.workout-header > span { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 800; }
.workout-progress { height: 7px; overflow: hidden; border-radius: 99px; background: #202c3d; }
.workout-progress div { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s; }
.workout-progress-label { color: var(--muted); margin: 8px 0 20px; font-size: .78rem; }
.exercise-list { display: grid; gap: 10px; margin-bottom: 18px; }
.exercise-card { display: grid; grid-template-columns: 82px 1fr auto; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 18px; padding: 9px; background: var(--surface); color: var(--text); text-align: left; width: 100%; }
.exercise-card img { width: 82px; height: 82px; object-fit: cover; border-radius: 13px; background: #071326; }
.exercise-card h3 { margin: 0 0 6px; font-size: 1rem; }
.exercise-card p { margin: 0; color: var(--muted); font-size: .76rem; }
.exercise-card .exercise-status { width: 28px; height: 28px; display: grid; place-items: center; border: 2px solid #58667a; border-radius: 50%; color: transparent; }
.exercise-card.completed { border-color: #2f6959; background: #10241f; }
.exercise-card.completed .exercise-status { border-color: var(--accent); background: var(--accent); color: #082219; font-weight: 900; }
.exercise-header { grid-template-columns: auto 1fr auto; }
.exercise-header > span { text-align: center; color: var(--muted); font-weight: 750; }
.done-exercise-button { color: var(--accent); }
#exerciseImage { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: center 43%; border-radius: 20px; background: #071326; }
.exercise-copy { padding: 22px 8px 18px; }
.exercise-copy h2 { max-width: none; font-size: 2rem; margin: 7px 0 10px; }
.exercise-cue { color: var(--muted); line-height: 1.5; margin: 0; }
.sets-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; }
.sets-heading, .set-row { display: grid; grid-template-columns: .65fr 1fr 1fr; align-items: center; gap: 8px; text-align: center; }
.sets-heading { color: var(--muted); font-size: .7rem; padding-bottom: 8px; }
.set-row { min-height: 60px; border-top: 1px solid #ffffff0a; }
.set-check { appearance: none; width: 34px; height: 34px; min-height: 34px; justify-self: center; padding: 0; border-radius: 50%; border: 2px solid #68758a; background: transparent; cursor: pointer; }
.set-check:checked { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 7px var(--surface); }
.set-row input[type="number"], .set-row input[type="text"] { min-height: 42px; padding: 8px; text-align: center; border-color: transparent; background: #0b1320; }
.rest-row { display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 12px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; color: var(--muted); }
.rest-row strong { color: var(--text); font-size: 1.5rem; font-variant-numeric: tabular-nums; text-align: center; }
.rest-button { min-height: 44px; border: 1px solid #477f31; color: var(--accent); background: #1a3421; border-radius: 99px; padding: 0 15px; font-weight: 800; }
.rest-button.running { background: var(--accent); color: #082219; }
.visual-note { color: var(--muted); font-size: .74rem; line-height: 1.45; padding: 0 7px; margin: 12px 0 16px; }
@media (max-width: 560px) {
  .app-shell { padding-inline: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card:first-child { grid-column: 1 / -1; }
  .summary-grid { grid-template-columns: 1fr 1fr 1fr; }
  .summary-card { padding: 12px; }
  .summary-card strong { font-size: 1.05rem; }
  .privacy-pill { display: none; }
  .three-columns { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .two-columns { grid-template-columns: 1fr; }
  .next-meta { align-items: flex-start; flex-direction: column; }
  .quick-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
