@import url("palette.css");

/* Bologna Champ — one stylesheet for five tabs.
 *
 * The tokens all come from palette.css. The two engines were written against different token
 * names, so the bridge below points the tracker's names at the brand's; nothing else in either
 * stylesheet had to change. Where both defined the same primitive (.btn, .view, .toast), the
 * reconciliation block at the bottom settles it once, on purpose, rather than by load order.
 */
:root {
  /* the tracker's names, pointed at the brand */
  --bg: var(--page);
  --radius: var(--r);
  --repairing: var(--bad);
  --ready: var(--warn);
  --available: var(--good);
  --silhouette: #222838;

  /* year-coverage ramp: one hue, dark end nearest the page so an untrained region recedes */
  --b0: #46463f;
  --b1: #184f95;
  --b2: #256abf;
  --b3: #3987e5;
  --b4: #6da7ec;
  --b5: #9ec5f4;
}
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 var(--font);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
.tab-root { max-width: 680px; margin: 0 auto; }
.loading { padding: 2.5rem 0; }

* { box-sizing: border-box; }
/* display rules below would otherwise beat the hidden attribute and leave invisible things clickable */
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  padding: 0 16px calc(84px + env(safe-area-inset-bottom)); max-width: 680px; margin: 0 auto;
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 1.5rem; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: .95rem; margin: 0 0 .3rem; }
p { margin: .4rem 0; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.centre { text-align: center; }
.view { padding-top: 18px; }
.top { margin-bottom: 1rem; }

/* buttons */
.btn, .big-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 48px; padding: 0 1rem; border-radius: 12px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #4b8dff, #2f6ee0); border-color: #4b8dff; color: #fff; }
.btn.danger { color: #ff8b7d; border-color: #5a2a26; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.row-btns { display: flex; gap: .5rem; margin: 1rem 0; flex-wrap: wrap; }
.row-btns > * { flex: 1 1 10rem; }
.file-btn { position: relative; }

/* fields */
.field { margin: 1rem 0; border: 0; padding: 0; }
.field > label, .field > legend { display: block; font-weight: 700; font-size: .85rem; color: var(--ink-2); margin-bottom: .35rem; padding: 0; }
select, textarea, input[type="text"] {
  width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; padding: .7rem .8rem; font: inherit; min-height: 48px;
}
textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9rem; line-height: 1.5; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: .5rem .85rem; min-height: 44px; font: inherit; font-weight: 700; cursor: pointer;
}
.chips button.on { background: var(--ink); color: #000; border-color: var(--ink); }

/* legend + bodies */
.legend { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .6rem; }
.legend > * { flex: 1 1 7rem; min-width: 0; }
.legend div {
  flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: .5rem .4rem; text-align: center; line-height: 1.25;
}
.legend b { display: block; font-size: 1.25rem; }
.legend span { font-size: .72rem; color: var(--ink-2); font-weight: 700; letter-spacing: .02em; }
.legend .l-repairing b { color: var(--repairing); }
.legend .l-ready b { color: var(--ready); }
.legend .l-available b { color: var(--available); }

.bodies { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.body-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .2rem .1rem; }
.body-box > p { text-align: center; font-size: .72rem; font-weight: 800; letter-spacing: .12em; color: var(--ink-2); margin: 0 0 .1rem; text-transform: uppercase; }
svg.body { width: 100%; height: auto; display: block; }
svg.body .silhouette { fill: var(--silhouette); pointer-events: none; }
/* Each region is outlined in the page background so two muscles in the same state still read apart. */
svg.body .m { fill: var(--silhouette); stroke: var(--bg); stroke-width: 1.4; stroke-linejoin: round; cursor: pointer; transition: fill .18s ease, opacity .18s ease; }
svg.body .m.s-repairing { fill: var(--repairing); }
svg.body .m.s-ready { fill: var(--ready); }
svg.body .m.s-available { fill: var(--available); }
svg.body .m.dim { opacity: .35; }
svg.body .m:hover, svg.body .m:focus { stroke: var(--ink); outline: none; }
svg.body .m.sel { stroke: var(--ink); stroke-width: 2.5; }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: #000a; }
.sheet {
  position: relative; width: min(680px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px 20px 0 0;
  padding: 1rem 1rem calc(1.4rem + env(safe-area-inset-bottom)); animation: up .22s ease;
}
@keyframes up { from { transform: translateY(16px); opacity: .4; } }
.sheet .grab { width: 44px; height: 4px; border-radius: 2px; background: var(--line); margin: -.3rem auto .7rem; }
.sheet-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.sheet-head h2 { margin: 0; font-size: 1.25rem; }
.state-pill { font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding: .25rem .6rem; border-radius: 999px; }
.state-pill.repairing { background: #3a1b17; color: var(--repairing); }
.state-pill.ready { background: #3a2f12; color: var(--ready); }
.state-pill.available { background: #14341f; color: var(--available); }

.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: .7rem 0 .3rem; }
.meter i { display: block; height: 100%; }
.meter i.repairing { background: var(--repairing); }
.meter i.ready { background: var(--ready); }
.meter i.available { background: var(--available); }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .8rem 0; }
.fact { background: var(--surface-2); border-radius: 10px; padding: .55rem; text-align: center; }
.fact b { display: block; font-size: 1.05rem; }
.fact span { font-size: .7rem; color: var(--ink-2); }

/* lists */
.ex-row {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: .6rem .7rem; margin-bottom: .4rem; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.ex-row b { grid-column: 1; grid-row: 1; font-size: .95rem; }
.ex-row .sub { grid-column: 1; grid-row: 2; font-size: .78rem; color: var(--ink-2); }
.ex-row .val { grid-column: 2; grid-row: 1 / span 2; font-weight: 900; font-size: .95rem; text-align: right; align-self: center; }
.ex-row .val small { display: block; font-weight: 600; font-size: .68rem; color: var(--ink-2); }
.ex-row.flat { cursor: default; }
.tagrow { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .35rem; }
.tag { font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .12rem .4rem; }
.tag.warn { color: var(--ready); border-color: #5a4a18; }
.tag.good { color: var(--available); border-color: #1e4a2c; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; margin-bottom: .6rem; }
.card h3 { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.card .why { font-size: .8rem; color: var(--ink-2); }
.note { border-left: 3px solid var(--ready); background: var(--surface); border-radius: 0 12px 12px 0; padding: .7rem .8rem; margin-bottom: .5rem; font-size: .9rem; }
.note.bad { border-left-color: var(--repairing); }
.note.good { border-left-color: var(--available); }

/* weekly bars */
.vol { display: grid; grid-template-columns: 5.6rem 1fr 2.6rem; gap: .4rem; align-items: center; margin-bottom: .3rem; font-size: .82rem; }
.vol .bar { height: 10px; background: var(--surface-2); border-radius: 5px; position: relative; overflow: hidden; }
.vol .bar i { display: block; height: 100%; background: var(--accent); }
.vol .bar .target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink-2); }
.vol .n { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

/* log */
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: .5rem; }
.day h3 { display: flex; justify-content: space-between; align-items: baseline; }
.day ul { list-style: none; margin: .4rem 0 0; padding: 0; }
.day li { display: flex; justify-content: space-between; gap: .6rem; padding: .3rem 0; border-top: 1px solid var(--line); font-size: .9rem; }
.day li span { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.unknown { border-left: 3px solid var(--ready); padding-left: .6rem; margin-bottom: .5rem; }
.unknown select { margin-top: .3rem; }

/* nav */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #15171bf2; backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; color: var(--ink-2); text-decoration: none; font-size: .7rem; font-weight: 700;
}
.tabs a.on { color: var(--ink); }
.tabs .ico { font-size: 1.1rem; line-height: 1; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom));
  background: var(--ink); color: #000; font-weight: 700; padding: .7rem 1rem; border-radius: 12px;
  z-index: 50; max-width: 90vw; box-shadow: 0 8px 24px #0009;
}
.empty { text-align: center; color: var(--ink-2); padding: 1.6rem .5rem; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* hover readout over the body map */
.tip { position: fixed; z-index: 60; width: min(300px, 86vw); pointer-events: none;
  background: #10131Cf2; backdrop-filter: blur(10px); border: 1px solid var(--line-2, #3A435A);
  border-radius: 12px; padding: .7rem .8rem; box-shadow: 0 14px 40px #000a; }
.tip h4 { margin: 0 0 .25rem; font-size: .98rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tip p { margin: 0 0 .5rem; }
.tip-ex { list-style: none; margin: 0; padding: 0; display: grid; gap: .22rem; }
.tip-ex li { display: flex; justify-content: space-between; gap: .6rem; font-size: .8rem; border-top: 1px solid var(--line); padding-top: .22rem; }
.tip-ex i { color: var(--muted); font-style: normal; font-size: .72rem; }
.tip-ex b { font-variant-numeric: tabular-nums; }
.tip-ex em { color: var(--muted); font-style: normal; font-size: .72rem; }
@media (hover: none) { .tip { display: none !important; } }

/* ---- sync panel (Cloudflare build) ---- */
.sync { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 1rem; margin: 1.2rem 0; display: flex; flex-direction: column; gap: .5rem; }
.sync h3 { margin: 0; font-size: 1rem; }
.sync p { margin: 0; }
.keybox { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.keybox code { font: 600 1.15rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
               letter-spacing: .06em; background: var(--surface-2); border: 1px solid var(--line);
               border-radius: 8px; padding: .5rem .7rem; user-select: all; word-break: break-all; }
.btn.small { padding: .35rem .7rem; font-size: .8rem; }
#keyIn { font: 600 1.05rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }
   /* ROSSOBLÙ — the one palette, shared with the logo */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--page); color: var(--ink); font: 17px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
.view { max-width: 620px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }
h1 { font-size: 2rem; line-height: 1.1; margin: .3rem 0 .5rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .centre { text-align: center; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.brand { font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; gap: .45rem; color: var(--ink-2); }
.dot { width: 11px; height: 11px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(12,163,12,.25); }
.lead { color: var(--ink-2); }
.back { display: inline-flex; min-height: 44px; align-items: center; color: var(--ink-2); text-decoration: none; }

/* buttons */
.big-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 62px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-size: 1.1rem; font-weight: 800; cursor: pointer; text-decoration: none; padding: .6rem 1rem; }
.big-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.big-btn.stop { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); text-decoration: none; padding: 0 1.1rem; font-weight: 700; cursor: pointer; }
.link { background: none; border: 0; color: var(--accent); padding: .4rem 0; min-height: 44px; cursor: pointer; }
.begin-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 72px; margin-top: .9rem; border: 0; border-radius: 999px; background: linear-gradient(135deg, var(--blu-mid), var(--blu)); color: #fff; font-size: 1.35rem; font-weight: 900; cursor: pointer; box-shadow: 0 10px 34px rgba(42,70,153,.55); }
@media (prefers-reduced-motion: no-preference) { .begin-btn { animation: pulse 2.6s ease-in-out infinite; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 10px 34px rgba(42,70,153,.55); } 50% { box-shadow: 0 10px 46px rgba(57,135,229,.78); } }
.row-btns { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }

/* camera */
.stage { position: relative; background: #000; border-radius: var(--r); overflow: hidden; aspect-ratio: 4 / 3; margin-top: 1rem; }
.stage.big { aspect-ratio: 9 / 16; max-height: 72vh; margin: 0 auto; display: flex; align-items: center; justify-content: center; }
.stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.stage.big video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.stage video.mirror { transform: scaleX(-1); }
.stage canvas { width: 100%; height: 100%; object-fit: contain; }
.cam-off { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; background: var(--surface-2); }
.cam-off .big-btn { width: 100%; max-width: 300px; }
.count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 8rem; font-weight: 900; text-shadow: 0 4px 24px rgba(0,0,0,.8); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.flip-pill { position: absolute; right: 10px; bottom: 10px; width: 52px; justify-content: center; padding: 0; z-index: 3; display: inline-flex; align-items: center; gap: .45rem; min-height: 46px; padding: 0 1rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.62); color: #fff; font-weight: 800; font-size: .95rem; cursor: pointer; }
.live-badge { position: absolute; left: 10px; top: 10px; z-index: 3; display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .75rem; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; pointer-events: none; }
.dot-live { width: 9px; height: 9px; border-radius: 50%; background: var(--bad-live); box-shadow: 0 0 0 4px rgba(255,106,82,.25); }
@media (prefers-reduced-motion: no-preference) { .dot-live { animation: live 1.6s ease-in-out infinite; } }
@keyframes live { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.status { min-height: 1.5em; text-align: center; font-weight: 700; margin: .8rem 0; }
.run-actions { display: grid; gap: .6rem; }

/* board link on the home screen */
.board-link { display: grid; grid-template-columns: 46px 1fr auto; gap: .8rem; align-items: center; margin-top: 1.2rem; padding: .85rem 1rem; border-radius: var(--r); text-decoration: none; color: var(--ink); background: linear-gradient(135deg, rgba(255,210,63,.18), rgba(255,210,63,.04)); border: 1px solid rgba(255,210,63,.5); }
.board-link .crown { font-size: 2rem; } .board-link b { display: block; color: var(--gold); } .board-link > span:last-child { font-size: 1.5rem; color: var(--gold); }
.board-link span span { display: block; }

.tips { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .7rem 1rem; margin-top: 1rem; }
.tips summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.tips ol { margin: .5rem 0 .2rem; padding-left: 1.2rem; display: grid; gap: .3rem; color: var(--ink-2); }

/* my sets */
.sets { display: grid; gap: .5rem; }
.set-row { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .7rem .9rem; text-decoration: none; color: var(--ink); }
.set-row .big { font-size: 1.2rem; font-weight: 800; } .set-row .sub { color: var(--muted); font-size: .85rem; }
.badge { min-width: 48px; text-align: center; font-weight: 800; border-radius: 999px; padding: .2rem .6rem; border: 2px solid; grid-row: span 2; }
.b-good { color: var(--good-live); border-color: var(--good); } .b-warn { color: var(--warn); border-color: var(--warn); } .b-bad { color: var(--bad-live); border-color: var(--bad); } .b-none { color: var(--muted); border-color: var(--line); }
.empty { text-align: center; color: var(--muted); padding: 1.4rem 0; }

/* result */
.verdict { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; display: grid; grid-template-columns: 1fr auto; gap: .4rem 1rem; align-items: center; margin-top: .4rem; }
.verdict .num { font-size: 3.6rem; font-weight: 900; line-height: 1; color: var(--gold); }
.verdict .lbl { color: var(--ink-2); font-weight: 700; }
.score-ring { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; font-weight: 900; border: 6px solid; grid-row: span 2; }
.reps { display: grid; gap: .45rem; margin-top: .8rem; }
.rep { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: .2rem .6rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .7rem; }
.rep .n { font-weight: 900; font-size: 1.1rem; color: var(--ink-2); }
.rep .sb { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.rep .sb i { display: block; height: 100%; border-radius: 5px; }
.rep .sc { font-weight: 800; min-width: 2.5rem; text-align: right; }
.rep .why { grid-column: 2 / 4; color: var(--ink-2); font-size: .88rem; }
.coach { margin-top: .9rem; border-radius: var(--r); padding: .9rem 1rem; background: rgba(57,135,229,.12); border: 1px solid rgba(57,135,229,.55); }
.coach b { display: block; margin-bottom: .2rem; }
.post-box { margin-top: 1.1rem; display: grid; gap: .6rem; background: linear-gradient(135deg, rgba(255,210,63,.14), rgba(255,210,63,.03)); border: 1px solid rgba(255,210,63,.5); border-radius: var(--r); padding: 1rem; }
.post-box b { font-size: 1.1rem; }
.post-box label { display: grid; gap: .25rem; font-weight: 700; color: var(--ink-2); font-size: .9rem; }
.post-box input { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.posted-box { margin-top: 1.1rem; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; border: 1px solid rgba(12,163,12,.5); background: rgba(12,163,12,.1); border-radius: var(--r); padding: .9rem 1rem; font-weight: 700; }

/* board */
.b-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.first 
.foot { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: center; border-top: 1px solid var(--line); padding-top: 1rem; }
.foot select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .4rem .6rem; min-height: 44px; }
.foot p { width: 100%; margin: 0; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); text-align: center; background: var(--surface-2); border: 1px solid var(--line); padding: .7rem 1.1rem; border-radius: 16px; z-index: 50; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* faces on the board and in the post form */
.first .champ-banner .face-pick { display: flex; gap: .9rem; align-items: center; }
.face-shot { width: 86px; height: 86px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); border: 3px solid var(--oro); flex: none; }
.face-shot img { width: 100%; height: 100%; object-fit: cover; }
.face-shot .ph { font-size: 2.2rem; font-weight: 900; color: var(--gold); }
.file-btn { cursor: pointer; }
#boardBox { margin-top: 1.2rem; }

/* ---------------------------------------------------------------- arcade fighter cards (original art, CSS only) */
.b-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.fighter { position: relative; background: linear-gradient(160deg, #222942 0%, #161A28 55%, var(--page) 100%); border: 1px solid var(--line-2); border-radius: 4px; padding: .7rem .8rem;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.fighter::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.045) 0 1px, transparent 1px 3px); }
.fighter.row { display: grid; grid-template-columns: 2.1rem 56px 1fr auto; gap: .7rem; align-items: center; min-height: 72px; }
.fighter.row.open { opacity: .45; border-style: dashed; background: none; }
.fighter.me { outline: 2px solid var(--accent); outline-offset: -2px; }
.fighter.row.first { border-color: var(--gold); background: linear-gradient(160deg, #3A2F15 0%, #1E1B14 60%, var(--page) 100%); }
.b-rank { font-weight: 900; font-size: 1.25rem; text-align: center; color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.first .b-rank, .champ .b-rank { color: var(--gold); }
.b-main { display: grid; min-width: 0; gap: .1rem; }
.b-main b { font-size: 1.05rem; letter-spacing: .01em; }
.b-ev { color: var(--ink-2); font-size: .85rem; }

/* the portrait: duotone + posterised, so a selfie reads as a fighter portrait */
.b-face { position: relative; display: inline-grid; place-items: center; overflow: hidden; flex: none;
  border: 2px solid var(--line-2); border-radius: 3px; background: var(--surface-2); color: var(--oro); font-weight: 900;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.b-face img { width: 100%; height: 100%; object-fit: cover; display: block; filter: contrast(1.45) saturate(.45) brightness(1.03); }
.b-face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,210,63,.42), rgba(217,89,38,.42) 60%, rgba(40,60,120,.38)); mix-blend-mode: color; }
.b-face.ph::after { display: none; }
.b-face.empty { border-style: dashed; border-color: var(--line); background: none; }
.first .b-face, .champ .b-face { border-color: var(--gold); }

/* champion card */
.fighter.champ { margin: 1rem 0 .9rem; padding: 1.1rem 1rem .9rem; border: 2px solid var(--gold);
  background: radial-gradient(ellipse at 20% 0%, #4A3A12 0%, #2A1A28 45%, var(--page) 100%);
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px); }
.fighter.champ .plate { position: absolute; top: -1px; right: -1px; background: var(--oro); color: #241A04; font-weight: 900; font-size: .72rem;
  letter-spacing: .22em; padding: .3rem .7rem; clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%); }
.f-top { display: flex; gap: .9rem; align-items: center; }
.f-id { min-width: 0; }
.f-name { font-size: 1.6rem; font-weight: 900; line-height: 1.05; }
.f-title { color: var(--gold); font-weight: 900; letter-spacing: .14em; font-size: .82rem; text-transform: uppercase; }
.f-title.small { font-size: .7rem; letter-spacing: .1em; }
.f-sub { color: var(--ink-2); font-size: .85rem; margin-top: .15rem; }
@media (prefers-reduced-motion: no-preference) {
  .fighter.champ { animation: champGlow 3.2s ease-in-out infinite; }
  @keyframes champGlow { 0%, 100% { box-shadow: 0 0 0 rgba(255,210,63,0), inset 0 0 20px rgba(255,210,63,.08); } 50% { box-shadow: 0 0 26px rgba(255,160,40,.4), inset 0 0 26px rgba(255,160,40,.16); } }
}

/* stat bars */
.fighter .stats { display: grid; gap: .35rem; margin-top: .8rem; }
.fighter .stat { display: grid; grid-template-columns: 5rem 1fr 3.3rem; gap: .55rem; align-items: center; }
.fighter .stat .k { font-size: .68rem; font-weight: 900; letter-spacing: .14em; color: var(--ink-2); }
.fighter .stat .v { white-space: nowrap; font-weight: 900; font-size: .9rem; text-align: right; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.fighter .stat .bar { height: 12px; background: var(--blu-deep); border: 1px solid var(--line-2); overflow: hidden; }
.fighter .stat .bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--oro) 0 7px, var(--oro-deep) 7px 9px); }
.fighter.row .stats { display: none; }

/* unhatched fighter: no photo posted yet */
.b-face.egg-face { background: radial-gradient(ellipse at 50% 35%, #2f3138 0%, #17181c 70%); border-style: solid; display: grid; place-items: center; }
.b-face.egg-face .egg { width: 62%; height: 62%; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); transform-origin: 50% 85%; }
@media (prefers-reduced-motion: no-preference) {
  .b-face.egg-face .egg { animation: eggWobble 3.6s ease-in-out infinite; }
  @keyframes eggWobble { 0%, 62%, 100% { transform: rotate(0deg); } 68% { transform: rotate(-7deg); } 74% { transform: rotate(6deg); } 80% { transform: rotate(-4deg); } 86% { transform: rotate(2deg); } }
  .champ .b-face.egg-face .egg { animation-duration: 2.4s; }
}
.perfect { display: inline-block; margin-left: .45rem; padding: .05rem .4rem; border: 1px solid var(--good); color: var(--good-live); font-size: .62rem; letter-spacing: .1em; vertical-align: middle; }
.f-title .tick { color: var(--good-live); margin-left: .3rem; font-size: .8rem; }
@media (max-width: 430px) { .fighter.row { grid-template-columns: 1.9rem 56px 1fr; } .fighter.row .b-date { display: none; } }

/* exercise picker */
.mode-pick { display: flex; gap: .4rem; margin: 1.1rem 0 .4rem; }
.mode-pick button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-family: inherit; font-weight: 900; font-size: 1rem; letter-spacing: .02em; cursor: pointer; }
.mode-pick button.on { background: linear-gradient(180deg, var(--blu-mid), var(--blu)); border-color: var(--blu-mid); color: #fff; }
.ex-pick { display: flex; gap: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; margin: .35rem 0 .2rem; overflow-x: auto; }
.ex-pick button { flex: 1 0 auto; border: 0; background: none; color: var(--ink-2); font-weight: 800; font-size: .92rem; padding: 0 .85rem; min-height: 46px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.ex-pick button.on { background: var(--ink); color: #000; }
.ex-pick button[data-ex="auto"].on { background: var(--oro); color: #241A04; }
.board-ex { display: flex; gap: .35rem; margin: .9rem 0 .2rem; }
.board-ex a, .board-ex button { flex: 1; cursor: pointer; font-family: inherit; flex: 1; text-align: center; padding: .55rem .3rem; min-height: 44px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 800; text-decoration: none; font-size: .9rem; }
.board-ex a.on, .board-ex button.on { background: var(--oro); border-color: var(--oro); color: #241A04; }

/* ───────────────────────── reconciliation ─────────────────────────
 * The primitives both engines define. Settled here once so neither stylesheet's load order
 * decides what a button looks like. The brand shape wins; the tracker's modifiers are kept.
 */
.view { max-width: 680px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px 1rem; }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.centre { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 1.6rem .5rem; }
.btn, .big-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); text-decoration: none; padding: 0 1.1rem; font-weight: 700; cursor: pointer;
  font-family: inherit; font-size: 1rem;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blu-mid); border-color: var(--blu-mid); color: #fff; }
.btn.danger { color: var(--bad-live); border-color: #5a2a26; background: transparent; }
.btn.small { min-height: 38px; padding: 0 .8rem; font-size: .85rem; font-weight: 600; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.row-btns { display: flex; gap: .6rem; margin: 1.1rem 0; flex-wrap: wrap; }
.row-btns > * { flex: 1 1 10rem; }
.row-btns.tight { margin: .5rem 0 0; }
.row-btns.tight > * { flex: 0 0 auto; }
.file-btn { position: relative; cursor: pointer; }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
  text-align: center; background: var(--surface-2); border: 1px solid var(--line);
  padding: .7rem 1.1rem; border-radius: 16px; z-index: 60; font-weight: 600;
}

/* ───────────────────────── the tab bar ───────────────────────── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .5rem 0 .55rem; color: var(--muted); text-decoration: none;
  font-size: .68rem; font-weight: 600; letter-spacing: .02em;
}
.tabs a .ico { font-size: 1.15rem; line-height: 1; }
.tabs a.on { color: var(--ink); }
.tabs a.on .ico { color: var(--oro); }

/* ───────────────────────── Body: the year-coverage mode ───────────────────────── */
.seg { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line);
       border-radius: 999px; padding: 4px; margin: .9rem 0; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--ink-2); font: inherit;
              font-size: .85rem; font-weight: 600; padding: .5rem; border-radius: 999px; cursor: pointer; }
.seg button.on { background: var(--surface-2); color: var(--ink); }
.l-band { display: flex; align-items: center; gap: .5rem; flex: 1 1 8rem; min-width: 0;
          background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
          padding: .5rem .6rem; }
.l-band b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.l-band span { font-size: .7rem; color: var(--ink-2); line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.l-band::before { content: ""; width: 11px; height: 11px; border-radius: 3px; background: var(--b0); flex: none; }
.l-band[data-band="1"]::before { background: var(--b1); }
.l-band[data-band="2"]::before { background: var(--b2); }
.l-band[data-band="3"]::before { background: var(--b3); }
.l-band[data-band="4"]::before { background: var(--b4); }
.l-band[data-band="5"]::before { background: var(--b5); }
.l-band[data-band="0"]::before { outline: 1px dashed var(--muted); outline-offset: 1px; }
path.m[data-band] { fill: var(--b0); }
path.m[data-band="0"] { stroke: var(--muted); stroke-dasharray: 2.5 2.5; }
path.m[data-band="1"] { fill: var(--b1); }
path.m[data-band="2"] { fill: var(--b2); }
path.m[data-band="3"] { fill: var(--b3); }
path.m[data-band="4"] { fill: var(--b4); }
path.m[data-band="5"] { fill: var(--b5); }
.state-pill.band { background: var(--b3); color: #0b1020; }

/* ───────────────────────── Plan ───────────────────────── */
.lifts { display: flex; flex-direction: column; gap: .7rem; }
.lift { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; }
.lift-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.lift h3 { margin: 0; font-size: 1.02rem; }
.lift .target { margin: .35rem 0 .2rem; font-size: 1.05rem; }
.lift .target b { font-variant-numeric: tabular-nums; }
.pill { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
        padding: .25rem .55rem; border-radius: 999px; white-space: nowrap; }
.pill.up { background: var(--good); color: #04120a; }
.pill.hold { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.pill.new { background: var(--oro); color: #241a00; }
.rep { display: inline-block; font-variant-numeric: tabular-nums; padding: .1rem .4rem; border-radius: 5px; margin: .1rem .15rem 0 0; }
.rep.ok { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good-live); }
.rep.no { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad-live); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
        padding: 1rem; margin: 1rem 0; }
.card.quiet { background: transparent; }
.card h3 { margin: 0 0 .3rem; font-size: 1rem; }

/* ───────────────────────── Year ───────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: .5rem; margin: .4rem 0 1.2rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; min-width: 0; }
.tile b { display: block; font-size: 1.5rem; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile span { font-size: .72rem; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 108px; margin: .5rem 0 1.4rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.bar-fill { width: 100%; background: var(--blu-mid); border-radius: 3px 3px 0 0; }
.bars.pr .bar-fill { background: var(--oro); }
.bar-fill.none { background: var(--line); }
.bar-lbl { font-size: .6rem; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.prs { list-style: none; margin: .4rem 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.prs li { display: grid; grid-template-columns: 4.2rem 1fr auto; gap: .6rem; align-items: baseline;
          padding: .5rem .2rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.pr-date { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.pr-ex { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-move { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
.pr-move b { color: var(--good-live); }

/* ───────────────────────── voice ───────────────────────── */
.voice { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: 0 0 .7rem; }
.btn.rec { gap: .5rem; }
.btn.rec.on { background: var(--rosso); border-color: var(--rosso); color: #fff; }
.recdot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad-live); flex: none; }
.btn.rec.on .recdot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .btn.rec.on .recdot { animation: none; } }

@media (max-width: 420px) {
  .prs li { grid-template-columns: 3.6rem 1fr auto; font-size: .84rem; }
}

/* ───────────────────────── the mark ───────────────────────── */
.hero { text-align: center; }
.wordmark { display: block; width: min(100%, 420px); height: auto; margin: .2rem auto .6rem; }
.hero .gym { margin: 0 0 .2rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.hero h1 { font-size: 1.35rem; margin: 0 0 .2rem; letter-spacing: -.01em; }
@media (max-width: 420px) { .wordmark { width: min(100%, 330px); } }

/* The mark sits once, at the top of the first tab you land on — enough to say whose app this is
   without taking a bite out of every screen. */
.brandtop { display: flex; flex-direction: column; align-items: flex-start; }
.brandtop .wordmark { width: min(62vw, 230px); height: auto; margin: 0 0 .5rem; }
.brandtop h1 { margin-top: 0; }

/* Lines the parser could not read. Shown in full, not counted: a workout that vanishes looks
   exactly like a workout not done, and the only person who can spot the difference is the one
   who wrote it. */
.ignored { margin: .35rem 0 0; padding-left: 1.1rem; }
.ignored li { color: var(--warn, #d9a441); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .86rem; line-height: 1.5; overflow-wrap: anywhere; }
