:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4f0;
  --ink: #17211d;
  --muted: #63716b;
  --line: #d9e1dc;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --accent: #c27a32;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(25, 43, 37, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px;
}

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

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

h1 {
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.05;
}

h2 {
  font-size: 24px;
  line-height: 1.15;
}

h3 {
  font-size: 17px;
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
}

.status-pill.ready {
  color: var(--brand-dark);
  border-color: rgba(15, 118, 110, 0.32);
  background: #e5f4ef;
}

.status-pill.warn {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff0ed;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.hidden {
  display: none !important;
}

.section-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

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

.summary-grid > div,
.metric-strip > div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.summary-grid span,
.metric-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-grid strong,
.metric-strip strong {
  font-size: 15px;
}

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

.exercise-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: inherit;
  background: #ffffff;
  text-align: left;
}

.exercise-choice.selected {
  border-color: rgba(15, 118, 110, 0.72);
  background: #e9f7f2;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.18);
}

.exercise-list p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.exercise-choice > span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f5eadf;
  color: #7b4a1c;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.button-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  color: #ffffff;
  background: var(--brand);
}

.button-row .primary-action,
.button-row .secondary-action,
.button-row .danger-action {
  width: auto;
}

.primary-action:hover {
  background: var(--brand-dark);
}

.secondary-action {
  color: var(--ink);
  background: #e9eeeb;
  border: 1px solid var(--line);
}

.danger-action {
  color: #ffffff;
  background: var(--danger);
}

.slider-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.slider-row input {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--brand);
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.check-list label,
.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.toggle-row {
  margin-top: 12px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.check-list input,
.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.notice {
  border-radius: 8px;
  padding: 12px;
  color: #5b390f;
  background: #fff5df;
  line-height: 1.5;
}

.notice.blocking {
  color: var(--danger);
  background: #fff0ed;
}

.camera-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111816;
}

.pose-guide {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #f8fbf8;
}

.pose-guide-image {
  width: 100%;
  max-height: min(62vh, 620px);
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef4f0;
}

.pose-guide-copy {
  display: grid;
  gap: 8px;
}

.pose-guide-copy h3 {
  font-size: 16px;
}

.pose-guide-copy p {
  color: var(--muted);
  line-height: 1.45;
}

.pose-guide-copy ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.camera-card.live {
  aspect-ratio: 3 / 4;
}

video,
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

video {
  transform: scaleX(-1);
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: #e7efeb;
  text-align: center;
  background: linear-gradient(180deg, rgba(13, 20, 18, 0.7), rgba(13, 20, 18, 0.92));
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: clamp(72px, 20vw, 180px);
  font-weight: 900;
  background: rgba(9, 18, 16, 0.38);
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
}

.camera-empty span {
  color: #b8c5c0;
}

.calibration {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.calibration > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.calibration span,
.calibration p {
  color: var(--muted);
}

.training-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.cue-box {
  min-height: 64px;
  display: grid;
  align-items: center;
  margin: 12px 0;
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  padding: 14px;
  background: #e9f7f2;
  color: #104b45;
  font-weight: 800;
  line-height: 1.45;
}

.cue-box.warn {
  border-left-color: var(--accent);
  color: #6b4217;
  background: #fff4e4;
}

.cue-box.danger {
  border-left-color: var(--danger);
  color: var(--danger);
  background: #fff0ed;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
}

.report-content {
  display: grid;
  gap: 12px;
}

.report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.report-card h3 {
  margin-bottom: 8px;
}

.report-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

@media (min-width: 760px) {
  .camera-card,
  .camera-card.live {
    aspect-ratio: 16 / 9;
  }

  .primary-action {
    width: auto;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 14px;
  }

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

  .status-pill {
    max-width: 130px;
    text-align: center;
  }

  .summary-grid,
  .metric-strip,
  .pose-guide {
    grid-template-columns: 1fr;
  }

  .training-header {
    display: grid;
  }

  .button-row {
    display: grid;
  }

  .button-row .primary-action,
  .button-row .secondary-action,
  .button-row .danger-action {
    width: 100%;
  }
}
