/* Sizes measured from a Hevy screenshot (iPhone points); accent swapped to red. */
:root {
  --bg: #000; --card: #1c1c1e; --field: #2c2c2e; --line: #2c2c2c;
  --text: #fff; --muted: #8e8e93; --accent: #e5383b; --accent-soft: rgba(229, 56, 59, .16);
  --nav: #181818; --nav-on: #3a3a3a; --gutter: 14.5px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.35 system-ui, -apple-system, sans-serif; -webkit-tap-highlight-color: transparent; }
#app { max-width: 560px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) var(--gutter) calc(170px + env(safe-area-inset-bottom)); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; min-height: 44px; }
header.page-title { margin: -12px 0 22px; } /* titles line up with the cards below */
h1 { font-size: 22px; font-weight: 700; margin: 0; }
h2 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin: 24px 0 8px; }
h2.sec { font-size: 17px; color: var(--text); text-transform: none; letter-spacing: 0; margin: 14px 0 14px; }
h3 { font-size: 17px; font-weight: 600; margin: 0; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.red { color: var(--accent); }

button, .btn { font: inherit; color: inherit; background: var(--card); border: 0; border-radius: 8px; padding: 10px 14px; min-height: 42px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.link { background: none; color: var(--muted); padding: 6px 8px; }
.danger { color: var(--accent) !important; }
.wide { width: 100%; margin-top: 10px; }
.big { font-size: 17px; font-weight: 600; min-height: 46px; }

/* Workout home */
.quick { width: 100%; height: 42px; justify-content: flex-start; padding: 0 0 0 16.5px; gap: 10.5px; font-size: 17px; font-weight: 500; }
.quick svg { width: 16px; height: 16px; stroke-width: 2; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); }
.tile { height: 82px; flex-direction: column; gap: 9px; font-size: 17px; padding: 0 8px; }
.tile svg { width: 20px; height: 20px; }

.card { background: var(--card); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.rt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: grid; gap: 8px; }
.stack .btn, .stack button { background: var(--field); }
.routine .rt-head { display: flex; align-items: center; gap: 8px; }
.routine .rt-head h3 { flex: 1; }
.dots { letter-spacing: 1px; font-size: 13px; }
.tag { background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.live { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--accent); }
.who { flex: 1; justify-content: flex-start; background: none; padding: 0; font-size: 17px; gap: 12px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--field); font-weight: 700; flex: none; }
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }

input, textarea, select { font: inherit; font-size: 16px; color: var(--text); background: var(--field); border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 42px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select { background: var(--card); }
label { display: block; margin: 14px 0 4px; color: var(--muted); font-size: 14px; }
.title-in { font-size: 22px; font-weight: 600; background: none; padding-left: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
#rtext { resize: vertical; }
.h-mid { font-size: 17px; }

/* Logging screen */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: calc(-12px - env(safe-area-inset-top)) calc(-1 * var(--gutter)) 0; padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 10px; border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 6px; }
.bar h1 { flex: 1; font-size: 17px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .link { font-size: 28px; line-height: 1; color: var(--text); padding: 0 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stats span { display: block; color: var(--muted); font-size: 13px; }
.stats b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.ex { padding: 16px 0 6px; border-bottom: 1px solid var(--line); }
.ex-head { display: flex; align-items: center; gap: 10px; }
.ex-head h3 { flex: 1; color: var(--accent); }
.ex-ico { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #000; font-weight: 700; flex: none; }
.ex-ico.sm { width: 26px; height: 26px; font-size: 12px; margin-right: 8px; }
.ex textarea { background: none; border: 0; padding: 8px 0 0; min-height: 0; resize: none; color: var(--text); }
.ex textarea::placeholder { color: var(--muted); }
.last { color: var(--muted); font-size: 14px; }
.hint { font-size: 14px; }
.hint::before { content: "▲ "; color: var(--accent); }
.rest-row { background: none; padding: 4px 0; min-height: 32px; color: var(--accent); font-size: 15px; gap: 6px; }
.rest-row b { font-weight: 600; }
.rest-row svg { width: 18px; height: 18px; }

.row { display: grid; grid-template-columns: 32px 1fr 64px 64px 40px; gap: 4px; align-items: center; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter); }
.row.one { grid-template-columns: 1fr 40px; padding-top: 8px; padding-bottom: 8px; }
.row.hdr { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding-top: 8px; padding-bottom: 6px; }
.row.hdr span:nth-child(n+3) { text-align: center; }
.sets .row:nth-child(odd) { background: #0e0e0f; }
.row .prev { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row input { text-align: center; padding: 6px 2px; min-height: 34px; font-weight: 600; background: none; }
.row input:focus { background: var(--field); }
.setno { background: none; min-height: 34px; padding: 0; font-weight: 600; justify-content: flex-start; padding-left: 4px; }
.chk { width: 34px; min-height: 34px; padding: 0; background: var(--field); border-radius: 7px; font-size: 16px; color: var(--muted); justify-self: end; }
.sets .row.done { background: var(--accent-soft); }
.row.done .chk { background: var(--accent); color: #fff; }
.addset { background: var(--card); min-height: 36px; font-size: 15px; margin-top: 10px; }
.empty { text-align: center; padding: 40px 0 20px; }

/* History + progress */
details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post h3 { margin-bottom: 8px; }
.post .stats { margin: 0 0 10px; }
.sum div { display: flex; align-items: center; padding: 3px 0; font-size: 15px; }
.detail { border-top: 1px solid var(--line); padding: 10px 0; }
.dline { display: flex; gap: 14px; padding: 2px 0; font-size: 15px; }
.big-num { font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { min-height: 32px; padding: 4px 12px; border-radius: 99px; font-size: 14px; background: var(--field); }
.chip.on { background: var(--accent); color: #fff; font-weight: 600; }
.chart { width: 100%; height: auto; display: block; stroke: none; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart line { stroke: var(--line); }

/* Floating tab bar: 243 × 53pt pill, 19pt off the bottom */
nav { position: fixed; left: 0; right: 0; margin: 0 auto; bottom: 19px; width: min(362px, calc(100% - 12px)); /* 5 tabs x 70pt; iPhone Safari squeezed the old left:50% version */ height: 53px; display: flex; align-items: center; padding: 0 5px; background: var(--nav); border: 1px solid var(--line); border-radius: 27px; z-index: 10; }
nav a { flex: 1 1 0; min-width: 0; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; border-radius: 23px; color: var(--text); text-decoration: none; font-size: 12px; }
nav a svg { width: 24px; height: 24px; }
nav a.on { background: var(--nav-on); color: var(--accent); margin: 0 -3px; }
nav[hidden] { display: none; }

#timer { position: fixed; left: var(--gutter); right: var(--gutter); max-width: 530px; margin: 0 auto; bottom: 82px; display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--card); border-radius: 12px; overflow: hidden; z-index: 10; }
#timer i { position: absolute; left: 0; top: 0; height: 3px; background: var(--accent); }
#timer span { flex: 1; text-align: center; color: var(--muted); }
#timer b { color: var(--text); font-size: 22px; font-variant-numeric: tabular-nums; margin-left: 4px; }
#timer button:not(.primary) { background: var(--field); }
#timer[hidden] { display: none; }
body[data-view="workout"] #timer { bottom: calc(12px + env(safe-area-inset-bottom)); }

/* Food */
.daynav { display: flex; align-items: center; justify-content: space-between; margin: -8px 0 10px; }
.daynav .link { font-size: 26px; line-height: 1; color: var(--text); padding: 4px 14px; }
.daynav .link:disabled { opacity: .25; }
.macro + .macro { margin-top: 12px; }
.macro-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.macro-top b { font-size: 17px; }
.track { position: relative; height: 8px; background: var(--field); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.track i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 4px; }
.track s { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: .6; }
.macro p { margin: 4px 0 0; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.entry { width: 100%; justify-content: space-between; text-align: left; background: none; padding: 10px 0; border-top: 1px solid var(--line); border-radius: 0; gap: 12px; }
#results .entry, .entry:first-child { border-top: 0; }
#results .entry { background: var(--card); border-radius: 8px; padding: 10px 14px; margin-bottom: 6px; }
.entry b { font-weight: 600; }
.entry .right { text-align: right; white-space: nowrap; }
.meal-actions { display: flex; justify-content: space-between; margin-top: 2px; }
.meal-actions .link { padding-left: 0; }
.link.red { color: var(--accent); font-weight: 600; }
.tiles.three { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.tile.sm { height: 48px; font-size: 15px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spacer { width: 60px; }
#cam { width: 100%; border-radius: 12px; background: var(--card); aspect-ratio: 3 / 4; object-fit: cover; }
input[type=search] { -webkit-appearance: none; }
.exform { display: flex; gap: 8px; margin-top: 14px; } .exform input { flex: 1; }

/* Body */
.white { color: var(--text); }
.inrow { display: flex; gap: 8px; margin: 8px 0 10px; }
.inrow input { flex: 1; font-size: 18px; font-weight: 600; }
.between { justify-content: space-between; align-items: center; }
.x { min-height: 28px; padding: 0 0 0 10px; font-size: 18px; }
.legend { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.red-bg { background: var(--accent); }
.sw.dash { background: repeating-linear-gradient(90deg, #fff 0 4px, transparent 4px 7px); margin-left: 10px; }
.steppers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 4px; }
.steppers button { background: var(--field); min-height: 38px; font-size: 15px; }
.habit-in label { margin-top: 10px; }
.supp { width: 100%; justify-content: space-between; text-align: left; background: none; border-top: 1px solid var(--line); border-radius: 0; padding: 10px 0; }
.supp .chk { display: inline-flex; align-items: center; justify-content: center; height: 34px; }
.supp.done .chk { background: var(--accent); color: #fff; }

/* Centering: titles sit in the true middle even when the side buttons differ in width */
header:has(.h-mid), .bar { display: grid; grid-template-columns: 1fr auto 1fr; }
header:has(.h-mid) > :first-child, .bar > :first-child { justify-self: start; }
header:has(.h-mid) > :last-child, .bar > :last-child { justify-self: end; }
.h-mid, .bar h1 { text-align: center; max-width: 52vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.center { justify-content: center; margin: 8px 0 20px; }
.empty-msg { text-align: center; padding: 28px 0; }
.daynav b, .tile, .empty, #timer span { text-align: center; }

/* Step 4 */
.install { position: fixed; left: var(--gutter); right: var(--gutter); max-width: 530px; margin: 0 auto; bottom: 88px; height: 50px; justify-content: space-between; padding: 0 16px; background: #3b2224; font-size: 17px; z-index: 9; }
.install span { font-size: 20px; }
#update { position: fixed; left: var(--gutter); right: var(--gutter); max-width: 530px; margin: 0 auto; top: calc(10px + env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 14px; background: var(--card); border: 1px solid var(--accent); border-radius: 12px; z-index: 20; }
header .link.red { padding-right: 0; }
.tag.pr { margin-left: 8px; }

/* Muscle map */
.bodymap { width: 100%; max-width: 340px; height: auto; display: block; margin: 8px auto 12px; stroke: none; }
.bodymap text { fill: var(--muted); font-size: 10px; }
.chips.tight { margin: 0; flex-wrap: nowrap; }
.chips.tight .chip { min-height: 28px; padding: 2px 10px; font-size: 13px; }
.mrow { display: grid; grid-template-columns: 92px 1fr 34px; gap: 10px; align-items: center; padding: 4px 0; font-size: 15px; }
.mrow b { text-align: right; font-variant-numeric: tabular-nums; }
.mbar { height: 6px; background: var(--field); border-radius: 3px; overflow: hidden; }
.mbar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* Polish pass: one section-header style, quieter badges, compact set lines, single-row chips */
h2 { font-size: 17px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 600; margin: 24px 0 10px; }
.card h2 { font-size: 15px; margin: 16px 0 4px; }
.ex-ico { background: var(--field); color: var(--text); }
.ex-ico.sm { background: var(--field); color: var(--text); }
.setline { margin: 4px 0 0; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.5; }
.detail b.red { font-size: 15px; }
.chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; white-space: nowrap; font-size: 13px; padding: 4px 11px; min-height: 30px; }
.card .muted.small + .setline { margin-top: 2px; }
.post .sum div { font-size: 15px; }
.dline.between span:last-child { font-variant-numeric: tabular-nums; }
.macro-top b, .meal-head .small, .entry .right { font-variant-numeric: tabular-nums; }


/* Meal ideas */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 3px; background: var(--card); border-radius: 9px; margin-bottom: 14px; }
.seg button { min-height: 34px; font-size: 14px; background: none; border-radius: 7px; }
.seg button.on { background: var(--field); color: var(--text); font-weight: 600; }
.idea-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.idea-head .right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.idea .tag { display: inline-block; margin-top: 6px; }
.idea details { margin-top: 8px; }
.idea ul { margin: 6px 0; padding-left: 18px; font-size: 14px; }
.idea li { margin: 2px 0; }
.tag.pub { background: var(--field); color: var(--text); }
.tag.est { background: none; border: 1px solid var(--line); color: var(--muted); }

/* Sharing */
.pick { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.pick input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); flex: none; }
#joinform .big { margin-top: 16px; }
