/*
VOICE   early-morning coach: short, plain, encouraging
IDEA    the gym's own purple-and-yellow signage and the machine console readout
PICTURE today's workout card is the hero; the player is a big console countdown
COLOUR  deep club purple ground, brighter purple panels, signal yellow for actions and done
TYPE    Archivo 900 for headings and numbers, system sans for body
LAYOUT  single phone column, bottom tab bar, full-screen player
*/
:root {
  --bg: #24103f;
  --panel: #33185a;
  --panel-2: #4b2483;
  --line: #5a3394;
  --yellow: #f9f72e;
  --fuchsia: #c23aa8;
  --ink: #ffffff;
  --muted: #cdbbe9;
  --dim: #9c86c4;
  --display: "Archivo", "Arial Black", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: clip;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
[hidden] { display: none !important; }
h1 { font: 900 30px/1.1 var(--display); margin: 8px 0 6px; letter-spacing: -0.01em; }
h2 { font: 700 18px/1.2 var(--display); margin: 28px 0 8px; }
.muted { color: var(--muted); margin: 0 0 14px; }
.fine { color: var(--dim); font-size: 13px; margin-top: 32px; }

/* header */
.top { padding: calc(14px + env(safe-area-inset-top)) 18px 6px; }
.brand { display: flex; gap: 12px; align-items: center; }
.mark { width: 38px; height: 38px; flex: none; }
.name { font: 900 20px/1.1 var(--display); }
.date { color: var(--muted); font-size: 14px; }

main { max-width: 560px; margin: 0 auto; padding: 8px 18px 0; }

/* week strip */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.day { text-align: center; font-size: 12px; color: var(--muted); }
.day i {
  display: grid; place-items: center; height: 38px; margin-top: 4px; border-radius: 10px;
  background: var(--panel); font: 700 13px var(--display); font-style: normal; color: var(--dim);
}
.day.done i { background: var(--yellow); color: var(--bg); }
.day.today i { box-shadow: inset 0 0 0 2px var(--yellow); color: var(--ink); }
.day.done.today i { box-shadow: none; }
.weeknote { color: var(--muted); font-size: 14px; margin: 10px 0 16px; }
.weeknote b { color: var(--ink); }

/* focus chips */
.focusrow { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -18px 14px; padding-inline: 18px; scrollbar-width: none; }
.focusrow::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  background: transparent; font-size: 14px; font-weight: 600; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { font-weight: 700; color: var(--yellow); margin-left: 4px; }
.chip[aria-pressed="true"] small { color: var(--fuchsia); }

/* hero card */
.hero {
  background: linear-gradient(160deg, var(--panel-2), var(--panel) 70%);
  border-radius: 22px; padding: 20px 18px 18px; position: relative; overflow: hidden;
  box-shadow: 0 18px 40px -20px #0009;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, #c23aa855, transparent 70%); pointer-events: none;
}
.kicker { font-size: 13px; font-weight: 700; color: var(--yellow); }
.hero h3 { font: 900 clamp(30px, 9vw, 40px)/1.02 var(--display); margin: 6px 0 8px; letter-spacing: -0.015em; text-wrap: balance; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.meta b { color: var(--ink); font-family: var(--display); }
.blurb { margin: 0 0 14px; color: #eee6fb; }
.blocks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.blk { background: #0002; border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.blk .m { font-weight: 700; }
.blk .t { font: 700 15px var(--display); color: var(--yellow); white-space: nowrap; text-align: right; }
.blk .d { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }
.watch { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); margin-top: 4px; }
.watch svg { width: 15px; height: 15px; color: var(--yellow); flex: none; }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.btn {
  min-height: 52px; border-radius: 14px; border: 0; padding: 0 18px;
  font: 900 18px var(--display); letter-spacing: 0.01em;
}
.btn.go { background: var(--yellow); color: var(--bg); }
.btn.go:active { transform: scale(.98); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); font: 700 15px var(--display); }
.donebadge { display: inline-block; background: var(--yellow); color: var(--bg); font: 900 13px var(--display); padding: 4px 10px; border-radius: 999px; margin-bottom: 8px; }

.tip { display: flex; gap: 12px; margin: 18px 0 8px; padding: 14px; border-radius: 16px; border: 1.5px dashed var(--line); color: var(--muted); font-size: 14px; }
.tip svg { width: 24px; height: 24px; flex: none; color: var(--yellow); }
.tip p { margin: 0; }
.tip b { color: var(--ink); }

/* library */
.group h2 { display: flex; justify-content: space-between; align-items: baseline; }
.group h2 span { font: 600 13px system-ui; color: var(--dim); }
.card {
  width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  background: var(--panel); border: 0; border-radius: 14px; padding: 14px; margin-bottom: 8px; min-height: 64px;
}
.card .n { font: 700 17px var(--display); }
.card .s { color: var(--muted); font-size: 13px; grid-column: 1; }
.card .t { grid-row: 1 / span 2; grid-column: 2; font: 900 16px var(--display); color: var(--yellow); white-space: nowrap; }
.card.off { opacity: .45; }

/* history */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 18px; }
.stat { background: var(--panel); border-radius: 14px; padding: 12px; }
.stat b { display: block; font: 900 28px/1 var(--display); color: var(--yellow); }
.stat span { font-size: 13px; color: var(--muted); }
.bars { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; align-items: end; height: 120px; margin-bottom: 6px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 11px; color: var(--dim); }
.bar i { width: 100%; background: var(--panel-2); border-radius: 6px 6px 3px 3px; min-height: 4px; position: relative; }
.bar.hit i { background: var(--yellow); }
.bar em { font-style: normal; font: 700 12px var(--display); color: var(--ink); }
.log { list-style: none; padding: 0; margin: 18px 0 0; }
.log li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.log .n { font-weight: 700; }
.log .s { color: var(--muted); font-size: 13px; }
.log button { grid-row: 1 / span 2; grid-column: 2; background: none; border: 0; color: var(--dim); min-width: 44px; min-height: 44px; font-size: 13px; }
.empty { color: var(--muted); padding: 20px 0; }

/* settings */
.seg { display: inline-grid; grid-auto-flow: column; background: var(--panel); border-radius: 12px; padding: 4px; }
.seg button { min-height: 44px; padding: 0 18px; border: 0; border-radius: 9px; background: none; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--yellow); color: var(--bg); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.toggle input { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--panel-2); position: relative; flex: none; margin: 0; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.toggle input:checked { background: var(--yellow); }
.toggle input:checked::after { transform: translateX(20px); background: var(--bg); }
.habits { padding-left: 18px; color: #eee6fb; }
.habits li { margin-bottom: 8px; }

/* tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #1b0b30ee; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #ffffff14; padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { background: none; border: 0; min-height: 62px; display: grid; place-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--dim); padding: 8px 0 6px; }
.tabs svg { width: 24px; height: 24px; }
.tabs button[aria-current="page"] { color: var(--yellow); }

/* player */
.player {
  position: fixed; inset: 0; z-index: 10; background: var(--bg); display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.p-top { display: grid; grid-template-columns: 48px 1fr auto; gap: 8px; align-items: center; padding: 10px 14px; }
.icon { width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--panel); display: grid; place-items: center; }
.icon svg { width: 22px; height: 22px; }
.p-title { font: 700 16px/1.2 var(--display); }
.p-sub { color: var(--muted); font: 500 13px system-ui; }
.p-elapsed { font: 700 16px var(--display); color: var(--muted); font-variant-numeric: tabular-nums; padding-right: 4px; }
.p-progress { height: 5px; background: var(--panel); margin: 0 14px; border-radius: 3px; overflow: hidden; }
.p-progress i { display: block; height: 100%; width: 0; background: var(--yellow); transition: width .3s; }
.p-body { flex: 1; overflow-y: auto; padding: 18px 18px 24px; display: flex; flex-direction: column; max-width: 560px; width: 100%; margin: 0 auto; }

.machine { font: 900 15px var(--display); color: var(--yellow); }
.watchcall {
  display: flex; gap: 10px; align-items: center; background: var(--panel); border-radius: 14px; padding: 10px 12px; margin: 10px 0 0; font-size: 14px; color: var(--muted);
}
.watchcall svg { width: 22px; height: 22px; color: var(--yellow); flex: none; }
.watchcall b { color: var(--ink); }
.seglabel { font: 900 clamp(30px, 9vw, 44px)/1.05 var(--display); margin: 22px 0 6px; text-wrap: balance; }
.segcue { font-size: 18px; color: #eee6fb; margin: 0; }
.clock {
  font: 900 clamp(84px, 30vw, 150px)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
  margin: auto 0 4px; padding-top: 18px; text-align: center;
}
.clock.last { color: var(--yellow); }
.segbar { height: 10px; background: var(--panel); border-radius: 6px; overflow: hidden; margin: 8px 0 14px; }
.segbar i { display: block; height: 100%; background: var(--fuchsia); }
.nextup { text-align: center; color: var(--muted); font-size: 15px; min-height: 24px; }
.nextup b { color: var(--ink); }
.controls { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; margin-top: 18px; }
.controls .icon { width: 64px; height: 64px; border-radius: 18px; }
.controls .btn { min-height: 64px; font-size: 20px; border-radius: 18px; }

.exlist { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.ex { background: var(--panel); border-radius: 16px; padding: 12px 14px; }
.ex.complete { opacity: .55; }
.ex .top2 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ex .n { font: 700 17px var(--display); }
.ex .r { color: var(--yellow); font: 700 15px var(--display); white-space: nowrap; }
.ex .note { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ex .row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.setb { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: none; font: 700 15px var(--display); }
.setb[aria-pressed="true"] { background: var(--yellow); border-color: var(--yellow); color: var(--bg); }
.wt { flex: 1 1 110px; display: flex; align-items: center; gap: 6px; margin-left: auto; max-width: 150px; }
.wt input { width: 100%; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); font: 600 16px system-ui; padding: 0 10px; }
.rest {
  position: sticky; bottom: 0; margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--fuchsia); color: #fff; border-radius: 16px; padding: 12px 16px; font: 700 16px var(--display);
}
.rest b { font: 900 32px var(--display); font-variant-numeric: tabular-nums; }
.rest button { background: #fff3; border: 0; border-radius: 10px; min-height: 44px; padding: 0 14px; font-weight: 700; }
.blockfoot { margin-top: 16px; }

.finish h3 { font: 900 40px/1.05 var(--display); margin: 20px 0 8px; }
.finish .big { font: 900 64px/1 var(--display); color: var(--yellow); margin: 14px 0 2px; }
.feel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 18px 0; }
.feel button { min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: none; font-weight: 700; }
.feel button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

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

/* help button */
.brand { position: relative; }
.helpbtn {
  margin-left: auto; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--panel); color: var(--yellow); font: 900 20px var(--display);
}

/* tappable names */
.gl {
  background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.gl svg { width: 18px; height: 18px; color: var(--yellow); flex: none; }
.blk .gl.m { font-weight: 700; min-height: 32px; }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.gl.mv { font-size: 14px; color: #eee6fb; background: #ffffff10; border-radius: 999px; padding: 6px 10px 6px 12px; min-height: 36px; }
.gl.mv:active, .gl.mv:hover { background: #ffffff22; }
.ex .n.gl { font: 700 17px var(--display); text-align: left; }
.machinerow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.howto {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px;
  border: 1.5px solid var(--yellow); background: none; color: var(--yellow); font: 700 14px var(--display);
}
.howto svg { width: 18px; height: 18px; }
.howto.inline { margin-top: 10px; align-self: flex-start; }
.card .t svg { width: 22px; height: 22px; }
.gtitle { margin-top: 36px; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: #0009; }
.sheet-card {
  position: relative; width: 100%; max-width: 620px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -20px 50px #0008;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } }
.sh-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 16px 8px 18px; }
.sh-head h2 { margin: 2px 0 0; font: 900 24px/1.1 var(--display); }
.sh-kind { font-size: 13px; font-weight: 700; color: var(--yellow); }
.sh-body { overflow-y: auto; padding: 4px 18px 24px; -webkit-overflow-scrolling: touch; }
.vid { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.vid iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.credit { font-size: 12px; color: var(--dim); margin: 6px 0 0; }
.credit a { color: var(--muted); }
.novideo { background: var(--panel); border-radius: 14px; padding: 14px; color: var(--muted); font-size: 14px; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 14px 0 4px; }
.facts div { background: var(--panel); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: #eee6fb; }
.facts b { display: block; font: 700 12px var(--display); color: var(--yellow); margin-bottom: 2px; }
.sh-body h3 { font: 700 16px var(--display); margin: 16px 0 6px; color: var(--ink); }
.sh-body ol, .sh-body ul { margin: 0; padding-left: 22px; color: #eee6fb; }
.sh-body li { margin-bottom: 6px; }
.howlist li { margin-bottom: 10px; }
.gloss dt { font: 700 15px var(--display); color: var(--yellow); margin-top: 10px; }
.gloss dd { margin: 2px 0 0; color: #eee6fb; font-size: 15px; }
@media (max-width: 420px) { .facts { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .sheet-card { animation: none; } }

/* silent video + flash cue */
.vshield { position: absolute; inset: 0; }
.vid iframe { pointer-events: none; }
.vbar { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.vbar .credit { margin: 0; flex: 1; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; flex: none; }
.toggle small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.player.flash::after { content: ""; position: fixed; inset: 0; background: var(--yellow); opacity: 0; pointer-events: none; animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .player.flash::after { animation-duration: .2s; } }
