:root {
  --primary: #FF5A36;   /* LeanFit brand */
  --accent:  #12B886;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #0b0e11; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }

#app { height: 100%; display: flex; align-items: center; justify-content: center; }
#stage {
  position: relative; width: min(100vw, 56.25vh); height: min(100vh, 177.78vw);
  max-height: 100vh; background: #000; overflow: hidden;
}
/* Camera fills the stage; mirrored for a natural selfie view. */
#video, #overlay {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);
}
#overlay { z-index: 2; }

/* Scrims for readability */
#stage::before, #stage::after {
  content: ""; position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none;
}
#stage::before { top: 0; height: 130px; background: linear-gradient(to bottom, rgba(0,0,0,.6), transparent); }
#stage::after  { bottom: 0; height: 240px; background: linear-gradient(to top, rgba(0,0,0,.75), transparent); }

/* Top bar */
#topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.brand-name { font-size: 22px; font-weight: 800; }
.brand-sub  { font-size: 10px; opacity: .7; font-weight: 500; }
.pill { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px);
  padding: 6px 10px; border-radius: 999px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #f5a623; }
.pill.tracking .dot { background: var(--accent); }

/* Rep + form card */
#repCard { position: absolute; left: 16px; right: 16px; top: 46%; transform: translateY(-50%); z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-radius: 22px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.12); }
.ex-title { font-size: 13px; font-weight: 800; letter-spacing: 1.5px; color: var(--accent); }
.reps { font-size: 82px; font-weight: 900; line-height: .95; font-variant-numeric: tabular-nums; }
.reps-label { font-size: 12px; font-weight: 600; letter-spacing: 2px; opacity: .7; }
.form-ring { position: relative; width: 76px; height: 76px; text-align: center; }
.form-num { position: absolute; top: 22px; left: 0; right: 0; font-size: 24px; font-weight: 700; }
.form-lab { position: absolute; bottom: -4px; left: 0; right: 0; font-size: 10px; letter-spacing: 1.5px; opacity: .7; }

/* Coaching banner */
#coach { position: absolute; left: 16px; right: 16px; bottom: 132px; z-index: 5;
  padding: 14px 16px; border-radius: 16px; font-size: 18px; font-weight: 700; text-align: center;
  background: var(--primary); box-shadow: 0 4px 16px rgba(0,0,0,.35); transition: background .2s; }
#coach.ready { background: var(--accent); }

/* Controls */
#controls { position: absolute; left: 12px; right: 12px; bottom: 16px; z-index: 6;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#controls select, #controls button {
  font-size: 15px; font-weight: 700; color: #fff; border: none; border-radius: 12px;
  padding: 14px; background: rgba(255,255,255,.16); backdrop-filter: blur(6px); cursor: pointer; }
#exSelect { grid-column: 1 / 2; }
#startBtn { grid-column: 2 / 3; background: var(--primary); }
#startBtn:disabled { background: #555; opacity: .7; cursor: default; }
#startBtn.running { background: var(--accent); }
.toggle { font-size: 13px !important; padding: 10px !important; }
.toggle.on { outline: 2px solid var(--accent); }

#diag { position: absolute; top: 54px; right: 16px; z-index: 5; text-align: right;
  font: 11px/1.5 ui-monospace, Menlo, monospace; color: rgba(255,255,255,.85);
  background: rgba(0,0,0,.35); padding: 6px 8px; border-radius: 8px; white-space: pre; display: none; }
#diag.show { display: block; }
