:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #e7ece9;
  --ink: #22231f;
  --muted: #706d66;
  --line: #d9e0dc;
  --green: #2e7d5b;
  --green-dark: #1f5c43;
  --blue: #316a8c;
  --red: #b8574a;
  --gold: #a1742a;
  --shadow: 0 18px 50px rgba(20, 33, 27, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(46, 125, 91, 0.08), transparent 38%),
    linear-gradient(315deg, rgba(49, 106, 140, 0.08), transparent 42%),
    var(--bg);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #171914;
  color: #fffdfa;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--green);
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: rgba(255, 253, 250, 0.7);
  font-size: 0.84rem;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  border: 0;
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 253, 250, 0.78);
  background: transparent;
  text-align: left;
}

.nav-tab span {
  width: 24px;
  text-align: center;
  color: rgba(255, 253, 250, 0.52);
}

.nav-tab:hover,
.nav-tab.is-active {
  background: rgba(255, 253, 250, 0.1);
  color: #fffdfa;
}

.profile-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 253, 250, 0.14);
}

.profile-panel label {
  color: rgba(255, 253, 250, 0.72);
  font-size: 0.8rem;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
}

.profile-panel select {
  border-color: rgba(255, 253, 250, 0.18);
  background: rgba(255, 253, 250, 0.1);
  color: #fffdfa;
}

.profile-panel option {
  color: var(--ink);
}

.content {
  min-width: 0;
  padding: 28px clamp(16px, 4vw, 44px) 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  line-height: 1.05;
}

h2 {
  font-size: 1.15rem;
  margin-bottom: 14px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.day-picker {
  display: grid;
  grid-template-columns: 42px minmax(78px, auto) 42px;
  align-items: center;
  gap: 8px;
}

.day-picker strong {
  text-align: center;
}

.icon-btn {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.icon-btn:hover {
  border-color: var(--green);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.exercise-card,
.day-card,
.meal-card,
.habit-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 250, 0.84);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.panel {
  padding: 18px;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.metric strong {
  display: block;
  font-size: 1.55rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.88rem;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 220ms ease;
}

.exercise-list {
  display: grid;
  gap: 10px;
}

.task-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.task-row input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--green);
}

.task-row strong {
  display: block;
}

.task-row span,
.muted {
  color: var(--muted);
}

.mini-btn,
.primary-btn,
.ghost-btn {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.primary-btn {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.ghost-btn {
  background: transparent;
}

.mini-btn:hover,
.primary-btn:hover,
.ghost-btn:hover {
  filter: brightness(0.96);
}

.plan-grid,
.library-grid,
.meal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.day-card,
.exercise-card,
.meal-card {
  padding: 14px;
}

.day-card {
  text-align: left;
}

.day-card.is-selected {
  outline: 2px solid var(--green);
}

.day-card header,
.exercise-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e1eee8;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.tag.blue {
  background: #e3eef4;
  color: var(--blue);
}

.tag.gold {
  background: #edf0e4;
  color: #67511d;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 10px;
  margin-bottom: 14px;
}

.demo-frame {
  margin: 12px 0;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.motion-art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.detail-frame {
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faf8;
  overflow: hidden;
}

.motion-detail {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 108 / 76;
  object-fit: cover;
}

.motion-svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.motion-svg .floor {
  stroke: #cbd6d0;
  stroke-width: 2;
}

.motion-svg .body {
  stroke: var(--ink);
  stroke-width: 6;
  stroke-linecap: round;
}

.motion-svg .joint {
  fill: var(--green);
}

.motion-svg .accent {
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 6 6;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(23, 25, 20, 0.4);
  display: none;
  justify-content: flex-end;
}

.drawer.is-open {
  display: flex;
}

.drawer-panel {
  width: min(760px, 100%);
  height: 100%;
  overflow: auto;
  padding: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drawer-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  z-index: 1;
}

.steps {
  padding-left: 18px;
  color: var(--muted);
}

.steps li + li {
  margin-top: 8px;
}

.habit-row {
  padding: 14px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.habit-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.notice {
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  background: #f4f7ea;
  color: #5d5127;
  border-radius: var(--radius);
}

.video-link-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.custom-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius);
  background: #10120f;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-tab {
    justify-content: center;
    padding: 10px 8px;
  }

  .nav-tab span {
    display: none;
  }

  .profile-panel {
    grid-template-columns: 1fr 1fr;
    margin-top: 0;
  }

  .profile-panel label {
    display: none;
  }

  .grid.two,
  .grid.three,
  .summary-band {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .content {
    padding-inline: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .day-picker {
    width: 100%;
    grid-template-columns: 42px 1fr 42px;
  }

  .nav-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .profile-panel,
  .grid.two,
  .grid.three,
  .summary-band,
  .toolbar,
  .video-link-form {
    grid-template-columns: 1fr;
  }

  .task-row,
  .habit-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .task-row .mini-btn,
  .habit-row .tag {
    grid-column: 2;
    width: max-content;
  }
}
