/* Train — dark, quiet, high-contrast where it matters (the clock and the movement). */
@font-face {
  font-family: 'JBM';
  src: url('/static/fonts/jbm-400.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'JBM';
  src: url('/static/fonts/jbm-600.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}

:root {
  --bg: #0d1013;
  --bg2: #12171c;
  --surface: #161c22;
  --surface2: #1c242c;
  --line: #26313b;
  --text: #e9eef3;
  --muted: #8c9dab;
  --accent: #c9ee5e;
  --accent-ink: #131a06;
  --work: #c9ee5e;
  --rest: #6fa8ff;
  --warn: #f2b544;
  --ok: #3fd08a;
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(120% 90% at 50% -20%, #182128 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.micro { color: var(--muted); font-size: .8rem; margin: 10px 0 0; }

.shell { max-width: 720px; margin: 0 auto; padding: 18px 18px 48px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand img { width: 22px; height: 22px; border-radius: 6px; }
.brand { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: .82rem; color: var(--muted); }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  font-size: .84rem; padding: 7px 12px; border-radius: 999px; color: var(--muted);
  border: 1px solid transparent;
}
.topbar nav a.on { color: var(--text); background: var(--surface); border-color: var(--line); }

/* ---------- headings ---------- */
h1 { font-size: 1.9rem; line-height: 1.15; margin: 2px 0 6px; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; margin: 0 0 8px; }
.eyebrow { font-size: .74rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); margin: 0 0 6px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.streak { text-align: right; flex: 0 0 auto; }
.streak .n { display: block; font-family: JBM, ui-monospace, monospace; font-size: 1.9rem; font-weight: 600; color: var(--accent); line-height: 1; }
.streak .l { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

/* ---------- cards ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.card.rest h1 { font-size: 1.5rem; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; }
.banner.done { border-color: #2b6b4b; background: linear-gradient(180deg, #16281f, #121a16); }
.banner.skipped { border-color: #4a3a22; background: linear-gradient(180deg, #241d12, #1a1610); }
.rowgap { display: flex; gap: 8px; }

/* ---------- pills / chips ---------- */
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pill {
  font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--text);
}
.pill.format { background: rgba(201,238,94,.14); border-color: rgba(201,238,94,.4); color: var(--accent); }
.pill.work { background: rgba(201,238,94,.2); border-color: var(--work); color: var(--work); }
.pill.restpill { background: rgba(111,168,255,.16); border-color: var(--rest); color: var(--rest); }
.blurb { color: var(--muted); font-size: .92rem; margin: 0 0 14px; }

.equip { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.equip .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-right: 2px; }
.chip { font-size: .82rem; padding: 5px 11px; border-radius: 999px; background: var(--surface2); border: 1px solid var(--line); }
.chip.alt { color: var(--muted); border-style: dashed; }

/* ---------- movement list ---------- */
.moves { list-style: none; counter-reset: m; margin: 0 0 14px; padding: 0; }
.moves li {
  counter-increment: m; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 2px; border-bottom: 1px solid var(--line);
}
.moves li:last-child { border-bottom: 0; }
.moves li::before {
  content: counter(m); font-family: JBM, monospace; font-size: .78rem; color: var(--muted);
  width: 20px; flex: 0 0 20px;
}
.mname { font-size: 1.02rem; font-weight: 500; flex: 1; }
.mname:active { opacity: .6; }
.mname::after { content: ' ›'; color: var(--muted); }
.mtarget { font-family: JBM, monospace; font-size: .9rem; color: var(--accent); flex: 0 0 auto; }
.note { font-size: .84rem; color: var(--muted); background: var(--surface2); border-left: 2px solid rgba(201,238,94,.5); padding: 9px 12px; border-radius: 0 8px 8px 0; margin: 0 0 16px; }

/* ---------- buttons ---------- */
.primary, .ghost, .ctrl, .advance {
  font: inherit; cursor: pointer; border-radius: 14px; border: 1px solid var(--line);
  padding: 15px 20px; text-align: center; transition: transform .06s ease, background .15s ease;
}
.primary {
  display: block; background: var(--accent); color: var(--accent-ink); font-weight: 700;
  letter-spacing: .01em; border-color: var(--accent); box-shadow: 0 8px 26px rgba(201,238,94,.16);
}
.primary:active { transform: scale(.985); }
.ghost { display: block; background: transparent; color: var(--muted); }
.ghost:active { background: var(--surface2); }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.actions .primary { font-size: 1.05rem; }

/* ---------- week / month nav ---------- */
.weeknav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 6px; }
.chev {
  width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 1.25rem;
  background: var(--surface);
}
.chev:active { background: var(--surface2); }
.navmid { text-align: center; line-height: 1.2; }
.navmid strong { font-size: .98rem; letter-spacing: -.01em; }
.navmid span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.monthnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.monthnav a { font-size: .74rem; color: var(--muted); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); }
.monthnav a.todayjump { color: var(--accent); border-color: rgba(201,238,94,.45); }

/* ---------- week strip ---------- */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 0 0 16px; }
.wd { text-align: center; padding: 8px 2px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.wd.today { border-color: var(--line); background: var(--surface); }
.wd.sel { border-color: rgba(201,238,94,.55); background: rgba(201,238,94,.08); }
.wd.sel .wn { color: var(--accent); }
.banner.missed { border-color: #4a3a22; background: linear-gradient(180deg, #211b12, #171410); }
.wl { display: block; font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.wn { display: block; font-family: JBM, monospace; font-size: .9rem; margin: 1px 0 5px; }
.dot { display: block; width: 7px; height: 7px; border-radius: 50%; margin: 0 auto; background: #2c3a45; }
.dot.done { background: var(--ok); }
.dot.skipped { background: var(--warn); }
.dot.todo { background: #35434f; }
.dot.rest { background: transparent; border: 1px solid #2c3a45; }

.otherday {
  text-align: center; font-size: .78rem; color: var(--warn); border: 1px solid #4a3a22;
  background: rgba(242,181,68,.08); border-radius: 999px; padding: 6px 12px; margin-bottom: 14px;
}

/* ---------- live workout ---------- */
.live { text-align: center; }
.live-top { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 28px; }
.iconbtn {
  background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  width: 38px; height: 38px; font-size: 1rem; cursor: pointer;
}
.stage { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 46vh; justify-content: center; }
.timer {
  font-family: JBM, ui-monospace, monospace; font-size: clamp(4.2rem, 19vw, 6.4rem); font-weight: 600;
  letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums;
}
.phase { color: var(--muted); font-size: .86rem; text-transform: uppercase; letter-spacing: .12em; margin-top: 6px; }
.move-name {
  font-size: clamp(1.5rem, 7vw, 2.1rem); font-weight: 600; letter-spacing: -.02em;
  margin-top: 22px; line-height: 1.15;
}
.move-name::after { content: ' ›'; color: var(--muted); font-weight: 400; }
.move-target { font-family: JBM, monospace; color: var(--accent); font-size: 1.05rem; margin-top: 6px; }
.nextline { color: var(--muted); font-size: .9rem; margin-top: 18px; min-height: 1.3em; }
.advance {
  margin-top: 20px; background: var(--accent); color: var(--accent-ink); font-weight: 700;
  border-color: var(--accent); width: 100%; max-width: 320px; font-size: 1.02rem;
}
.rounds { color: var(--muted); font-family: JBM, monospace; font-size: .8rem; margin-top: 16px; }
.progress { height: 4px; background: #1d262e; border-radius: 999px; overflow: hidden; margin: 24px 0 18px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #8fbf3a, var(--accent)); transition: width .2s linear; }
.live-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ctrl { background: var(--surface); color: var(--text); }
.ctrl.ghost { background: transparent; }

.rewind { display: flex; gap: 8px; margin-top: 10px; }
.rw {
  flex: 1; font: inherit; font-size: .82rem; cursor: pointer; padding: 11px 8px;
  background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 12px;
}
.rw:active { background: var(--surface2); color: var(--text); }

/* voice picker */
.voicelist { display: flex; flex-direction: column; }
.voicerow {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px; cursor: pointer;
  border-bottom: 1px solid var(--line); border-radius: 10px;
}
.voicerow:last-child { border-bottom: 0; }
.voicerow.on { background: rgba(201,238,94,.08); border-color: rgba(201,238,94,.4); }
.voicerow.on .vname { color: var(--accent); font-weight: 600; }
.vname { flex: 1; font-size: .95rem; }
.vname em { font-style: normal; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.vlang { font-family: JBM, monospace; font-size: .74rem; color: var(--muted); }
.vplay { color: var(--accent); font-size: .8rem; }

/* count-in pulse for AMRAP transitions */
body.countin .timer { color: var(--accent); }

/* ---------- finish sheet ---------- */
.sheet { position: fixed; inset: 0; background: rgba(6,8,10,.72); backdrop-filter: blur(6px); display: flex; align-items: flex-end; z-index: 50; }
.sheet[hidden] { display: none; }
.sheet-inner {
  width: 100%; max-width: 720px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 24px 20px 28px;
}
.effort { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0 20px; }
.effort button {
  font: inherit; font-family: JBM, monospace; font-size: 1.1rem; font-weight: 600; cursor: pointer;
  background: var(--surface2); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 0 10px;
}
.effort button small { display: block; font-family: inherit; font-size: .58rem; font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.effort button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.effort button.on small { color: rgba(19,26,6,.7); }
.sheet-inner .primary { width: 100%; margin-bottom: 8px; }
.sheet-inner .ghost { width: 100%; }

/* ---------- exercise guide ---------- */
.guide-img {
  width: 100%; max-height: 380px; object-fit: contain; background: #0a0d10;
  border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px;
}
.attr { font-size: .72rem; color: var(--muted); margin: -6px 0 16px; }
.steps { margin: 0 0 16px; padding-left: 20px; }
.steps li { margin-bottom: 9px; }
.fault { border-left: 2px solid var(--warn); background: rgba(242,181,68,.08); padding: 11px 14px; border-radius: 0 10px 10px 0; font-size: .92rem; }
.demo { display: inline-block; margin-top: 16px; font-size: .9rem; color: var(--accent); border-bottom: 1px solid rgba(201,238,94,.4); padding-bottom: 2px; }

/* ---------- lists (history / library) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.done { color: var(--ok); border-color: rgba(63,208,138,.4); }
.tag.skipped { color: var(--warn); border-color: rgba(242,181,68,.4); }
.slotgrid { display: grid; gap: 10px; }
.slotgrid h3 { font-size: .76rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 18px 0 6px; }
.slotgrid a { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }

.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: .72rem; color: var(--muted);
}
.foot a { border-bottom: 1px solid var(--line); }

@media (min-width: 720px) {
  .shell { padding: 28px 24px 64px; }
  h1 { font-size: 2.2rem; }
  .stage { min-height: 40vh; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- profiles / auth ---------- */
.whoami {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: -8px 0 18px;
}
.who-link { display: inline-flex; align-items: center; gap: 8px; }
.who-name { font-weight: 600; font-size: .92rem; }
.who-level { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.who-switch { font-size: .74rem; color: var(--muted); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; }

.avatar {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 50%; background: var(--surface2); border: 1px solid var(--line);
  font-size: 1.35rem; line-height: 1;
}
.avatar.small { width: 30px; height: 30px; flex-basis: 30px; font-size: .95rem; }

.gate { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.gate-logo { width: 84px; height: 84px; border-radius: 20px; margin-bottom: 16px; }
.gate-form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.gate-form input, .manageform input, .manageform select {
  font: inherit; width: 100%; padding: 14px 16px; border-radius: 14px;
  background: var(--surface2); border: 1px solid var(--line); color: var(--text);
}
.err { color: #ff8f8f; font-size: .88rem; }
.ok { color: var(--ok); font-size: .88rem; }

.profilegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.profilegrid form { margin: 0; }
.profilecard {
  width: 100%; font: inherit; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 18px 12px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg2) 100%);
  border: 1px solid var(--line); color: var(--text);
}
.profilecard.on { border-color: rgba(201,238,94,.5); background: rgba(201,238,94,.06); }
.profilecard .avatar { width: 56px; height: 56px; font-size: 1.7rem; }
.pname { font-weight: 600; }
.plevel { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

/* ---------- leaderboard ---------- */
.boardrows li.me { background: rgba(201,238,94,.06); border-radius: 12px; padding-left: 10px; padding-right: 10px; }
.boardwho { display: inline-flex; align-items: center; gap: 10px; }
.rank { font-family: JBM, monospace; color: var(--muted); width: 14px; }
.boardstats { display: inline-flex; gap: 14px; align-items: center; }
.bst { font-family: JBM, monospace; font-size: 1.02rem; display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; }
.bst small { font-family: inherit; font-size: .58rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.bst.streak { color: var(--accent); }
.bst.streak small { color: var(--muted); }

/* ---------- admin ---------- */
.manageform { display: flex; flex-direction: column; gap: 10px; }
.mrow { display: flex; gap: 10px; align-items: center; }
.mrow.wrap { flex-wrap: wrap; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); }
.chk input { width: auto; }
.ghost.danger { color: #ff8f8f; border-color: #4a2a2a; margin-top: 8px; }
