/* ===== AFK FITNESS CLUB — dark teal theme (from logo) ===== */
:root {
  --bg: #07090b;
  --bg2: #0d1114;
  --card: #12181c;
  --card2: #171f24;
  --line: #1f2a30;
  --teal: #2f6b5e;
  --teal-bright: #46c2a4;
  --teal-glow: rgba(70, 194, 164, .15);
  --white: #f2f5f4;
  --muted: #8fa3a0;
  --danger: #e05c5c;
  --gold: #e8c268;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 300px at 80% -50px, var(--teal-glow), transparent 70%),
    radial-gradient(500px 300px at 10% 110%, rgba(47,107,94,.12), transparent 70%);
}
h1,h2,h3 { font-weight: 800; letter-spacing: .5px; }
a { color: var(--teal-bright); text-decoration: none; }
img { max-width: 100%; }

.wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px 90px; }
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: rgba(10,13,15,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 34px; width: auto; }
.brand .bname { font-size: 15px; font-weight: 800; letter-spacing: 2px; }
.brand .bname span { color: var(--teal-bright); }

nav.bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: rgba(10,13,15,.95); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
nav.bottom button {
  flex: 1; padding: 10px 4px 12px; background: none; border: none; color: var(--muted);
  font-size: 11px; font-weight: 700; letter-spacing: .5px; cursor: pointer;
}
nav.bottom button .ic { display: block; font-size: 20px; margin-bottom: 3px; }
nav.bottom button.active { color: var(--teal-bright); }

.card {
  background: linear-gradient(160deg, var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.card h2 { font-size: 16px; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; color: var(--white); }
.card h2 small { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; }
.sub { color: var(--muted); font-size: 13px; }

.btn {
  display: inline-block; background: linear-gradient(135deg, var(--teal), #245248);
  color: #fff; border: none; border-radius: 10px; padding: 12px 20px;
  font-weight: 800; font-size: 14px; letter-spacing: 1px; cursor: pointer; text-transform: uppercase;
}
.btn:hover { filter: brightness(1.15); }
.btn.bright { background: linear-gradient(135deg, var(--teal-bright), var(--teal)); color: #04211a; }
.btn.ghost { background: none; border: 1px solid var(--line); color: var(--muted); }
.btn.danger { background: none; border: 1px solid var(--danger); color: var(--danger); }
.btn.small { padding: 7px 12px; font-size: 12px; }
.btn.wide { width: 100%; }
input, select {
  width: 100%; background: var(--bg2); color: var(--white);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  font-size: 15px; margin-bottom: 12px; outline: none;
}
input:focus, select:focus { border-color: var(--teal-bright); }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.err { color: var(--danger); font-size: 13px; margin: 6px 0 10px; min-height: 16px; font-weight: 600; }
.ok-msg { color: var(--teal-bright); font-size: 13px; margin: 6px 0 10px; font-weight: 600; }

.auth-hero { text-align: center; padding: 34px 0 10px; }
.auth-hero img { width: 300px; max-width: 88%; height: auto; }
.auth-hero p { color: var(--muted); letter-spacing: 3px; font-size: 12px; text-transform: uppercase; margin-top: 6px; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { flex: 1; padding: 11px; background: var(--bg2); color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; font-weight: 800; letter-spacing: 1px; cursor: pointer; text-transform: uppercase; font-size: 12px; }
.tabs button.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.pbar { background: var(--bg2); border: 1px solid var(--line); border-radius: 99px; height: 14px; overflow: hidden; }
.pbar > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal-bright)); border-radius: 99px; transition: width .6s; }
.pbar.gold > div { background: linear-gradient(90deg, #b98f2f, var(--gold)); }
.prow { margin-bottom: 14px; }
.prow .plabel { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.prow .plabel b { color: var(--teal-bright); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 10px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.stat .v { font-size: 22px; font-weight: 900; color: var(--teal-bright); }
.stat .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 3px; }

.meal-slot { border-left: 3px solid var(--teal); padding-left: 14px; margin-bottom: 20px; }
.meal-slot .mtitle { font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: 14px; }
.meal-slot .mtime { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.food-opts { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 8px; }
.food-card {
  min-width: 150px; max-width: 150px; background: var(--card2); border: 1.5px solid var(--line);
  border-radius: 12px; overflow: hidden; cursor: pointer; flex-shrink: 0; position: relative;
}
.food-card img { width: 100%; height: 88px; object-fit: cover; display: block; background: #0a0e10; }
.food-card .fc-body { padding: 8px 10px 10px; }
.food-card .fc-name { font-size: 12.5px; font-weight: 700; line-height: 1.25; min-height: 31px; }
.food-card .fc-unit { color: var(--teal-bright); font-size: 11.5px; font-weight: 700; margin-top: 2px; }
.food-card .fc-mac { color: var(--muted); font-size: 10.5px; margin-top: 3px; }
.food-card.selected { border-color: var(--teal-bright); box-shadow: 0 0 0 2px var(--teal-glow); }
.food-card .pick { position: absolute; top: 6px; right: 6px; background: var(--teal-bright); color: #04211a;
  font-size: 10px; font-weight: 900; padding: 2px 7px; border-radius: 99px; display: none; }
.food-card.selected .pick { display: block; }
.alt-tag { font-size: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  padding: 2px 7px; border-radius: 99px; position: absolute; top: 6px; left: 6px; }
.rec .alt-tag { background: var(--teal); color: #fff; border-color: var(--teal); }

.logrow { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.logrow .ln { font-weight: 700; font-size: 14px; }
.logrow .lm { color: var(--muted); font-size: 12px; }
.logrow .del { background: none; border: none; color: var(--danger); font-size: 17px; cursor: pointer; }

.avoid li { color: #e8b4b4; font-size: 13.5px; margin-bottom: 7px; list-style: none; }
.avoid li::before { content: '✕  '; color: var(--danger); font-weight: 900; }

.ex-card { background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; }
.ex-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ex-name { font-weight: 800; font-size: 15px; }
.ex-meta { color: var(--teal-bright); font-size: 12.5px; font-weight: 700; margin-top: 3px; }
.ex-target { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { font-size: 10px; font-weight: 900; letter-spacing: 1px; padding: 3px 9px; border-radius: 99px; text-transform: uppercase; white-space: nowrap; }
.badge.done { background: rgba(70,194,164,.15); color: var(--teal-bright); border: 1px solid var(--teal); }
.badge.muscle { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.video-box { position: relative; margin: 10px 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.video-box iframe { width: 100%; aspect-ratio: 16/9; display: block; border: 0; }
.video-placeholder { background: #0a0e10; aspect-ratio: 16/9; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--muted); font-size: 13px; gap: 6px; }
.video-placeholder .play { width: 52px; height: 52px; border-radius: 50%; background: var(--teal);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; }
.ex-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 18px; color: var(--teal-bright); min-width: 64px; }
.alt-box { margin-top: 10px; background: var(--bg); border: 1px dashed var(--teal); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.alt-box b { color: var(--teal-bright); }

details.form-check { margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
details.form-check summary { cursor: pointer; padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--teal-bright); list-style: none; }
details.form-check summary::-webkit-details-marker { display: none; }
details.form-check summary::after { content: ' ▾'; color: var(--muted); }
details.form-check[open] summary::after { content: ' ▴'; }
details.form-check .video-box { margin: 0 10px 10px; }

.warn-box { background: rgba(224,92,92,.1); border: 1px solid var(--danger); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px; font-size: 13.5px; line-height: 1.5; color: #f0c4c4; }
.warn-box b { color: var(--danger); }
ul.rules { list-style: none; }
ul.rules li { font-size: 13.5px; line-height: 1.5; margin-bottom: 9px; padding-left: 22px; position: relative; color: #cfdcda; }
ul.rules li::before { content: '✓'; position: absolute; left: 0; color: var(--teal-bright); font-weight: 900; }

.rank-row { display: flex; align-items: center; gap: 12px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; margin-bottom: 8px; }
.rank-row .pos { font-weight: 900; font-size: 17px; width: 30px; color: var(--muted); }
.rank-row.top1 { border-color: var(--gold); background: linear-gradient(90deg, rgba(232,194,104,.08), var(--bg2)); }
.rank-row.top1 .pos { color: var(--gold); }
.rank-row.me { border-color: var(--teal-bright); }
.rank-row .rname { font-weight: 800; flex: 1; }
.rank-row .rmeta { color: var(--muted); font-size: 12px; }
.tag { font-size: 10px; font-weight: 900; background: rgba(232,194,104,.12); color: var(--gold);
  border: 1px solid rgba(232,194,104,.4); padding: 2px 8px; border-radius: 99px; margin-left: 6px; white-space: nowrap; }

.gate { text-align: center; padding: 30px 10px; }
.gate .lock { font-size: 46px; margin-bottom: 10px; }
.wa-btn { display: inline-flex; align-items: center; gap: 8px; background: #1faf55; color: #fff;
  padding: 12px 22px; border-radius: 10px; font-weight: 800; margin-top: 8px; }

table.admin { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin th { text-align: left; color: var(--muted); text-transform: uppercase; font-size: 10.5px;
  letter-spacing: 1px; padding: 8px; border-bottom: 1px solid var(--line); }
table.admin td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.admin .pbar { min-width: 90px; }

.tv { position: fixed; inset: 0; background: var(--bg); z-index: 100; padding: 40px 60px; overflow: auto; }
.tv h1 { font-size: 42px; letter-spacing: 3px; text-align: center; margin-bottom: 6px; }
.tv h1 span { color: var(--teal-bright); }
.tv .period { text-align: center; color: var(--gold); font-size: 20px; letter-spacing: 4px;
  text-transform: uppercase; margin-bottom: 26px; font-weight: 800; }
.tv .rank-row { padding: 18px 24px; margin-bottom: 12px; }
.tv .rank-row .pos { font-size: 30px; width: 56px; }
.tv .rank-row .rname { font-size: 24px; }
.tv .rank-row .rmeta { font-size: 16px; }
.tv .tag { font-size: 14px; padding: 4px 12px; }
.tv-close { position: fixed; top: 18px; right: 22px; z-index: 101; }

.hide { display: none !important; }
.center { text-align: center; }
.mt { margin-top: 12px; }
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; gap: 0; }
  .tv { padding: 20px; }
  .tv h1 { font-size: 26px; }
}

.install-bar {
  position: fixed; left: 10px; right: 10px; bottom: 68px; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  background: var(--card2); border: 1px solid var(--teal); border-radius: 14px;
  padding: 10px 12px; box-shadow: 0 8px 26px rgba(0,0,0,.55);
}
.install-bar img { width: 38px; height: 38px; border-radius: 9px; }
.install-bar div { flex: 1; line-height: 1.25; }
.install-bar b { display: block; font-size: 13.5px; }
.install-bar span { color: var(--muted); font-size: 11.5px; }
.install-x { background: none; border: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 4px; }

@supports (padding: env(safe-area-inset-top)) {
  header.topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  nav.bottom { padding-bottom: env(safe-area-inset-bottom); }
  .install-bar { bottom: calc(68px + env(safe-area-inset-bottom)); }
}

.vb-fs { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; z-index: 2; }
.vb-fs:active { background: rgba(0,0,0,.85); }
body {
  background: var(--bg);
  color: var(--white);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .bname, .wk-title, .tv h1, .ex-name, .rname {
  font-family: 'Oswald', 'Segoe UI', sans-serif;
  font-weight: 600;
  letter-spacing: .01em;
}
.bname, .tv h1 { text-transform: uppercase; letter-spacing: .04em; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
.video-box { position: relative; margin: 10px 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.video-box iframe { width: 100%; aspect-ratio: 16/9; display: block; border: 0; }
.video-box video.vb-video { width: 100%; aspect-ratio: 16/9; display: block; border: 0; background: #000; object-fit: contain; }
.video-box .vb-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.85); color: #fff;
  font-size: 19px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2; transition: opacity .25s ease, transform .25s ease;
}
.video-box .vb-play:active { transform: translate(-50%, -50%) scale(.9); }
.video-box .vb-play.hide { opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(1.2); }
.video-box .vb-fs {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  background: rgba(0,0,0,.6); color: #fff; border: 1px solid rgba(255,255,255,.4);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.video-box .vb-fs:active { background: rgba(0,0,0,.85); transform: scale(.94); }
.note-box {
  margin: 10px 0; border-radius: 10px; border: 1px dashed var(--teal);
  background: var(--bg); padding: 14px 16px; font-size: 13.5px; line-height: 1.5; color: #cfdcda;
/* ---- v3: calmer typography, video that fits its frame, set-by-set rows ---- */
h1, h2, h3, .bname, .wk-title, .tv h1, .ex-name, .rname {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  letter-spacing: 0;
}
h1, h2, .bname, .tv h1 { font-weight: 700; }
h3, .wk-title, .ex-name, .rname { font-weight: 600; }
.bname, .tv h1 { text-transform: none; letter-spacing: 0; }
.sub, .ex-target { font-style: normal; }

.video-box {
  position: relative; margin: 12px 0; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: #000;
  aspect-ratio: 16 / 9; max-height: 78vh;
}
.video-box iframe,
.video-box video.vb-video,
.video-box .video-placeholder {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; border: 0; aspect-ratio: auto;
}
.video-box video.vb-video { background: #000; object-fit: contain; }
.video-box .video-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #0a0e10; color: var(--muted); gap: 6px;
}
.video-box .vb-play, .video-box .vb-fs { display: none; }

.set-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.set-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 13.5px; color: var(--white);
  cursor: pointer; text-align: left; font-family: inherit;
  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.set-row:active { transform: scale(.985); }
.set-row .set-tick {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.set-row .set-label { font-weight: 600; }
.set-row .set-reps { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.set-row.done { border-color: var(--teal); background: rgba(70,194,164,.09); }
.set-row.done .set-tick { background: var(--teal); border-color: var(--teal); color: #fff; }
.set-row.done .set-label { color: var(--teal-bright); }
/* ---- v4: the video sizes itself from its own dimensions — no JS involved ----
   v3 pinned the video absolutely inside a box whose ratio JS had to set. If that
   JS hadn't loaded (or the CSS and JS were from different deploys) you got a
   sliver in the top-left corner. Now the <video> is a normal block with
   height:auto, so the browser derives the height from the real frame size. A
   9:16 clip is tall, a 16:9 clip is wide, and nothing has to agree with anything. */
.video-box {
  position: relative; display: block;
  margin: 12px 0; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: #000;
  aspect-ratio: auto; max-height: none;
}
.video-box video.vb-video {
  position: static; inset: auto; display: block;
  width: 100%; height: auto; max-height: 78vh;
  background: #000; object-fit: contain; aspect-ratio: auto; border: 0;
}
.video-box iframe {
  position: static; inset: auto; display: block;
  width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0;
}
.video-box .video-placeholder {
  position: static; inset: auto; display: flex;
  width: 100%; height: auto; aspect-ratio: 16 / 9;
  flex-direction: column; align-items: center; justify-content: center;
  background: #0a0e10; color: var(--muted); gap: 6px; font-size: 13px;
}
