:root {
  --ink: #1a1a16;
  --muted: #68675f;
  --paper: #f6f3ea;
  --panel: #fffdf7;
  --line: #d8d0bd;
  --green: #1f9f74;
  --blue: #2e6f9e;
  --red: #bd4a3d;
  --gold: #c9972d;
  --shadow: 0 24px 70px rgba(43, 35, 18, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(26, 26, 22, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(26, 26, 22, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
}

button {
  font: inherit;
}

.shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 34px);
}

.stage {
  min-height: calc(100vh - clamp(32px, 6vw, 68px));
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.86);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(18px, 2.8vw, 34px);
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4.6rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: 0;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: #fffdf7;
  background: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.button-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--gold);
  font-size: 0.74rem;
}

.trainer-grid {
  display: grid;
  grid-template-columns: minmax(250px, 330px) minmax(360px, 1fr) minmax(230px, 290px);
  min-height: 680px;
}

.lesson-panel,
.metrics-panel {
  padding: 22px;
  background: rgba(250, 247, 238, 0.72);
}

.lesson-panel {
  border-right: 1px solid var(--line);
}

.metrics-panel {
  border-left: 1px solid var(--line);
}

.lesson-header strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
}

.gesture-list {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}

.gesture-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
  cursor: pointer;
}

.gesture-card.active {
  border-color: var(--blue);
  outline: 3px solid rgba(46, 111, 158, 0.16);
}

.gesture-card strong,
.gesture-card small {
  display: block;
}

.gesture-card small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.gesture-mark,
.reference-art {
  position: relative;
  display: block;
  width: 48px;
  height: 56px;
}

.gesture-mark.open-palm,
.reference-art.open-palm {
  border-radius: 18px 18px 20px 20px;
  background: var(--gold);
}

.gesture-mark.open-palm i,
.reference-art.open-palm i {
  position: absolute;
  bottom: 39px;
  width: 8px;
  border-radius: 8px;
  background: var(--gold);
}

.gesture-mark.open-palm i:nth-child(1),
.reference-art.open-palm i:nth-child(1) { left: 3px; height: 30px; transform: rotate(-12deg); }
.gesture-mark.open-palm i:nth-child(2),
.reference-art.open-palm i:nth-child(2) { left: 13px; height: 40px; }
.gesture-mark.open-palm i:nth-child(3),
.reference-art.open-palm i:nth-child(3) { left: 24px; height: 44px; }
.gesture-mark.open-palm i:nth-child(4),
.reference-art.open-palm i:nth-child(4) { left: 35px; height: 34px; }
.gesture-mark.open-palm i:nth-child(5),
.reference-art.open-palm i:nth-child(5) { left: -7px; height: 27px; bottom: 22px; transform: rotate(-45deg); }

.gesture-mark.fist,
.reference-art.fist {
  height: 48px;
  border-radius: 18px 18px 16px 16px;
  background: var(--red);
  box-shadow: inset 0 13px 0 rgba(255,255,255,0.18);
}

.gesture-mark.point,
.reference-art.point {
  width: 42px;
  height: 50px;
  border-radius: 16px 16px 19px 19px;
  background: var(--green);
}

.gesture-mark.point i,
.reference-art.point i {
  position: absolute;
  left: 17px;
  bottom: 36px;
  width: 9px;
  height: 45px;
  border-radius: 9px;
  background: var(--green);
}

.reference {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.reference-art {
  width: 86px;
  height: 96px;
  margin: 18px auto 20px;
  transform: scale(1.45);
}

.reference p {
  color: var(--muted);
  line-height: 1.55;
}

.camera-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  background: #20201d;
}

.video-wrap {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,0.08), transparent 34%),
    #20201d;
}

video,
canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  color: #fffdf7;
  text-align: center;
  padding: 28px;
}

.empty-state.hidden {
  display: none;
}

.empty-state span {
  color: rgba(255,255,255,0.68);
}

.scan-symbol {
  width: 150px;
  height: 150px;
  margin: 0 auto 18px;
  border: 1px solid rgba(255,255,255,0.46);
  border-radius: 50%;
  background:
    linear-gradient(transparent 48%, rgba(201,151,45,0.8) 50%, transparent 52%),
    radial-gradient(circle, transparent 54%, rgba(255,255,255,0.18) 55%, transparent 57%);
  animation: scan 2.2s linear infinite;
}

@keyframes scan {
  to { transform: rotate(360deg); }
}

.status-strip {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 18px;
  align-items: center;
  min-height: 142px;
  padding: 18px 22px;
  color: #fffdf7;
  border-top: 1px solid rgba(255,255,255,0.14);
  background: #181816;
}

.score-dial {
  position: relative;
  width: 112px;
  height: 112px;
}

.score-dial svg {
  width: 112px;
  height: 112px;
  transform: rotate(-90deg);
}

.score-dial circle {
  fill: none;
  stroke-width: 10;
}

.track {
  stroke: rgba(255,255,255,0.14);
}

.progress {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 160ms ease, stroke 160ms ease;
}

#scoreValue {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
}

.state-label {
  display: inline-flex;
  margin-bottom: 7px;
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
}

.feedback p {
  margin: 0;
  max-width: 62ch;
  color: rgba(255,255,255,0.78);
  line-height: 1.45;
}

.metrics-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.metric span {
  display: flex;
  margin-bottom: 9px;
  color: var(--muted);
  font-weight: 800;
}

meter {
  width: 100%;
  height: 14px;
}

meter::-webkit-meter-bar {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: var(--green);
}

.notes {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.notes ul {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 1040px) {
  .trainer-grid {
    grid-template-columns: 1fr;
  }

  .lesson-panel,
  .metrics-panel {
    border: 0;
  }

  .lesson-panel {
    border-bottom: 1px solid var(--line);
  }

  .metrics-panel {
    border-top: 1px solid var(--line);
  }

  .video-wrap {
    min-height: 62vh;
  }
}

@media (max-width: 680px) {
  .topbar,
  .status-strip {
    grid-template-columns: 1fr;
    display: grid;
  }

  .primary-button {
    justify-content: center;
    width: 100%;
  }

  .status-strip {
    justify-items: start;
  }

  .video-wrap {
    min-height: 56vh;
  }
}
