:root {
  color-scheme: dark;
  --bg: #10151f;
  --panel: #171e2b;
  --panel-2: #202938;
  --text: #f6f8fb;
  --muted: #91a0b5;
  --line: rgba(255,255,255,.1);
  --green: #35e09b;
  --blue: #71a7ff;
  --coral: #ff8067;
  --yellow: #ffd166;
  --shadow: 0 22px 60px rgba(0, 0, 0, .32);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
button { font: inherit; color: inherit; }

body {
  background:
    radial-gradient(circle at 18% 4%, rgba(53,224,155,.18), transparent 28%),
    radial-gradient(circle at 94% 0%, rgba(113,167,255,.18), transparent 30%),
    linear-gradient(180deg, #10151f 0%, #0e121a 100%);
}

.app-shell {
  width: min(100vw, 440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px calc(86px + env(safe-area-inset-bottom));
  position: relative;
  overflow-x: hidden;
}

.screen { display: none; animation: rise .28s ease both; }
.screen.is-active { display: block; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 2px 14px;
}
.topbar.compact { padding-top: 22px; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
}
h1, h2, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.1; letter-spacing: 0; }
h2 { font-size: 18px; letter-spacing: 0; }

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  position: relative;
}
.icon-button span,
.icon-button::before,
.icon-button::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: var(--text);
}
.icon-button span { width: 14px; height: 2px; left: 13px; top: 21px; }
.icon-button::before { width: 2px; height: 14px; left: 19px; top: 14px; }
.icon-button::after { width: 6px; height: 6px; right: 10px; top: 10px; background: var(--coral); }

.hero-workout {
  min-height: 214px;
  border-radius: 28px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
  background:
    linear-gradient(140deg, rgba(16,21,31,.2), rgba(16,21,31,.78)),
    url("data:image/svg+xml,%3Csvg width='760' height='520' viewBox='0 0 760 520' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%2335e09b'/%3E%3Cstop offset='.48' stop-color='%2371a7ff'/%3E%3Cstop offset='1' stop-color='%23ff8067'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='760' height='520' fill='%23151b28'/%3E%3Cpath d='M132 464c45-86 111-132 197-139 92-8 150-55 174-142 18-66 59-104 124-113' stroke='url(%23g)' stroke-width='54' fill='none' stroke-linecap='round' opacity='.74'/%3E%3Ccircle cx='578' cy='101' r='54' fill='%23ffd166' opacity='.95'/%3E%3Cpath d='M440 399c-50-44-81-94-94-151-12-54-42-84-90-90' stroke='%23f6f8fb' stroke-width='34' fill='none' stroke-linecap='round' opacity='.42'/%3E%3Cpath d='M257 156l50 76 62-32' stroke='%23ffffff' stroke-width='30' fill='none' stroke-linecap='round' stroke-linejoin='round' opacity='.68'/%3E%3Ccircle cx='243' cy='129' r='31' fill='%23f6f8fb' opacity='.74'/%3E%3C/svg%3E") center/cover;
}
.hero-copy { position: relative; z-index: 1; }
.hero-copy p { color: rgba(255,255,255,.78); font-size: 14px; margin-bottom: 8px; }
.hero-copy h2 { font-size: 29px; line-height: 1.12; max-width: 260px; }
.metric-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.metric-row span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 12px;
}

.primary-action, .secondary-action, .ghost-action {
  border: 0;
  cursor: pointer;
  min-height: 42px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 800;
}
.primary-action { background: var(--green); color: #08120e; align-self: flex-start; }
.secondary-action { background: var(--panel-2); border: 1px solid var(--line); }
.ghost-action { background: rgba(255,255,255,.06); color: var(--muted); min-height: 34px; padding: 0 14px; }
.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.apk-download {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 18px;
}
.stats-grid article,
.section-block,
.chart-panel,
.profile-card,
.habit-panel {
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  border-radius: 22px;
}
.stats-grid article { padding: 14px 10px; }
.stat-value { display: block; font-size: 21px; font-weight: 850; }
.stat-label { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; white-space: nowrap; }

.section-block, .chart-panel { padding: 16px; margin-top: 14px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 17px; }
.section-head span { color: var(--muted); font-size: 13px; }

.plan-list, .course-list, .history-list { display: grid; gap: 10px; }
.plan-card, .course-card, .history-card {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
}
.course-card { min-height: 88px; }
.plan-thumb {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #06100c;
  font-weight: 900;
  background: var(--green);
}
.plan-card:nth-child(2n) .plan-thumb { background: var(--blue); }
.plan-card:nth-child(3n) .plan-thumb { background: var(--coral); }
.plan-title { font-size: 15px; font-weight: 800; margin-bottom: 5px; }
.plan-meta { font-size: 12px; color: var(--muted); }
.mini-start {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: rgba(53,224,155,.16);
  position: relative;
}
.mini-start::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 13px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid var(--green);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 4px 0 14px;
}
.segmented button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--muted);
  border-radius: 999px;
  min-height: 36px;
  font-size: 13px;
}
.segmented button.is-active { background: var(--text); color: #111827; border-color: var(--text); }

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 9px;
  height: 174px;
  padding-top: 8px;
}
.bar {
  min-width: 0;
  display: grid;
  align-items: end;
  gap: 8px;
  height: 100%;
}
.bar span {
  display: block;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--green), var(--blue));
  min-height: 16px;
}
.bar b {
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  font-weight: 700;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.avatar {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--green), var(--blue));
  color: #07120e;
  font-size: 28px;
  font-weight: 900;
}
.profile-card p { color: var(--muted); font-size: 13px; margin-top: 5px; }
.habit-panel { margin-top: 14px; padding: 6px 14px; }
.habit-row {
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.habit-row:last-child { border-bottom: 0; }
.habit-row span { color: var(--muted); }
.habit-row button {
  border: 0;
  border-radius: 999px;
  background: rgba(53,224,155,.14);
  color: var(--green);
  min-height: 34px;
  padding: 0 12px;
  font-weight: 800;
}

.player {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: end;
  justify-content: center;
  background: rgba(4,7,12,.62);
  padding: 18px;
}
.player.is-open { display: flex; }
.player-card {
  width: min(100%, 420px);
  border-radius: 30px;
  padding: 22px;
  background: #151c28;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}
.close-player {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  position: absolute;
  right: 18px;
  top: 18px;
}
.close-player::before, .close-player::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 18px;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 999px;
}
.close-player::before { transform: rotate(45deg); }
.close-player::after { transform: rotate(-45deg); }
.timer-ring {
  width: 210px;
  height: 210px;
  margin: 22px auto 14px;
  display: grid;
  place-items: center;
  position: relative;
}
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle {
  fill: none;
  stroke-width: 9;
  stroke: rgba(255,255,255,.08);
}
.timer-ring circle[data-progress] {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
}
.timer-ring strong {
  position: absolute;
  font-size: 42px;
  letter-spacing: 0;
}
.coach-tip { color: var(--muted); text-align: center; min-height: 24px; }
.player-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.player-actions .primary-action,
.player-actions .secondary-action { width: 100%; min-height: 48px; align-self: auto; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 440px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(14,18,26,.84);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  gap: 3px;
}
.bottom-nav button.is-active { background: rgba(53,224,155,.12); color: var(--green); }
.bottom-nav b { font-size: 11px; font-weight: 800; }
.nav-icon {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  display: block;
  position: relative;
}
.nav-icon.home { border-radius: 6px 6px 5px 5px; transform: translateY(2px) rotate(45deg); }
.nav-icon.train { border-radius: 50%; }
.nav-icon.train::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  position: absolute;
  right: -7px;
  top: 3px;
  transform: rotate(45deg);
}
.nav-icon.data {
  border: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}
.nav-icon.data::before, .nav-icon.data::after, .nav-icon.me::before {
  content: "";
  display: block;
  background: currentColor;
  border-radius: 999px;
}
.nav-icon.data::before { height: 12px; align-self: end; }
.nav-icon.data::after { height: 18px; align-self: end; box-shadow: 8px 6px 0 currentColor; }
.nav-icon.me { border-radius: 50%; }
.nav-icon.me::before {
  width: 8px;
  height: 8px;
  position: absolute;
  left: 4px;
  top: 3px;
  box-shadow: 0 10px 0 3px currentColor;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 22px 8px;
  font-size: 14px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 700px) {
  body { background-color: #0c1119; }
  .app-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
