:root {
  --bg: #07080b;
  --bg2: #0e1016;
  --card: #14171f;
  --card2: #1b1f2a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f5f7;
  --muted: #8d93a5;
  --lime: #d1ff3a;
  --lime-dim: rgba(209, 255, 58, 0.14);
  --coral: #ff5a3c;
  --coral-dim: rgba(255, 90, 60, 0.16);
  --blue: #6aa7ff;
  --ok: #3ee0a0;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --nav: 76px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Manrope", system-ui, sans-serif;
  --display: "Syne", "Manrope", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2208 0%, transparent 50%),
              radial-gradient(900px 500px at 110% 10%, #24140f 0%, transparent 46%),
              var(--bg);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; }

.orb {
  position: fixed;
  z-index: 0;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  opacity: 0.45;
  animation: drift 16s var(--ease) infinite alternate;
}
.orb-a { top: -80px; left: -60px; background: #8cff2a; }
.orb-b { right: -80px; top: 30%; background: #ff7a3c; animation-delay: -6s; opacity: 0.28; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(40px, 30px, 0) scale(1.12); }
}

#app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(var(--nav) + 18px + env(safe-area-inset-bottom));
}
#app.session {
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
}

.screen { animation: rise 0.55s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

h1, h2, .display {
  font-family: var(--display);
  letter-spacing: -0.04em;
  line-height: 0.95;
}
h1 { font-size: clamp(34px, 9vw, 46px); font-weight: 800; }
h2 { font-size: 26px; font-weight: 800; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
  color: var(--lime);
  margin-bottom: 10px;
}
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 12px; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 14px; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.card.hero {
  padding: 22px 18px;
  background:
    linear-gradient(180deg, rgba(209,255,58,0.12), rgba(20,23,31,0.4)),
    var(--card);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  border-radius: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: transform 0.2s var(--ease), filter 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-lime { background: var(--lime); color: #111; }
.btn-ghost {
  background: var(--card2);
  border: 1px solid var(--line);
}
.btn-coral { background: var(--coral); color: #fff; }
.btn-sm { min-height: 44px; width: auto; padding: 0 16px; font-size: 14px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip {
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 72px;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.chip strong { display: block; font-size: 15px; }
.chip span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.chip.on {
  border-color: var(--lime);
  background: var(--lime-dim);
  transform: translateY(-1px);
}

.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 700; }
.field input, .field select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px;
  outline: none;
}
.field input:focus { border-color: var(--lime); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.dots { display: flex; gap: 7px; margin: 8px 0 18px; }
.dots i {
  width: 8px; height: 8px; border-radius: 99px;
  background: #2a2e3a;
}
.dots i.on { width: 22px; background: var(--lime); }

.nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(7, 8, 11, 0.86);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  z-index: 20;
}
.nav button {
  display: grid;
  gap: 4px;
  justify-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 0;
}
.nav button.on { color: var(--lime); }
.nav svg { width: 22px; height: 22px; }

.day-card .tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--lime-dim);
  color: var(--lime);
}
.day-card.rest .tag { background: rgba(106,167,255,0.15); color: var(--blue); }
.ex-list { display: grid; gap: 8px; margin-top: 12px; }
.ex-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.ex-row b { font-size: 14px; }
.ex-row small { color: var(--muted); display: block; }
.badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--lime);
  background: var(--lime-dim);
  padding: 6px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.week button, .week span {
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}
.week .done { background: var(--lime); color: #111; border-color: var(--lime); }
.week .today { outline: 2px solid var(--lime); }
.week .rest { opacity: 0.55; }

.stat {
  display: grid;
  gap: 2px;
}
.stat b { font-size: 22px; font-family: var(--display); }
.stat span { color: var(--muted); font-size: 12px; }

/* workout */
.wo {
  min-height: calc(100dvh - 36px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}
.wo > div:nth-child(2) {
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.wo-top { display: flex; justify-content: space-between; align-items: center; }
.phase {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.phase.prep { color: var(--blue); }
.phase.work { color: var(--lime); }
.phase.count { color: var(--lime); }
.phase.rest { color: var(--coral); }
.ring-wrap {
  display: grid;
  place-items: center;
  position: relative;
  margin: 8px auto;
}
.ring-wrap svg { width: min(72vw, 280px); height: auto; transform: rotate(-90deg); }
.ring-wrap .num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}
.ring-wrap .num b {
  font-family: var(--display);
  font-size: 64px;
  letter-spacing: -0.06em;
  line-height: 1;
}
.ring-wrap .num span { color: var(--muted); font-size: 14px; font-weight: 700; }
.fig {
  width: 88px;
  height: 88px;
  margin: 0 auto 8px;
}
.fig svg { width: 100%; height: 100%; }
.demo {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
  margin: 8px 0 12px;
}
.demo .frame {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px 4px 0;
}
.demo .frame.wide { grid-column: 1 / -1; }
.demo .frame svg { width: 100%; height: auto; color: var(--muted); }
.demo .frame.on { border-color: rgba(209,255,58,0.45); }
.demo .frame.on svg { color: var(--lime); }
.demo .arr { color: var(--lime); font-size: 20px; font-weight: 800; }
.demo .floor, .demo .prop { stroke: rgba(255,255,255,0.28); }
.how-link {
  display: block;
  width: 100%;
  text-align: center;
  color: var(--lime);
  font-weight: 800;
  padding: 8px 0 4px;
}
.how-steps {
  margin: 10px 0 8px;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  text-align: left;
  font-size: 14px;
  line-height: 1.4;
}
.how-steps b { color: var(--lime); margin-right: 6px; }
.yt-link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 8px;
  border-radius: 14px;
  background: #1a1a1a;
  border: 1px solid var(--line);
  font-weight: 800;
  color: #fff;
}
.yt-thumb {
  width: 88px;
  height: 50px;
  object-fit: cover;
  border-radius: 8px;
  background: #333;
}
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 18px 0;
}
.stepper b {
  font-family: var(--display);
  font-size: 64px;
  letter-spacing: -0.05em;
  min-width: 1.4em;
  text-align: center;
}
.stepper button {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--card2);
  border: 1px solid var(--line);
  font-size: 28px;
  font-weight: 800;
}
.code-box {
  font-family: ui-monospace, monospace;
  font-size: 28px;
  letter-spacing: 0.28em;
  font-weight: 800;
  text-align: center;
  padding: 14px;
  border-radius: 16px;
  background: var(--lime-dim);
  color: var(--lime);
}
.wo.prep-layout .ring-wrap svg { width: min(42vw, 160px); }
.wo.prep-layout .ring-wrap .num b { font-size: 36px; }
.how-mini {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--card2);
  border: 1px solid var(--line);
  color: var(--lime);
  font-weight: 800;
}
.cue { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.45; max-width: 34ch; margin: 0 auto; }
.wo-actions { display: grid; gap: 10px; }
.wo-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.progress-thin {
  height: 6px;
  background: #1c2030;
  border-radius: 99px;
  overflow: hidden;
}
.progress-thin i {
  display: block;
  height: 100%;
  background: var(--lime);
  width: 0;
  transition: width 0.35s var(--ease);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: #111;
  border: 1px solid var(--lime);
  color: var(--lime);
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: 0.35s var(--ease);
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#app.session ~ .toast, .toast.up { bottom: 28px; }

.confetti i {
  position: fixed;
  top: -10px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: fall 1.1s linear forwards;
  z-index: 40;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(220deg); opacity: 0.2; }
}

.logo {
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--lime); color: #111;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 28px; font-weight: 800;
  box-shadow: 0 10px 30px rgba(209,255,58,0.25);
}

.done-screen { text-align: center; padding-top: 48px; }
.done-screen h1 { margin: 12px 0; }

.install-card {
  margin-bottom: 14px;
  border-color: rgba(209, 255, 58, 0.35);
  background: linear-gradient(180deg, rgba(209,255,58,0.14), rgba(20,23,31,0.5));
}
.install-card p { margin-top: 6px; }
.sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0,0,0,0.62);
  display: grid;
  align-items: end;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 18px 16px;
  animation: rise 0.4s var(--ease);
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  max-height: 88dvh;
  overflow-y: auto;
}
.sheet .how-steps { margin: 10px 0 8px; color: var(--text); }
.sheet ol { margin: 12px 0 16px 18px; color: var(--muted); line-height: 1.55; }
.sheet ol b { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
