:root {
  --chalk: #E6EBEC;
  --paper: #F6F8F8;
  --studio: #C6D0D3;
  --ink: #15202A;
  --ink-2: #5B6973;
  --line: #CDD5D8;
  --p1: #D8402F;
  --p2: #2457C5;
  --p3: #E9AE16;
  --p4: #1F8F57;
  --p5: #15202A;
  --plate: var(--p1);
  --r-tile: 20px;
  --pad: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font: 400 16px/1.45 "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + var(--safe-b));
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid var(--p2); outline-offset: 2px; border-radius: 8px; }
#app { max-width: 560px; margin: 0 auto; padding: 0 var(--pad); }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.01em; }

/* Expanded display voice */
.wordmark, .day h1, .count strong, .num output, .stepper output b, .week dd, .row .d b {
  font-variation-settings: "wdth" 125;
}

/* ---- day header ---- */
.day { padding: calc(18px + env(safe-area-inset-top, 0px)) 0 4px; }
.when { display: flex; align-items: center; gap: 6px; }
.when > div { flex: 1; }
.day h1 { font-size: 34px; line-height: 1.05; font-weight: 850; }
.day p { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; }
.nav {
  width: 40px; height: 40px; border-radius: 50%; font-size: 26px; line-height: 1;
  display: grid; place-items: center; color: var(--ink-2);
}
.nav:disabled { opacity: .25; cursor: default; }
.kinds {
  margin-top: 16px; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--paper); border-radius: 14px; padding: 4px; gap: 2px;
}
.kinds button {
  padding: 9px 0; border-radius: 10px; font-weight: 600; font-size: 15px; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.kinds button[aria-checked="true"] { background: var(--ink); color: var(--paper); }

/* ---- hero barbell ---- */
.hero { margin: 18px calc(-1 * var(--pad)) 6px; padding: 0 8px; }
.bar { display: block; width: 100%; height: auto; overflow: visible; }
.bar .steel { fill: #9AA6AC; }
.bar .knurl { fill: #808D94; }
.bar .collar { fill: #6E7B82; }
.bar .slot { fill: none; stroke: #B5C0C4; stroke-width: 1.5; stroke-dasharray: 3 4; }
.bar .load rect { transform-box: fill-box; animation: load .55s cubic-bezier(.2, .9, .25, 1.15) both; }
.bar .load rect:first-child { --from: -60px; }
.bar .load rect:last-child { --from: 60px; }
@keyframes load { from { transform: translateX(var(--from)); opacity: 0; } }
.count { display: flex; align-items: baseline; gap: 8px; margin: 6px 12px 0; color: var(--ink-2); }
.count strong { font-size: 44px; line-height: 1; color: var(--ink); font-weight: 900; }
.count .sets { margin-left: auto; }

/* ---- breaks ---- */
.break { padding: 22px 0 6px; }
.break header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pip {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: #fff; background: var(--plate);
}
.break h2 { font-size: 19px; font-weight: 700; }
.tick { margin-left: auto; color: var(--plate); font-weight: 900; font-size: 20px; }
.break.next h2::after {
  content: "Up next"; margin-left: 10px; font-size: 13px; font-weight: 600; color: var(--plate);
}
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.moves.n1 { grid-template-columns: 1fr 1fr; }
.tile { text-align: left; display: flex; flex-direction: column; min-width: 0; }
.clip {
  position: relative; display: block; aspect-ratio: 540 / 676; border-radius: var(--r-tile);
  overflow: hidden; background: var(--studio);
}
.clip video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.logged .clip::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 3px var(--plate);
}
.tile .name { margin-top: 9px; font-weight: 700; font-size: 16px; line-height: 1.2; }
.tile .meta { color: var(--ink-2); font-size: 14px; display: flex; gap: 8px; }
.tile .meta em { font-style: normal; color: var(--ink); font-weight: 600; }
.tile:active .clip { transform: scale(.98); }
.break.done .name { color: var(--ink); }

.solo { margin-top: 22px; }
.solo.quiet p { color: var(--ink-2); font-size: 18px; margin: 30px 0; }

/* ---- steppers ---- */
.walk { margin-top: 28px; }
.stepper {
  display: grid; grid-template-columns: 1fr 52px auto 52px; align-items: center; gap: 6px;
  background: var(--paper); border-radius: 18px; padding: 10px 10px 10px 18px;
}
.stepper .label { font-weight: 700; font-size: 17px; }
.stepper output { min-width: 84px; text-align: center; color: var(--ink-2); }
.stepper output b { color: var(--ink); font-size: 26px; font-weight: 800; }
.stepper button, .num button {
  width: 52px; height: 52px; border-radius: 14px; background: var(--chalk);
  font-size: 26px; font-weight: 500;
}
.stepper button:active, .num button:active { background: var(--line); }

/* ---- sheet ---- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(21, 32, 42, .45); opacity: 0; transition: opacity .2s; }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  max-height: 94vh; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 26px 26px 0 0;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: calc(20px + var(--safe-b));
}
.sheet.open .sheet-scrim { opacity: 1; }
.sheet.open .sheet-body { transform: none; }
.close {
  position: absolute; z-index: 2; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(246, 248, 248, .85); font-size: 24px; line-height: 1;
}
.big-clip { aspect-ratio: 540 / 676; width: min(100%, 52vh * 0.8); width: min(100%, 52dvh * 0.8); margin: 0 auto; background: var(--studio); overflow: hidden; border-radius: 26px 26px 0 0; }
.big-clip video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet-main { padding: 18px var(--pad) 0; }
.sheet-main h2 { font-size: 28px; font-variation-settings: "wdth" 115; }
.cue { margin: 4px 0 0; font-size: 17px; }
.target { margin: 2px 0 0; color: var(--ink-2); }
.log { display: grid; gap: 10px; margin-top: 18px; }
.num {
  display: grid; grid-template-columns: 1fr 52px 96px 52px; align-items: center;
  border-top: 1px solid var(--line); padding-top: 10px;
}
.num .label { color: var(--ink-2); font-weight: 600; }
.num output { text-align: center; font-size: 34px; font-weight: 850; font-variant-numeric: tabular-nums; }
.btn {
  display: block; width: 100%; padding: 17px; border-radius: 16px; background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: 18px; transition: background .2s;
}
.log-set { background: var(--plate); margin-top: 6px; }
.sheet[style*="--p3"] .log-set { color: var(--ink); }
.log-set.ok { background: var(--ink); color: var(--paper); }
.timer { padding: 14px; border-radius: 16px; border: 2px solid var(--line); font-weight: 700; }
.timer.on { border-color: var(--plate); color: var(--plate); }
.done-sets { list-style: none; padding: 0; margin: 18px 0 0; }
.done-sets li {
  display: grid; grid-template-columns: 1fr auto 44px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.done-sets span { color: var(--ink-2); }
.done-sets b { font-size: 18px; font-variant-numeric: tabular-nums; }
.done-sets button { width: 44px; height: 44px; font-size: 20px; color: var(--ink-2); }

/* ---- tabs ---- */
#tabs {
  position: fixed; z-index: 10; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--ink);
  box-shadow: 0 8px 24px rgba(21, 32, 42, .25);
}
#tabs[hidden] { display: none; }
#tabs a { padding: 11px 22px; border-radius: 999px; color: #A9B5BB; font-weight: 600; }
#tabs a[aria-current="page"] { background: var(--paper); color: var(--ink); }

/* ---- history ---- */
.week { margin-top: 18px; background: var(--paper); border-radius: 22px; padding: 16px; }
.week ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.week li span { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.week li.is-today span { color: var(--ink); font-weight: 800; }
.week li.later { opacity: .35; }
.dots { display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; height: 60px; justify-content: flex-start; margin-top: 6px; }
.dots i { width: 22px; height: 8px; border-radius: 3px; border: 1px solid var(--line); }
.dots i[style*="transparent"] { border-style: dashed; }
.dots i.run { height: 22px; border-radius: 50%; border: 0; background: var(--ink); }
.week dl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 0 0; border-top: 1px solid var(--line); padding-top: 12px; }
.week dt { color: var(--ink-2); font-size: 14px; }
.week dd { margin: 0; font-size: 28px; font-weight: 850; }
.week dd small { font-size: 14px; font-weight: 500; color: var(--ink-2); font-variation-settings: "wdth" 100; }
.days { margin-top: 18px; }
.row { display: grid; grid-template-columns: 52px 1fr 104px; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.row .d { text-align: center; line-height: 1.05; }
.row .d b { display: block; font-size: 26px; font-weight: 850; }
.row .d span { font-size: 13px; color: var(--ink-2); }
.row h3 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.row p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.row .bar.mini { width: 104px; }
.k { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--chalk); color: var(--ink-2); }
.k-run { background: var(--ink); color: var(--paper); }
.empty { display: block; padding: 30px 0; font-size: 18px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

/* ---- login ---- */
.login { min-height: 92vh; min-height: 92dvh; display: flex; flex-direction: column; justify-content: center; }
.login .bar { margin: 0 -8px; }
.wordmark { font-size: 64px; font-weight: 900; line-height: 1; margin: 18px 0 36px; text-align: center; }
.login label { font-weight: 700; display: block; margin-bottom: 6px; }
.login input {
  width: 100%; font: inherit; font-size: 18px; padding: 16px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--paper); color: var(--ink);
}
.login input:focus { outline: none; border-color: var(--ink); }
.err { color: var(--p1); min-height: 1.4em; margin: 8px 0; font-weight: 600; }

@media (min-width: 600px) {
  .day h1 { font-size: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
