/* The dock layout, from the client-software-design skill (layout.md). Every value is the approved reference's unless
   a comment says why not. Every colour is a token. The brand is Evan's aqua, used only where you are and on the main button. */
@font-face {
  font-family: 'Geist Variable';
  src: url('/fonts/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --page: #ebebea; --card: #f6f6f5; --card-2: #efefee; --card-3: #e5e5e3; --card-hover: #fdfdfc;
  --edge: rgb(0 0 0 / .05); --line: #e2e2df; --line-strong: #cdcdca; --input: #80807d;
  --ink: #161616; --ink-2: #45454a; --muted: #626260;
  --good: #167a3e; --good-soft: #e2f0e6; --bad: #b8312a; --bad-soft: #f9e5e2; --warn: #8a5700; --warn-soft: #f4ead6;
  --s1: #00979e; --bar-past: #8c8c87;
  --tip-bg: #1c1c1e; --tip-ink: #f4f4f2;
  --pop: 0 18px 40px -12px rgb(0 0 0 / .22), 0 2px 8px rgb(0 0 0 / .06);
  --scrim: rgb(20 20 20 / .28);
  --accent: #2ee4d5; --on-accent: #121317; --accent-edge: #00968c; --accent-line: #00968c; --accent-text: #00766e;
  --r: 22px; --r-in: 14px; --r-sm: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e0e0f; --card: #18181a; --card-2: #202023; --card-3: #29292d; --card-hover: #232326;
    --edge: rgb(255 255 255 / .055); --line: #2a2a2e; --line-strong: #3c3c41; --input: #76767b;
    --ink: #f3f3f1; --ink-2: #c9c9c5; --muted: #9b9b97;
    --good: #4cc27a; --good-soft: #15291d; --bad: #ff7c6e; --bad-soft: #321b18; --warn: #e3a53c; --warn-soft: #2e2414;
    --s1: #14a0a6; --bar-past: #6d6d72;
    --tip-bg: #2b2b2f;
    --pop: 0 18px 40px -12px rgb(0 0 0 / .6), 0 0 0 1px rgb(255 255 255 / .06);
    --scrim: rgb(0 0 0 / .55);
    --accent-edge: transparent; --accent-line: #2ee4d5; --accent-text: #2ee4d5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e0e0f; --card: #18181a; --card-2: #202023; --card-3: #29292d; --card-hover: #232326;
  --edge: rgb(255 255 255 / .055); --line: #2a2a2e; --line-strong: #3c3c41; --input: #76767b;
  --ink: #f3f3f1; --ink-2: #c9c9c5; --muted: #9b9b97;
  --good: #4cc27a; --good-soft: #15291d; --bad: #ff7c6e; --bad-soft: #321b18; --warn: #e3a53c; --warn-soft: #2e2414;
  --s1: #14a0a6; --bar-past: #6d6d72;
  --tip-bg: #2b2b2f;
  --pop: 0 18px 40px -12px rgb(0 0 0 / .6), 0 0 0 1px rgb(255 255 255 / .06);
  --scrim: rgb(0 0 0 / .55);
  --accent-edge: transparent; --accent-line: #2ee4d5; --accent-text: #2ee4d5;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.45 'Geist Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
body::before { content: ''; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top); background: var(--page); z-index: 50; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app {
  max-width: 960px; margin: 0 auto; min-height: 100dvh;
  padding: 0 max(16px, env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* The top bar and the dock. The max width above is narrower than the reference's on purpose: this is a phone form. */
.top { position: sticky; top: env(safe-area-inset-top); z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 0 10px; background: var(--page); }
.logo { display: inline-flex; align-items: baseline; gap: 7px; min-height: 44px; align-self: center; text-decoration: none; color: var(--ink); line-height: 44px; }
.logo b { font-size: 21px; font-weight: 700; letter-spacing: .06em; }
.logo span { font-size: 15px; color: var(--muted); }
.top-actions { margin-left: auto; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--card); font-size: 15px; font-weight: 600; }
.dock { order: 3; flex: 1 0 100%; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * max(16px, env(safe-area-inset-right))); padding-right: 28px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.dock::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 17px 0 14px; border-radius: 999px; border: 1px solid var(--edge); background: var(--card); color: var(--ink-2); font-size: 14px; font-weight: 450; text-decoration: none; white-space: nowrap; flex: none; }
.tab[aria-current="page"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent-edge); }
@media (hover: hover) { .tab:not([aria-current]):hover { background: var(--card-hover); color: var(--ink); } }
/* One row needs about 800px for the logo, five named tabs and the account button; narrower screens keep two rows. */
@media (min-width: 880px) {
  .dock { order: 1; flex: 0 1 auto; margin: 0 auto; padding: 0; -webkit-mask-image: none; mask-image: none; }
  .top { flex-wrap: nowrap; padding: 20px 0 18px; }
  .top-actions { order: 2; margin-left: 0; }
}
main { max-width: 760px; margin: 0 auto; }

.ph { margin: 10px 0 16px; }
.ph h1 { font-size: clamp(32px, 3.2vw, 44px); line-height: 1.05; font-weight: 430; letter-spacing: -.04em; text-wrap: balance; }
.ph p { margin-top: 6px; color: var(--muted); }

.stack { display: grid; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--edge); border-radius: var(--r); padding: 18px; min-width: 0; }
.card-head { margin-bottom: 14px; }
.card-head h2 { font-size: 18px; font-weight: 500; letter-spacing: -.02em; }
.card-head p { margin-top: 2px; font-size: 13px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--edge); background: var(--card); font-size: 14px; font-weight: 500; transition: transform .12s, background .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent-edge); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent-text); }
.btn[disabled] { opacity: .7; cursor: default; }
@media (hover: hover) {
  .btn-primary:not([disabled]):hover { background: color-mix(in oklab, var(--accent) 88%, var(--on-accent)); }
}
.save-bar { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20; margin-top: 10px; }
.save-bar .btn { width: 100%; min-height: 50px; font-size: 16px; box-shadow: var(--pop); }

.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.nav-row strong { font-size: 15px; font-weight: 500; text-align: center; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--card); flex: none; }
.icon-btn[disabled] { opacity: .35; cursor: default; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field small { font-size: 12.5px; color: var(--muted); }
input[type="text"], textarea { width: 100%; min-height: 48px; padding: 11px 13px; font-size: 16px; border: 1px solid var(--input); border-radius: var(--r-in); background: var(--card-hover); }
textarea { min-height: 88px; resize: vertical; }
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent-line); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card-hover); color: var(--ink-2); font-weight: 500; }
.chip input:checked + span { background: var(--ink); color: var(--page); border-color: var(--ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent-text); flex: none; }

.status { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 550; }
.status.good { background: var(--good-soft); color: var(--good); }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.idle { background: var(--card-3); color: var(--ink-2); }

.big { font-size: 34px; font-weight: 450; letter-spacing: -.04em; line-height: 1.1; }
.answer { font-size: 15px; margin-top: 6px; max-width: 60ch; text-wrap: pretty; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--edge); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.tile p { font-size: 13px; color: var(--muted); }
.tile strong { display: block; margin-top: 4px; font-size: 28px; font-weight: 450; letter-spacing: -.035em; line-height: 1.15; }
.tile small { font-size: 12.5px; color: var(--muted); }

.chart { display: block; width: 100%; height: auto; margin-top: 14px; }
.chart text { fill: var(--muted); font-size: 11.5px; font-family: inherit; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .day { stroke: var(--bar-past); stroke-width: 1.2; fill: none; }
.chart .avg { stroke: var(--s1); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart .goal { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 5 5; }
.key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.key i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.k-day { background: var(--bar-past); }
.k-avg { background: var(--s1); }
.k-goal { background: var(--warn); }

.rows { display: grid; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 0; }
.row b { font-weight: 500; }
.row span { color: var(--muted); font-size: 13px; }
.row .end { text-align: right; color: var(--ink); font-size: 14px; }
.row .end.muted { color: var(--muted); font-size: 13px; }

.coach dt { font-size: 13px; color: var(--muted); margin-top: 12px; }
.coach dt:first-child { margin-top: 0; }
.coach dd { margin: 2px 0 0; font-size: 15px; white-space: pre-wrap; }
.coach { margin: 0; }

.exercise h2 { font-size: 17px; font-weight: 500; letter-spacing: -.02em; }
.exercise .note { margin-top: 2px; font-size: 13px; color: var(--muted); }
.set { display: grid; grid-template-columns: 1fr 86px 76px; align-items: center; gap: 8px; padding-top: 12px; }
.set-head { padding-top: 12px; font-size: 12.5px; color: var(--muted); }
.set-head span:nth-child(n+2) { text-align: left; }
.set-label b { display: block; font-weight: 500; }
.set-label small { display: block; font-size: 12.5px; color: var(--muted); }
.set input { padding: 10px 8px; text-align: center; }

.hevy { display: grid; gap: 10px; }
.hevy-actions { display: flex; gap: 8px; }
.hevy-actions .btn { flex: 1; padding: 0 10px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.hv-preview { max-height: 34dvh; overflow-y: auto; margin-top: 12px; }
.hv-preview:empty { display: none; }
.hv-preview .coach { margin-top: 10px; }
.hv-warn { margin-top: 8px; color: var(--warn); }
.routine-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.routine h2 { font-size: 18px; font-weight: 500; letter-spacing: -.02em; }
.routine .note { margin-top: 4px; font-size: 13px; color: var(--muted); }
.routine .btn { width: 100%; margin-top: 14px; }

/* The live workout. The set row is tuned so the numbers still fit on a 360px phone. */
.wk-set { display: grid; grid-template-columns: 24px minmax(0, 1fr) 62px 52px 44px; align-items: center; gap: 6px; margin: 0 -8px; padding: 6px 8px; border-radius: var(--r-in); }
.wk-set.done { background: var(--good-soft); }
.wk-head { font-size: 12.5px; color: var(--muted); padding-top: 12px; padding-bottom: 2px; }
.wk-head span:nth-child(3), .wk-head span:nth-child(4) { text-align: center; }
.wk-n { font-weight: 550; text-align: center; }
.wk-info small { display: block; font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.wk-set input { padding: 10px 4px; text-align: center; }
.wk-set input::placeholder { color: var(--muted); opacity: 1; }
.tick { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--card-hover); color: var(--muted); }
.tick[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: var(--page); }
.tick .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.wk-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wk-bar { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 20; display: grid; gap: 8px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--edge); border-radius: var(--r); background: var(--card); box-shadow: var(--pop); }
.wk-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wk-main .btn { min-height: 48px; }
.wk-clock b { display: block; font-size: 22px; font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
.wk-clock small { font-size: 12.5px; color: var(--muted); }
.wk-rest { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.wk-rest[hidden] { display: none; }
.wk-rest span { font-size: 13px; color: var(--muted); }
.wk-rest strong { margin-right: auto; font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.wk-rest .btn { padding: 0 6px; white-space: nowrap; }
@media (max-width: 340px) { .wk-rest > span { display: none; } }
.wk-names { display: grid; max-height: 38dvh; overflow-y: auto; margin-top: 10px; }
.wk-names button { min-height: 44px; padding: 10px 2px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; }
.sheet-actions { display: grid; gap: 8px; margin-top: 16px; }
.btn-bad { color: var(--bad); }

.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot { position: relative; display: grid; place-items: center; gap: 4px; min-height: 92px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--r-in); background: var(--card-hover); text-align: center; color: var(--ink-2); }
.slot.done { border-style: solid; border-color: var(--good); background: var(--good-soft); color: var(--good); }
.slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.slot:focus-within { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.slot b { font-weight: 500; }
.slot small { font-size: 12.5px; }

.notice { display: grid; gap: 8px; }
.notice p { color: var(--ink-2); }
.welcome { display: grid; align-content: center; justify-items: center; gap: 12px; min-height: 80dvh; text-align: center; }
.welcome h1 { font-size: 24px; font-weight: 500; letter-spacing: -.02em; }
.welcome p { max-width: 36ch; color: var(--muted); }

.skeleton { display: grid; gap: 10px; width: 100%; }
.skeleton div { height: 120px; border-radius: var(--r); background: var(--card-2); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); max-width: calc(100vw - 32px); width: max-content; padding: 12px 18px; border-radius: 22px; background: var(--tip-bg); color: var(--tip-ink); font-size: 14px; text-align: center; opacity: 0; pointer-events: none; z-index: 80; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

dialog.sheet { border: 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); width: 100%; max-width: 520px; margin: auto auto 0; border-radius: 24px 24px 0 0; background: var(--card); color: var(--ink); box-shadow: var(--pop); }
dialog.sheet::backdrop { background: var(--scrim); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { font-size: 20px; font-weight: 500; letter-spacing: -.025em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
