/* Fonts: self-hosted Montserrat + Roboto (SIL OFL), see web/fonts */
@font-face { font-family: "Montserrat"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-style: normal; font-display: swap; src: url("fonts/montserrat-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-style: italic; font-display: swap; src: url("fonts/montserrat-latin-800-italic.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 900; font-style: italic; font-display: swap; src: url("fonts/montserrat-latin-900-italic.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/roboto-latin-700-normal.woff2") format("woff2"); }

/* Spotter: white, black, red. Classic 2018-style fitness app: bold Montserrat, clean cards, square corners. */
:root {
  --bg: #FFFFFF;
  --soft: #F4F4F4;
  --line: #E6E6E6;
  --ink: #111111;
  --mute: #757575;
  --red: #E10600;
  --red-dark: #B80500;
  --head: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --body: "Roboto", "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 2px 10px rgba(0, 0, 0, .08);
}
* { box-sizing: border-box; border-radius: 0; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--soft); color: var(--ink); font-family: var(--body); }
[hidden] { display: none !important; }
button { font-family: var(--head); cursor: pointer; }

.screen { min-height: 100%; max-width: 560px; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line); flex: none; }
.topbar.dark { background: var(--ink); border-bottom: 0; }
.brand { font: italic 900 22px/1 var(--head); letter-spacing: .02em; color: var(--red); }
.tag { font: 700 11px/1 var(--head); letter-spacing: .14em; color: var(--mute); }
.topbar.dark .tag { color: #BDBDBD; }

/* hero */
.hero { padding: 28px 20px 26px; background: var(--ink); color: #fff; }
.eyebrow { font: 700 12px var(--head); letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: 10px; }
.hero h1 { font: 800 34px/1.08 var(--head); margin: 0 0 12px; letter-spacing: -.01em; }
.hero h1 em { font-style: italic; color: var(--red); }
.hero p { margin: 0; font-size: 15px; line-height: 1.5; color: #CFCFCF; max-width: 440px; }
.hero-done { padding-bottom: 30px; }

.content { padding: 8px 16px 32px; }
.section-title { font: 700 13px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); margin: 22px 4px 10px; }

/* mode list */
.modes { display: grid; gap: 10px; }
.mode { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; padding: 18px 16px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); transition: border-color .15s, transform .15s; }
.mode:hover { border-color: var(--ink); }
.mode:active { transform: scale(.99); }
.mode-num { font: italic 900 28px/1 var(--head); color: var(--red); width: 42px; flex: none; }
.mode-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.mode-text b { font: 800 17px var(--head); text-transform: uppercase; letter-spacing: .02em; }
.mode-text small { font: 400 14px var(--body); color: var(--mute); }
.chev { font: 400 30px/1 var(--body); color: #BDBDBD; }
.mode.on { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.mode.on .chev { color: var(--red); transform: rotate(90deg); }

/* workout cards */
.cards { display: grid; gap: 12px; }
.card { background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 18px 16px 16px; background: var(--ink); color: #fff; position: relative; }
.card-head::after { content: ""; position: absolute; left: 0; bottom: 0; width: 64px; height: 4px; background: var(--red); }
.card-head h2 { margin: 0; font: italic 900 24px/1 var(--head); text-transform: uppercase; }
.card-head span { font: 600 12px var(--head); color: #BDBDBD; letter-spacing: .06em; }
.card ol { list-style: none; margin: 0; padding: 4px 16px; counter-reset: ex; }
.card li { counter-increment: ex; display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font: 500 15px var(--body); }
.card li:last-child { border-bottom: 0; }
.card li::before { content: counter(ex, decimal-leading-zero); font: 800 13px var(--head); color: var(--red); width: 22px; }
.card li .dur { margin-left: auto; font: 500 13px var(--body); color: var(--mute); }
.card .btn { margin: 4px 16px 16px; width: calc(100% - 32px); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 50px; padding: 0 22px; font: 800 14px var(--head); letter-spacing: .08em; text-transform: uppercase; border: 2px solid transparent; transition: background .15s, color .15s; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.btn-outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { background: #D6D6D6; color: #fff; cursor: not-allowed; }

/* video form */
.video-form { display: grid; gap: 14px; }
.video-form .section-title { margin-bottom: 0; }
.field { display: grid; gap: 6px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 12px 14px; }
.field span { font: 700 11px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.field select, .field input { font: 500 16px var(--body); border: 0; padding: 4px 0; background: transparent; color: var(--ink); width: 100%; outline: none; }
.fine { font-size: 12px; line-height: 1.5; color: var(--mute); margin: 26px 4px 0; text-align: center; }

/* ---------- workout ---------- */
.workout { height: 100vh; height: 100dvh; min-height: 0; }
.setbar { height: 4px; background: #2A2A2A; flex: none; }
#setBar { height: 100%; width: 0; background: var(--red); transition: width .25s linear; }
.panel { position: relative; flex: 1 1 0; min-height: 0; overflow: hidden; }
.coach-panel { background: linear-gradient(#FFFFFF, #F1F1F1); }
#coachCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ex-info { position: absolute; top: 14px; left: 16px; }
.ex-phase { font: 800 11px var(--head); letter-spacing: .16em; color: var(--red); }
.ex-name { font: italic 900 26px/1.1 var(--head); text-transform: uppercase; margin-top: 2px; }
.next { font: 500 12px var(--body); color: var(--mute); margin-top: 4px; }
.timer { position: absolute; top: 10px; right: 16px; font: 800 46px/1 var(--head); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer.low { color: var(--red); }
.subtitle { position: absolute; left: 12px; right: 12px; bottom: 12px; background: var(--ink); color: #fff; font: 600 16px/1.35 var(--head); padding: 10px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.18); border-left: 4px solid #fff; }
.subtitle:empty { display: none; }
.subtitle.correction { border-left-color: var(--red); background: #1A1A1A; }

.cam-panel { background: #000; }
#video, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.mirror #video, .mirror #overlay { transform: scaleX(-1); }
.chip { position: absolute; top: 12px; left: 12px; background: rgba(17,17,17,.85); color: #fff; font: 800 11px var(--head); letter-spacing: .1em; padding: 7px 10px; }
.chip::before { content: ""; display: inline-block; width: 8px; height: 8px; background: #3DDC84; margin-right: 8px; vertical-align: 0; }
.chip.bad { background: var(--red); }
.chip.bad::before { background: #fff; }
.meta { position: absolute; right: 10px; bottom: 8px; font: 400 11px var(--body); color: #BDBDBD; }

.ask { position: absolute; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ask-card { background: var(--bg); width: 100%; max-width: 420px; padding: 20px; border-top: 4px solid var(--red); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.ask-label { font: 800 11px var(--head); letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: 6px; }
.ask-q { font: 700 19px/1.3 var(--head); margin-bottom: 16px; }
.ask-btns { display: grid; gap: 8px; }
.ask-btns button { height: 48px; font: 800 13px var(--head); letter-spacing: .08em; text-transform: uppercase; background: var(--ink); color: #fff; border: 0; }
.ask-btns button:first-child { background: var(--red); }
.ask-btns button.stop { background: transparent; color: var(--ink); border: 2px solid var(--ink); }

.controls { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ink); flex: none; padding-bottom: env(safe-area-inset-bottom); }
.controls button { height: 56px; border: 0; background: transparent; color: #fff; font: 700 12px var(--head); letter-spacing: .12em; text-transform: uppercase; border-right: 1px solid #2A2A2A; }
.controls button:last-child { border-right: 0; }
.controls button:hover { background: #1F1F1F; }
.controls .end { color: var(--red); }

.trace { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); box-shadow: -6px 0 24px rgba(0,0,0,.2); display: flex; flex-direction: column; z-index: 5; }
.trace-head { display: flex; gap: 8px; align-items: center; padding: 0 12px; height: 56px; background: var(--ink); color: #fff; }
.trace-head b { flex: 1; font: 800 13px var(--head); letter-spacing: .12em; text-transform: uppercase; }
.trace-head button { height: 34px; padding: 0 12px; font: 700 11px var(--head); letter-spacing: .08em; text-transform: uppercase; background: transparent; color: #fff; border: 1px solid #555; }
.trace ol { list-style: none; margin: 0; padding: 0; overflow: auto; font: 13px/1.45 var(--body); }
.trace li { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.trace li .ev { font: 700 11px var(--head); letter-spacing: .06em; color: var(--mute); }
.trace li.decide .ev, .trace li.human .ev { color: var(--red); }

/* done */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.stat { background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 16px; }
.stat b { display: block; font: 800 30px/1 var(--head); }
.stat span { display: block; margin-top: 6px; font: 500 13px var(--body); color: var(--mute); }
.stat.hl b { color: var(--red); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

@media (min-width: 561px) { body { padding: 0; } .screen { box-shadow: 0 0 40px rgba(0,0,0,.06); } }
.field input[type=file]::file-selector-button { font: 800 12px var(--head); letter-spacing: .08em; text-transform: uppercase; background: var(--ink); color: #fff; border: 0; height: 36px; padding: 0 14px; margin-right: 12px; cursor: pointer; }
/* soft question (user stopped): keep the camera visible so the coach can see them come back */
.ask.soft { background: transparent; align-items: flex-end; padding: 10px; pointer-events: none; }
.ask.soft .ask-card { pointer-events: auto; padding: 14px; }
.ask.soft .ask-q { font-size: 16px; margin-bottom: 10px; }
.ask.soft .ask-btns { grid-template-columns: 1fr 1fr; }
.mic { position: absolute; left: 12px; bottom: 8px; max-width: 70%; background: rgba(17,17,17,.85); color: #fff; font: 600 11px var(--head); letter-spacing: .04em; padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mic .dot { display: inline-block; width: 8px; height: 8px; background: var(--red); margin-right: 8px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.ask-hint { font: 700 14px var(--head); color: var(--ink); margin: -6px 0 12px; }

/* pages */
.back { background: none; border: 0; font: 700 14px var(--head); color: var(--ink); padding: 8px 8px 8px 0; letter-spacing: .02em; }
.back:hover { color: var(--red); }
.topbar .back + .brand { margin-right: auto; margin-left: 8px; }
.hero-small h1 { font-size: 30px; }
.steps { margin: 18px 0 20px; padding-left: 20px; font: 400 15px/1.6 var(--body); }
.steps li { margin-bottom: 8px; }
.sound-btn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; background: var(--red); color: #fff; border: 0; padding: 16px 20px; font: 800 14px var(--head); letter-spacing: .04em; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* phone held sideways (floor exercises): coach left, you right */
@media (orientation: landscape) and (max-height: 600px) {
  .screen.workout { max-width: none; display: grid; grid-template-columns: 1fr 1.4fr; grid-template-rows: auto auto 1fr auto; }
  .screen.workout > .topbar, .screen.workout > .setbar, .screen.workout > .controls { grid-column: 1 / -1; }
  .screen.workout > .topbar { height: 40px; }
  .coach-panel { border-bottom: 0; border-right: 2px solid var(--ink); }
  .controls button { height: 44px; }
  .timer { font-size: 34px; }
  .ex-name { font-size: 20px; }
}
