/* Fitness Hub, "bumper plates".
   Concrete floor, navy ink, and competition-plate colours that only ever code an activity or a state. */

:root {
  --floor: #E4E7EB;  --deck: #F6F7F9;  --well: #DCE0E5;
  --ink: #16203A;    --ink-2: #4B5567; --rule: #CBD1D9;
  --plate-blue: #1F5FBF; --plate-yellow: #B88A0A; --plate-green: #2A8A6C; --plate-red: #C3302A;
  --blue-tint: #DCE6F6; --on-blue: #FFFFFF;
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --text: "Atkinson Hyperlegible", system-ui, sans-serif;
  --nav-h: calc(4rem + env(safe-area-inset-bottom));
  color-scheme: light;
}
:root[data-theme="dark"] {
  --floor: #181D24;  --deck: #212832;  --well: #2A323E;
  --ink: #E6EAF0;    --ink-2: #A3ADBD; --rule: #343D4A;
  --plate-blue: #5B93E8; --plate-yellow: #B88A1A; --plate-green: #3A9A7A; --plate-red: #EF6A5E;
  --blue-tint: #243656; --on-blue: #0E1420;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--floor); color: var(--ink);
  font: 400 15px/1.5 var(--text); overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + 1rem);
}
[x-cloak] { display: none !important; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
.min-w-0 { min-width: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--plate-blue); outline-offset: 2px; border-radius: 6px; }

main { width: 100%; max-width: 36rem; margin: 0 auto; padding: 1.25rem 1rem 0; }
main > section { display: flex; flex-direction: column; gap: 1.75rem; }

/* ---------- type */
.display { font-family: var(--display); font-weight: 800; line-height: .95; letter-spacing: .005em; font-variant-numeric: tabular-nums; }
.page-title { font: 800 34px/1 var(--display); }
.h2 { font-weight: 700; font-size: 17px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }

/* ---------- controls */
.btn {
  min-height: 2.75rem; padding: 0 1.1rem; border-radius: 999px; border: 1.5px solid var(--rule);
  background: var(--deck); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  transition: transform .08s ease;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--plate-blue); border-color: var(--plate-blue); color: var(--on-blue); }
.btn.wide { width: 100%; }
.btn.quiet { border-color: transparent; background: none; padding: 0; color: var(--plate-blue); justify-content: flex-start; }

.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill {
  min-height: 2.75rem; min-width: 2.75rem; padding: 0 1rem; border-radius: 999px;
  border: 1.5px solid var(--rule); background: transparent; font-weight: 700;
  display: inline-flex; align-items: center; gap: .45rem;
}
.pill[aria-checked="true"] { background: var(--ink); border-color: var(--ink); color: var(--floor); }
.pill .swatch { width: .7rem; height: .7rem; border-radius: 50%; flex: none; }

.input, .textarea, .select {
  width: 100%; min-height: 3rem; padding: .7rem .9rem; border-radius: 10px;
  border: 1.5px solid var(--rule); background: var(--deck);
}
.textarea { resize: vertical; }

.segmented { display: flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--well); }
.segmented > button {
  flex: 1; min-height: 2.75rem; border: 0; border-radius: 999px; background: none; font-weight: 700; color: var(--ink-2);
}
.segmented > button[aria-selected="true"] { background: var(--deck); color: var(--ink); }

/* activity colour swatches (plate colours) */
.a-Gym { background: var(--plate-blue); }
.a-Tennis { background: var(--plate-yellow); }
.a-Badminton { background: var(--plate-green); }
.a-Other { background: transparent; box-shadow: inset 0 0 0 2px var(--ink-2); }
.a-Rest { background: var(--ink-2); height: 3px !important; border-radius: 2px !important; }

/* ---------- lift sheet: the one loud thing */
.sheet {
  background: var(--deck); border-radius: 10px; padding: 1.25rem 1.1rem 1rem 1.35rem; position: relative; overflow: hidden;
}
.sheet::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--plate-blue); }
.sheet.sport-Tennis::before { background: var(--plate-yellow); }
.sheet.sport-Badminton::before { background: var(--plate-green); }
.sheet.sport-Rest::before, .sheet.sport-Other::before { background: var(--ink-2); }
.sheet-title { font: 800 52px/.92 var(--display); letter-spacing: .005em; overflow-wrap: anywhere; }
.sheet-sub { margin-top: .6rem; color: var(--ink-2); }
.lifts { margin-top: 1rem; }
.lift { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.lift-name { font-size: 17px; font-weight: 700; line-height: 1.25; }
.lift-sets { color: var(--ink-2); }
.load { flex: none; text-align: right; white-space: nowrap; }
.load b { font: 800 34px/1 var(--display); font-variant-numeric: tabular-nums; }
.load span { font-weight: 700; color: var(--ink-2); margin-left: .2rem; }
.sheet.compact .sheet-title { font-size: 34px; }
.sheet.compact .load b { font-size: 26px; }
.sheet.compact .lift-name { font-size: 15px; }
@media (prefers-reduced-motion: no-preference) {
  .sheet.enter .lift { animation: rise .4s cubic-bezier(.2,.7,.2,1) backwards; animation-delay: calc(var(--i) * 45ms + 80ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } }
}

/* ---------- week plates */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; text-align: center; }
.day { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: .5rem 0; border-radius: 10px; }
.day.today { background: var(--deck); }
.day > span:first-child { font-size: 13px; color: var(--ink-2); }
.day.today > span:first-child { color: var(--ink); font-weight: 700; }
.plate { width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center; }
.plate.rest::after { content: ""; width: .8rem; height: 3px; border-radius: 2px; background: var(--ink-2); }
.plate.future { box-shadow: inset 0 0 0 1.5px var(--rule); }
.plate.lift { background: var(--plate-blue); }
.plate.Tennis { background: var(--plate-yellow); }
.plate.Badminton { background: var(--plate-green); }
.plate.other { box-shadow: inset 0 0 0 3px var(--ink-2); }
.key { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .5rem; font-size: 13px; color: var(--ink-2); }
.key span { display: inline-flex; align-items: center; gap: .35rem; }
.key i { width: .7rem; height: .7rem; border-radius: 50%; display: inline-block; }

/* ---------- figures (no cards) */
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.fig b { display: block; font: 800 34px/1 var(--display); font-variant-numeric: tabular-nums; margin: .15rem 0 .2rem; }
.fig b small { font: 700 15px var(--text); color: var(--ink-2); margin-left: .15rem; }
.fig > span { font-size: 13px; color: var(--ink-2); display: block; }
.fig > .label { font-size: 15px; color: var(--ink); font-weight: 700; }

/* ---------- check-in */
.scale-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.scale-row .label { font-weight: 700; line-height: 1.2; }
.scale-row .label span { display: block; font-weight: 400; font-size: 13px; color: var(--ink-2); }
.scale { display: flex; gap: 4px; flex: none; }
.scale button {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1.5px solid var(--rule); background: var(--deck);
  font: 800 20px/1 var(--display);
}
.scale button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--floor); }
.done { display: inline-flex; align-items: center; gap: .4rem; font-size: 13px; color: var(--ink-2); }
.done::before { content: "✓"; color: var(--plate-green); font-weight: 700; }

/* ---------- lists: strength, history, routines */
.list > * { border-top: 1px solid var(--rule); }
.list > *:last-child { border-bottom: 1px solid var(--rule); }
.strength { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; }
.strength .name { font-weight: 700; }
.strength .max { text-align: right; flex: none; }
.strength .max b { font: 800 34px/1 var(--display); font-variant-numeric: tabular-nums; }
.change { font-size: 13px; color: var(--ink-2); display: block; }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.log summary { display: grid; grid-template-columns: 3.5rem 1fr auto; align-items: center; gap: .75rem; min-height: 3.5rem; padding: .6rem 0; }
.log .date { font: 800 22px/1 var(--display); }
.log .chev, .fold .chev { width: .6rem; height: .6rem; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); margin: 0 .4rem; transition: transform .15s; }
details[open] > summary .chev { transform: rotate(-135deg); }
.log ul { padding: 0 0 .9rem 4.25rem; display: flex; flex-direction: column; gap: .3rem; }

.fold { background: var(--deck); border-radius: 10px; }
.fold > summary { display: flex; align-items: center; justify-content: space-between; min-height: 3.25rem; padding: 0 1.1rem; font-weight: 700; }
.fold > div { padding: 0 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .75rem; }

.tag { display: inline-flex; align-items: center; min-height: 1.6rem; padding: 0 .6rem; border-radius: 999px; background: var(--blue-tint); color: var(--ink); font-size: 13px; font-weight: 700; }

/* ---------- push steps (a real sequence, so numbered) */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 1rem; }
.step { display: grid; grid-template-columns: 2rem 1fr; gap: .75rem; counter-increment: step; }
.step::before { content: counter(step); width: 2rem; height: 2rem; border-radius: 50%; background: var(--well); display: grid; place-items: center; font: 800 18px/1 var(--display); }
.step > div { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.out { background: var(--well); border-radius: 10px; padding: .8rem; max-height: 18rem; overflow: auto; font-size: 13px; margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--text); }
.check { display: flex; align-items: flex-start; gap: .75rem; min-height: 2.75rem; }
.check input { width: 1.4rem; height: 1.4rem; margin: .1rem 0 0; accent-color: var(--plate-blue); flex: none; }

.note { border-radius: 10px; padding: .8rem 1rem; border-left: 4px solid var(--ink-2); background: var(--deck); }
.note.bad { border-left-color: var(--plate-red); }
.note.bad strong::before { content: "! "; color: var(--plate-red); }
.note.good { border-left-color: var(--plate-green); }
.note ul { list-style: disc; padding-left: 1.2rem; margin-top: .3rem; }

/* ---------- charts */
.chart h3 { font-size: 15px; font-weight: 700; margin-bottom: .4rem; }
.canvas-wrap { position: relative; height: 15rem; }
.canvas-wrap.short { height: 11rem; }

/* ---------- coach (chat) */
.coach { display: flex; flex-direction: column; min-height: calc(100dvh - var(--nav-h) - 3rem); }
.coach .empty { margin-top: .5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.chip { min-height: 2.75rem; padding: .5rem 1rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--deck); color: var(--ink); text-align: left; }
.chip:active { transform: scale(.98); }
.thread { display: flex; flex-direction: column; gap: .9rem; flex: 1; padding: 1rem 0; }
.msg { word-break: break-word; }
.msg.user { align-self: flex-end; max-width: 88%; padding: .65rem 1rem; border-radius: 16px 16px 4px 16px; background: var(--blue-tint); }
.msg.user span { white-space: pre-wrap; }
.msg.assistant { align-self: stretch; padding: .85rem 1rem; border: 1px solid var(--rule); border-radius: 4px 16px 16px 16px; background: var(--deck); }
.md > div > :first-child { margin-top: 0; } .md > div > :last-child { margin-bottom: 0; }
.md p { margin: .6em 0; line-height: 1.5; }
.md ul, .md ol { margin: .6em 0; padding-left: 1.3rem; list-style: revert; }
.md li { margin: .25em 0; line-height: 1.45; }
.md h1, .md h2, .md h3 { font-family: var(--display); font-weight: 800; letter-spacing: .01em; margin: 1em 0 .3em; line-height: 1.1; }
.md h1 { font-size: 26px; } .md h2 { font-size: 22px; } .md h3 { font-size: 18px; }
.md strong { color: var(--ink); font-weight: 700; }
.md code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; padding: .1em .35em; border-radius: 5px; background: var(--well); }
.md pre { overflow-x: auto; padding: .7rem; border-radius: 10px; background: var(--well); } .md pre code { padding: 0; background: none; }
.md table { display: block; overflow-x: auto; border-collapse: collapse; margin: .6em 0; font-size: .95em; }
.md th, .md td { padding: .35rem .6rem; border: 1px solid var(--rule); text-align: left; white-space: nowrap; }
.md hr { border: 0; border-top: 1px solid var(--rule); margin: 1em 0; }
.status { display: flex; align-items: center; gap: .5rem; margin-top: .6rem; color: var(--ink-2); font-size: 14px; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--plate-blue); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }
.composer { position: sticky; bottom: calc(var(--nav-h) + .5rem); display: flex; align-items: flex-end; gap: .5rem; padding: .5rem .5rem .5rem 1rem;
  border: 1px solid var(--rule); border-radius: 24px; background: var(--deck); box-shadow: 0 -6px 12px var(--floor); }
.composer .input { flex: 1; min-width: 0; min-height: 2.75rem; max-height: 10rem; padding: .6rem 0; border: 0; background: none; resize: none; outline: none; line-height: 1.4; font: inherit; color: var(--ink); }
.composer:focus-within { border-color: var(--plate-blue); }
.send { flex: none; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: var(--plate-blue); color: var(--on-blue); font-size: 20px; font-weight: 700; }
.send.stop { background: var(--ink); color: var(--floor); }
.send:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- chrome */
.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20; height: var(--nav-h); padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center; background: var(--floor); border-top: 1px solid var(--rule);
}
.nav button {
  flex: 1; max-width: 9rem; border: 0; background: none; font-weight: 700; font-size: 15px; color: var(--ink-2); position: relative;
}
.nav button[aria-current="page"] { color: var(--ink); }
.nav button[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--plate-blue); }
.footer { margin-top: 2.5rem; text-align: center; font-size: 13px; color: var(--ink-2); }
.toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(var(--nav-h) + .75rem); transform: translateX(-50%);
  max-width: calc(100% - 2rem); padding: .7rem 1.1rem; border-radius: 12px; background: var(--ink); color: var(--floor); font-weight: 700;
}

@media (min-width: 768px) {
  main { max-width: 44rem; padding-top: 2rem; }
  body { padding-top: 4rem; padding-bottom: 2rem; }
  .nav { inset: 0 0 auto 0; height: 4rem; padding: 0; border-top: 0; border-bottom: 1px solid var(--rule); }
  .nav button[aria-current="page"]::before { top: auto; bottom: -1px; border-radius: 3px 3px 0 0; }
  .toast { bottom: 1.5rem; }
  .composer { bottom: 1rem; }
  .coach { min-height: calc(100dvh - 8rem); }
  .sheet-title { font-size: 64px; }
}
@media (max-width: 380px) {
  .sheet-title { font-size: 44px; }
  .scale button { width: 2.6rem; height: 2.6rem; }
  .fig b { font-size: 30px; }
}
