:root {
  --ink: #050b12;
  --ink-2: #07131f;
  --surface: #0b1a27;
  --surface-2: #102536;
  --line: rgba(143, 188, 212, 0.2);
  --text: #f0eadc;
  --muted: #8fa2ad;
  --cyan: #35cef5;
  --green: #61d46c;
  --amber: #ffb219;
  --coral: #ff6656;
  --violet: #bd8cff;
  --font-sans: Arial, Helvetica, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--ink);
  font-family: var(--font-sans);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.movement-app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 72px auto minmax(520px, 1fr) 32px;
  background:
    linear-gradient(90deg, transparent 31px, rgba(53, 206, 245, 0.022) 32px, transparent 33px) 0 0 / 64px 64px,
    linear-gradient(0deg, transparent 31px, rgba(53, 206, 245, 0.016) 32px, transparent 33px) 0 0 / 64px 64px,
    radial-gradient(circle at 18% 0%, rgba(35, 115, 153, 0.16), transparent 30%),
    var(--ink);
}

.movement-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto minmax(170px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 11px 20px;
  border: 1px solid rgba(53, 206, 245, 0.22);
  border-left: 3px solid var(--green);
  background: rgba(7, 17, 28, 0.97);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36);
}

.back-link,
.page-nav a {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
}

.back-link span:first-child {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 20px;
}

.back-link:hover,
.page-nav a:hover {
  color: var(--text);
}

.movement-brand {
  text-align: center;
}

.movement-brand p,
.section-heading > div:first-child > p {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.2em;
}

.movement-brand h1,
.section-heading h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0.055em;
}

.movement-brand h1 {
  font-size: 24px;
}

.page-nav {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
}

.bucket-section {
  position: relative;
  padding: 18px 24px 16px;
  border-bottom: 1px solid rgba(53, 206, 245, 0.25);
  background: rgba(6, 16, 25, 0.78);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2 {
  font-size: clamp(20px, 2vw, 29px);
}

.bucket-definition {
  max-width: 520px;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 10px;
}

.bucket-definition p {
  margin: 0;
  color: #a9b8bf;
  font-size: 11px;
  line-height: 1.4;
}

.bucket-definition strong {
  color: var(--text);
}

.info-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
}

.bucket-lanes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.bucket-card {
  --bucket-color: var(--cyan);
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: 97px minmax(0, 1fr);
  min-height: 165px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--bucket-color) 48%, transparent);
  border-top: 3px solid var(--bucket-color);
  background: linear-gradient(135deg, color-mix(in srgb, var(--bucket-color) 7%, #0d2030), #07131e 62%);
}

.bucket-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 48%, color-mix(in srgb, var(--bucket-color) 4%, transparent));
  pointer-events: none;
}

.bucket-1 { --bucket-color: var(--green); }
.bucket-2 { --bucket-color: var(--cyan); }
.bucket-3 { --bucket-color: var(--amber); }

.bucket-metric {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 13px 10px 11px 13px;
  border-right: 1px solid color-mix(in srgb, var(--bucket-color) 28%, transparent);
}

.bucket-number {
  color: color-mix(in srgb, var(--bucket-color) 84%, white);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.bucket-time {
  display: block;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 31px;
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.bucket-time small {
  margin-left: 2px;
  color: var(--bucket-color);
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.bucket-speed {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.4;
}

.bucket-speed strong {
  display: block;
  color: var(--bucket-color);
  font-size: 12px;
}

.hero-cluster {
  position: relative;
  z-index: 2;
  align-content: center;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(43px, 1fr));
  gap: 5px;
  padding: 10px;
}

.hero-chip {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1.12;
  overflow: hidden;
  border: 1px solid rgba(240, 234, 220, 0.14);
  background: #112536;
}

.hero-chip img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: saturate(0.82) contrast(1.04);
  transform: scale(1.035);
}

.hero-chip span {
  position: absolute;
  inset: auto 0 0;
  padding: 11px 2px 3px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(transparent, rgba(3, 8, 13, 0.95));
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bucket-scale {
  position: absolute;
  right: 25px;
  bottom: -9px;
  left: 25px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  color: #5d7480;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.bucket-scale div {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(143, 188, 212, 0.25);
}

.bucket-scale i {
  width: 1px;
  height: 5px;
  background: rgba(143, 188, 212, 0.35);
}

.trainer-section {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(620px, 1.65fr);
  background: rgba(4, 12, 19, 0.68);
}

.trainer-copy {
  min-width: 0;
  padding: 24px;
  border-right: 1px solid rgba(53, 206, 245, 0.24);
}

.trainer-heading {
  align-items: flex-end;
}

.drill-tabs {
  display: flex;
  gap: 4px;
}

.drill-tabs button {
  min-height: 35px;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: #0b1b28;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.drill-tabs button[aria-selected="true"] {
  color: #061016;
  border-color: var(--green);
  background: var(--green);
}

.lesson-card {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 16px;
  margin-top: 24px;
  padding: 19px;
  border: 1px solid rgba(97, 212, 108, 0.34);
  background: linear-gradient(120deg, rgba(97, 212, 108, 0.09), rgba(12, 29, 41, 0.66));
}

.lesson-number {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.1em;
  line-height: 0.9;
}

.lesson-card strong {
  font-size: 14px;
  letter-spacing: 0.1em;
}

.lesson-card p {
  margin: 7px 0 0;
  color: #bac6ca;
  font-size: 12px;
  line-height: 1.45;
}

.input-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(11, 27, 40, 0.72);
}

.keycap,
.mouse-turn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  border: 1px solid rgba(53, 206, 245, 0.42);
  background: #102739;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
}

.keycap {
  min-width: 38px;
  padding: 0 7px;
}

.keycap-muted {
  color: #99a7ad;
  border-color: rgba(143, 162, 173, 0.22);
  background: #0b1721;
}

.mouse-turn {
  gap: 7px;
  padding: 0 9px;
}

.mouse-turn i {
  color: var(--green);
  font-size: 16px;
  font-style: normal;
}

.formula-arrow,
.formula-or {
  color: #647782;
  font-size: 9px;
  font-weight: 850;
}

.why-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.why-grid > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  background: rgba(9, 23, 34, 0.62);
}

.why-grid span,
.live-stat span,
.coach-line span {
  display: block;
  color: var(--cyan);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.15em;
}

.why-grid > div:last-child span {
  color: var(--coral);
}

.why-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: 0.055em;
}

.why-grid small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.simulator-shell {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 61px minmax(300px, 1fr) 74px 48px;
  background: #07131e;
}

.simulator-topbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr)) 74px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
}

.live-stat {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px;
  border-right: 1px solid var(--line);
}

.live-stat strong {
  margin-top: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
}

.live-stat b {
  color: var(--green);
  font-size: 20px;
}

.reset-button {
  color: var(--muted);
  border: 0;
  background: #0c1e2c;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.reset-button:hover {
  color: var(--text);
  background: #112a3b;
}

.canvas-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  background:
    radial-gradient(circle at center, rgba(29, 77, 101, 0.12), transparent 55%),
    #06111b;
}

.canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-instruction {
  position: absolute;
  top: 16px;
  left: 17px;
  padding: 9px 11px;
  color: #a9bbc3;
  border-left: 2px solid var(--green);
  background: rgba(4, 12, 19, 0.74);
  pointer-events: none;
}

.canvas-instruction strong,
.canvas-instruction span {
  display: block;
}

.canvas-instruction strong {
  color: var(--text);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.canvas-instruction span {
  margin-top: 3px;
  font-size: 9px;
}

.canvas-instruction b {
  color: var(--cyan);
  font-weight: 850;
}

.canvas-instruction b:last-child {
  color: var(--amber);
}

.timing-callout {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 116px;
  padding: 9px;
  color: var(--amber);
  border: 1px solid rgba(255, 178, 25, 0.42);
  background: rgba(18, 14, 6, 0.82);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.timing-callout i {
  position: relative;
  display: block;
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  background: rgba(255, 178, 25, 0.18);
}

.timing-callout i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--amber);
  transform: scaleX(var(--landing-progress, 0));
  transform-origin: left;
}

.sim-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr minmax(150px, 1.8fr);
  gap: 7px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #081722;
}

.control-key {
  min-width: 0;
  color: var(--text);
  border: 1px solid rgba(53, 206, 245, 0.32);
  background: #10283a;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 850;
  cursor: pointer;
  user-select: none;
}

.control-key small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 7px;
  letter-spacing: 0.1em;
}

.control-key.is-held,
.control-key:active {
  color: #061016;
  border-color: var(--green);
  background: var(--green);
}

.control-key.is-held small,
.control-key:active small {
  color: #17331b;
}

.control-w.is-held {
  color: #fff;
  border-color: var(--coral);
  background: #7c2928;
}

.control-w.is-held small {
  color: #ffd3cc;
}

.jump-key {
  border-color: rgba(255, 178, 25, 0.5);
}

.jump-key.is-hot {
  color: #161004;
  border-color: #ffe080;
  background: var(--amber);
  box-shadow: 0 0 22px rgba(255, 178, 25, 0.22);
}

.coach-line {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  background: #061019;
}

.coach-line span {
  color: var(--green);
}

.coach-line p {
  margin: 0;
  color: #aab9bf;
  font-size: 10px;
  line-height: 1.3;
}

footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 0 14px;
  color: #526572;
  border-top: 1px solid rgba(143, 188, 212, 0.12);
  background: #050c13;
  font-size: 8px;
  font-weight: 760;
  letter-spacing: 0.09em;
}

footer > span:nth-child(2) {
  text-align: center;
}

footer div {
  display: flex;
  justify-content: flex-end;
  gap: 13px;
}

footer a {
  color: #718995;
  text-decoration: none;
}

footer a:hover {
  color: var(--cyan);
}

@media (max-width: 1250px) {
  .bucket-section {
    padding-inline: 16px;
  }

  .bucket-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .bucket-metric {
    padding-left: 10px;
  }

  .hero-cluster {
    grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
    gap: 4px;
    padding: 8px;
  }

  .trainer-copy {
    padding: 20px 17px;
  }

  .trainer-section {
    grid-template-columns: minmax(340px, 0.75fr) minmax(570px, 1.4fr);
  }
}

@media (max-width: 980px) {
  .movement-app {
    grid-template-rows: 68px auto auto 32px;
  }

  .bucket-lanes,
  .trainer-section {
    grid-template-columns: 1fr;
  }

  .bucket-card {
    grid-template-columns: 105px minmax(0, 1fr);
  }

  .hero-cluster {
    grid-template-columns: repeat(auto-fit, minmax(47px, 1fr));
  }

  .trainer-copy {
    border-right: 0;
    border-bottom: 1px solid rgba(53, 206, 245, 0.24);
  }

  .simulator-shell {
    min-height: 560px;
  }
}

@media (max-width: 620px) {
  .movement-header {
    grid-template-columns: auto 1fr;
    padding-inline: 12px;
  }

  .movement-brand {
    text-align: right;
  }

  .movement-brand p,
  .page-nav {
    display: none;
  }

  .movement-brand h1 {
    font-size: 19px;
  }

  .bucket-section,
  .trainer-copy {
    padding-inline: 12px;
  }

  .bucket-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
  }

  .bucket-definition {
    max-width: none;
  }

  .bucket-card {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .hero-cluster {
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  }

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

  .drill-tabs {
    width: 100%;
  }

  .drill-tabs button {
    flex: 1;
  }

  .why-grid {
    grid-template-columns: 1fr;
  }

  .simulator-shell {
    min-height: 530px;
    grid-template-rows: 58px minmax(260px, 1fr) 68px 54px;
  }

  .simulator-topbar {
    grid-template-columns: repeat(3, 1fr) 56px;
  }

  .live-stat {
    padding-inline: 8px;
  }

  .live-stat strong {
    font-size: 11px;
  }

  .live-stat b {
    font-size: 16px;
  }

  .sim-controls {
    grid-template-columns: 0.8fr 0.8fr 0.8fr 1.45fr;
    padding-inline: 7px;
  }

  .control-key {
    font-size: 14px;
  }

  .coach-line {
    grid-template-columns: 64px 1fr;
    padding-inline: 10px;
  }

  footer {
    grid-template-columns: 1fr auto;
  }

  footer > span:nth-child(2),
  footer div a:not(:first-child) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
