:root {
  --bg: #fff8f1;
  --surface: #ffffff;
  --surface-2: #fff1e4;
  --text: #2a1a10;
  --muted: #7a6455;
  --line: #f0dccb;
  --brand: #f26b1d;
  --brand-ink: #ffffff;
  --brand-soft: #ffe1cc;
  --good: #1f9d55;
  --good-soft: #d9f5e4;
  --danger: #d23b3b;
  --flame: #ff7a1a;
  --shadow: 0 2px 0 rgba(120, 60, 20, .08), 0 8px 24px rgba(120, 60, 20, .08);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a120d; --surface: #241912; --surface-2: #2f2118; --text: #fbefe6; --muted: #bba393;
    --line: #3d2b20; --brand: #ff7a2e; --brand-soft: #4a2a17; --good: #3ccf7c; --good-soft: #173826;
    --danger: #ff6b6b; --shadow: 0 2px 0 rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a120d; --surface: #241912; --surface-2: #2f2118; --text: #fbefe6; --muted: #bba393;
  --line: #3d2b20; --brand: #ff7a2e; --brand-soft: #4a2a17; --good: #3ccf7c; --good-soft: #173826;
  --danger: #ff6b6b; --shadow: 0 2px 0 rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 Nunito, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
h1, h2, h3, .display { font-family: Fredoka, Nunito, sans-serif; letter-spacing: .2px; margin: 0; }
h1 { font-size: 28px; } h2 { font-size: 22px; } h3 { font-size: 18px; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }

.wrap { max-width: 960px; margin: 0 auto; padding: 16px 16px 96px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 10px 18px; font-weight: 800; cursor: pointer;
  background: var(--surface-2); color: var(--text); text-decoration: none; min-height: 44px;
  transition: transform .08s ease, filter .15s;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.btn.good { background: var(--good); color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.big { font-size: 20px; padding: 16px 28px; min-height: 60px; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
label.field { display: block; }
.field > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--muted); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar .inner { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-family: Fredoka; font-weight: 700; font-size: 20px; text-decoration: none; color: var(--text); }
.logo img { width: 34px; height: 34px; }
.topbar .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 800; white-space: nowrap; }
.tabs a.on { background: var(--brand-soft); color: var(--brand); }
.coach-tabs { max-width: 960px; margin: 0 auto; padding: 0 16px 10px; }

/* bottom nav for player */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface);
  border-top: 1px solid var(--line); display: flex; justify-content: center; gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
}
.bottomnav a { flex: 1; max-width: 160px; text-align: center; padding: 6px; border-radius: 14px; text-decoration: none; color: var(--muted); font-weight: 800; font-size: 13px; }
.bottomnav a .ico { display: block; font-size: 24px; line-height: 1.1; }
.bottomnav a.on { color: var(--brand); background: var(--brand-soft); }

/* hero */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin: 8px 0 18px; }
.hero h1 { font-size: 30px; }
.streak {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 96px; height: 96px; border-radius: 28px; background: linear-gradient(160deg, #ffb347, var(--flame));
  color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.15); text-align: center;
}
.streak .n { font-family: Fredoka; font-size: 36px; font-weight: 700; line-height: 1; }
.streak .l { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.streak.zero { background: var(--surface-2); color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; text-align: center; }
.stat .n { font-family: Fredoka; font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 700; }

/* week strip */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 18px; }
.week a { text-decoration: none; color: var(--text); text-align: center; padding: 8px 0 10px; border-radius: 14px; }
.week a.sel { background: var(--surface); box-shadow: var(--shadow); }
.week .dn { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.week .dot {
  width: 36px; height: 36px; margin: 6px auto 0; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; border: 2.5px solid transparent;
}
.dot.none { color: var(--muted); }
.dot.todo { border-color: var(--brand); color: var(--brand); }
.dot.part { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dot.done { background: var(--good); color: #fff; }
.dot.missed { border-color: var(--line); color: var(--muted); border-style: dashed; }
.dot.today { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--text); }

/* progress */
.progress { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #ffb347, var(--brand)); border-radius: 999px; transition: width .4s ease; }
.progress.done > i { background: var(--good); }

/* drill cards */
.drills { display: grid; gap: 12px; margin-top: 12px; }
.drill {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
  box-shadow: var(--shadow); cursor: pointer; text-align: left; width: 100%;
}
.drill .th { position: relative; aspect-ratio: 16/10; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.drill .th img { width: 100%; height: 100%; object-fit: cover; }
.drill .th .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 26px; text-shadow: 0 2px 8px rgba(0,0,0,.5); }
.drill .t { font-weight: 800; font-size: 17px; }
.drill .reps { color: var(--brand); font-weight: 800; font-size: 14px; }
.check {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--line); display: grid; place-items: center;
  font-size: 22px; color: transparent; background: var(--surface); flex-shrink: 0;
}
.drill.done { background: var(--good-soft); border-color: transparent; }
.drill.done .check { background: var(--good); border-color: var(--good); color: #fff; }
.drill.done .t { text-decoration: line-through; text-decoration-thickness: 2px; opacity: .75; }

.complete-banner { text-align: center; padding: 26px 16px; background: linear-gradient(160deg, var(--good-soft), var(--surface)); border-color: transparent; }
.complete-banner .big { font-size: 54px; }
.empty { text-align: center; padding: 36px 16px; }
.empty .big { font-size: 54px; }

/* overlay player */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 3, .92); display: flex; flex-direction: column; }
.overlay .bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #fff; }
.overlay .bar .x { background: rgba(255,255,255,.15); color: #fff; }
.overlay .vid { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.overlay video { max-width: 100%; max-height: 100%; border-radius: 12px; background: #000; }
.overlay .info { padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); color: #fff; text-align: center; }
.overlay .info .reps { color: #ffb347; font-weight: 800; font-size: 20px; }
.overlay .info .notes { opacity: .85; margin: 6px auto 12px; max-width: 600px; white-space: pre-wrap; }
.overlay .mute { font-size: 20px; min-width: 48px; min-height: 40px; padding: 4px 10px; }
.speed { display: inline-flex; gap: 4px; background: rgba(255,255,255,.12); border-radius: 999px; padding: 3px; }
.speed button { border: 0; background: transparent; color: #fff; padding: 4px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; cursor: pointer; }
.speed button.on { background: #fff; color: #000; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .h { text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; padding-bottom: 4px; }
.cal .c { aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; color: var(--text); font-weight: 800; background: var(--surface); border: 1px solid var(--line); font-size: 15px; position: relative; overflow: hidden; }
.cal .c.out { visibility: hidden; }
.cal .c.done { background: var(--good); color: #fff; border-color: transparent; }
.cal .c.part { background: var(--brand-soft); border-color: var(--brand); }
.cal .c.todo { border: 2px solid var(--brand); }
.cal .c.missed { background: var(--surface-2); color: var(--muted); }
.cal .c.today { outline: 3px solid var(--text); outline-offset: 1px; }
.cal .c .sub { font-size: 10px; font-weight: 700; opacity: .85; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line); }

/* coach: library */
.drop {
  display: block; border: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-radius: var(--radius);
  padding: 34px 16px; text-align: center; background: var(--brand-soft); cursor: pointer; transition: background .15s, border-color .15s;
}
.drop.over { border-color: var(--brand); }
.drop.over { background: color-mix(in srgb, var(--brand) 25%, var(--bg)); }
.drop .big { font-size: 44px; }
.vcard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.vcard .th { aspect-ratio: 16/9; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); position: relative; }
.vcard .th img { width: 100%; height: 100%; object-fit: cover; }
.vcard .body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.vcard .t { font-weight: 800; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--good-soft); color: var(--good); }
.badge.err { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge.work { background: var(--brand-soft); color: var(--brand); }
.uploads .u { display: grid; grid-template-columns: 1fr 120px; gap: 10px; align-items: center; font-size: 14px; }

/* coach: drill cards grouped by video */
.vgroup + .vgroup { margin-top: 28px; }
.vgroup-h { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.vgroup-h img, .vgroup-h .ph { width: 56px; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.dgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.dcard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.dcard .th { position: relative; aspect-ratio: 16/9; background: var(--surface-2); border: 0; padding: 0; cursor: pointer; display: block; width: 100%; }
.dcard .th img { width: 100%; height: 100%; object-fit: cover; }
.dcard .th .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 34px; text-shadow: 0 2px 10px rgba(0,0,0,.55); opacity: .9; }
.dcard .th .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.dcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.dcard input[type=text] { min-height: 32px; padding: 5px 9px; border-radius: 8px; font-size: 14px; }
.dcard input.t { font-weight: 800; }
.dcard .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* coach: editor */
.editor { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.editor video { width: 100%; max-height: 60vh; background: #000; border-radius: 14px; }
.timeline { position: relative; height: 38px; background: var(--surface-2); border-radius: 10px; margin-top: 10px; cursor: pointer; overflow: hidden; }
.timeline .seg { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; opacity: .85; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; overflow: hidden; white-space: nowrap; }
.timeline .cut { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); opacity: .5; }
.timeline .head { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--danger); pointer-events: none; }
.timeline .pend { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--brand) 35%, transparent); border-left: 3px solid var(--brand); }
.time { font-variant-numeric: tabular-nums; font-weight: 800; }
.sec { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.sec + .sec { margin-top: 8px; }
.sec .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* coach: lists */
.list .li { display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.list .li:first-child { border-top: 0; }
.list .li img, .list .li .ph { width: 96px; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.witem { display: grid; grid-template-columns: auto 64px minmax(0, 1fr) 250px auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.witem + .witem { margin-top: 8px; }
.witem img, .witem .ph { width: 64px; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.witem .mv { display: flex; flex-direction: column; }
.witem .mv button { border: 0; background: none; cursor: pointer; padding: 0 4px; font-size: 14px; color: var(--muted); }
.picker { max-height: 360px; overflow: auto; }
.picker button { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 6px; border-radius: 10px; cursor: pointer; }
.picker button:hover { background: var(--surface-2); }
.picker img, .picker .ph { width: 64px; aspect-ratio: 16/10; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.wdays { display: flex; gap: 6px; flex-wrap: wrap; }
.wdays label { cursor: pointer; }
.wdays input { display: none; }
.wdays span { display: inline-block; padding: 8px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 800; }
.wdays input:checked + span { background: var(--brand); color: #fff; }
.seg-ctl { display: inline-flex; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.seg-ctl button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg-ctl button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* login */
.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; text-align: center; }
.login img { width: 84px; height: 84px; margin: 0 auto 14px; }
.login form { margin-top: 20px; }
.err { color: var(--danger); font-weight: 700; min-height: 1.4em; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 800; z-index: 80; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100%; height: 100%; }

@media (max-width: 760px) {
  .editor { grid-template-columns: 1fr; }
  .drill { grid-template-columns: 96px 1fr auto; gap: 10px; }
  .witem { grid-template-columns: auto 52px 1fr auto; }
  .witem .repsin { grid-column: 2 / -1; grid-row: 2; }
  .witem [data-a=rm] { grid-column: 4; grid-row: 1; }
  .witem img, .witem .ph { width: 52px; }
  .hero h1 { font-size: 24px; }
  .streak { width: 84px; height: 84px; }
  .week .dot { width: 32px; height: 32px; font-size: 14px; }
  .logo span { display: none; }
  .hide-sm { display: none !important; }
  #logout { white-space: nowrap; }
}

/* ---------- start workout button on Today ---------- */
.go-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; border: 0; cursor: pointer; text-align: left;
  padding: 14px 18px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #ff9a3d, var(--brand) 55%, #d9480f);
  box-shadow: 0 4px 0 #a8380a, 0 10px 24px rgba(242, 107, 29, .35);
  transition: transform .1s ease, box-shadow .1s ease;
}
.go-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a8380a, 0 4px 12px rgba(242, 107, 29, .3); }
.go-btn .ball { font-size: 38px; animation: bounce 1.1s ease-in-out infinite; }
.go-btn .go-t { display: block; font-family: Fredoka; font-size: 22px; font-weight: 700; line-height: 1.1; }
.go-btn .go-s { display: block; font-size: 13px; font-weight: 700; opacity: .9; }
.go-btn .go-arrow { margin-left: auto; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 18px; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px) rotate(20deg); } }

/* ---------- timed workout overlay ---------- */
.trn {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; color: #fff;
  background: radial-gradient(120% 80% at 50% 0%, #3a1d0c 0%, #140a05 60%, #0b0603 100%);
  padding-top: env(safe-area-inset-top);
}
.trn-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px; gap: 10px; }
.tbtn { border: 0; background: rgba(255,255,255,.14); color: #fff; min-width: 46px; height: 46px; border-radius: 999px; font-size: 18px; font-weight: 800; cursor: pointer; padding: 0 14px; }
.tbtn.wide { min-width: 120px; }
.tbtn:active { transform: scale(.96); }
.trn-clock { text-align: center; flex: 1; }
.trn-time { font-family: Fredoka; font-weight: 700; font-size: clamp(56px, 14vw, 96px); line-height: .95; font-variant-numeric: tabular-nums; text-shadow: 0 4px 20px rgba(255, 122, 26, .45); transition: color .2s; }
.trn-label { font-weight: 800; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; opacity: .75; margin-top: 2px; }
.trn.hurry .trn-time { color: #ff5a5a; animation: throb .5s ease-in-out infinite alternate; }
.trn.resting .trn-time { color: #63e6be; }
.trn.paused .trn-time { opacity: .45; }
@keyframes throb { to { transform: scale(1.08); } }
.trn-bar { height: 8px; margin: 8px 16px 0; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; }
.trn-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ffb347, #ff7a1a); border-radius: 999px; transition: width .1s linear; }
.trn.hurry .trn-bar i { background: #ff5a5a; }
.trn.resting .trn-bar i { background: #63e6be; }
.trn-steps { display: flex; gap: 5px; justify-content: center; padding: 10px 16px 6px; }
.trn-steps i { width: 26px; height: 6px; border-radius: 999px; background: rgba(255,255,255,.18); transition: background .3s; }
.trn-steps i.done { background: #3ccf7c; }
.trn-steps i.on { background: #ff9a3d; box-shadow: 0 0 10px #ff7a1a; }
.trn-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px 10px; }
.trn-stage video { max-width: 100%; max-height: 100%; border-radius: 16px; background: #000; }
.trn.resting video, .trn.paused video { filter: brightness(.35) blur(2px); }
.trn-screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; overflow-y: auto; }
.trn-screen:not(:empty) { background: rgba(10, 5, 2, .55); }
.trn-foot { padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); text-align: center; }
.trn-name { font-family: Fredoka; font-size: 24px; font-weight: 700; }
.trn-reps { color: #ffb347; font-weight: 800; font-size: 18px; min-height: 1.2em; }

/* big animated words */
.pop { font-family: Fredoka; font-weight: 700; line-height: 1; animation: pop .55s cubic-bezier(.2, 1.6, .4, 1) both; }
.pop.num { font-size: clamp(140px, 40vw, 260px); color: #fff; text-shadow: 0 0 40px rgba(255, 154, 61, .8), 0 8px 0 #c2410c; }
.pop.go { font-size: clamp(110px, 30vw, 200px); color: #69f0ae; text-shadow: 0 0 40px rgba(105, 240, 174, .7), 0 8px 0 #1b7a43; }
.pop.stop { font-size: clamp(90px, 26vw, 180px); color: #ff5a5a; text-shadow: 0 0 40px rgba(255, 90, 90, .7), 0 8px 0 #8a1c1c; animation: slam .5s cubic-bezier(.2, 1.4, .4, 1) both, shake .4s .45s ease-in-out; }
@keyframes pop { 0% { transform: scale(2.6); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slam { 0% { transform: scale(3) rotate(-12deg); opacity: 0; } 100% { transform: scale(1) rotate(-6deg); opacity: 1; } }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -12px; } 40% { translate: 10px; } 60% { translate: -8px; } 80% { translate: 6px; } }
.sub-msg { font-size: 22px; font-weight: 800; margin-top: 14px; animation: rise .5s .2s both; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* rest */
.rest-box { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rest-t { font-family: Fredoka; font-size: 34px; font-weight: 700; letter-spacing: 6px; color: #63e6be; }
.rest-n { font-family: Fredoka; font-size: clamp(110px, 30vw, 180px); font-weight: 700; line-height: 1; }
.rest-n.pulse { color: #ffd43b; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.next-card { display: flex; gap: 12px; align-items: center; text-align: left; background: rgba(255,255,255,.1); border-radius: 16px; padding: 10px 14px 10px 10px; max-width: 420px; animation: rise .4s both; }
.next-card img { width: 110px; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; }
.next-card b { font-size: 18px; }
.muted-l { font-size: 13px; opacity: .7; font-weight: 700; }

/* intro + start button */
.intro-box { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; max-width: 460px; }
.intro-t { font-family: Fredoka; font-size: 34px; font-weight: 700; }
.intro-s { opacity: .8; font-weight: 700; }
.start-btn {
  position: relative; width: 210px; height: 210px; margin: 22px 0; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  font-family: Fredoka; font-size: 26px; font-weight: 700; line-height: 1.05; letter-spacing: 1px;
  background: radial-gradient(circle at 35% 30%, #ffb15c, #f26b1d 55%, #b9400c);
  box-shadow: 0 10px 0 #8a2f08, 0 20px 50px rgba(242, 107, 29, .55), inset 0 -8px 20px rgba(0,0,0,.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  animation: breathe 1.6s ease-in-out infinite; transition: transform .1s;
}
.start-btn:active { transform: translateY(6px) scale(.98); box-shadow: 0 4px 0 #8a2f08, 0 10px 30px rgba(242, 107, 29, .5); }
.start-btn .ball { font-size: 46px; animation: bounce 1.1s ease-in-out infinite; }
.start-btn .ring { position: absolute; inset: -6px; border-radius: 50%; border: 4px solid #ff9a3d; animation: ripple 1.8s ease-out infinite; pointer-events: none; }
.start-btn .ring.r2 { animation-delay: .9s; }
.start-btn.small { width: auto; height: auto; border-radius: 999px; padding: 14px 40px; margin: 20px 0 0; animation: none; font-size: 22px; }
@keyframes breathe { 0%, 100% { scale: 1; } 50% { scale: 1.05; } }
@keyframes ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(1.45); opacity: 0; } }
.intro-list { width: 100%; text-align: left; background: rgba(255,255,255,.07); border-radius: 16px; padding: 6px 12px; }
.intro-list div { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-weight: 700; }
.intro-list div + div { border-top: 1px solid rgba(255,255,255,.08); }
.intro-list span { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.15); display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.intro-list em { margin-left: auto; font-style: normal; opacity: .7; font-size: 14px; }

/* finished */
.done-box { display: flex; flex-direction: column; align-items: center; }
.trophy { font-size: 90px; animation: pop .7s cubic-bezier(.2, 1.6, .4, 1) both, bounce 1.4s .7s ease-in-out infinite; }
.done-t { font-size: clamp(44px, 12vw, 72px); color: #ffd43b; text-shadow: 0 6px 0 #a35f00, 0 0 30px rgba(255, 212, 59, .5); margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .pop, .pop.stop, .start-btn, .start-btn .ring, .go-btn .ball, .trophy, .trn.hurry .trn-time { animation: none !important; }
}
@media (max-height: 640px) {
  .start-btn { width: 160px; height: 160px; font-size: 21px; margin: 10px 0; }
  .intro-list { display: none; }
}

/* ---------- one-button workout card ---------- */
.wo-card {
  display: grid; grid-template-columns: 1fr; width: 100%; padding: 0; border: 0; cursor: pointer; text-align: left;
  border-radius: 24px; overflow: hidden; color: var(--text); background: var(--surface);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--brand) 55%, #000 10%), 0 14px 30px rgba(242, 107, 29, .22);
  outline: 3px solid color-mix(in srgb, var(--brand) 70%, transparent); outline-offset: -3px;
  transition: transform .1s ease, box-shadow .1s ease;
}
.wo-card:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 55%, #000 10%), 0 6px 14px rgba(242, 107, 29, .2); }
.wo-card[disabled] { opacity: .6; cursor: default; }
.wo-card.done { outline-color: var(--good); box-shadow: 0 5px 0 #157a40, 0 14px 30px rgba(31, 157, 85, .2); }
.wo-art { position: relative; aspect-ratio: 16/7; background: linear-gradient(135deg, #ffb347, var(--brand)); overflow: hidden; }
.wo-mosaic { position: absolute; inset: 0; display: grid; gap: 2px; }
.wo-mosaic.n2 { grid-template-columns: 1fr 1fr; }
.wo-mosaic.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.wo-mosaic.n3 img:first-child { grid-row: 1 / 3; }
.wo-mosaic.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.wo-mosaic img { width: 100%; height: 100%; object-fit: cover; }
.wo-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.45)); }
.wo-play {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 1; width: 78px; height: 78px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px; color: #fff; padding-left: 4px;
  background: radial-gradient(circle at 35% 30%, #ffb15c, #f26b1d 60%, #b9400c); box-shadow: 0 6px 20px rgba(0,0,0,.4), 0 0 0 6px rgba(255,255,255,.35);
  animation: breathe 1.8s ease-in-out infinite;
}
.wo-card.done .wo-play { background: var(--good); padding-left: 0; animation: none; }
.wo-ribbon { position: absolute; top: 14px; right: -34px; z-index: 1; rotate: 35deg; background: var(--good); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: 1px; padding: 4px 40px; }
.wo-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.wo-name { font-family: Fredoka; font-size: 26px; font-weight: 700; line-height: 1.1; }
.wo-meta { color: var(--muted); font-weight: 700; font-size: 14px; }
.wo-notes { color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.wo-cta {
  display: flex; align-items: center; gap: 12px; margin-top: 4px; padding: 12px 14px; border-radius: 16px; color: #fff;
  font-family: Fredoka; font-size: 21px; font-weight: 700; background: linear-gradient(135deg, #ff9a3d, var(--brand) 55%, #d9480f);
}
.wo-card.done .wo-cta { background: var(--good); }
.wo-cta .ball { font-size: 26px; animation: bounce 1.1s ease-in-out infinite; }
.wo-cta .go-arrow { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; font-size: 15px; }
.set-pips { display: flex; flex-wrap: wrap; gap: 6px; }
.pip { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.pip.part { background: var(--brand-soft); color: var(--brand); }
.pip.done { background: var(--good); color: #fff; }

/* coach check-off grid */
.checkgrid { margin: 10px 2px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.checkgrid summary { cursor: pointer; font-weight: 800; color: var(--muted); }
.cg { display: grid; gap: 6px; align-items: center; margin-top: 10px; }
.cg-h { text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.cg-n { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-b { height: 36px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: transparent; font-weight: 800; cursor: pointer; }
.cg-b.on { background: var(--good); border-color: var(--good); color: #fff; }

/* editor: sets */
.setbox { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.stepper { display: inline-flex; align-items: center; gap: 12px; }
.stepper b { font-family: Fredoka; font-size: 26px; min-width: 28px; text-align: center; }
.stepper .btn { width: 40px; min-height: 40px; font-size: 20px; padding: 0; background: var(--surface); }
.dim { opacity: .45; }

/* training: sets */
.trn-steps { flex-wrap: wrap; gap: 10px; }
.trn-steps .grp { display: flex; gap: 4px; }
.trn-steps i { width: auto; min-width: 10px; flex: 0 1 22px; }
.pop.set-t { font-size: clamp(54px, 15vw, 96px); color: #74c0fc; text-shadow: 0 6px 0 #1864ab, 0 0 30px rgba(116, 192, 252, .5); }
.resume { background: rgba(255,255,255,.12); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; }
.small-l { font-size: 13px; opacity: .65; }

/* ---------- full-screen video in workout mode (controls float over it) ---------- */
.trn-stage { position: absolute; inset: 0; z-index: 0; padding: 0; display: block; }
.trn-stage video { width: 100%; height: 100%; max-width: none; max-height: none; border-radius: 0; object-fit: contain; background: #000; }
.trn.zoom .trn-stage video { object-fit: cover; }
.trn::before, .trn::after { content: ''; position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; }
.trn::before { top: 0; height: 190px; background: linear-gradient(180deg, rgba(8,4,2,.85) 0%, rgba(8,4,2,.55) 55%, rgba(8,4,2,0) 100%); }
.trn::after { bottom: 0; height: 230px; background: linear-gradient(0deg, rgba(8,4,2,.9) 0%, rgba(8,4,2,.6) 50%, rgba(8,4,2,0) 100%); }
.trn-top, .trn-bar, .trn-steps, .trn-foot { position: relative; z-index: 2; }
.trn-foot { margin-top: auto; text-shadow: 0 2px 8px rgba(0,0,0,.7); }
.trn-time { text-shadow: 0 3px 14px rgba(0,0,0,.6), 0 4px 20px rgba(255, 122, 26, .45); }
.trn .tbtn { background: rgba(20, 10, 4, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.trn-screen { z-index: 1; padding: 170px 16px 150px; }
.trn-screen:empty { display: none; }
.trn-steps i { box-shadow: 0 1px 4px rgba(0,0,0,.5); }
@media (max-height: 640px) { .trn-screen { padding: 120px 12px 110px; } }
@media (orientation: landscape) and (max-height: 500px) {
  .trn::before { height: 120px; } .trn::after { height: 150px; }
  .trn-time { font-size: 48px; }
  .trn-steps { display: none; }
  .trn-screen { padding: 80px 12px 90px; }
  .trn-name { font-size: 18px; } .tbtn { height: 40px; min-width: 40px; } .tbtn.wide { min-width: 96px; }
}

.trn #tctl { flex-wrap: nowrap; gap: 8px !important; }
.trn .tbtn.wide { min-width: 0; padding: 0 16px; }

/* editor: Sets block at the top + set-all toolbar */
.setbox { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; border-radius: 16px;
  background: var(--brand-soft); border: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); }
.setbox-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.setbox-t { font-family: Fredoka; font-size: 24px; font-weight: 700; color: var(--brand); line-height: 1; }
.setbox-s { font-size: 13px; color: var(--muted); font-weight: 700; margin-top: 3px; }
.setbox .stepper b { font-size: 34px; min-width: 40px; color: var(--text); }
.setbox .stepper .btn { width: 46px; min-height: 46px; font-size: 24px; }
#srwrap > span { display: inline; }
.allbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.allbar select, .allbar input { min-height: 38px; padding: 6px 10px; }

/* ---------- proof photos ---------- */
.cam-setup { display: flex; align-items: center; gap: 12px; width: 100%; background: rgba(255,255,255,.1); border-radius: 16px; padding: 8px; text-align: left; }
.cam-setup video { width: 96px; height: 128px; object-fit: cover; border-radius: 12px; background: #000; transform: scaleX(-1); flex-shrink: 0; }
.cam-setup.off video { display: none; }
.cam-msg { font-size: 14px; font-weight: 700; line-height: 1.35; }
.cam-pip { position: absolute; z-index: 3; right: 12px; bottom: calc(150px + env(safe-area-inset-bottom)); width: 84px; height: 112px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.7); }
.cam-pip video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #000; }
.cam-pip .rec { position: absolute; left: 6px; top: 5px; font-size: 10px; font-weight: 800; color: #fff; background: rgba(210, 40, 40, .85); padding: 1px 6px; border-radius: 999px; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }
.proof-box { margin: 10px 2px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.proof-box summary { cursor: pointer; font-weight: 800; color: var(--muted); }
.ps { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.ps + .ps { border-top: 1px solid var(--line); padding-top: 12px; }
.tl-vid { width: 100%; max-height: 60vh; background: #000; border-radius: 12px; }
.pg-h { font-size: 14px; margin-bottom: 4px; }
.pg-strip { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.pg-strip button { padding: 0; border: 0; background: var(--surface-2); border-radius: 6px; overflow: hidden; cursor: pointer; aspect-ratio: 3/4; }
.pg-strip img { width: 100%; height: 100%; object-fit: cover; }
.lb .vid img { max-width: 100%; max-height: 100%; border-radius: 12px; object-fit: contain; }
.cal .c .camdot { position: absolute; top: 2px; right: 3px; font-size: 10px; }
@media (max-width: 760px) { .pg-strip { grid-template-columns: repeat(4, 1fr); } .pg-strip button:nth-child(n+5) { display: none; } }
