/* Зал. Colours come from competition bumper plates: red A, blue B, yellow C, green = done.
   Surfaces are the gym floor (rubber) in dark mode and concrete in light mode. */
:root {
  color-scheme: dark light;
  --plate-a: #d8382f; --plate-b: #2f6fd6; --plate-c: #e9b419; --go: #43b066;
  --floor: #1d1e21; --mat: #26282c; --mat-2: #303338; --line: #3b3e45;
  --chalk: #eef0eb; --steel: #969ca5; --ghost: #6c727b; --on-chalk: #1d1e21;
  --focus: #8fb8ff; --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset;
  --display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --text: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 64px; --rail: 104px;
}
@media (prefers-color-scheme: light) {
  :root {
    --plate-c: #d9a300; --go: #22843e;
    --floor: #e4e6e3; --mat: #f7f8f6; --mat-2: #eceeeb; --line: #cdd1cc;
    --chalk: #17181b; --steel: #5d636b; --ghost: #a0a6ad; --on-chalk: #f7f8f6;
    --focus: #2f6fd6; --shadow: 0 1px 2px rgba(30, 32, 36, .06);
  }
}
[data-day="A"] { --day: var(--plate-a); --on-day: #fff; }
[data-day="B"] { --day: var(--plate-b); --on-day: #fff; }
[data-day="C"] { --day: var(--plate-c); --on-day: #1d1e21; }
[data-day="home"] { --day: var(--mat-2); --on-day: var(--steel); }

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { overscroll-behavior: none; }  /* no rubber-band stretch at the top and bottom */
body { margin: 0; min-height: 100dvh; background: var(--floor); color: var(--chalk);
  font: 400 16px/1.45 var(--text); font-feature-settings: "tnum" 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--steel); }
.small { font-size: 14px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.pad { padding: 24px 0; }
.boot { font: 700 28px var(--display); text-align: center; margin-top: 40vh; color: var(--steel); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- form controls */
input, select, textarea { font: inherit; color: var(--chalk); background: var(--mat-2); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--ghost); opacity: 1; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--go); margin: 0; }
input[type=date] { min-width: 0; }
textarea { resize: vertical; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--steel); }
label.inline { display: flex; align-items: center; gap: 10px; color: var(--chalk); font-size: 15px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--mat);
  text-decoration: none; font-weight: 500; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--chalk); color: var(--on-chalk); border-color: var(--chalk); font-weight: 600; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--steel); }
.btn.danger { color: var(--plate-a); }
.btn.icon { width: 44px; padding: 0; font-size: 20px; }

/* ---------------------------------------------------------------- the plate: the logo on the sign-in screen */
.plate { --s: 44px; width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--day, var(--plate-a)); color: var(--on-day, #fff); font: 700 calc(var(--s) * .36)/1 var(--display);
  box-shadow: inset 0 0 0 calc(var(--s) * .09) rgba(0, 0, 0, .16), inset 0 0 0 calc(var(--s) * .26) var(--day, var(--plate-a)),
              inset 0 0 0 calc(var(--s) * .27) rgba(0, 0, 0, .22); }
.plate.xl { --s: 96px; }

/* ---------------------------------------------------------------- navigation */
nav.tabs { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; display: flex; justify-content: center;
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); background: var(--mat); border-top: 1px solid var(--line); }
nav.tabs button { flex: 1; max-width: 120px; min-height: 56px; border: 0; background: none; color: var(--steel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 500; }
nav.tabs button[aria-current="page"] { color: var(--chalk); }
nav.tabs button[aria-current="page"] svg { stroke-width: 2.4; }
main { padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }

/* ---------------------------------------------------------------- header */
.top { position: sticky; top: 0; z-index: 5; background: var(--floor); border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.top-in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; min-height: 44px; }
.top:has(+ .wrap.wide) .top-in { max-width: 1080px; }
.top-t { flex: 1; min-width: 0; }
.top h1 { font: 600 19px/1.2 var(--display); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top h1::first-letter { text-transform: uppercase; }
.top-t p { color: var(--steel); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-r { display: flex; align-items: center; gap: 8px; }
.drain { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--chalk);
  transform: scaleX(0); transform-origin: left; will-change: transform; }
.top[data-day] .drain { background: var(--day); }
.top[data-day="home"] .drain { background: var(--chalk); }
.queue { font-size: 12px; color: var(--plate-c); border: 1px solid currentColor; border-radius: 99px; padding: 2px 8px; white-space: nowrap; }

.tmr { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tmr button { min-height: 40px; min-width: 42px; padding: 0 6px; border: 0; background: var(--mat); font-size: 13px; }
.tmr button + button { border-left: 1px solid var(--line); }
.tmr-run { display: flex; flex-direction: column; align-items: flex-end; border: 0; background: none; padding: 0 2px;
  font-size: 26px; font-weight: 700; line-height: 1; }
.tmr-run small { font: 500 11px var(--text); color: var(--steel); margin-top: 3px; }

/* ---------------------------------------------------------------- page body */
.wrap { width: min(100% - 32px, 720px); margin: 0 auto; padding: 16px 0 0; }
.wrap.wide { width: min(100% - 32px, 1080px); }
.cols { display: grid; gap: 0 28px; }
.cols > div { min-width: 0; }
.h2 { display: block; font: 600 15px/1.3 var(--display); color: var(--chalk); margin: 26px 0 12px; }
.cols > div > .h2:first-child, .cols > div > .panel:first-child, .cols > div > .entry:first-child { margin-top: 0; }
.panel { background: var(--mat); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel .h2 { margin-top: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.four { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.acts { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 24px; }
.empty { padding: 32px 0; display: grid; gap: 14px; justify-items: start; }
.foot { text-align: center; color: var(--steel); font-size: 13px; margin: 18px 0 8px; }

.datebar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.datebar input { flex: 1; text-align: center; }

.days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.days .long { display: none; }
.days button { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-height: 52px; padding: 6px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--mat); text-align: left; line-height: 1.2; }
.days b { font-weight: 600; font-size: 15px; }
.days small { font-size: 13px; color: var(--steel); }
.days button[aria-pressed="true"] { border-color: var(--chalk); background: var(--chalk); color: var(--on-chalk); }
.days button[aria-pressed="true"] small { color: inherit; opacity: .7; }

.meter { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.meter > .num { font: 700 22px var(--text); white-space: nowrap; }  /* Unbounded's 0 reads as a ring */
.meter > .num small { font: 500 14px var(--text); color: var(--steel); }
.bar { flex: 1; height: 8px; background: var(--mat-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--chalk); border-radius: inherit; transition: width .3s; }
[data-full="true"] .bar > i { background: var(--go); }
.banner { margin: 0 0 16px; color: var(--chalk); font-size: 15px; }

/* ---------------------------------------------------------------- exercise block */
.ex { background: var(--mat); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 10px;
  margin-bottom: 12px; box-shadow: var(--shadow); }
.ex-h { display: flex; gap: 12px; align-items: flex-start; }
.ex[data-done="true"] { border-color: color-mix(in srgb, var(--go) 55%, var(--line)); }
.ex[data-done="true"] h3::after { content: " ✓"; color: var(--go); }
.ex h3 { font: 600 17px/1.3 var(--text); }
.target { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px; color: var(--steel); font-size: 14px; }
.target .num { color: var(--chalk); font-size: 14px; font-weight: 600; }
.note { color: var(--steel); font-size: 14px; margin: 8px 0 0; }
.last { font-size: 14px; color: var(--steel); margin: 6px 0 0; }
.last .num { font-size: 13px; color: var(--chalk); }
.hint { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--chalk); }
.hint[data-tone="up"] { color: var(--go); }
.hint[data-tone="hold"] { font-weight: 500; }

.sets { margin: 12px 0 2px; display: grid; gap: 8px; }
.set { display: grid; grid-template-columns: 28px minmax(0, 1fr) 18px minmax(0, 1fr) 48px; gap: 6px; align-items: center; }
.sets.one .set { grid-template-columns: 28px minmax(0, 1fr) 48px; }
.set.head { font-size: 12px; color: var(--steel); text-align: center; margin-bottom: -4px; }
.set-n { text-align: center; color: var(--steel); font-size: 13px; }
.set .x { text-align: center; color: var(--steel); font-size: 18px; }
.set input { text-align: center; font-size: 21px; font-weight: 600; padding: 8px 4px; min-height: 54px; border-radius: 12px; }
.set input.filled { background: var(--floor); border-color: var(--chalk); }
.set.extra { opacity: .5; }
.cp { min-height: 54px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--steel); font: 600 20px var(--display); }
.ex-f { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; font-size: 14px; color: var(--steel); }
.lnk { background: none; border: 0; padding: 0; font: inherit; color: var(--chalk); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; }
.ex-h > div { flex: 1; min-width: 0; }
.ph { flex: none; width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: var(--mat-2); cursor: zoom-in; }
.ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph { position: relative; }
.ph small { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0 2px; font-size: 10px; line-height: 1.2;
  background: rgba(0, 0, 0, .55); color: #fff; }
.ph.empty { display: grid; place-content: center; justify-items: center; gap: 2px; cursor: pointer;
  border-style: dashed; background: transparent; color: var(--steel); font-size: 12px; }
@media (min-width: 960px) { .ph { width: 88px; height: 88px; } }
.phv { padding: 0; overflow: hidden; }
.phv figure { margin: 0; }
.phv img { display: block; width: 100%; max-height: min(50dvh, 720px); object-fit: contain; background: #000; }
.phv figcaption { padding: 14px 16px 0; font-weight: 600; }
.phv .credit, .phv .ph-why { padding: 4px 16px 0; font-size: 13px; color: var(--steel); }
.phv .credit a { color: inherit; }
.phv .acts { padding: 0 16px; margin: 12px 0 16px; display: grid; grid-template-columns: 1fr 1fr; }
.phv .acts > :last-child:nth-child(odd) { grid-column: 1 / -1; }

.superset { position: relative; padding-left: 16px; margin-bottom: 12px; }
.superset::before { content: ""; position: absolute; left: 3px; top: 30px; bottom: 26px; width: 10px;
  border: 2px solid var(--steel); border-right: 0; border-radius: 10px 0 0 10px; }
.ss-l { font-size: 13px; color: var(--steel); margin: 0 0 8px 2px; }
.superset .ex:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- stretching */
.stretch { margin: 28px 0 8px; }
.stretch h2, .rest h2 { font: 600 17px/1.3 var(--display); }
.stretch > p { font-size: 14px; margin: 6px 0 12px; }
.stretch ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.stretch li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stretch li b { font-weight: 600; display: block; }
.stretch li .grow small { color: var(--steel); font-size: 14px; display: block; }
.stretch li[data-done="true"] b { color: var(--steel); text-decoration: line-through; text-decoration-color: var(--go); text-decoration-thickness: 2px; }
.check { width: 30px; height: 30px; flex: none; border-radius: 8px; border: 2px solid var(--line); background: none; }
.check[aria-pressed="true"] { background: var(--go); border-color: var(--go); }
.check[aria-pressed="true"]::after { content: "✓"; color: #fff; font-weight: 700; }
.hold { flex: none; white-space: nowrap; min-width: 64px; min-height: 44px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--mat); font-size: 15px; font-weight: 600; }
.hold small { font: 500 12px var(--text); margin-left: 1px; color: var(--steel); }

.rest { padding: 6px 0 4px; }
.rest p { margin-top: 6px; }
.rest .days { margin-top: 16px; grid-template-columns: 1fr; }
.rest .days button { font-size: 15px; }

.notes { margin-top: 22px; color: var(--steel); }

/* ---------------------------------------------------------------- lists, stats, charts */
.rows { list-style: none; margin: 0 0 8px; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows small { display: block; color: var(--steel); font-size: 13px; margin-top: 2px; }
.rows small.num { font-family: var(--text); }
.rows .time { color: var(--steel); font-size: 13px; width: 44px; flex: none; }
.rows b.num { font-size: 17px; }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; text-align: left; padding: 2px 0; }
.panel.rows { padding: 4px 16px; }
[data-tone="ok"] { color: var(--go); }
[data-tone="low"], [data-tone="high"] { color: var(--plate-c); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stats > div { background: var(--mat); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.stats span { color: var(--steel); font-size: 13px; }
.stats b { display: block; font-size: 26px; font-weight: 700; margin-top: 2px; }
.stats b small { font: 500 14px var(--text); color: var(--steel); }
.verdict { font-size: 15px; margin: 0 0 14px; color: var(--chalk); }

/* date and kilos side by side, the button under them: a phone's date field needs half the row */
.entry { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-bottom: 14px; }
.entry .btn { grid-column: 1 / -1; }
.entry .big { font-size: 20px; font-weight: 600; text-align: center; }

figure { margin: 0; }
figcaption { color: var(--steel); font-size: 13px; margin-top: 6px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--steel); font: 12px var(--text); }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart path { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .c-main { stroke: var(--chalk); }
svg.chart .c-main.dot { fill: var(--chalk); stroke: none; }
svg.chart .c-raw.dot { fill: var(--ghost); stroke: none; }
#hex { margin: 0 0 12px; }

/* ---------------------------------------------------------------- food */
.macro { margin-bottom: 12px; }
.macro-t { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--steel); }
.macro-t .num { font-size: 13px; }
.macro-t b { color: var(--chalk); font-size: 15px; }
.macro.big .macro-t { font-size: 15px; color: var(--chalk); }
.macro.big .macro-t b { font-size: 19px; }
.macro .bar { margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { display: grid; text-align: left; gap: 2px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--mat); font-size: 15px; line-height: 1.25; max-width: 100%; }
.chip small { color: var(--steel); font: 500 12px var(--text); }
details.panel summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.panel summary::after { content: "+"; font: 600 20px/1 var(--display); color: var(--steel); }
details[open].panel summary::after { content: "−"; }
details summary::-webkit-details-marker { display: none; }
.meal-f { display: grid; gap: 12px; margin-top: 14px; }

/* ---------------------------------------------------------------- settings */
.goals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.goals .btn { grid-column: 1 / -1; }
.prog h3 { display: flex; align-items: center; gap: 10px; font: 600 15px var(--display); margin-bottom: 6px; }
.prog .rows li { padding: 6px 0; gap: 4px; }
.prog .rows li.linked { border-bottom-style: dashed; }
.prog .btn.icon { width: 40px; min-height: 40px; font-size: 17px; }
/* in the app the page runs under the status and navigation bars: keep dialogs clear of both */
dialog { width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: 18px;
  background: var(--mat); color: var(--chalk); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.exf { display: grid; gap: 12px; }
.exf h2 { font: 600 18px var(--display); }
.exf .acts { margin: 6px 0 0; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-f { width: 100%; max-width: 360px; display: grid; gap: 14px; justify-items: stretch; text-align: left; }
.login-f .plate { justify-self: center; }
.login-f h1 { font: 800 40px/1 var(--display); text-align: center; letter-spacing: -.02em; margin-top: 6px; }
.login-f > p { text-align: center; }
.login-f b { color: var(--chalk); font-weight: 600; }
.err { color: var(--plate-a); min-height: 1.4em; text-align: center; font-size: 14px; }
.cmd { display: block; padding: 12px 14px; border-radius: 12px; background: var(--mat); border: 1px solid var(--line);
  font: 500 13px/1.5 ui-monospace, "Cascadia Mono", Menlo, monospace; overflow-wrap: anywhere; user-select: all; }

/* ---------------------------------------------------------------- toast */
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px); max-width: calc(100vw - 32px); background: var(--chalk); color: var(--on-chalk);
  padding: 10px 16px; border-radius: 12px; font-size: 15px; font-weight: 500; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- larger screens */
@media (min-width: 560px) {
  .days .long { display: inline; }
  .rest .days { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .days .short { display: none; }
  .set { grid-template-columns: 32px 150px 22px 150px 52px; justify-content: start; }
  .sets.one .set { grid-template-columns: 32px 150px 52px; }
}
@media (min-width: 960px) {
  nav.tabs { top: 0; right: auto; width: var(--rail); flex-direction: column; justify-content: flex-start; gap: 4px;
    padding: 18px 8px; border-top: 0; border-right: 1px solid var(--line); }
  nav.tabs button { flex: none; max-width: none; min-height: 64px; border-radius: 12px; font-size: 13px; }
  nav.tabs button[aria-current="page"] { background: var(--mat-2); }
  main { padding: 0 0 40px var(--rail); }
  .toast { bottom: 28px; left: calc(50% + var(--rail) / 2); }
  .top { padding-left: 24px; padding-right: 24px; }
  .wrap { width: min(100% - 48px, 720px); padding-top: 24px; }
  .wrap.wide { width: min(100% - 48px, 1080px); }
  .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .wrap.wide .h2:first-child { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
.two .macro-t { flex-direction: column; gap: 0; }
.macro-t .num { white-space: nowrap; }
@media (max-width: 400px) { .top h1 { font-size: 17px; } }
