/* Burnlift – premium dark fitness UI (HDK Labs) */
:root {
  --bg: #0b0f14;
  --bg2: #121821;
  --card: #161d28;
  --card2: #1c2533;
  --line: rgba(255,255,255,0.08);
  --text: #f4f7fb;
  --muted: #9aa8bc;
  --orange: #ff7a2f;
  --lime: #b8ff3c;
  --accent: linear-gradient(135deg, #ff7a2f 0%, #ffb347 45%, #b8ff3c 100%);
  --accent-solid: #ff7a2f;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --nav-h: 68px;
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, 'Noto Nastaliq Urdu', 'Noto Sans Arabic', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
}
body { min-height: 100dvh; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

#app {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  padding: calc(12px + var(--safe-t)) 16px calc(var(--nav-h) + 16px + var(--safe-b));
  position: relative;
}
#app.mode-workout { padding-bottom: 16px; }

.hidden { display: none !important; }

/* Top */
.hero {
  background: radial-gradient(120% 80% at 10% 0%, rgba(255,122,47,0.28), transparent 55%),
              radial-gradient(100% 70% at 100% 10%, rgba(184,255,60,0.16), transparent 50%),
              var(--bg2);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  background: var(--accent); display: grid; place-items: center;
  font-weight: 800; color: #111; font-size: 1.1rem;
  box-shadow: 0 8px 24px rgba(255,122,47,0.35);
}
.brand h1 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.78rem; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 1.15rem;
}
.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px;
}
.stat-pill {
  background: rgba(0,0,0,0.28); border: 1px solid var(--line);
  border-radius: 16px; padding: 10px 8px; text-align: center;
}
.stat-pill .v { font-size: 1.25rem; font-weight: 800; background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-pill .l { font-size: 0.7rem; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title-row h2 { margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; border-radius: 16px;
  font-weight: 700; font-size: 0.98rem;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--accent); color: #121212;
  box-shadow: 0 10px 28px rgba(255,122,47,0.28);
  width: 100%;
}
.btn-ghost {
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); color: var(--text);
}
.btn-soft {
  background: rgba(255,122,47,0.12); 
  color: #ffc39a; border: 1px solid rgba(255,122,47,0.3);
}
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.plan-grid { display: grid; gap: 10px; }
.plan-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px; text-align: start; width: 100%;
}
.plan-card.active { border-color: rgba(255,122,47,0.55); box-shadow: inset 0 0 0 1px rgba(184,255,60,0.25); }
.plan-ico {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-size: 1.5rem; background: rgba(255,255,255,0.05); flex-shrink: 0;
}
.plan-card h3 { margin: 0; font-size: 1rem; }
.plan-card p { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.35; }

.level-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 8px; }
.level-chip {
  padding: 12px 8px; border-radius: 14px; text-align: center; font-weight: 700; font-size: 0.85rem;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line);
}
.level-chip.active { background: var(--accent); color: #111; border-color: transparent; }

.day-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
}
.day-cell {
  aspect-ratio: 1; border-radius: 14px; display: grid; place-items: center;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  font-weight: 700; font-size: 0.85rem; position: relative;
}
.day-cell.done { background: rgba(184,255,60,0.18); border-color: rgba(184,255,60,0.45); color: #d8ff9a; }
.day-cell.current { background: rgba(255,122,47,0.2); border-color: rgba(255,122,47,0.6); box-shadow: 0 0 0 2px rgba(255,122,47,0.25); }
.day-cell.rest { color: var(--muted); }
.day-cell.locked { opacity: 0.4; }

/* Bottom nav */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(480px, 100%);
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 10px calc(8px + var(--safe-b));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: rgba(11,15,20,0.92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); z-index: 50;
}
.nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 0.68rem; color: var(--muted); border-radius: 14px; padding: 6px;
}
.nav button.active { color: #fff; background: rgba(255,122,47,0.12); }
.nav .ni { font-size: 1.25rem; }

/* Progress bits */
.calendar {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.cal-h { text-align: center; font-size: 0.65rem; color: var(--muted); padding: 4px 0; }
.cal-d {
  aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center;
  font-size: 0.75rem; background: rgba(255,255,255,0.03);
}
.cal-d.done { background: rgba(255,122,47,0.35); }
.cal-d.today { outline: 2px solid var(--lime); }

.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.badge {
  background: var(--card2); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; display: flex; gap: 10px; align-items: center;
}
.badge.off { opacity: 0.4; filter: grayscale(0.8); }
.badge .bi { font-size: 1.5rem; }
.badge .bn { font-weight: 700; font-size: 0.85rem; }
.badge .bd { color: var(--muted); font-size: 0.72rem; margin-top: 2px; }

.water-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.drop {
  width: 36px; height: 36px; border-radius: 12px;
  background: rgba(80,180,255,0.12); border: 1px solid rgba(80,180,255,0.25);
  display: grid; place-items: center; font-size: 1rem;
}
.drop.full { background: rgba(80,180,255,0.45); }

.weight-list { list-style: none; padding: 0; margin: 0; }
.weight-list li {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.9rem;
}
.weight-list strong { color: var(--text); }

.field {
  display: flex; gap: 8px; margin-top: 8px;
}
.field input {
  flex: 1; min-height: 46px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(0,0,0,0.25); color: var(--text); padding: 0 14px; font-size: 1rem;
}

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--line); gap: 12px;
}
.toggle-row:last-child { border-bottom: none; }
.switch {
  width: 50px; height: 30px; border-radius: 999px; background: rgba(255,255,255,0.12);
  position: relative; transition: .2s; flex-shrink: 0;
}
.switch.on { background: linear-gradient(90deg, #ff7a2f, #b8ff3c); }
.switch i {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: .2s; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.switch.on i { left: 23px; }

.muted { color: var(--muted); }
.credit { text-align: center; color: var(--muted); font-size: 0.75rem; margin: 18px 0 8px; }

/* Workout screen */
.wo {
  display: flex; flex-direction: column; min-height: calc(100dvh - 24px - var(--safe-t));
  gap: 12px;
}
.wo-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.wo-progress {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 4px;
}
.wo-progress > i {
  display: block; height: 100%; width: 0%;
  background: var(--accent); border-radius: inherit; transition: width .3s ease;
}
.wo-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  padding: 18px 16px; min-height: 360px; position: relative; overflow: hidden;
}
.wo-stage::before {
  content: ''; position: absolute; inset: -40%;
  background: radial-gradient(circle at 50% 30%, rgba(255,122,47,0.18), transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(184,255,60,0.1), transparent 45%);
  pointer-events: none;
}
.wo-name { font-size: 1.35rem; font-weight: 800; text-align: center; z-index: 1; margin: 8px 0 4px; }
.wo-tip { color: var(--muted); font-size: 0.85rem; text-align: center; z-index: 1; max-width: 280px; }
.wo-timer {
  font-size: 4.2rem; font-weight: 900; letter-spacing: -0.03em; z-index: 1;
  background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1; margin: 8px 0;
}
.wo-phase {
  z-index: 1; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--lime); font-weight: 700;
}
.wo-next {
  z-index: 1; margin-top: 10px; padding: 8px 14px; border-radius: 999px;
  background: rgba(0,0,0,0.35); border: 1px solid var(--line);
  font-size: 0.8rem; color: var(--muted);
}
.wo-actions { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 10px; }
.wo-actions .btn { min-height: 52px; }
.rep-hit {
  width: 100%; min-height: 64px; border-radius: 18px; font-size: 1.15rem; font-weight: 800;
  background: var(--accent); color: #111;
}

/* SVG figure */
.figure-wrap {
  width: min(220px, 70vw); height: min(220px, 70vw); z-index: 1;
  display: grid; place-items: center;
}
.figure-wrap svg { width: 100%; height: 100%; overflow: visible; }
.fig-limb { stroke: #f2f5fa; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.fig-head { fill: #f2f5fa; }
.fig-accent { stroke: url(#accGrad); stroke-width: 8; stroke-linecap: round; fill: none; }
.floor { stroke: rgba(255,255,255,0.15); stroke-width: 3; stroke-linecap: round; }

/* Animations */
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
@keyframes squat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(14px) scaleY(0.92)} }
@keyframes push { 0%,100%{transform:translateY(0)} 50%{transform:translateY(18px)} }
@keyframes plankPulse { 0%,100%{opacity:1} 50%{opacity:0.7} }
@keyframes kick { 0%,100%{transform:rotate(0)} 50%{transform:rotate(-35deg)} }
@keyframes twist { 0%,100%{transform:rotate(-12deg)} 50%{transform:rotate(12deg)} }
@keyframes jumpOut { 0%,100%{transform:scaleX(1)} 50%{transform:scaleX(1.25)} }
@keyframes climb { 0%,100%{transform:translateY(0) rotate(0)} 50%{transform:translateY(-10px) rotate(-8deg)} }
@keyframes flutter { 0%,100%{transform:rotate(8deg)} 50%{transform:rotate(-8deg)} }
@keyframes breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }

.anim-jj .mover { animation: jumpOut 0.55s ease-in-out infinite; transform-origin: center bottom; }
.anim-knees .legL { animation: kick 0.4s ease-in-out infinite; transform-origin: 100px 130px; }
.anim-knees .legR { animation: kick 0.4s ease-in-out infinite reverse; transform-origin: 100px 130px; }
.anim-squat .mover { animation: squat 0.9s ease-in-out infinite; transform-origin: center top; }
.anim-pushup .mover { animation: push 0.85s ease-in-out infinite; }
.anim-plank .mover { animation: plankPulse 1.4s ease-in-out infinite; }
.anim-lunge .legL { animation: kick 1s ease-in-out infinite; transform-origin: 90px 120px; }
.anim-crunch .mover { animation: squat 1s ease-in-out infinite; }
.anim-climber .legL { animation: climb 0.35s ease-in-out infinite; transform-origin: 70px 120px; }
.anim-climber .legR { animation: climb 0.35s ease-in-out infinite reverse; transform-origin: 130px 120px; }
.anim-bridge .mover { animation: bob 1.1s ease-in-out infinite; }
.anim-twist .mover { animation: twist 0.9s ease-in-out infinite; transform-origin: center center; }
.anim-flutter .legL { animation: flutter 0.3s ease-in-out infinite; transform-origin: 100px 110px; }
.anim-flutter .legR { animation: flutter 0.3s ease-in-out infinite reverse; transform-origin: 100px 110px; }
.anim-kick .legR { animation: kick 0.8s ease-in-out infinite; transform-origin: 100px 120px; }
.anim-hydrant .legR { animation: kick 0.9s ease-in-out infinite; transform-origin: 110px 130px; }
.anim-calf .mover { animation: bob 0.7s ease-in-out infinite; }
.anim-wallsit .mover { animation: breathe 2s ease-in-out infinite; }
.anim-sideplank .mover { animation: breathe 1.8s ease-in-out infinite; }
.anim-superman .mover { animation: bob 1.2s ease-in-out infinite; }
.anim-birddog .armR, .anim-birddog .legL { animation: bob 1.2s ease-in-out infinite; }
.anim-inchworm .mover { animation: breathe 1.4s ease-in-out infinite; }
.anim-arms .armL, .anim-arms .armR { animation: twist 0.7s linear infinite; transform-origin: 100px 80px; }
.anim-bicycle .legL { animation: kick 0.5s ease-in-out infinite; transform-origin: 100px 120px; }
.anim-bicycle .legR { animation: kick 0.5s ease-in-out infinite reverse; transform-origin: 100px 120px; }
.anim-legraise .legL, .anim-legraise .legR { animation: kick 1.1s ease-in-out infinite; transform-origin: 100px 110px; }
.anim-burpee .mover { animation: squat 0.7s ease-in-out infinite; }
.anim-pike .mover { animation: push 1s ease-in-out infinite; }
.anim-tricep .mover { animation: push 0.9s ease-in-out infinite; }
.anim-rest .mover { animation: breathe 2.4s ease-in-out infinite; }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 80; padding: 16px; padding-bottom: calc(16px + var(--safe-b));
}
.overlay-card {
  width: min(480px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 24px; padding: 20px; max-height: 85vh; overflow: auto;
}
.overlay-card h2 { margin: 0 0 8px; }
.sheet-actions { display: grid; gap: 8px; margin-top: 14px; }

.lang-seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px;
}
.lang-seg button {
  padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.05);
  border: 1px solid var(--line); font-weight: 700;
}
.lang-seg button.active { background: var(--accent); color: #111; border-color: transparent; }

.reward-pop {
  text-align: center; padding: 10px 0 4px;
}
.reward-pop .big { font-size: 3rem; animation: bob 1s ease-in-out infinite; }

/* RTL tweaks */
.rtl .nav button, .rtl .stat-pill, .rtl .plan-card { text-align: center; }
.rtl .plan-card { text-align: start; }

@media (prefers-reduced-motion: reduce) {
  .mover, .legL, .legR, .armL, .armR { animation: none !important; }
}
