* { box-sizing: border-box; -webkit-tap-highlight-color: transparent }
html, body { margin: 0; padding: 0 }
body {
  background: var(--ink); color: var(--chalk); font-family: var(--body);
  font-size: 15px; line-height: 1.45; min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
h1, h2, h3, h4 { font-family: var(--head); font-weight: 500; letter-spacing: .02em; margin: 0 }
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: none; cursor: pointer }
input { font-family: inherit; font-size: inherit }
[hidden] { display: none !important }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px }

/* The installed app draws under the status bar, so on a phone with a
   Dynamic Island the clock and battery sit on top of the wordmark. The
   inset is exactly the height that needs clearing, and it is zero on a
   laptop, so no device needs a special case. */
.top {
  position: sticky; top: 0; z-index: 40; background: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 14px 16px 12px; display: flex; align-items: baseline; justify-content: space-between }
.brand { font-family: var(--head); font-size: 23px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase }
.brand span { color: var(--gold) }
.bellset { display: flex; align-items: center; gap: 6px; color: var(--chalk-dim); font-size: 13px }
.bellset input {
  width: 46px; background: var(--ink-3); border: 1px solid var(--line); color: var(--chalk);
  border-radius: 6px; padding: 4px 6px; text-align: center; font-size: 13px;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--ink-2);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-in { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr) }
.tab {
  padding: 10px 2px 12px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--chalk-faint); font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; font-family: var(--head);
}
.tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round }
.tab.on { color: var(--gold) }
.screen { display: none; padding-top: 18px }
.screen.on { display: block }

.eyebrow { font-family: var(--head); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--chalk-faint) }
.h-sec { font-size: 19px; margin: 0 0 2px }
.muted { color: var(--chalk-dim) }
.tiny { font-size: 12.5px }
.card { background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px }
.rowline { display: flex; align-items: center; gap: 12px }
.spacer { flex: 1 }
.btn {
  background: var(--gold); color: #241C05; font-family: var(--head); font-size: 15px; letter-spacing: .07em;
  text-transform: uppercase; padding: 13px 18px; border-radius: 9px; width: 100%; text-align: center; font-weight: 600;
}
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--chalk); font-family: var(--head);
  letter-spacing: .07em; text-transform: uppercase; font-size: 13px; padding: 10px 14px; border-radius: 9px;
}
.chipbar { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none }
.chipbar::-webkit-scrollbar { display: none }
.chip { white-space: nowrap; border: 1px solid var(--line); color: var(--chalk-dim); padding: 6px 11px; border-radius: 99px; font-size: 12.5px }
.chip.on { background: var(--gold); border-color: var(--gold); color: #241C05; font-weight: 600 }

/* ---------- stick figure ----------
   The viewBox is written by the renderer, sized to the movement, so nothing
   overhead gets clipped the way it used to. */
.fig { display: block; width: 100%; height: auto; margin: 0 auto }
.fig .torso { fill: var(--chalk); stroke: none }
.fig .shoulder { fill: var(--chalk); stroke: none }
.fig .neck { stroke: var(--chalk); stroke-linecap: round; fill: none }
.fig .limb { stroke: var(--chalk); stroke-linecap: round; stroke-linejoin: round; fill: none }
.fig .limb.far { stroke: var(--chalk-faint) }
.fig .joint { fill: var(--chalk); stroke: none }
.fig .joint.far { fill: var(--chalk-faint) }
.fig .foot { stroke: var(--chalk); stroke-width: 5; stroke-linecap: round; fill: none }
.fig .foot.far { stroke: var(--chalk-faint); stroke-width: 4.2 }
.fig .skull { fill: var(--chalk); stroke: none }
.fig .nose { stroke: var(--chalk); stroke-width: 3; stroke-linecap: round; fill: none }
.fig .hand { fill: var(--chalk); stroke: none }
.fig .hand.far { fill: var(--chalk-faint) }
.fig .bell-handle { stroke: var(--gold); stroke-width: 3.2; fill: none; stroke-linecap: round }
.fig .bell-body { fill: rgba(217, 166, 46, .30); stroke: var(--gold); stroke-width: 2.6; stroke-linejoin: round }
.fig .bell-handle.far { stroke: var(--gold-dim) }
.fig .bell-body.far { stroke: var(--gold-dim); fill: rgba(217, 166, 46, .10) }
.fig .prop { stroke: var(--chalk-faint); stroke-width: 3; fill: none; stroke-linecap: round }
.fig .floor { stroke: var(--line); stroke-width: 2; stroke-linecap: round }

/* ---------- demo panel: video if there is one, drawn figure if not ---------- */
.demo { background: var(--ink-3); border-radius: 12px; padding: 8px 0; margin-bottom: 12px; overflow: hidden }
.demo .fig { max-height: 252px }
.demo .clipwrap { margin: -8px 0 }
/* a clip filmed in portrait is 9:16 and would otherwise fill the screen */
.demo .clip { max-height: 300px; object-fit: contain }
.card.demo { border: 1px solid var(--line) }
.clipwrap { position: relative; display: block; width: 100%; background: var(--ink-3); border-radius: 12px; overflow: hidden }
.clip { display: block; width: 100%; height: auto; background: var(--ink-3) }
.cliptap {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(32, 31, 29, .78); border: 1px solid var(--gold); color: var(--gold);
  font-size: 20px; display: grid; place-items: center; padding-left: 4px;
}
.exthumb .clipwrap { border-radius: 8px }
.exthumb .clip { height: 46px; object-fit: cover }
.exthumb .cliptap { display: none }
.exthumb .fig { width: 100%; height: 46px }

.dateinput {
  width: 100%; background: var(--ink-3); border: 1px solid var(--line); color: var(--chalk);
  border-radius: 9px; padding: 12px; margin: 10px 0 4px; font-size: 16px;
}

input[type=file]::file-selector-button {
  font-family: var(--head); text-transform: uppercase; letter-spacing: .06em; font-size: 12px;
  background: var(--ink-2); color: var(--chalk); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 11px; margin-right: 10px; cursor: pointer;
}

.searchrow { display: flex; gap: 8px; margin-bottom: 10px }
.searchrow input { flex: 1; background: var(--ink-2); border: 1px solid var(--line); color: var(--chalk); border-radius: 9px; padding: 10px 12px }
.exlist { display: flex; flex-direction: column; gap: 8px }
.exrow { display: flex; align-items: center; gap: 9px; padding: 9px 11px; background: var(--ink-2); border: 1px solid var(--line); border-radius: 11px }
.exrow.picked { border-color: var(--gold); background: #2B2719 }
.exthumb { width: 52px; height: 46px; flex: none; background: var(--ink-3); border-radius: 8px; overflow: hidden }
.exname { font-family: var(--head); font-size: 15.5px; line-height: 1.2 }
.exmeta { font-size: 11.5px; color: var(--chalk-dim); margin-top: 3px }
.exmeta b { color: var(--chalk); font-weight: 500 }
.kbtag {
  font-size: 10px; color: var(--gold); border: 1px solid var(--gold-dim); border-radius: 4px;
  padding: 1px 4px; margin-left: 6px; vertical-align: 1px; letter-spacing: .06em;
}
.star { flex: none; width: 28px; height: 32px; font-size: 17px; color: var(--chalk-faint); line-height: 1 }
.star.on { color: var(--gold) }
.addbtn {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 20px; color: var(--chalk-dim); line-height: 1;
}
.exrow.picked .addbtn { background: var(--gold); border-color: var(--gold); color: #241C05 }

.mixscroll { display: flex; gap: 10px; overflow-x: auto; padding: 2px 16px 4px; margin: 0 -16px; scrollbar-width: none }
.mixscroll::-webkit-scrollbar { display: none }
.mixcard {
  flex: none; width: 172px; background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; display: flex; flex-direction: column; gap: 5px; text-align: left;
}
.mixcard .mt { font-family: var(--head); font-size: 16px; line-height: 1.15 }
.mixcard .ms { font-size: 11.5px; color: var(--chalk-dim); line-height: 1.3; min-height: 31px }
.mixcard .mm { font-size: 11px; color: var(--gold); font-family: var(--head); letter-spacing: .06em }
.mixdot { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; background: var(--ink-3); margin-bottom: 3px }

.tray { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 30; margin-top: 14px }
.trayin { background: var(--ink-3); border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; box-shadow: 0 -8px 22px rgba(0, 0, 0, .45) }
.pickrow { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line) }
.pickrow:last-of-type { border-bottom: none }
.ord { display: flex; flex-direction: column; gap: 2px }
.ord button { width: 24px; height: 17px; border: 1px solid var(--line); border-radius: 5px; color: var(--chalk-dim); font-size: 9px; display: grid; place-items: center }
.pickname { flex: 1; font-family: var(--head); font-size: 14.5px }
.pickdose { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums }
.xbtn { color: var(--chalk-faint); font-size: 19px; padding: 0 3px; line-height: 1 }
.timebar { height: 7px; border-radius: 99px; background: var(--ink); overflow: hidden; margin: 9px 0 6px; position: relative }
.timefill { height: 100%; background: var(--green); transition: width .25s }
.timefill.over { background: var(--gold) }
.timefill.under { background: var(--blue) }
.zone { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--chalk-faint); opacity: .55 }

.sess-dots { display: flex; gap: 5px; margin-bottom: 14px }
.dot { flex: 1; height: 4px; border-radius: 99px; background: var(--ink-3) }
.dot.done { background: var(--green) }
.dot.cur { background: var(--gold) }
.doseline { display: flex; gap: 9px; align-items: baseline; margin: 8px 0 2px }
.dose { font-family: var(--head); font-size: 33px; color: var(--gold); line-height: 1 }
.dosesub { font-size: 13px; color: var(--chalk-dim) }
.cue { color: var(--chalk-dim); font-size: 14px; margin: 10px 0 0 }
.setdots { display: flex; gap: 8px; margin: 14px 0 4px }
.setdot { flex: 1; padding: 9px 0; text-align: center; border: 1px solid var(--line); border-radius: 8px; font-family: var(--head); font-size: 13px; color: var(--chalk-faint) }
.setdot.done { background: var(--green); border-color: var(--green); color: #1C2412 }
.hfnum { font-family: var(--head); font-size: 76px; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; margin: 6px 0 4px }
.hfnum .hfs { font-size: 26px; color: var(--chalk-faint); margin-left: 3px }
.hfctl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px }
.hfctl button { padding: 11px 4px; font-size: 12px }
.resttimer { text-align: center; font-family: var(--head); font-size: 40px; color: var(--gold); font-variant-numeric: tabular-nums; padding: 4px 0 }
.revrow { padding: 11px 0; border-bottom: 1px solid var(--line) }
.revrow:last-child { border-bottom: none }
.revname { font-family: var(--head); font-size: 15px; margin-bottom: 7px }
.revname span { color: var(--chalk-faint); font-size: 12px; font-family: var(--body); margin-left: 6px }
.fb3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px }
.fb3 button {
  padding: 9px 3px; border: 1px solid var(--line); border-radius: 8px; font-family: var(--head);
  font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--chalk-faint);
}
.fb3 button.sel[data-v="easy"] { background: var(--green); border-color: var(--green); color: #1C2412 }
.fb3 button.sel[data-v="ok"] { background: var(--chalk); border-color: var(--chalk); color: var(--ink) }
.fb3 button.sel[data-v="hard"] { background: var(--red); border-color: var(--red); color: #2A100A }

.bar { display: flex; align-items: center; gap: 9px; margin: 7px 0 }
.barname { width: 82px; flex: none; font-size: 12.5px; color: var(--chalk-dim); text-transform: capitalize }
.bartrack { flex: 1; height: 9px; background: var(--ink-3); border-radius: 99px; overflow: hidden; position: relative }
.barfill { height: 100%; border-radius: 99px; background: var(--gold) }
.barfill.low { background: var(--blue) }
.barfill.good { background: var(--green) }
.barval { width: 34px; flex: none; text-align: right; font-size: 11.5px; color: var(--chalk-faint); font-variant-numeric: tabular-nums }
.target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--chalk-faint); opacity: .7 }

.bodywrap { background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px 4px }
.body { display: block; width: 100%; height: auto }
.body .seg { stroke: #17160F; stroke-width: 1.1; stroke-linejoin: round }
.body .silhouette * { fill: #36342F; stroke: #17160F; stroke-width: 1.1 }
.body .silhouette path { fill: none; stroke: #36342F; stroke-width: 17; stroke-linecap: round; stroke-linejoin: round }
.body .lbl { fill: var(--chalk-faint); font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: .14em }
.mcard { background: var(--ink-3); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 14px }
.mcard .body { max-width: 330px; margin: 0 auto }
.taglab { font-family: var(--head); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--chalk-faint); margin-top: 8px }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px }
.tagpill {
  font-family: var(--head); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 11px; border-radius: 99px; color: #191A11; font-weight: 600;
}
.fixlist { margin: 10px 0 0; padding: 0; list-style: none }
.fixlist li { position: relative; padding-left: 20px; font-size: 13.5px; color: var(--chalk-dim); margin-top: 6px }
.fixlist li:before {
  content: '!'; position: absolute; left: 0; top: 0; width: 14px; height: 14px; border-radius: 50%;
  background: var(--red); color: #2A100A; font-size: 10px; font-weight: 700; display: grid; place-items: center; margin-top: 3px;
}
.ta {
  width: 100%; min-height: 96px; background: var(--ink); border: 1px solid var(--line); color: var(--chalk-dim);
  border-radius: 9px; padding: 10px; font-family: ui-monospace, Menlo, monospace; font-size: 11px; resize: vertical;
}
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 11px; font-size: 11.5px; color: var(--chalk-dim) }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px }
.mcell { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 12.5px }
.mcell b { display: block; font-family: var(--head); font-size: 14px; font-weight: 500; letter-spacing: .02em }

.verdict { background: var(--ink-2); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 9px; padding: 12px 13px; margin: 12px 0 }
/* the verdict sometimes opens on a muscle name, which is lower case in the
   data and would otherwise start the sentence in lower case */
.verdict::first-letter { text-transform: capitalize }
.logrow { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line) }
.logdate { width: 46px; flex: none; text-align: center }
.logday { font-family: var(--head); font-size: 20px; line-height: 1 }
.logmon { font-size: 10px; color: var(--chalk-faint); text-transform: uppercase; letter-spacing: .1em }

.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(14, 13, 12, .72); display: none; align-items: flex-end }
.sheet.on { display: flex }
.sheetin {
  background: var(--ink-2); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0;
  width: 100%; max-width: var(--maxw); margin: 0 auto; max-height: 88vh; overflow-y: auto;
  padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
}
.grab { width: 38px; height: 4px; background: var(--line); border-radius: 99px; margin: 0 auto 14px }
.deflink {
  display: inline-block; margin-top: 12px; color: var(--gold); font-size: 13px; text-decoration: none;
  border-bottom: 1px solid var(--gold-dim); padding-bottom: 1px;
}
.empty { text-align: center; color: var(--chalk-faint); padding: 26px 16px; font-size: 14px }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom));
  background: var(--chalk); color: var(--ink); padding: 9px 15px; border-radius: 99px; font-size: 13px; font-weight: 500;
  z-index: 70; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 88%; text-align: center;
}
.toast.on { opacity: 1 }
