/* Layout idea: a pocket gym logbook with a scoreboard. One thumb-wide column; weights, reps and the
   workout clock are set in a tall athletic display face; everything else stays quiet so the numbers lead.
   Blue marks what you logged, orange marks the muscles doing the work and anything that is a new best. */
@font-face { font-family: "Big Shoulders Display"; src: url("fonts/big-shoulders.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
:root {
  color-scheme: light;
  --bg: #e9edf2; --surface: #fbfcfd; --surface-2: #f0f3f7; --ink: #0f1722; --ink-2: #465264; --muted: #6b7786;
  --line: #dde2e9; --line-strong: #c2cad4;
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-soft: #e1ecfa; --on-accent: #ffffff;
  --hot: #eb6834; --hot-ink: #b0441a; --hot-soft: #fdeae0; --series-2: #eb6834;
  --good: #0ca30c; --good-ink: #006300; --good-soft: #e2f4e2; --bad: #c93636;
  --board: #0f1722; --board-ink: #f3f6f9; --board-dim: #9aa7b6; --board-line: #2a3646;
  --fig: #1c2530; --fig-far: #98a2af; --equip: #b6bfca; --pad: #cbd2db; --weight: #5d6875; --illo-bg: #f0f3f7;
  --shadow: 0 10px 30px rgba(15, 23, 34, 0.16);
  --font-display: "Big Shoulders Display", "Big Shoulders", "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --radius: 14px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-app-theme="light"]) {
  color-scheme: dark;
  --bg: #0c1117; --surface: #151b23; --surface-2: #1d2530; --ink: #eef1f5; --ink-2: #b7c0cc; --muted: #8792a0;
  --line: #27303b; --line-strong: #3a4654;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #15283f; --on-accent: #ffffff;
  --hot: #e8703a; --hot-ink: #f29a70; --hot-soft: #38210f; --series-2: #d95926;
  --good: #0ca30c; --good-ink: #46c646; --good-soft: #12301a; --bad: #e66767;
  --board: #1b2940; --board-ink: #f3f6f9; --board-dim: #a3b3c7; --board-line: #2f4059;
  --fig: #e7ebf0; --fig-far: #6b7684; --equip: #4d5866; --pad: #3b4551; --weight: #aab4c0; --illo-bg: #1d2530;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"]:not([data-app-theme="light"]) {
  color-scheme: dark;
  --bg: #0c1117; --surface: #151b23; --surface-2: #1d2530; --ink: #eef1f5; --ink-2: #b7c0cc; --muted: #8792a0;
  --line: #27303b; --line-strong: #3a4654;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #15283f; --on-accent: #ffffff;
  --hot: #e8703a; --hot-ink: #f29a70; --hot-soft: #38210f; --series-2: #d95926;
  --good: #0ca30c; --good-ink: #46c646; --good-soft: #12301a; --bad: #e66767;
  --board: #1b2940; --board-ink: #f3f6f9; --board-dim: #a3b3c7; --board-line: #2f4059;
  --fig: #e7ebf0; --fig-far: #6b7684; --equip: #4d5866; --pad: #3b4551; --weight: #aab4c0; --illo-bg: #1d2530;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
:root[data-app-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1117; --surface: #151b23; --surface-2: #1d2530; --ink: #eef1f5; --ink-2: #b7c0cc; --muted: #8792a0;
  --line: #27303b; --line-strong: #3a4654;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #15283f; --on-accent: #ffffff;
  --hot: #e8703a; --hot-ink: #f29a70; --hot-soft: #38210f; --series-2: #d95926;
  --good: #0ca30c; --good-ink: #46c646; --good-soft: #12301a; --bad: #e66767;
  --board: #1b2940; --board-ink: #f3f6f9; --board-dim: #a3b3c7; --board-line: #2f4059;
  --fig: #e7ebf0; --fig-far: #6b7684; --equip: #4d5866; --pad: #3b4551; --weight: #aab4c0; --illo-bg: #1d2530;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.45; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.05; margin: 0; text-wrap: balance; letter-spacing: 0.01em; }
h1 { font-size: 1.6rem; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
h2 { font-size: 1.7rem; text-transform: uppercase; }
h3 { font-size: 1.3rem; text-transform: uppercase; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.num { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

.app { min-height: 100%; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; }
.bar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: calc(10px + var(--safe-t)) 16px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.bar-r { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sync { font-size: 0.78rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; }
.sync i { flex: none; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync[data-s="synced"] i { background: var(--good); }
.sync[data-s="syncing"] i { background: var(--accent); }
.sync[data-s="pending"] i { background: var(--hot); }
.icon-btn { appearance: none; border: 0; background: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); padding: 0; flex: none; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: var(--surface-2); }

/* workout scoreboard */
.wbar { position: sticky; top: 0; z-index: 21; background: var(--board); color: var(--board-ink); padding: calc(8px + var(--safe-t)) 12px 0 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0 10px; }
.wbar-main { appearance: none; border: 0; background: none; color: inherit; text-align: left; padding: 2px 0; min-width: 0; display: flex; flex-direction: column; }
.wbar-name { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; text-transform: uppercase; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wbar-sub { font-size: 0.8rem; color: var(--board-dim); white-space: nowrap; }
.wbar-clock { appearance: none; border: 0; background: none; color: inherit; font-family: var(--font-display); font-weight: 800; font-size: 2.3rem; line-height: 1; font-variant-numeric: tabular-nums; padding: 2px 4px; min-width: 96px; text-align: right; letter-spacing: 0.02em; }
.wbar-fin { appearance: none; border: 0; background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.04em; border-radius: 10px; padding: 0 14px; min-height: 40px; }
.wbar-fin:disabled { opacity: 0.4; }
.wbar-prog { grid-column: 1 / -1; display: flex; gap: 5px; padding: 8px 0 9px; margin-right: 4px; }
.wbar-prog span { display: flex; gap: 2px; flex: 1 1 0; min-width: 0; }
.wbar-prog i { flex: 1 1 0; height: 5px; border-radius: 2px; background: var(--board-line); min-width: 2px; }
.wbar-prog i.on { background: var(--accent); }
.wbar-prog i.pr { background: var(--hot); }

main { flex: 1; padding: 16px 16px 28px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tabs { position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tab { appearance: none; border: 0; background: none; padding: 11px 4px 12px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-top: 3px solid transparent; margin-top: -1px; }
.tab[aria-current="page"] { color: var(--ink); border-top-color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.label { font-size: 0.8rem; color: var(--muted); font-weight: 600; letter-spacing: 0.01em; }
.sub { color: var(--ink-2); font-size: 0.925rem; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.btn { appearance: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 10px 16px; min-height: 46px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:active { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 12px 20px; min-height: 54px; }
.btn.primary:active { filter: brightness(0.92); }
.btn.block { width: 100%; }
.btn.quiet { border-color: transparent; background: none; color: var(--accent-ink); padding: 8px 6px; min-height: 42px; }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: 0.925rem; border-radius: 10px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.chip { appearance: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 99px; padding: 7px 14px; min-height: 38px; font-size: 0.925rem; font-weight: 500; white-space: nowrap; flex: none; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; border: 1px solid var(--line); }
.seg button { appearance: none; border: 0; background: none; border-radius: 9px; min-height: 38px; font-weight: 600; font-size: 0.925rem; color: var(--ink-2); padding: 4px 8px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 34, 0.18); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { font-size: 0.82rem; background: var(--surface-2); border-radius: 99px; padding: 3px 10px; color: var(--ink-2); white-space: nowrap; }
.pill.hot { background: var(--hot-soft); color: var(--hot-ink); font-weight: 600; }
.pill.good { background: var(--good-soft); color: var(--good-ink); font-weight: 600; }
.foot { color: var(--muted); font-size: 0.8rem; }

/* home: week strip */
.week { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.day i { width: 100%; max-width: 30px; aspect-ratio: 1; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; font-style: normal; }
.day.done i { background: var(--accent); }
.day.done.extra i { background: var(--series-2); }
.day.today i { box-shadow: inset 0 0 0 2px var(--ink); }
.day svg { width: 60%; height: 60%; stroke: var(--on-accent); fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.week-n { text-align: right; line-height: 1.1; }
.week-n b { font-family: var(--font-display); font-size: 2rem; font-weight: 800; display: block; }
.week-n span { font-size: 0.78rem; color: var(--ink-2); }

/* home: next session */
.next { gap: 14px; }
.next-title { font-family: var(--font-display); font-weight: 900; font-size: 3.4rem; text-transform: uppercase; line-height: 0.92; letter-spacing: 0.005em; overflow-wrap: anywhere; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.strip .illo { border-radius: 10px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li + li { border-top: 1px solid var(--line); }
.list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.item { appearance: none; border: 0; background: none; width: 100%; text-align: left; padding: 12px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; align-items: center; min-height: 56px; }
.item b { font-weight: 600; overflow-wrap: anywhere; }
.item small { color: var(--ink-2); font-size: 0.85rem; }
.chev { color: var(--muted); font-size: 1.3rem; padding: 0 4px 0 8px; }

/* workout */
.draft-head { display: flex; flex-direction: column; gap: 10px; }
.date-in, .text-in { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 6px 10px; min-height: 44px; font-size: 16px; min-width: 0; }
.text-in { width: 100%; }
.warm { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: 0.9rem; color: var(--ink-2); }
.warm b { color: var(--ink); }
.group-tag { font-size: 0.82rem; color: var(--ink-2); font-weight: 600; padding-left: 12px; border-left: 3px solid var(--accent); }
.exc { gap: 10px; }
.exc.in-group { border-left: 3px solid var(--accent); }
.exc.all-done { border-color: var(--accent); }
.exc-head { display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.thumb { appearance: none; border: 0; background: var(--illo-bg); border-radius: 12px; padding: 0; width: 60px; height: 60px; overflow: hidden; flex: none; }
.thumb svg, .illo svg { display: block; width: 100%; height: 100%; }
.exc-name { font-weight: 700; font-size: 1.08rem; line-height: 1.25; overflow-wrap: anywhere; }
.exc-n { font-family: var(--font-display); font-weight: 800; color: var(--ink-2); background: var(--surface-2); border-radius: 6px; padding: 1px 6px 0; margin-right: 7px; font-size: 0.98rem; display: inline-block; min-width: 24px; text-align: center; letter-spacing: 0.03em; position: relative; top: -1px; }
.exc-target { color: var(--ink-2); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.last { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.last-sets { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.last-hint { font-size: 0.875rem; color: var(--ink-2); }
.last-hint.up { color: var(--good-ink); font-weight: 600; }
.sets { display: flex; flex-direction: column; gap: 8px; }
.set { display: grid; grid-template-columns: 22px minmax(0, 1fr) 14px minmax(0, 1fr) 50px; gap: 8px; align-items: center; }
.set.one { grid-template-columns: 22px minmax(0, 1fr) 50px; }
.set-n { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; color: var(--muted); text-align: center; }
.set-x { color: var(--muted); text-align: center; }
.field { position: relative; }
.field input { width: 100%; height: 50px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; text-align: center; padding: 0 30px 0 8px; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.field input::placeholder { color: var(--muted); opacity: 0.5; }
.field span { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 0.72rem; color: var(--muted); font-weight: 600; pointer-events: none; }
.set.done .field input { background: var(--accent-soft); border-color: transparent; }
.set.pr .field input { background: var(--hot-soft); }
.tick { appearance: none; width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; padding: 0; }
.tick svg { width: 24px; height: 24px; stroke: var(--line-strong); fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.set.done .tick { background: var(--accent); border-color: var(--accent); }
.set.done .tick svg { stroke: var(--on-accent); }
.set.pr .tick { background: var(--hot); border-color: var(--hot); }
.set.pr .tick svg { fill: var(--on-accent); stroke: var(--on-accent); stroke-width: 1.5; }
.tick.pop { animation: pop 0.32s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { 0% { transform: scale(0.72); } 100% { transform: scale(1); } }
.note-in, .notes-in { width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); padding: 10px 12px; font-size: 16px; }
.notes-in { min-height: 72px; resize: vertical; }
.unit-hint { font-size: 0.8rem; color: var(--muted); }
.add-ex { border: 2px dashed var(--line-strong); background: none; border-radius: var(--radius); min-height: 60px; font-weight: 600; color: var(--accent-ink); display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; appearance: none; }
.add-ex:active { background: var(--surface-2); }

/* rest timer */
.rest { position: sticky; bottom: calc(53px + var(--safe-b)); z-index: 19; margin: 0 16px 8px; background: var(--board); color: var(--board-ink); border-radius: 16px; padding: 8px 8px 8px 10px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.rest svg { width: 44px; height: 44px; flex: none; transform: rotate(-90deg); }
.rest circle { fill: none; stroke-width: 4; }
.rest .trk { stroke: var(--board-line); }
.rest .arc { stroke: var(--accent); stroke-linecap: round; }
.rest.over .arc { stroke: var(--good); }
.rest-main { flex: 1; min-width: 0; line-height: 1.05; }
.rest-main small { font-size: 0.76rem; color: var(--board-dim); display: block; }
.rest-main b { font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rest button { appearance: none; border: 0; background: var(--board-line); color: inherit; min-height: 40px; padding: 0 12px; font-weight: 600; border-radius: 10px; font-size: 0.9rem; }

/* tiles and charts */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.tile b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; line-height: 1; }
.tile b small { font-size: 1.1rem; font-weight: 700; color: var(--ink-2); margin-left: 3px; }
.tile span { color: var(--ink-2); font-size: 0.82rem; line-height: 1.25; display: block; margin-top: 4px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tiles.three .tile b { font-size: 1.9rem; }
.demo { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; font-size: 0.9rem; }
.demo b { font-weight: 700; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart text { font-family: var(--font-body); font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart text.val { fill: var(--ink); font-weight: 700; font-size: 12px; }
.grid { stroke: var(--line); stroke-width: 1; }
.axis { stroke: var(--line-strong); stroke-width: 1; }
.ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ln2 { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.area { fill: var(--accent); opacity: 0.1; }
.dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.dot2 { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.cross { stroke: var(--line-strong); stroke-width: 1; }
.col-core { fill: var(--accent); }
.col-extra { fill: var(--series-2); }
.target { stroke: var(--ink-2); stroke-width: 1; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 0.82rem; line-height: 1.35; max-width: 240px; width: max-content; box-shadow: var(--shadow); }
.tip b { font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.82rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; background: var(--accent); }
.legend i.x { background: var(--series-2); }
.legend i.tk { width: 2px; height: 13px; border-radius: 0; background: var(--ink); }
.legend i.ln-k { width: 14px; height: 2px; border-radius: 0; background: var(--ink-2); }
.legend i.dot-k { width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.mus { display: grid; grid-template-columns: 92px minmax(0, 1fr) 64px; gap: 8px 10px; align-items: center; font-size: 0.875rem; }
.mus-track { position: relative; height: 16px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.mus-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 0 4px 4px 0; }
.mus-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.mus-val { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; text-align: right; }
.mus-val b { color: var(--ink); font-weight: 700; }
.hist { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.hist td { padding: 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
.hist td:first-child { color: var(--ink-2); white-space: nowrap; padding-right: 12px; width: 1%; }
.hist td:last-child { font-variant-numeric: tabular-nums; font-weight: 500; }
.hist td.del { width: 1%; padding-left: 8px; }

/* consistency calendar */
.cal { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 6px; font-size: 0.7rem; color: var(--muted); }
.cal-rows { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; align-items: center; }
.cal-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.cal-grid i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); min-width: 0; }
.cal-grid i.on { background: var(--accent); }
.cal-grid i.x { background: var(--series-2); }
.cal-grid i.now { box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-grid i.future { background: none; }
.cal-months { grid-column: 2; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }

/* milestones */
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; font-size: 0.76rem; line-height: 1.2; color: var(--ink-2); min-width: 0; }
.badge i { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; background: var(--surface-2); color: var(--muted); border: 2px dashed var(--line-strong); }
.badge.got i { background: var(--hot); color: #fff; border: 2px solid var(--hot); }
.badge.got { color: var(--ink); font-weight: 600; }
.badge u { text-decoration: none; display: block; width: 100%; max-width: 70px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.badge u s { display: block; height: 100%; background: var(--accent); }

/* records */
.rec { appearance: none; border: 0; background: none; width: 100%; text-align: left; padding: 10px 0; display: grid; grid-template-columns: minmax(0, 1fr) 64px auto; gap: 10px; align-items: center; }
.rec + .rec { border-top: 1px solid var(--line); }
.rec b { font-weight: 600; display: block; overflow-wrap: anywhere; }
.rec small { color: var(--ink-2); font-size: 0.82rem; }
.rec svg { width: 64px; height: 24px; overflow: visible; }
.rec .num { font-size: 1.5rem; text-align: right; white-space: nowrap; }
.rec .num small { font-family: var(--font-body); font-weight: 500; font-size: 0.72rem; margin-left: 2px; }
.gain { color: var(--good-ink); font-weight: 700; font-size: 0.82rem; }
.body-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.body-form label, .fld { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--ink-2); font-weight: 600; min-width: 0; }
.body-form input, .fld input, .fld select { width: 100%; height: 46px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); padding: 0 10px; font-size: 16px; font-weight: 400; color: var(--ink); min-width: 0; }
.body-form .wide { grid-column: 1 / -1; }
.goal-track { height: 10px; border-radius: 5px; background: var(--accent-soft); overflow: hidden; }
.goal-track i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }

/* library and picker */
.search { position: relative; }
.search input { width: 100%; height: 46px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); padding: 0 12px 0 40px; font-size: 16px; }
.search svg { position: absolute; left: 12px; top: 13px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.lib-head { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; text-transform: uppercase; padding: 14px 0 4px; display: flex; justify-content: space-between; align-items: baseline; }
.lib-head small { font-family: var(--font-body); font-size: 0.8rem; font-weight: 500; color: var(--muted); text-transform: none; }
.lib-row { appearance: none; border: 0; background: none; width: 100%; text-align: left; padding: 8px 0; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; border-top: 1px solid var(--line); min-height: 68px; }
.lib-row .thumb { width: 52px; height: 52px; display: block; }
.lib-row b { font-weight: 600; display: block; line-height: 1.25; overflow-wrap: anywhere; }
.lib-row small { color: var(--ink-2); font-size: 0.82rem; }
.lib-row .plus { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-size: 1.4rem; font-weight: 500; line-height: 1; }
.empty { text-align: center; color: var(--ink-2); padding: 20px 8px; font-size: 0.925rem; }
.illo { background: var(--illo-bg); border-radius: 14px; aspect-ratio: 1; overflow: hidden; }
.b, .b0 { fill: var(--fig); }
.b { stroke: var(--illo-bg); stroke-width: 0.7; }
.tr { stroke: var(--fig); stroke-width: 4; stroke-linejoin: round; }
.f { fill: var(--fig-far); }
.h { fill: var(--hot); }
.e { stroke: var(--equip); fill: none; stroke-linecap: round; }
.ep { stroke: var(--pad); fill: none; stroke-linecap: round; }
.epf { fill: var(--pad); }
.w { stroke: var(--weight); fill: none; stroke-linecap: round; }
.wb { stroke: var(--weight); fill: none; stroke-linecap: butt; }
.wf { fill: var(--weight); }
.wh { fill: var(--illo-bg); }
.c { stroke: var(--weight); fill: none; opacity: 0.7; }
.g { stroke: var(--line-strong); stroke-width: 1; }
.guide { display: flex; flex-direction: column; }
.g-item { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); align-items: start; appearance: none; border-left: 0; border-right: 0; border-bottom: 0; background: none; text-align: left; width: 100%; }
.g-item:first-child { border-top: 0; padding-top: 0; }
.g-name { font-weight: 700; font-size: 1.05rem; line-height: 1.25; }
.g-detail { color: var(--ink-2); font-size: 0.875rem; }
.g-cue { font-size: 0.9rem; color: var(--ink-2); margin-top: 4px; }
.g-meta { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* session editor */
.ed-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.ed-item.linked { border-left: 3px solid var(--accent); }
.ed-top { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.ed-top .thumb { width: 44px; height: 44px; border-radius: 10px; }
.ed-top b { font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.ed-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; }
.stepper { display: inline-grid; grid-template-columns: 40px 34px 40px; align-items: center; border: 1px solid var(--line-strong); border-radius: 12px; height: 46px; overflow: hidden; background: var(--surface); }
.stepper button { appearance: none; border: 0; background: none; height: 100%; font-size: 1.3rem; color: var(--ink-2); padding: 0; }
.stepper button:active { background: var(--surface-2); }
.stepper b { text-align: center; font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; }
.range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; align-items: center; }
.range input { text-align: center; padding: 0 4px; }
.ed-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--ink-2); min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.mini { display: flex; gap: 2px; }

/* sheets */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(8, 10, 14, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 640px; max-height: 92%; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; animation: rise 0.22s ease-out; }
.sheet.tall { height: 92%; }
.sheet > * { flex-shrink: 0; }
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet .illo.big { width: min(260px, 72%); margin: 0 auto; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h2 { min-width: 0; padding-top: 6px; overflow-wrap: anywhere; }
.sheet dl { margin: 0; display: grid; gap: 10px; }
.sheet dt { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.sheet dd { margin: 2px 0 0; color: var(--ink-2); font-size: 0.95rem; }
.sess-entry { padding: 8px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.sess-entry b { font-weight: 600; }
.sess-entry span { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.menu { display: flex; flex-direction: column; }
.menu button { appearance: none; border: 0; background: none; text-align: left; padding: 14px 4px; font-weight: 600; border-top: 1px solid var(--line); min-height: 52px; }
.menu button:first-child { border-top: 0; }
.menu button.danger { color: var(--bad); }
.menu button:disabled { opacity: 0.4; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; }
.setting b { font-weight: 600; display: block; }
.setting small { color: var(--ink-2); font-size: 0.85rem; }
.setting.stack { grid-template-columns: 1fr; }
.switch { appearance: none; width: 52px; height: 32px; border-radius: 16px; background: var(--line-strong); position: relative; border: 0; padding: 0; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.backup { width: 100%; min-height: 110px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 16px; line-height: 1.2; }

/* finish summary */
.done-hero { text-align: center; display: flex; flex-direction: column; gap: 4px; padding: 6px 0 2px; }
.done-hero .big { font-family: var(--font-display); font-weight: 900; font-size: 3.2rem; line-height: 0.95; text-transform: uppercase; }
.done-fun { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-size: 0.925rem; color: var(--ink-2); text-align: center; }
.pr-list { display: flex; flex-direction: column; gap: 6px; }
.pr-list div { display: flex; gap: 10px; align-items: center; background: var(--hot-soft); color: var(--hot-ink); border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: 0.925rem; }
.pr-list svg { width: 18px; height: 18px; fill: var(--hot); flex: none; }
#fx { position: fixed; inset: 0; z-index: 60; pointer-events: none; width: 100%; height: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(120px + var(--safe-b)); transform: translateX(-50%); z-index: 55; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow); max-width: 88%; text-align: center; }
@media (min-width: 560px) { .g-item { grid-template-columns: 132px minmax(0, 1fr); } .badges { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 360px) { #sync-t { display: none; } .bar { gap: 8px; } }
@media (max-width: 380px) { .ed-grid { grid-template-columns: auto minmax(0, 1fr); } .ed-grid > :nth-child(3) { grid-column: 1 / -1; } .mini .icon-btn { width: 34px; } }
@media (max-width: 350px) { .next-title { font-size: 2.8rem; } .wbar-clock { font-size: 2rem; min-width: 84px; } .field input { font-size: 1.5rem; } }
@media (prefers-reduced-motion: reduce) { .sheet, .tick.pop { animation: none; } .switch, .switch::after { transition: none; } }
