@font-face {
    font-family: "Archivo";
    src: url("fonts/archivo-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
}

/* Inked manga page: paper, black ink, one Hunter-licence red. Screentone and speed lines are the only textures. */
:root {
    --paper: #f4f1ea;
    --sheet: #fffdf8;
    --ink: #0f0e0d;
    --ink-2: #57524a;
    --rule: #d3cdc1;
    --rule-strong: #0f0e0d;
    --accent: #d62a1e;
    --accent-soft: #f7dcd7;
    --accent-deep: #7d140d;
    --on-accent: #ffffff;
    --tone: rgb(15 14 13 / 0.18);
    --bar: #0f0e0d;
    --bar-ink: #f4f1ea;
    --bar-ink-2: #9a948a;
    --good: #2f6b2c;
    --warn: #945200;
    --bad: #b3261e;
    --radius: 2px;
    --shadow: 4px 4px 0 var(--ink);
    --tabbar-h: 64px;
    --timer-h: 0px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0e0d0c;
        --sheet: #191715;
        --ink: #f1ede4;
        --ink-2: #a39d92;
        --rule: #34302b;
        --rule-strong: #f1ede4;
        --accent: #ff5a45;
        --accent-soft: #3d1b16;
        --on-accent: #140605;
        --tone: rgb(241 237 228 / 0.13);
        --bar: #000000;
        --good: #8cc084;
        --warn: #e0a54a;
        --bad: #f08b82;
        --shadow: 4px 4px 0 var(--accent);
        --accent-deep: #ffb4a8;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Archivo", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    font-stretch: 100%;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--timer-h) + env(safe-area-inset-bottom) + 32px); }

h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 700; }
h1 { text-wrap: balance; font-size: clamp(1.7rem, 7vw, 2.3rem); font-stretch: 125%; font-weight: 900; line-height: 1; text-transform: uppercase; letter-spacing: -0.005em; }
h2 { font-size: 1rem; font-stretch: 112%; font-weight: 800; }
p { margin: 0; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
img { max-width: 100%; display: block; }
code { font-size: 0.9em; }
small { font-size: 0.8em; }
[hidden] { display: none !important; }

.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 18px; height: 18px; }

.container { max-width: 680px; margin: 0 auto; padding: 8px 20px 0; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-2); font-size: 0.875rem; }
.lede { color: var(--ink-2); margin-top: 8px; max-width: 34em; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; padding: 16px 0 4px; }

/* Masthead: a full-width ink band closed by a red rule */
.masthead {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px max(20px, calc((100% - 640px) / 2));
    background: var(--bar); color: var(--bar-ink);
    border-bottom: 4px solid var(--accent);
}
.masthead__brand {
    display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
    font-stretch: 125%; font-weight: 900; font-size: 1.15rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.masthead__links { display: flex; align-items: center; gap: 18px; font-size: 0.85rem; color: var(--bar-ink-2); }
.masthead__links a { text-decoration: none; }
.masthead__links a[aria-current] { color: var(--bar-ink); box-shadow: inset 0 -2px 0 var(--accent); }
.masthead .linkbtn { color: var(--bar-ink-2); text-decoration: none; }

/* Hanko seal: the brand mark */
.seal {
    display: inline-grid; place-items: center; flex: none;
    width: 30px; height: 30px; border-radius: 3px;
    background: var(--accent); color: #fff;
}
.seal__glyph { width: 68%; height: 68%; fill: currentColor; }

/* Bottom navigation */
.tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 20;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bar);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--bar-ink-2); text-decoration: none; font-size: 0.72rem; font-weight: 700;
}
.tabbar a[aria-current] { color: var(--bar-ink); box-shadow: inset 0 3px 0 var(--accent); }
.tabbar a[aria-current] .icon { color: var(--accent); stroke-width: 2.4; }

/* Sections: a heavy rule and a title, like a ledger heading */
.sheet { padding: 26px 0 6px; }
.sheet__head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    border-top: 3px solid var(--rule-strong); margin-bottom: 12px;
}
/* Titles hang from the rule like a manga caption box */
.sheet__head h2 {
    background: var(--ink); color: var(--paper);
    padding: 5px 12px 4px; font-size: 0.82rem; font-weight: 850;
    text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap;
}
.sheet__head .meta { color: var(--ink-2); font-size: 0.78rem; padding-top: 7px; text-align: right; }
.sheet > .hint { margin-bottom: 12px; }
.sheet > .hint:last-child { margin: 10px 0 0; }

/* Ledger rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
    display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 16px;
    padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.row:last-child { border-bottom: 0; }
.row__label { font-weight: 600; }
.row__value { font-stretch: 62%; font-weight: 800; font-size: 1.5rem; line-height: 1; text-align: right; }
.row__value small { font-size: 0.8rem; font-stretch: 100%; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.row__note { grid-column: 1 / -1; color: var(--ink-2); font-size: 0.85rem; }
.row--link { text-decoration: none; }

/* Figures */
.figure { font-stretch: 62%; font-weight: 850; line-height: 0.85; letter-spacing: -0.01em; }
.figure small { font-stretch: 100%; font-weight: 500; font-size: 0.28em; letter-spacing: 0; color: var(--ink-2); margin-left: 6px; }
.delta-down { color: var(--good); }
.delta-up { color: var(--warn); }

/* Home */
.kicker {
    display: inline-flex; align-items: baseline; gap: 10px;
    font-stretch: 125%; font-weight: 900; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em;
}
.kicker span { color: var(--accent); }
.today { position: relative; isolation: isolate; padding: 22px 0 8px; }
/* Screentone behind the watermark, fading out like manga shading */
.today::before {
    content: ""; position: absolute; top: 0; right: -20px; z-index: -2; pointer-events: none;
    width: 70%; height: 260px;
    background-image: radial-gradient(var(--tone) 1.1px, transparent 1.4px); background-size: 6px 6px;
    -webkit-mask-image: radial-gradient(circle at 75% 35%, #000, transparent 70%);
    mask-image: radial-gradient(circle at 75% 35%, #000, transparent 70%);
}
.today__mark {
    position: absolute; top: 14px; right: -6px; z-index: -1;
    width: min(46vw, 220px); height: min(46vw, 220px); fill: var(--ink); opacity: 0.07;
}
.today__date { color: var(--ink-2); font-size: 0.875rem; margin-top: 2px; }
.today__label { font-weight: 800; margin-top: 16px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; }
.today .figure { font-size: clamp(5.4rem, 30vw, 9rem); margin-top: 4px; }
.today__line { margin-top: 12px; font-size: 1.05rem; max-width: 30em; }
.today__line strong { font-weight: 800; }

.weigh { display: flex; gap: 8px; margin-top: 18px; max-width: 360px; }
.weigh input { flex: 1; font-stretch: 75%; font-size: 1.25rem; font-weight: 700; }

/* Next session: an ink panel with speed lines rushing to the go button */
.next-session {
    position: relative; overflow: hidden; isolation: isolate;
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
    margin: 24px 4px 0 0; padding: 18px 18px 18px 20px; border-radius: var(--radius);
    background: var(--bar); color: var(--bar-ink); text-decoration: none;
    box-shadow: 4px 4px 0 var(--accent);
}
.next-session::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: repeating-conic-gradient(from 0deg at 92% 50%, rgb(244 241 234 / 0.16) 0 1.4deg, transparent 1.4deg 7deg);
    -webkit-mask-image: linear-gradient(90deg, transparent 20%, #000 75%);
    mask-image: linear-gradient(90deg, transparent 20%, #000 75%);
}
.next-session:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--accent); }
.next-session__kicker { display: block; font-size: 0.75rem; color: var(--bar-ink-2); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.next-session__name { display: block; text-wrap: balance; font-stretch: 125%; font-weight: 900; font-size: 1.35rem; line-height: 1.1; margin-top: 4px; text-transform: uppercase; }
.next-session__go {
    width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
    display: grid; place-items: center; border: 3px solid var(--bar-ink);
}

.next-session__sfx {
    position: absolute; right: 64px; top: 50%; z-index: -1; width: 150px; height: 50px;
    transform: translateY(-50%) rotate(-8deg); fill: var(--bar-ink); opacity: 0.12;
}

/* Manga sound effect stamped next to a section title */
.sfx-don {
    width: 74px; height: 32px; margin: -6px auto 0 10px; flex: none;
    fill: var(--accent); transform: rotate(-7deg);
}

/* Nen rank, the four basic principles in learning order */
.rank { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 12px; margin-bottom: 14px; }
.rank__label { grid-column: 1 / -1; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.rank__name { font-stretch: 125%; font-weight: 900; font-size: 1.9rem; line-height: 1.1; text-transform: uppercase; }
.rank--hatsu .rank__name, .rank--ren .rank__name { color: var(--accent); }
.rank__note { font-size: 0.85rem; color: var(--ink-2); }

/* Manga panel: a framed case with a narration box hanging off its corner */
.panel { position: relative; margin: 26px 4px 0 0; }
.panel a { display: block; border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: var(--sheet); }
.panel img { width: 100%; max-height: 70vh; object-fit: cover; }
.panel__caption {
    position: absolute; left: -2px; bottom: -10px; max-width: 85%;
    padding: 6px 12px; background: var(--sheet); color: var(--ink);
    border: 2.5px solid var(--ink); font-weight: 800; font-size: 0.9rem; line-height: 1.3;
}
.panel-empty {
    display: flex; flex-direction: column; gap: 4px; margin: 26px 0 0; padding: 16px;
    border: 2px dashed var(--rule); border-radius: var(--radius); text-decoration: none; color: var(--ink-2);
}
.panel-empty strong { color: var(--ink); font-stretch: 112%; font-weight: 850; text-transform: uppercase; letter-spacing: 0.04em; }

.panels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
.panels__item { display: flex; flex-direction: column; gap: 6px; }
.panels__item a { display: block; border: 2.5px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.panels__item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.panels__caption { font-size: 0.85rem; font-weight: 700; }

/* Body maps */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.body-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 360px; margin: 0 auto; }
.body { width: 100%; height: auto; display: block; }
.body__outline { fill: var(--sheet); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.body__m path { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; transition: fill 0.2s; }
a.body__m:hover path, a.body__m:focus-visible path { stroke-width: 2.4; }
.body__m.is-selected path { stroke: var(--accent); stroke-width: 3; }
.body__m.is-primary path, .body__m.lvl-ok path { fill: var(--accent); }
.body__m.is-secondary path, .body__m.lvl-low path { fill: var(--accent-soft); }
.body__m.lvl-mid path { fill: color-mix(in srgb, var(--accent) 50%, var(--sheet)); }
.body__m.lvl-high path { fill: var(--accent-deep); }

.legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend__swatch { width: 14px; height: 14px; border: 1.5px solid var(--ink); background: var(--paper); }
.legend__swatch.lvl-low { background: var(--accent-soft); }
.legend__swatch.lvl-mid { background: color-mix(in srgb, var(--accent) 50%, var(--sheet)); }
.legend__swatch.lvl-ok { background: var(--accent); }
.legend__swatch.lvl-high { background: var(--accent-deep); }

.week-map { display: block; }
.week-map .body-pair { max-width: 260px; }
.to-train { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.to-train > span { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); margin-right: 2px; }
.chip {
    display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px;
    border: 2px solid var(--ink); border-radius: 999px; background: var(--sheet);
    font-size: 0.85rem; font-weight: 800; text-decoration: none;
}

.day__map { margin: 4px 0 8px; }
.day__map .body-pair { max-width: 190px; }
.day__map--wide .body-pair { max-width: 230px; }
.focus-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin-top: 10px; font-weight: 700; }
.focus-form { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.muscle-dose { display: flex; align-items: center; gap: 14px; }
.muscle-dose .figure { font-size: 4rem; }

/* Equipment pictograms */
.equip {
    display: inline-grid; place-items: center; flex: none;
    width: 34px; height: 34px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--sheet);
}
.equip .icon { width: 22px; height: 22px; }
.lift.lift--eq { grid-template-columns: auto 1fr auto; column-gap: 12px; }
.lift.lift--eq .equip { grid-row: span 2; align-self: center; }
.lift.lift--eq .lift__rest { grid-column: 2 / -1; }
.lift__dose small { font-size: 0.7em; font-stretch: 100%; color: var(--ink-2); }
.exercise__head h2 { display: flex; align-items: center; gap: 10px; }
.exercise__muscles { font-size: 0.85rem; font-weight: 700; color: var(--accent); margin-top: 6px; }

/* Body fat: the fat layer is a thick stroke behind the lean silhouette */
.fat { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 18px; align-items: center; margin: 4px 0 14px; }
.fat__body { width: 100%; height: auto; overflow: visible; }
.fat__layer {
    --fat: color-mix(in srgb, var(--accent) 38%, var(--sheet));
    fill: var(--fat); stroke: var(--fat); stroke-linejoin: round;
}
.fat__lean { fill: var(--sheet); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.fat__side { display: flex; flex-direction: column; gap: 6px; }
.fat__label { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.fat__value { font-size: 4.2rem; }
.fat__band { font-stretch: 125%; font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent); }
.fat__gauge { position: relative; display: flex; height: 12px; margin: 8px 0 4px; border: 2px solid var(--ink); }
.fat__seg { flex: 1; }
.fat__seg + .fat__seg { border-left: 1.5px solid var(--ink); }
.fat__seg--1 { background: var(--ink-2); }
.fat__seg--2 { background: var(--accent); }
.fat__seg--3 { background: color-mix(in srgb, var(--accent) 55%, var(--sheet)); }
.fat__seg--4 { background: var(--accent-soft); }
.fat__seg--5 { background: var(--sheet); }
.fat__marker {
    position: absolute; top: -8px; bottom: -8px; left: 50%; width: 4px; margin-left: -2px;
    background: var(--ink); box-shadow: 0 0 0 2px var(--paper);
}
.fat__from, .fat__source { font-size: 0.82rem; color: var(--ink-2); }
.fat [data-fat-replay] { align-self: flex-start; font-size: 0.85rem; }

/* Records: each one bursts out of speed lines */
.records { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.record {
    position: relative; overflow: hidden; isolation: isolate;
    display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px;
    padding: 12px 14px; border: 2.5px solid var(--ink); border-radius: var(--radius);
    background: var(--sheet); box-shadow: var(--shadow);
}
.record::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: repeating-conic-gradient(from 0deg at 100% 50%, var(--tone) 0 1.2deg, transparent 1.2deg 5deg);
    -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000);
    mask-image: linear-gradient(90deg, transparent 35%, #000);
}
.record__name { font-weight: 800; }
.record__value { font-stretch: 62%; font-weight: 900; font-size: 1.9rem; line-height: 1; text-align: right; }
.record__value small { font-size: 0.8rem; font-stretch: 100%; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.record__gain { grid-column: 1 / -1; font-size: 0.82rem; color: var(--accent); font-weight: 700; }

.progress { height: 8px; background: var(--rule); border-radius: 0; overflow: hidden; margin-top: 8px; }
progress.progress { width: 100%; appearance: none; border: 0; display: block; }
progress.progress::-webkit-progress-bar { background: var(--rule); }
progress.progress::-webkit-progress-value { background: var(--accent); }
progress.progress::-moz-progress-bar { background: var(--accent); }

.plate { display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; align-items: end; }
.plate .figure { font-size: 3.6rem; }
.macros { display: flex; gap: 20px; flex-wrap: wrap; font-size: 0.95rem; }
.macros b { font-stretch: 75%; font-weight: 650; font-size: 1.35rem; display: block; line-height: 1.1; }
.macros span { color: var(--ink-2); font-size: 0.8rem; }

.advice {
    display: flex; flex-direction: column; gap: 10px; margin-right: 4px;
    padding: 16px; border: 2.5px solid var(--ink); border-radius: var(--radius);
    background: var(--sheet); box-shadow: var(--shadow);
}
.advice h3 { font-size: 1.1rem; font-stretch: 112%; font-weight: 850; }

.weeks { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; }
.weeks__col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.weeks__bar { width: 100%; height: 56px; display: flex; flex-direction: column-reverse; gap: 3px; }
.weeks__tick { height: 100%; border-radius: 0; background: var(--rule); flex: 1; }
.weeks__tick.is-done { background: var(--ink); }
.weeks__tick.is-extra { background: var(--accent); }
.weeks__col--now .weeks__tick:not(.is-done) { background: transparent; outline: 1.5px dashed var(--rule); outline-offset: -1.5px; }
.weeks__label { font-size: 0.72rem; color: var(--ink-2); }

.segment-tabs { display: inline-flex; gap: 14px; font-size: 0.85rem; }
.segment-tabs button {
    border: 0; background: none; padding: 2px 0; font: inherit; color: var(--ink-2); cursor: pointer;
    border-bottom: 2px solid transparent;
}
.segment-tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.chart { min-height: 150px; margin-top: 6px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { fill: var(--ink-2); font-size: 12px; font-family: inherit; font-stretch: 75%; }
.chart .raw { fill: var(--ink); opacity: 0.35; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .last { fill: var(--accent); stroke: var(--paper); stroke-width: 3; }

/* Notices */
.notice { padding: 12px 14px; margin: 12px 0; border-radius: var(--radius); background: var(--sheet); border: 1px solid var(--rule); font-size: 0.95rem; }
.notice ul { margin: 0; padding-left: 18px; }
.notice--ok { border-color: var(--good); }
.notice--warn { border-color: var(--warn); }
.notice--err { border-color: var(--bad); color: var(--bad); }
.notice a { font-weight: 700; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 20px; border: 2px solid var(--ink); border-radius: var(--radius);
    background: var(--ink); color: var(--paper);
    font: inherit; font-weight: 850; font-stretch: 112%; text-transform: uppercase; letter-spacing: 0.04em;
    text-decoration: none; cursor: pointer;
}
.btn:active { transform: translate(2px, 2px); }
.btn--accent { background: var(--accent); border-color: var(--ink); color: var(--on-accent); box-shadow: 3px 3px 0 var(--ink); }
.btn--accent:active { box-shadow: 1px 1px 0 var(--ink); }
.btn--line { background: transparent; color: var(--ink); }
.btn--block { width: 100%; min-height: 56px; font-size: 1.05rem; }
.btn[disabled] { opacity: 0.55; }
.linkbtn {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: 0; padding: 0; font: inherit; font-size: 0.9rem; cursor: pointer;
    color: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px;
}
.linkbtn--danger { color: var(--bad); text-decoration-color: currentColor; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { font-size: 0.85rem; font-weight: 600; padding: 0; }
.field small { color: var(--ink-2); font-size: 0.8rem; }
.field--inline { flex-direction: row; align-items: center; gap: 12px; }
.field--inline input { width: auto; }
input:not([type=radio]):not([type=range]):not([type=file]), select, textarea {
    width: 100%; min-height: 48px; padding: 10px 12px;
    background: var(--sheet); color: var(--ink);
    border: 1.5px solid var(--rule); border-radius: var(--radius);
    font: inherit; font-size: 16px;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
input::placeholder { color: var(--ink-2); opacity: 0.7; }
fieldset.form-part { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }

.segmented { display: flex; gap: 6px; }
.segmented label, .choices label { flex: 1; position: relative; }
.segmented input, .choices input { position: absolute; opacity: 0; }
.segmented span, .choices span {
    display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 12px;
    background: var(--sheet); border: 1.5px solid var(--rule); border-radius: var(--radius);
    font-weight: 700; cursor: pointer; text-align: center;
}
.choices { display: flex; flex-direction: column; gap: 6px; }
.choices span { justify-content: flex-start; text-align: left; }
.segmented input:checked + span, .choices input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span, .choices input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Auth */
.auth { max-width: 380px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 18px; }
.auth__brand {
    display: flex; align-items: center; gap: 16px;
    font-size: 3.4rem; font-stretch: 125%; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase;
}
.auth__brand .seal { width: 64px; height: 64px; border-radius: 5px; box-shadow: var(--shadow); }
.checks { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.checks .is-ok { color: var(--good); }
.checks .is-ko { color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 10px 10px 10px 0; text-align: left; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table th { color: var(--ink-2); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table td.num, .table th.num { text-align: right; }
.table tr:last-child td { border-bottom: 0; }

/* Program */
.day { padding: 4px 0 8px; }
.day__meta { color: var(--ink-2); font-size: 0.85rem; }
.lift { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.lift:last-of-type { border-bottom: 0; }
.lift__name { font-weight: 600; }
.lift__dose { font-stretch: 62%; font-weight: 850; font-size: 1.25rem; text-align: right; }
.lift__rest { grid-column: 1 / -1; color: var(--ink-2); font-size: 0.82rem; }
.flag { font-size: 0.7rem; font-weight: 850; text-transform: uppercase; letter-spacing: 0.08em; background: var(--accent); color: var(--on-accent); padding: 2px 6px; }
.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.rules li::marker { color: var(--accent); }

/* Workout */
.day-switch { display: flex; gap: 18px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; font-size: 0.9rem; }
.day-switch a { flex: none; color: var(--ink-2); text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.day-switch a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 800; }

.exercise { padding: 18px 0 8px; border-top: 3px solid var(--rule-strong); }
.exercise + .exercise { margin-top: 10px; }
.exercise__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.exercise__head h2 { font-size: 1.1rem; font-stretch: 112%; font-weight: 850; }
.exercise__dose { font-stretch: 62%; font-weight: 850; font-size: 1.15rem; white-space: nowrap; }
.exercise__last { color: var(--ink-2); font-size: 0.85rem; margin-top: 4px; }
.exercise__tip { font-size: 0.9rem; margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--accent); font-weight: 600; }

.sets { margin-top: 12px; }
.sets__head, .sets__row { display: grid; grid-template-columns: 30px 1fr 1fr 52px; gap: 8px; align-items: center; }
.sets__head { color: var(--ink-2); font-size: 0.75rem; font-weight: 600; padding-bottom: 4px; }
.sets__row { padding: 5px 0; }
.sets__no { font-stretch: 75%; font-weight: 700; color: var(--ink-2); font-size: 1.1rem; }
.sets__row input { text-align: center; font-stretch: 62%; font-size: 1.35rem !important; font-weight: 800; }
.set-done {
    height: 48px; border-radius: var(--radius); border: 2px solid var(--rule); background: transparent;
    color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.sets__row.is-done input { background: transparent; border-color: transparent; color: var(--ink-2); }
.sets__row.is-done .set-done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.draft-note { font-size: 0.85rem; color: var(--ink-2); margin: 10px 0 14px; }
form[data-workout] > .field--inline { margin-bottom: 10px; }

.timer {
    position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 19;
    background: var(--accent); color: var(--on-accent);
    background-image: radial-gradient(rgb(0 0 0 / 0.16) 1.1px, transparent 1.4px); background-size: 6px 6px;
    border-top: 3px solid var(--bar);
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
    padding: 10px 20px;
}
.timer__time { font-stretch: 62%; font-weight: 900; font-size: 2.6rem; line-height: 1; }
.timer__label { font-size: 0.8rem; opacity: 0.85; }
.timer__actions { display: flex; gap: 6px; }
.timer__actions button {
    min-width: 48px; height: 44px; border-radius: var(--radius); border: 1.5px solid currentColor;
    background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer;
}
.timer.is-over { background-color: var(--bar); color: var(--bar-ink); }

/* Photos */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shot { display: flex; flex-direction: column; gap: 6px; }
.shot__frame {
    position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden;
    background: var(--sheet); border: 2px dashed var(--rule);
    display: grid; place-items: center; color: var(--ink-2);
}
.shot__frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot__name { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.shot__buttons { display: flex; flex-direction: column; gap: 4px; }
.shot__buttons label, .shot__buttons button { font-size: 0.82rem; }
.shot__file { position: relative; overflow: hidden; }
.shot__file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.album a, .album div { position: relative; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; background: var(--sheet); }
.album img { width: 100%; height: 100%; object-fit: cover; }
.album div { border: 1px dashed var(--rule); }

.camera {
    position: fixed; inset: 0; z-index: 50; background: #000; color: #fff;
    display: flex; flex-direction: column;
}
.camera__view { position: relative; flex: 1; overflow: hidden; }
.camera__view video, .camera__ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera__ghost { opacity: 0.35; pointer-events: none; }
.camera__guide { position: absolute; inset: 0; pointer-events: none; }
.camera__guide::before, .camera__guide::after { content: ""; position: absolute; background: rgb(255 255 255 / 0.35); }
.camera__guide::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.camera__guide::after { top: 50%; left: 0; right: 0; height: 1px; }
.camera__count {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-stretch: 62%; font-weight: 700; font-size: 9rem; text-shadow: 0 2px 20px rgb(0 0 0 / 0.5);
}
.camera__bar {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
}
.camera__bar button { background: none; border: 0; color: #fff; font: inherit; font-size: 0.95rem; cursor: pointer; }
.camera__shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff !important; background: rgb(255 255 255 / 0.15) !important; }
.camera__right { display: flex; justify-content: flex-end; gap: 16px; }
.camera__bar [aria-pressed="true"] { color: #ff5a45; }

.compare-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 16px; }
.compare-form .field:first-child { grid-column: 1 / -1; }
.compare {
    --pos: 50%;
    position: relative; aspect-ratio: 3 / 4; max-height: 76vh; margin: 0 auto;
    border-radius: var(--radius); overflow: hidden; background: var(--sheet); touch-action: pan-y;
}
.compare img, .compare__before { position: absolute; inset: 0; width: 100%; height: 100%; }
.compare img { object-fit: cover; }
.compare__before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare__handle {
    position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px;
    background: #fff; pointer-events: none;
}
.compare__handle::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px;
    border-radius: 50%; background: var(--accent); border: 3px solid #fff;
}
.compare__tag {
    position: absolute; bottom: 10px; padding: 3px 10px; border-radius: 0; font-size: 0.72rem; font-weight: 850;
    text-transform: uppercase; letter-spacing: 0.08em;
    background: var(--bar); color: var(--bar-ink); pointer-events: none;
}
.compare__tag--before { left: 10px; }
.compare__tag--after { right: 10px; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }

.log summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none; border-bottom: 1px solid var(--rule); }
.log summary::-webkit-details-marker { display: none; }
.log[open] summary { border-bottom: 0; }
.log__list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.log__list li { display: flex; justify-content: space-between; gap: 12px; }
.log__list span { color: var(--ink-2); text-align: right; }

.empty { padding: 48px 0; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }

@media (max-width: 380px) {
    .grid-2 { grid-template-columns: 1fr; }
    .container, .masthead { padding-left: 16px; padding-right: 16px; }
}
