/* Archivo variable (wght 100–900, wdth 62–125), Omnibus-Type, SIL Open Font License 1.1; latin subset from @fontsource-variable/archivo 5.1.0. */
@font-face { font-family: "Archivo"; src: url("fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
/* Layout: app shell. Top app bar, one phone-first column, bottom navigation (top on wide screens), rest timer sheet above the nav. */
:root {
  --ground: #E2E5E8;
  --wall: #CDD2D7;
  --tnut: rgba(20, 24, 28, 0.22);
  --seam: rgba(20, 24, 28, 0.10);
  --surface: #FFFFFF;
  --ink: #14181C;
  --ink-2: #4B535B;
  --rule: #D3D8DD;
  --rule-strong: #AEB5BC;
  --chalk: #E4E4DF;
  --raised: #F1F5F9;
  --c-warm: #3FAE5E;  --t-warm: #0E1A12;
  --c-a: #F07F2E;     --t-a: #1C0E04;
  --c-b: #7E57D9;     --t-b: #FFFFFF;
  --c-cool: #2F7FE8;  --t-cool: #06142A;
  --c-rest: #B7BDC3;  --t-rest: #14181C;
  --ok: #1D7A3E; --ok-bg: #E1F2E6;
  --warn: #8A5A00; --warn-bg: #FBEFD4;
  --bad: #B3261E; --bad-bg: #FBE3E0;
  --f-sans: "Archivo", "Helvetica Neue", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #131619; --wall: #2A2D30; --tnut: rgba(255,255,255,0.16); --seam: rgba(255,255,255,0.06);
    --surface: #1A1E22; --ink: #E7EAED; --ink-2: #A3ABB3; --rule: #2A3036; --rule-strong: #3E464E;
    --chalk: #DADBD7; --raised: #232A31;
    --ok: #74D292; --ok-bg: #14301E; --warn: #E8B54E; --warn-bg: #33280F; --bad: #FF8D84; --bad-bg: #3A1B18;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #131619; --wall: #2A2D30; --tnut: rgba(255,255,255,0.16); --seam: rgba(255,255,255,0.06);
  --surface: #1A1E22; --ink: #E7EAED; --ink-2: #A3ABB3; --rule: #2A3036; --rule-strong: #3E464E;
  --chalk: #DADBD7; --raised: #232A31;
  --ok: #74D292; --ok-bg: #14301E; --warn: #E8B54E; --warn-bg: #33280F; --bad: #FF8D84; --bad-bg: #3A1B18;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ground); color: var(--ink);
  font-family: var(--f-sans); font-size: 16px; line-height: 1.5; font-stretch: 100%;
  caret-color: var(--ink); scrollbar-color: var(--rule-strong) var(--ground);
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--c-a); color: var(--t-a); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 720px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* Tape: the route tag a setter sticks under a start hold */
.tape {
  display: inline-flex; align-items: center; gap: 8px;
  font-stretch: 72%; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1;
  background: var(--c, var(--c-rest)); color: var(--t, var(--t-rest));
  padding: 6px 12px 5px;
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%);
}

/* Shell */
.top { background: var(--surface); border-bottom: 1px solid var(--rule); }
.top .wrap { padding-block: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.brand-mark { width: 32px; height: 32px; flex: 0 0 auto; color: var(--ink); }
.brand h1 { font-size: 22px; line-height: 1.05; font-weight: 800; font-stretch: 80%; margin: 0; text-transform: uppercase; letter-spacing: 0.01em; }
.brand p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.3; }

.seg { display: inline-flex; gap: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  font-size: 17px; font-weight: 800; font-stretch: 72%; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--ink-2); background: var(--rule); cursor: pointer;
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%);
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.seg label:active { transform: scale(0.97); }
.seg input:checked + label { background: var(--ink); color: var(--surface); transform: rotate(-1deg); }
.seg input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: 2px; }


main .wrap { padding-block: 20px calc(96px + var(--timer-h, 0px) + env(safe-area-inset-bottom, 0px)); }
.panel { display: grid; gap: 20px; }
.panel[hidden] { display: none; }
h2 { font-size: 30px; line-height: 1; font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: 0.01em; margin: 0; text-wrap: balance; }
.panel-head h2 { justify-self: start; background: var(--ink); color: var(--surface); padding: 9px 16px 7px; transform: rotate(-0.8deg); transform-origin: left center;
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%); }
.note h3 { justify-self: start; font-size: 18px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .02em; background: var(--rule); color: var(--ink); padding: 5px 10px 4px; transform: rotate(-0.8deg); transform-origin: left center;
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%); }
h3 { font-size: 19px; line-height: 1.2; font-weight: 700; margin: 0; text-wrap: balance; }
.lede { margin: 6px 0 0; color: var(--ink-2); max-width: 62ch; }
.sub { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--ink-2); }
p { margin: 0; max-width: 65ch; }
.panel-head { display: grid; gap: 6px; }

/* The wall */
.wall {
  position: relative; border-radius: 4px; overflow: hidden;
  background-color: var(--wall);
  background-image:
    radial-gradient(circle at 50% 50%, var(--tnut) 1.3px, transparent 1.8px),
    linear-gradient(to right, transparent calc(50% - 1px), var(--seam) calc(50% - 1px), var(--seam) calc(50% + 1px), transparent calc(50% + 1px));
  background-size: 22px 22px, 100% 100%;
  background-position: 11px 11px, 0 0;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0;
}
.wall-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 14px 14px 0; }
.wall-head .tape { --c: var(--ink); --t: var(--surface); font-size: 19px; padding: 8px 14px 7px; }
.wall-head .when { font-size: 15px; font-weight: 700; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.03em; }
.route { display: block; width: 100%; height: auto; max-height: 360px; padding: 6px 8px 4px; }
.route .hold { transition: fill 200ms var(--ease-out); }
.route text { font-family: var(--f-sans); font-stretch: 72%; font-weight: 800; letter-spacing: .02em; }

.legend { display: grid; background: var(--surface); border-top: 1px solid var(--rule); }
.leg-link {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 14px; text-decoration: none; border-top: 1px solid var(--rule);
  transition: background-color 160ms var(--ease-out);
}
.leg-link:first-child { border-top: 0; }
.leg-link svg { width: 30px; height: 30px; color: var(--c); }
.leg-link b { font-size: 18px; font-weight: 700; line-height: 1.15; display: block; }
.leg-link small { font-size: 14px; color: var(--ink-2); display: block; }
.leg-link .mins { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.leg-link .prog { font-size: 14px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.leg-link.topped .prog { color: var(--ink); }
.leg-link:active { background: var(--raised); }
.wall-foot .btn { min-height: 48px; }
.wall-foot { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 10px 14px 14px; background: var(--surface); border-top: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); }
.linkbtn { appearance: none; border: 0; background: none; padding: 8px 0; cursor: pointer; font: 600 15px/1.2 var(--f-sans); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* A part of the session: tape tag + hold rows */
.leg { scroll-margin-top: 64px; display: grid; }
.leg-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "tape . count" "meta meta meta"; align-items: center; gap: 6px 12px; padding: 0 0 10px; }
.leg-head .tape { grid-area: tape; }
.leg-head .count { grid-area: count; }
.leg-head .meta-row { grid-area: meta; }
.tape .tp { display: none; align-items: center; gap: 6px; padding-left: 10px; margin-left: 2px; border-left: 2px solid currentColor; }
.tape .tp svg { width: 16px; height: 16px; }
.leg.topped .tape .tp { display: inline-flex; }
.leg-foot { display: flex; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--rule); }
.leg-foot[hidden] { display: none; }
.leg-head .tape { font-size: 22px; padding: 9px 16px 8px; transform: rotate(-0.8deg); transform-origin: left center; }
.leg-head .meta { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.count { font-size: 15px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.clear {
  appearance: none; border: 1.5px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  font: 600 14px/1 var(--f-sans); min-height: 44px; min-width: 72px; padding: 0 12px; border-radius: 2px; cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.clear:active { transform: scale(0.97); }
.ex-list { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }

.ex { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 2px 12px; padding: 14px 16px; border-top: 1px solid var(--rule); align-items: start; }
.ex:first-child { border-top: 0; }

.ex.next .ex-name { font-size: 23px; }
.ex.next .ex-rx { font-size: 22px; }
.ex.next .ex-rx small { font-size: 15px; }
.ex-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 18px; font-weight: 700; line-height: 1.25; cursor: pointer; }
.ex.done .ex-name { color: var(--ink-2); font-weight: 600; }
.ex-rx { text-align: right; font-size: 17px; font-weight: 700; font-stretch: 85%; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex-rx small { display: block; font-size: 13px; font-weight: 500; font-stretch: 100%; color: var(--ink-2); }
.ex-cue { grid-column: 2 / 4; font-size: 15px; color: var(--ink-2); line-height: 1.45; margin-top: 2px; max-width: 65ch; }
.ex-links { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.tag { font-size: 12px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .04em; line-height: 1; padding: 4px 6px 3px; border-radius: 2px; }
.tag.next { background: var(--ink); color: var(--surface); }
.tag.note { background: #E3A21A; color: #1C1303; border-radius: 0; clip-path: polygon(0 6%, 3px 0, calc(100% - 2px) 4%, 100% 50%, calc(100% - 3px) 100%, 2px 94%, 0 60%); }

/* Hold checkbox: coloured hold to do, chalked hold done */
.hold-check { position: relative; width: 36px; height: 36px; margin-top: -4px; }
.hold-check input { position: absolute; inset: -4px; width: 44px; height: 44px; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.hold-check svg.h { position: absolute; inset: 0; width: 36px; height: 36px; color: var(--c); transition: color 180ms var(--ease-out), transform 160ms var(--ease-out); }
.hold-check svg.ok { position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; color: var(--ink); opacity: 0; transform: scale(.9); transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out); }
.hold-check input:checked ~ svg.h { color: var(--chalk); animation: chalk 280ms var(--ease-out); }
@keyframes chalk { 0% { transform: scale(.82); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.hold-check input:checked ~ svg.ok { opacity: 1; transform: scale(1); color: #14181C; }
.hold-check input:active ~ svg.h { transform: scale(.92); }
.hold-check input:focus-visible ~ svg.h { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 50%; }

.vid { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; min-height: 32px; }
.vid svg { width: 16px; height: 16px; flex: 0 0 auto; }
.vid span { text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.vid.search { color: var(--ink-2); }

.note { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 16px; display: grid; gap: 10px; }
.note ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.note li { max-width: 65ch; }
.note.gate { background: var(--raised); }

.tt { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.tt-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; padding: 12px 16px; border-top: 1px solid var(--rule); }
.tt-row:first-child { border-top: 0; }
.tt-time { justify-self: start; align-self: start; font-size: 18px; font-weight: 800; font-stretch: 72%; font-variant-numeric: tabular-nums; background: var(--rule); padding: 4px 8px 3px; transform: rotate(-1deg);
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%); }
.tt-row b { display: block; font-weight: 700; }
.tt-row span { color: var(--ink-2); font-size: 15px; }

.lights { display: grid; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.light { padding: 14px 16px; display: grid; gap: 6px; border-top: 1px solid var(--rule); }
.light:first-child { border-top: 0; }
.light b { justify-self: start; font-size: 17px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .02em; padding: 5px 10px 4px; transform: rotate(-0.8deg);
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%); }
.light.g b { background: #1D7A3E; color: #FFFFFF; }
.light.y b { background: #E3A21A; color: #1C1303; }
.light.r b { background: #B3261E; color: #FFFFFF; }
section > .light.r { background: var(--surface); border: 2px solid var(--bad); border-radius: 4px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.marklist { list-style: none; padding: 0 !important; }
.marklist li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; align-items: start; }
.marklist svg { width: 18px; height: 18px; margin-top: 3px; }
.marklist.no svg { color: var(--bad); }
.marklist.yes svg { color: var(--ok); }

.gear { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.g-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 14px 16px; border-top: 1px solid var(--rule); }
.g-row:first-child { border-top: 0; }
.g-row b { font-weight: 700; }
.g-row .when { justify-self: end; align-self: start; font-size: 14px; font-weight: 800; font-stretch: 72%; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); white-space: nowrap; background: var(--rule); padding: 4px 8px 3px; transform: rotate(-1deg);
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%); }
.g-row span:last-child { grid-column: 1 / 3; color: var(--ink-2); font-size: 15px; }
footer { margin-top: 28px; color: var(--ink-2); font-size: 14px; }

@media (min-width: 680px) {
  .wall { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 20px; padding-right: 20px; background-size: 22px 22px, 320px 100%; background-repeat: repeat, no-repeat; }
  .wall-head { grid-column: 1 / 3; }
  .route { max-height: 440px; grid-row: 2 / 5; }
  .legend { grid-column: 2; grid-row: 2; align-self: start; margin-top: 12px; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
  .wall-foot { grid-column: 2; grid-row: 3; align-self: start; margin-top: 10px; border: 1px solid var(--rule); border-radius: 4px; }
}
@media (max-width: 520px) {
  .seg { width: 100%; }
  .seg label { flex: 1; }
        .two { grid-template-columns: 1fr; }
  h2 { font-size: 28px; }
}
@media (hover: hover) and (pointer: fine) {
  .vid:hover span { text-decoration-color: currentColor; }
  .leg-link:hover { background: var(--raised); }
  .clear:hover { border-color: var(--ink-2); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; animation: none !important; }
  html { scroll-behavior: auto !important; }
}


/* ---------- App shell ---------- */
.appbar { position: sticky; top: 0; z-index: 12; background: var(--surface); border-bottom: 1px solid var(--rule); padding-top: env(safe-area-inset-top, 0px); }
.appbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; padding-block: 6px; }
.appbar .brand h1 { font-size: 20px; }
.stage-chip { appearance: none; border: 0; cursor: pointer; font: 800 16px/1 var(--f-sans); font-stretch: 72%; text-transform: uppercase; letter-spacing: .03em;
  background: var(--ink); color: var(--surface); padding: 9px 12px 8px; min-height: 40px; transform: rotate(-1deg);
  clip-path: polygon(0 6%, 4px 0, calc(100% - 3px) 4%, 100% 50%, calc(100% - 4px) 100%, 3px 94%, 0 60%); }
.stage-chip:active { transform: rotate(-1deg) scale(.97); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 14; background: var(--surface); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom, 0px); }
.nav .wrap { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav button { appearance: none; border: 0; background: none; cursor: pointer; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 58px; padding: 6px 2px 4px; position: relative;
  font: 600 12px/1 var(--f-sans); color: var(--ink-2); transition: color 160ms var(--ease-out); }
.nav button svg { width: 24px; height: 24px; }
.nav button[aria-current="page"] { color: var(--ink); }
.nav button[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; background: var(--ink); }
.nav button:active svg { transform: scale(.92); }
.nav button:focus-visible { outline-offset: -4px; }
@media (min-width: 760px) {
  .nav { position: sticky; top: calc(57px + env(safe-area-inset-top, 0px)); bottom: auto; border-top: 0; border-bottom: 1px solid var(--rule); padding-bottom: 0; z-index: 11; }
  .nav .wrap { display: flex; gap: 4px; }
  .nav button { grid-auto-flow: column; gap: 8px; min-height: 48px; padding: 0 12px; font-size: 15px; }
  .nav button svg { width: 20px; height: 20px; }
  .nav button[aria-current="page"]::before { top: auto; bottom: 0; left: 10px; right: 10px; }
  main .wrap { padding-bottom: calc(48px + var(--timer-h, 0px)); }
}

.btn { appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px;
  font: 800 19px/1 var(--f-sans); font-stretch: 75%; text-transform: uppercase; letter-spacing: .03em; border-radius: 2px;
  background: var(--ink); color: var(--surface); transition: transform 160ms var(--ease-out); }
.btn:active { transform: scale(.97); }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule-strong); }
.btn.small { min-height: 44px; font-size: 16px; padding: 0 14px; }
.btn svg { width: 20px; height: 20px; }
.btn[disabled] { opacity: .45; cursor: default; }

/* Session bar on Today */
.session { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 12px 14px; }
.session .clock { display: grid; gap: 2px; }
.session .clock b { font-size: 28px; font-weight: 800; font-stretch: 75%; font-variant-numeric: tabular-nums; line-height: 1; }
.session .clock small { font-size: 13px; color: var(--ink-2); }
.session p { font-size: 15px; color: var(--ink-2); }
.summary { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 16px; }
.summary .tape { font-size: 22px; }
.summary dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.summary dt { font-size: 13px; color: var(--ink-2); }
.summary dd { margin: 0; font-size: 22px; font-weight: 800; font-stretch: 80%; font-variant-numeric: tabular-nums; }

/* Set logging */
.ex-hint { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 14px; color: var(--ink-2); margin-top: 6px; }
.ex-hint .up { font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .03em; font-size: 14px; background: var(--ink); color: var(--surface); padding: 4px 8px 3px;
  clip-path: polygon(0 6%, 3px 0, calc(100% - 2px) 4%, 100% 50%, calc(100% - 3px) 100%, 2px 94%, 0 60%); }
.sets { grid-column: 2 / 4; display: grid; gap: 6px; margin-top: 10px; }
.set { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr) 48px; align-items: center; gap: 8px; }
.set.nokg { grid-template-columns: 44px minmax(0, 1fr) 48px; }
.set-n { font-size: 14px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.fld { position: relative; display: block; }
.fld input { width: 100%; min-height: 48px; padding: 0 44px 0 12px; border: 1.5px solid var(--rule-strong); border-radius: 2px; background: var(--surface); color: var(--ink);
  font: 700 20px/1 var(--f-sans); font-stretch: 85%; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.fld input::-webkit-outer-spin-button, .fld input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fld input::placeholder { color: var(--ink-2); opacity: 1; font-weight: 500; }
.fld input:focus { outline: none; border-color: var(--ink); }
.fld span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 600; color: var(--ink-2); pointer-events: none; }
.set-done { appearance: none; width: 48px; height: 48px; border: 1.5px solid var(--rule-strong); border-radius: 2px; background: var(--surface); color: var(--ink-2); cursor: pointer; display: grid; place-items: center;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out), transform 160ms var(--ease-out); }
.set-done svg { width: 22px; height: 22px; }
.set-done:active { transform: scale(.94); }
.set-done[aria-pressed="true"] { background: var(--c); border-color: var(--c); color: var(--t); }
.set.is-done .fld input { border-color: var(--rule); color: var(--ink-2); }

/* Rest timer sheet */
.timer { position: fixed; left: 0; right: 0; bottom: calc(59px + env(safe-area-inset-bottom, 0px)); z-index: 13; background: var(--ink); color: var(--surface); }
.timer[hidden] { display: none; }
.timer .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding-block: 10px 12px; }
.timer .t-label { grid-column: 1 / 3; font-size: 13px; font-weight: 600; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer .t-time { font-size: 44px; font-weight: 800; font-stretch: 72%; line-height: 1; font-variant-numeric: tabular-nums; }
.timer .t-btns { display: flex; gap: 6px; }
.timer .t-btns button { appearance: none; border: 1.5px solid currentColor; background: transparent; color: inherit; min-width: 52px; min-height: 44px; padding: 0 10px; border-radius: 2px; cursor: pointer;
  font: 700 16px/1 var(--f-sans); font-variant-numeric: tabular-nums; transition: transform 160ms var(--ease-out); }
.timer .t-btns button:active { transform: scale(.95); }
.timer .t-bar { grid-column: 1 / 3; height: 4px; background: rgba(127,127,127,.35); overflow: hidden; }
.timer .t-bar i { display: block; height: 100%; background: var(--c, var(--c-a)); transform-origin: left center; transition: transform 250ms linear; }
.timer.go { background: var(--c, var(--c-a)); color: var(--t, var(--t-a)); }
@media (min-width: 760px) { .timer { bottom: 0; } }

/* History */
.week { display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 16px; }
.week-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.week-holds { display: flex; gap: 6px; }
.week-holds svg { width: 40px; height: 40px; }
.week b.big { font-size: 34px; font-weight: 800; font-stretch: 72%; line-height: 1; font-variant-numeric: tabular-nums; }
.week p { color: var(--ink-2); font-size: 15px; }
.cal { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 12px; display: grid; gap: 8px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head h3 { font-size: 18px; font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .02em; }
.icon-btn { appearance: none; border: 1.5px solid var(--rule-strong); background: var(--surface); color: var(--ink); width: 44px; height: 44px; border-radius: 2px; cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-grid .dow { font-size: 12px; font-weight: 700; color: var(--ink-2); text-align: center; padding: 4px 0; }
.cal-grid .day { position: relative; aspect-ratio: 1 / 1; max-width: 100%; display: grid; place-items: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); border-radius: 2px; }
.cal-grid .day.today { box-shadow: inset 0 0 0 2px var(--ink); color: var(--ink); }
.cal-grid .day.out { visibility: hidden; }
.cal-grid .day svg { position: absolute; inset: 2%; width: 96%; height: 96%; }
.cal-grid .day.has span { font-size: 13px; transform: translateY(-1px); }
.cal-grid .day.has span { position: relative; color: var(--t); font-weight: 800; }
.legend-inline { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.legend-inline svg { width: 18px; height: 18px; }
.sess-list { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.sess { border-top: 1px solid var(--rule); }
.sess:first-child { border-top: 0; }
.sess summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; min-height: 60px; }
.sess summary::-webkit-details-marker { display: none; }
.sess summary svg { width: 30px; height: 30px; }
.sess summary b { display: block; font-size: 17px; }
.sess summary small { display: block; font-size: 14px; color: var(--ink-2); }
.sess summary .dur { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sess-body { padding: 0 14px 14px 56px; display: grid; gap: 6px; font-size: 15px; }
.sess-body div { display: flex; justify-content: space-between; gap: 12px; }
.sess-body span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.empty { background: var(--surface); border: 1.5px dashed var(--rule-strong); border-radius: 4px; padding: 20px 16px; color: var(--ink-2); display: grid; gap: 6px; }
.empty b { color: var(--ink); font-size: 17px; }

/* Settings */
.settings { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--rule); min-height: 60px; }
.s-row:first-child { border-top: 0; }
.s-row b { display: block; font-weight: 700; }
.s-row small { display: block; font-size: 14px; color: var(--ink-2); max-width: 46ch; }
.s-row select { min-height: 44px; padding: 0 10px; border: 1.5px solid var(--rule-strong); border-radius: 2px; background: var(--surface); color: var(--ink); font: 700 16px/1 var(--f-sans); }
.switch { position: relative; width: 52px; height: 32px; flex: 0 0 auto; }
.switch input { position: absolute; inset: -6px; width: 64px; height: 44px; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--rule-strong); transition: background-color 160ms var(--ease-out); }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); transition: transform 160ms var(--ease-out); }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px var(--bad); }
.btn.danger.armed { background: var(--bad); color: #fff; }

/* Install card */
.install { display: grid; gap: 10px; }
.install ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

/* Plan tab */
.plan-switch { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.plan-switch .seg { flex: 0 0 auto; }
.is-current { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.ex.static { grid-template-columns: 36px minmax(0, 1fr) auto; }
.ex.static .hold-deco { width: 36px; height: 36px; color: var(--c); }

.toast { position: fixed; left: 50%; bottom: calc(76px + var(--timer-h, 0px) + env(safe-area-inset-bottom, 0px)); z-index: 30; transform: translateX(-50%); background: var(--ink); color: var(--surface);
  padding: 12px 16px; border-radius: 2px; font-weight: 600; font-size: 15px; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.25);
  opacity: 0; transform: translate(-50%, 8px); pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 760px) { .toast { bottom: calc(24px + var(--timer-h, 0px)); } }
