/* Barracks PT · field-manual paper and ink, olive drab, one signal orange. */

:root {
  --paper: #F2EEE3;
  --paper-2: #E7E1D0;
  --paper-3: #DAD2BC;
  --ink: #1D2116;
  --ink-2: #51574A;
  --ink-3: #7A7C6A;
  --line: rgba(29, 33, 22, .15);
  --line-2: rgba(29, 33, 22, .3);
  --primary: #3E4829;
  --primary-press: #2D3520;
  --on-primary: #F4F1E7;
  --signal: #AE3A0C;
  --signal-wash: rgba(174, 58, 12, .09);
  --slab: #1D2116;
  --on-slab: #F2EEE3;
  --on-slab-2: #B9B6A2;
  --done: #3E4829;
  --on-done: #F2EEE3;
  --scrim: rgba(20, 22, 15, .42);

  --f-display: 'Big Shoulders', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --f-stencil: 'Saira Stencil One', 'Big Shoulders', 'Arial Narrow', sans-serif;
  --f-text: 'Public Sans', 'Helvetica Neue', Arial, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --gutter: 20px;
  --tabbar-h: 54px;
  --r: 4px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1C1F16; --paper-2: #262A1F; --paper-3: #323729;
    --ink: #ECE6D3; --ink-2: #ADAC97; --ink-3: #7D7F6C;
    --line: rgba(236, 230, 211, .13); --line-2: rgba(236, 230, 211, .28);
    --primary: #CFC196; --primary-press: #B8AA7E; --on-primary: #1C1F16;
    --signal: #E37B46; --signal-wash: rgba(227, 123, 70, .13);
    --slab: #0F110B; --on-slab: #ECE6D3; --on-slab-2: #A3A28E;
    --done: #CFC196; --on-done: #1C1F16;
    --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1C1F16; --paper-2: #262A1F; --paper-3: #323729;
  --ink: #ECE6D3; --ink-2: #ADAC97; --ink-3: #7D7F6C;
  --line: rgba(236, 230, 211, .13); --line-2: rgba(236, 230, 211, .28);
  --primary: #CFC196; --primary-press: #B8AA7E; --on-primary: #1C1F16;
  --signal: #E37B46; --signal-wash: rgba(227, 123, 70, .13);
  --slab: #0F110B; --on-slab: #ECE6D3; --on-slab-2: #A3A28E;
  --done: #CFC196; --on-done: #1C1F16;
  --scrim: rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.45 var(--f-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--signal); outline-offset: 2px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.noscript { padding: 40px 20px; }

/* ---------- shell ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#tabs { position: relative; flex: 1; min-height: 0; }
.tab { position: absolute; inset: 0; overflow: hidden; }

.view {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain;
  background: var(--paper);
  padding-left: var(--safe-left); padding-right: var(--safe-right);
  padding-bottom: 32px;
}
.view.pushing { transition: transform .34s var(--ease); }
.view.under { transition: transform .34s var(--ease), filter .34s var(--ease); }

/* Top bar: safe area, then a 44 pt bar whose small title fades in once the big title scrolls away. */
.navbar {
  position: sticky; top: 0; z-index: 5;
  padding-top: var(--safe-top);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.navbar.scrolled { border-bottom-color: var(--line); }
/* Tab roots: the bar floats over the top of the page and only fills in once you scroll. */
.navbar.float { margin-bottom: -44px; background: transparent; pointer-events: none; }
.navbar.float.scrolled { background: var(--paper); }
.navbar.float .navbtn { pointer-events: auto; }
.navbar-in { height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; padding: 0 8px; }
.navbar .navtitle { font: 600 17px/1 var(--f-text); text-align: center; opacity: 0; transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.navbar.scrolled .navtitle, .navbar.always .navtitle { opacity: 1; }
.navbar .left { justify-self: start; }
.navbar .right { justify-self: end; }
.navbtn {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 44px; min-width: 44px; padding: 0 10px;
  background: none; border: 0; color: var(--ink);
  font-weight: 600; font-size: 17px;
}
.navbtn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: square; }
.navbtn:active { opacity: .55; }

.largetitle { padding: 14px var(--gutter) 14px; }
.largetitle h1 { font: 800 44px/0.95 var(--f-display); letter-spacing: -.01em; }
.largetitle p { color: var(--ink-2); margin-top: 8px; font-size: 15px; }

/* Tab bar */
.tabbar {
  flex: none;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--paper);
  border-top: 1px solid var(--line-2);
  position: relative; z-index: 10;
}
.tabbtn {
  position: relative;
  height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--ink-2);
  font: 600 11px/1 var(--f-text); letter-spacing: .01em;
}
.tabbtn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: square; }
.tabbtn svg .fill { fill: currentColor; stroke: none; }
.tabbtn[aria-current="page"] { color: var(--ink); }
.tabbtn[aria-current="page"]::before {
  content: ""; position: absolute; top: -1px; left: 50%; width: 28px; height: 3px; margin-left: -14px; background: var(--signal);
}
.tabbtn:active svg { transform: scale(.92); }

/* ---------- type & blocks ---------- */
.stencil { font-family: var(--f-stencil); font-weight: 400; }
.section { padding: 0 var(--gutter); margin-top: 30px; }
.sec-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  border-top: 2px solid var(--ink);
  padding-top: 10px; margin-bottom: 4px;
}
.sec-h h2, .sec-h h3 { font: 700 19px/1.2 var(--f-text); letter-spacing: -.005em; }
.sec-h .aside { font-size: 15px; color: var(--ink-2); }
.lead { font-size: 15px; color: var(--ink-2); margin: 6px 0 4px; }
.fine { font-size: 14px; color: var(--ink-2); margin-top: 10px; }
.muted { color: var(--ink-2); }
.sig { color: var(--signal); }

/* Buttons: square-shouldered, never pills. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  border-radius: var(--r);
  font: 600 17px/1 var(--f-text);
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  text-decoration: none; touch-action: manipulation;
  transition: transform .12s, background-color .12s;
}
.btn:active { transform: scale(.98); background: var(--paper-2); }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:active { background: var(--primary-press); border-color: var(--primary-press); }
.btn.big { min-height: 60px; width: 100%; font-size: 19px; justify-content: space-between; padding: 0 20px; }
.btn.wide { width: 100%; }
.btn.quiet { border-color: var(--line-2); }
.btn.danger { color: var(--signal); border-color: var(--signal); }
.btn.solid-danger { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.btnrow > .btn { flex: 1 1 0; min-width: 0; }

/* Rows: full-bleed list lines with hairlines, like a ruled page. */
.rows { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 10px 0;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; color: var(--ink);
}
button.row:active, a.row:active { background: var(--paper-2); }
a.row { text-decoration: none; }
.row .t { font-weight: 600; }
.row .s { display: block; font-size: 14px; color: var(--ink-2); margin-top: 1px; font-weight: 400; }
.row .v { color: var(--ink-2); font-size: 16px; display: inline-flex; align-items: center; gap: 6px; }
.chev { width: 9px; height: 15px; fill: none; stroke: var(--ink-3); stroke-width: 2; flex: none; }
.row.flush { padding-left: 0; padding-right: 0; }

/* ---------- Today ---------- */
.today-head { padding: 16px var(--gutter) 0; }
.dateline { font-size: 15px; color: var(--ink-2); }
.weekline { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.wk-num { font: 400 58px/0.85 var(--f-stencil); color: var(--ink); }
.weekline > div b { display: block; font-size: 17px; }
.weekline > div span { display: block; font-size: 14px; color: var(--ink-2); }
.weekbar { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; margin-top: 14px; }
.weekbar li { height: 6px; background: var(--paper-3); position: relative; }
.weekbar li.past { background: var(--ink); }
.weekbar li.now { background: var(--signal); }
.weekbar-legend { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--ink-2); }

.notice {
  margin: 22px var(--gutter) 0; padding: 12px 14px;
  border-left: 4px solid var(--signal); background: var(--signal-wash);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
}
.notice b { display: block; }
.notice p { font-size: 14px; color: var(--ink-2); }
.notice .btn { min-height: 40px; padding: 0 14px; font-size: 15px; }

.hero { padding: 0 var(--gutter); margin-top: 26px; }
.hero .when { font-size: 15px; color: var(--ink-2); display: flex; gap: 8px; align-items: baseline; }
.hero .when .dot { flex: none; width: 8px; height: 8px; background: var(--signal); display: inline-block; }
.hero h2 { font: 800 84px/0.86 var(--f-display); letter-spacing: -.015em; margin-top: 10px; }
.hero h2.long { font-size: 66px; }
.hero .title { font: 600 22px/1.2 var(--f-text); margin-top: 8px; }
.hero .meta { margin-top: 10px; font-size: 15px; color: var(--ink-2); }
.hero .btn.big { margin-top: 22px; }
.hero .copy { margin-top: 12px; max-width: 34em; }
.hero.done h2 { color: var(--ink); }
.stamp {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  border: 2px solid var(--done); color: var(--done); padding: 5px 10px 4px 8px;
  font: 400 18px/1 var(--f-stencil); letter-spacing: .06em; transform: rotate(-2deg);
}
.stamp svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 3; }

.moves li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.moves .no { font: 700 15px/1 var(--f-text); color: var(--ink-2); }
.moves .nm { font-weight: 600; }
.moves .ds { font-size: 15px; color: var(--ink); white-space: nowrap; text-align: right; }
.moves .kt { grid-column: 2 / 4; font-size: 14px; color: var(--ink-2); }
.moves .how { grid-column: 2 / 4; font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.moves .lvl { color: var(--signal); font-size: 13px; font-weight: 600; }

.upnext .row .t { display: flex; gap: 10px; align-items: baseline; }
.upnext .d { width: 36px; color: var(--ink-2); font-weight: 400; }

/* ---------- Plan ---------- */
.roster { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 4px; }
.roster th { font: 600 12px/1 var(--f-text); color: var(--ink-2); padding: 6px 0; }
.roster th.wk { width: 46px; text-align: left; }
.roster td { padding: 2px; }
.roster td.wk { padding: 0; }
.roster .wkbtn {
  width: 100%; height: 38px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  background: none; border: 0; padding: 0; text-align: left;
}
.roster .wkbtn b { font: 700 16px/1 var(--f-text); }
.roster .wkbtn small { font-size: 10.5px; color: var(--ink-2); margin-top: 2px; }
.roster tr.sel .wkbtn b { color: var(--signal); }
.cell {
  width: 100%; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line-2); background: transparent; border-radius: 2px;
  font: 700 15px/1 var(--f-text); color: var(--ink); padding: 0;
}
.cell.rest { border-color: transparent; color: var(--ink-3); font-weight: 400; }
.cell.opt { border-style: dashed; color: var(--ink-2); }
.cell.done { background: var(--done); border-color: var(--done); color: var(--on-done); }
.cell.missed { color: var(--ink-2); border-color: var(--line); background: repeating-linear-gradient(-45deg, transparent 0 5px, var(--line) 5px 6px); }
.cell.today { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--signal); }
.cell:active { transform: scale(.94); }
.roster tr.sel td:not(.wk) .cell:not(.done) { border-color: var(--ink); }
.roster tr.sel td:not(.wk) .cell.rest { border-color: transparent; }
.phase-band td { padding: 10px 0 2px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line-2); }
.legend i.d { background: var(--done); border-color: var(--done); }
.legend i.m { background: repeating-linear-gradient(-45deg, transparent 0 3px, var(--line-2) 3px 4px); }
.legend i.t { box-shadow: 0 0 0 2px var(--signal); border-color: transparent; }

.dayrow .t { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.dayrow .d { font-weight: 400; color: var(--ink-2); }
.dayrow.is-today .d { color: var(--signal); font-weight: 700; }
.tag { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tag.ok { color: var(--done); }
.tag.now { color: var(--signal); }
.tick { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; vertical-align: -3px; }

/* Day preview */
.preview-head { padding: 0 var(--gutter); }
.preview-head h1 { font: 800 72px/0.86 var(--f-display); letter-spacing: -.015em; }
.preview-head .title { font: 600 21px/1.2 var(--f-text); margin-top: 8px; }
.preview-head .meta { margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.bulleted li { padding: 9px 0 9px 18px; border-bottom: 1px solid var(--line); position: relative; }
.bulleted li::before { content: ""; position: absolute; left: 0; top: 18px; width: 7px; height: 2px; background: var(--ink); }
.bottombar {
  position: sticky; bottom: -32px; z-index: 4; margin-top: 28px;
  padding: 12px var(--gutter) 44px; background: var(--paper);
  border-top: 1px solid var(--line);
}

/* ---------- Progress ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 2px solid var(--ink); }
.stat { padding: 12px 0 4px; }
.stat + .stat { padding-left: 14px; border-left: 1px solid var(--line); }
.stat b { display: block; font: 400 38px/0.95 var(--f-stencil); }
.stat span { display: block; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.ttable { width: 100%; border-collapse: collapse; margin-top: 4px; }
.ttable th { font: 600 13px/1.2 var(--f-text); color: var(--ink-2); text-align: right; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ttable th:first-child, .ttable td:first-child { text-align: left; }
.ttable td { padding: 12px 0; border-bottom: 1px solid var(--line); text-align: right; font-size: 17px; }
.ttable td:first-child { font-weight: 600; font-size: 16px; }
.ttable td small { display: block; font-weight: 400; color: var(--ink-2); font-size: 13px; }
.ttable .up { color: var(--done); font-weight: 700; }
.chart { margin-top: 10px; width: 100%; height: 150px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ln { fill: none; stroke: var(--ink); stroke-width: 2; }
.chart .pt { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.chart .last { fill: var(--signal); stroke: var(--signal); }
.chart text { font: 500 11px var(--f-text); fill: var(--ink-2); }
.weightnow { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.weightnow b { font: 800 40px/1 var(--f-display); }
.weightnow span { font-size: 15px; color: var(--ink-2); }
.empty { padding: 18px 0 6px; color: var(--ink-2); font-size: 15px; }

/* ---------- Guide ---------- */
.manual { counter-reset: para; }
.manual li { counter-increment: para; display: grid; grid-template-columns: 30px minmax(0, 1fr); padding: 12px 0; border-bottom: 1px solid var(--line); }
.manual li::before { content: counter(para) "."; font-weight: 700; color: var(--ink-2); }
.timeline li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.timeline .w { font: 700 15px/1.3 var(--f-text); }
.timeline li.key .w { color: var(--signal); }
.callout { border-left: 4px solid var(--signal); padding: 4px 0 4px 14px; font-size: 15px; margin-top: 18px; }
.lvltable { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 15px; }
.lvltable td { padding: 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
.lvltable td:first-child { width: 74px; color: var(--ink-2); }
.lvltable td:last-child { text-align: right; white-space: nowrap; color: var(--ink-2); padding-left: 10px; }
.lvltable tr.mine td { color: var(--ink); font-weight: 600; }
.lvltable tr.mine td:first-child { color: var(--signal); }
.guide-move { padding: 16px 0 14px; border-bottom: 1px solid var(--line); }
.guide-move h3 { font: 700 18px/1.25 var(--f-text); }
.guide-move p { font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.suitlist li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.suit { width: 18px; height: 18px; fill: var(--ink); }
.suit.red { fill: var(--signal); }

/* ---------- Settings controls ---------- */
.field { padding: 14px 0; border-bottom: 1px solid var(--line); }
.field > .lab { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; font-weight: 600; margin-bottom: 10px; }
.field > .lab small { font-weight: 400; color: var(--ink-2); font-size: 14px; }
.field .help { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1.5px solid var(--ink); border-radius: var(--r); overflow: hidden; margin: 0; padding: 0; min-width: 0; }
.seg legend { padding: 0; }
.seg label { position: relative; display: grid; place-items: center; min-height: 44px; padding: 0 6px; text-align: center; font-weight: 600; font-size: 15px; line-height: 1.1; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--line-2); }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--ink); color: var(--paper); }
.seg label:has(input:focus-visible) { outline: 2.5px solid var(--signal); outline-offset: -4px; }
.switchrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 0; min-height: 56px; border-bottom: 1px solid var(--line); cursor: pointer; }
.switchrow .t { font-weight: 600; }
.switchrow .s { display: block; font-size: 14px; color: var(--ink-2); font-weight: 400; }
.toggle { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; margin: 0; border: 1.5px solid var(--ink); border-radius: 3px; background: var(--paper); position: relative; cursor: pointer; transition: background-color .18s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; background: var(--ink); border-radius: 1px; transition: transform .18s var(--ease), background-color .18s; }
.toggle:checked { background: var(--primary); border-color: var(--primary); }
.toggle:checked::after { transform: translateX(22px); background: var(--on-primary); }
.input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--ink); border-radius: var(--r); background: var(--paper); color: var(--ink);
  font-size: 17px; -webkit-appearance: none; appearance: none;
}
input[type="date"].input, input[type="time"].input { display: flex; align-items: center; }
.input::-webkit-date-and-time-value { text-align: left; }
.inline-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.err { color: var(--signal); font-size: 14px; margin-top: 6px; font-weight: 600; }

/* ---------- Sheets & toast ---------- */
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: 560px; margin-inline: auto;
  max-height: calc(100% - 40px);
  border: 0; border-top: 3px solid var(--ink); border-radius: 0;
  padding: 0; background: var(--paper); color: var(--ink); overflow: auto;
}
.sheet::backdrop { background: var(--scrim); }
.sheet[open] { animation: sheet-in .3s var(--ease); }
.sheet-in { padding: 18px var(--gutter) calc(18px + var(--safe-bottom)); }
.sheet h2 { font: 800 30px/1 var(--f-display); }
.sheet h2:focus, h1:focus { outline: none; }
.sheet .sub { color: var(--ink-2); font-size: 15px; margin-top: 8px; }
.sheet .btnrow { margin-top: 18px; }
.sheet .stack { display: grid; gap: 10px; margin-top: 18px; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--slab); color: var(--on-slab); padding: 10px 16px; border-radius: var(--r);
  font-size: 15px; font-weight: 600; max-width: calc(100% - 40px); text-align: center;
  transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.session:not([hidden]) ~ .toast { bottom: calc(var(--safe-bottom) + 24px); }

/* ---------- Session (full-screen workout mode) ---------- */
.session {
  position: fixed; inset: 0; z-index: 30; background: var(--paper);
  display: flex; flex-direction: column;
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
}
.session.enter { animation: session-in .36s var(--ease); }
@keyframes session-in { from { transform: translateY(40px); } to { transform: none; } }
.s-top { flex: none; height: 48px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; padding: 0 8px; }
.s-top .clock { font: 600 16px/1 var(--f-text); color: var(--ink-2); text-align: center; }
.s-top .right { justify-self: end; }
.s-progress { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; padding: 0 var(--gutter); }
.s-progress i { height: 4px; background: var(--paper-3); }
.s-progress i.done { background: var(--ink); }
.s-progress i.now { background: var(--signal); }
.s-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px var(--gutter) 24px; }
.s-foot { flex: none; padding: 12px var(--gutter) calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.s-step { font-size: 15px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 10px; }
.s-name { font: 800 46px/0.92 var(--f-display); letter-spacing: -.01em; margin-top: 8px; }
.s-name.xl { font-size: 64px; }
.s-dose { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 17px; }
.s-dose > b:only-child { font-size: 22px; }
.s-kit { margin-top: 4px; font-size: 16px; color: var(--ink); }
.s-dose b { font-weight: 700; }
.s-dose span + span::before { content: ""; display: inline-block; width: 1px; height: 13px; background: var(--line-2); margin: 0 10px; vertical-align: -1px; }
.s-how { margin-top: 12px; font-size: 16px; color: var(--ink-2); max-width: 34em; }
.howbtn { margin-top: 8px; }

.sets { margin-top: 20px; border-top: 2px solid var(--ink); }
.set { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); gap: 8px; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; padding: 0; text-align: left; color: var(--ink); }
.set .n { color: var(--ink-2); font-size: 15px; }
.set .val { font-weight: 700; font-size: 19px; }
.set .val small { font-weight: 400; color: var(--ink-2); font-size: 14px; }
.set.cur { background: var(--signal-wash); box-shadow: inset 4px 0 0 var(--signal); padding-left: 10px; grid-template-columns: 54px minmax(0, 1fr) auto; }
.set .last { font-size: 14px; color: var(--ink-2); text-align: right; padding-right: 2px; }
.set.logged .tick { color: var(--done); }

.stepper { display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; align-items: stretch; border: 1.5px solid var(--ink); border-radius: var(--r); height: 72px; }
.stepper button { background: none; border: 0; display: grid; place-items: center; color: var(--ink); }
.stepper button:active { background: var(--paper-2); }
.stepper button svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2.4; fill: none; }
.stepper .num { border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stepper input { width: 100%; text-align: center; border: 0; background: none; font: 800 40px/1 var(--f-display); padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .unit { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.foot-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.foot-row.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.subnav { display: flex; justify-content: space-between; margin-top: 4px; }
.subnav .linkbtn { font-size: 15px; text-decoration: none; color: var(--ink-2); }

/* Rest: a dark slab that rises over the lower half, readable from the floor. */
.restpanel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  background: var(--slab); color: var(--on-slab);
  padding: 20px var(--gutter) calc(18px + var(--safe-bottom));
  border-top: 3px solid var(--signal);
  animation: rest-in .32s var(--ease);
}
@keyframes rest-in { from { transform: translateY(100%); } to { transform: none; } }
.restpanel.out { transform: translateY(100%); transition: transform .28s var(--ease); }
.restpanel .r-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; color: var(--on-slab-2); }
.restpanel .r-top b { color: var(--on-slab); font-size: 17px; }
.restpanel .r-clock { font: 400 min(124px, 31vw)/0.9 var(--f-stencil); margin-top: 16px; }
.restpanel .r-bar { height: 6px; background: rgba(242, 238, 227, .16); margin-top: 16px; position: relative; overflow: hidden; }
.restpanel .r-bar i { position: absolute; inset: 0; background: var(--signal); transform-origin: left; }
.restpanel .r-next { margin-top: 14px; font-size: 16px; color: var(--on-slab-2); }
.restpanel .r-next b { color: var(--on-slab); font-weight: 600; }
.restpanel .btnrow { margin-top: 16px; }
.restpanel .btn { color: var(--on-slab); border-color: rgba(242, 238, 227, .5); }
.restpanel .btn:active { background: rgba(242, 238, 227, .1); }
.restpanel .btn.primary { background: var(--on-slab); color: var(--slab); border-color: var(--on-slab); }
.s-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Big clocks for EMOM, holds and walks */
.bigclock { font: 400 min(140px, 36vw)/0.9 var(--f-stencil); margin-top: 18px; }
.bigclock.mid { font-size: min(100px, 24vw); }
.bigclock.go { color: var(--signal); }
.minute-of { font: 600 17px/1.3 var(--f-text); margin-top: 18px; }
.task { margin-top: 18px; border-top: 2px solid var(--ink); padding-top: 12px; }
.task .now { font: 800 44px/0.95 var(--f-display); }
.task .how { margin-top: 8px; color: var(--ink-2); font-size: 16px; }
.task .next { margin-top: 14px; font-size: 15px; color: var(--ink-2); }
.task .next b { color: var(--ink); font-weight: 600; }
.minutes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; margin-top: 22px; }
.minutes li { height: 14px; border: 1px solid var(--line-2); }
.minutes li.done { background: var(--ink); border-color: var(--ink); }
.minutes li.now { background: var(--signal); border-color: var(--signal); }
.dial { height: 6px; background: var(--paper-3); margin-top: 18px; position: relative; overflow: hidden; }
.dial i { position: absolute; inset: 0; background: var(--ink); transform-origin: left; }

/* Deck */
.deck-stage { display: grid; place-items: center; margin-top: 8px; perspective: 900px; }
.card {
  width: min(62vw, 230px); aspect-ratio: 5 / 7; position: relative;
  background: #FBF8F0; color: #1D2116; border: 1.5px solid #1D2116; border-radius: 8px;
  box-shadow: 4px 4px 0 var(--ink);
  display: grid; place-items: center;
}
.card.red { color: #A8360B; }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; font: 800 30px/0.9 var(--f-display); }
.card .corner svg { width: 18px; height: 18px; margin-top: 3px; fill: currentColor; }
.card .tl { top: 10px; left: 12px; }
.card .br { bottom: 10px; right: 12px; transform: rotate(180deg); }
.card .pip { width: 44%; height: auto; fill: currentColor; }
.card .face { font: 400 110px/1 var(--f-stencil); }
.card.back { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.card.back .mark { font: 400 44px/1 var(--f-stencil); letter-spacing: .04em; }
.card.back::before { content: ""; position: absolute; inset: 10px; border: 1.5px solid currentColor; border-radius: 4px; opacity: .55; }
.card.flip { animation: flip .26s var(--ease); }
@keyframes flip { from { transform: rotateY(70deg) translateY(-6px); } to { transform: none; } }
.deck-do { text-align: center; margin-top: 20px; }
.deck-do b { display: block; font: 800 56px/0.95 var(--f-display); }
.deck-do span { display: block; font-size: 15px; color: var(--ink-2); margin-top: 6px; }
.deck-tally { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 22px; border-top: 2px solid var(--ink); }
.deck-tally div { padding: 10px 0; text-align: center; }
.deck-tally div + div { border-left: 1px solid var(--line); }
.deck-tally b { display: block; font: 700 22px/1 var(--f-text); }
.deck-tally span { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.deck-tally svg { width: 12px; height: 12px; fill: currentColor; }

/* Summary */
.sum-head .stamp { margin-top: 0; }
.sum-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 22px; border-top: 2px solid var(--ink); }
.sum-stats div { padding: 12px 0; }
.sum-stats div + div { padding-left: 14px; border-left: 1px solid var(--line); }
.sum-stats b { display: block; font: 800 34px/1 var(--f-display); }
.sum-stats span { font-size: 13px; color: var(--ink-2); }
.sum-moves li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.sum-moves .nm { font-weight: 600; }
.sum-moves .sets-done { font-size: 15px; color: var(--ink-2); }
.sum-moves .delta { font-weight: 700; text-align: right; }
.sum-moves .delta.up { color: var(--done); }
.sum-moves .lvlup { grid-column: 1 / -1; margin-top: 8px; padding: 10px 12px; background: var(--signal-wash); border-left: 3px solid var(--signal); font-size: 15px; display: grid; gap: 8px; }
.sum-moves .lvlup .btn { min-height: 40px; font-size: 15px; justify-self: start; }
textarea.input { min-height: 84px; resize: vertical; }

/* Onboarding */
.welcome { padding: 8px var(--gutter) 40px; }
.wordmark { font: 400 21px/1 var(--f-stencil); letter-spacing: .08em; }
.welcome h1 { font: 800 64px/0.88 var(--f-display); margin-top: 28px; letter-spacing: -.01em; }
.welcome .intro { margin-top: 14px; font-size: 17px; color: var(--ink-2); }
.kitlist { margin-top: 18px; border-top: 2px solid var(--ink); }
.kitlist li { display: grid; grid-template-columns: 64px minmax(0, 1fr); padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kitlist li b { font-weight: 700; }

@media (min-width: 700px) {
  :root { --gutter: 32px; }
  .view > *, .s-body > *, .s-foot > *, .restpanel > * { max-width: 620px; margin-left: auto; margin-right: auto; }
  .view > .navbar { max-width: none; }
  .hero h2 { font-size: 104px; }
}
@media (max-width: 370px) {
  :root { --gutter: 16px; }
  .hero h2 { font-size: 72px; }
  .hero h2.long { font-size: 56px; }
  .s-name { font-size: 40px; }
}

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

#app.onboarding .tabbar { display: none; }
