:root {
  color: #18212f;
  background: #f6f4ec;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f9f7ef 0%, #eef6f6 52%, #f8efe8 100%);
}

button,
[role="button"] {
  font: inherit;
}

button {
  border: 0;
}

.game-shell {
  position: relative;
  min-height: 100vh;
  padding: clamp(14px, 2vw, 26px);
  overflow: hidden;
}

.landing-shell,
.chooser-shell {
  padding: 0;
}

.landing-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 32px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcfb 0%, #eef8f8 58%, #fff6df 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

.menu-screen {
  isolation: isolate;
}

.landing-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.landing-line {
  fill: none;
  stroke-width: 15;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.42;
}

.landing-line.cyan {
  stroke: #2ab7ca;
}

.landing-line.yellow {
  stroke: #fed766;
}

.landing-line.coral {
  stroke: #f25f5c;
}

.landing-train {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 4px solid #18212f;
  border-radius: 999px;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.15);
}

.landing-train.cyan {
  background: #2ab7ca;
  animation: landingTrainCyan 7.8s ease-in-out infinite;
}

.landing-train.yellow {
  background: #fed766;
  animation: landingTrainYellow 8.4s ease-in-out infinite;
}

.landing-train.coral {
  background: #f25f5c;
  animation: landingTrainCoral 9s ease-in-out infinite;
}

.landing-title-block {
  position: relative;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 28px;
  text-align: center;
}

.landing-title-block h1 {
  max-width: 1060px;
  margin: 0;
  color: #ffffff;
  font-size: clamp(4rem, 11vw, 8.4rem);
  line-height: 0.9;
  -webkit-text-stroke: clamp(2px, 0.38vw, 5px) #18212f;
  text-shadow:
    0 9px 0 #2ab7ca,
    0 16px 0 rgba(254, 215, 102, 0.88),
    0 26px 34px rgba(24, 33, 47, 0.18);
}

.landing-actions {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.landing-actions .primary-action,
.landing-actions .secondary-action {
  position: relative;
  width: min(360px, 84vw);
  min-height: 74px;
  overflow: hidden;
  font-size: 1.38rem;
}

.landing-actions .primary-action::after,
.landing-actions .secondary-action::after {
  position: absolute;
  inset: 9px;
  border: 2px dashed rgba(24, 33, 47, 0.26);
  border-radius: 6px;
  content: "";
  opacity: 0;
  transform: scaleX(0.78);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.landing-actions .primary-action:hover,
.landing-actions .primary-action:focus-visible,
.landing-actions .secondary-action:hover,
.landing-actions .secondary-action:focus-visible {
  transform: translateY(-7px) scale(1.05) rotate(-1deg);
}

.landing-actions .primary-action:hover::after,
.landing-actions .primary-action:focus-visible::after,
.landing-actions .secondary-action:hover::after,
.landing-actions .secondary-action:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.menu-ball-field {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.menu-ball {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: var(--ball-size);
  height: var(--ball-size);
  border: 4px solid rgba(24, 33, 47, 0.88);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.8) 0 17%, transparent 18%),
    var(--token-color);
  box-shadow:
    inset 0 -7px 0 rgba(0, 0, 0, 0.12),
    0 12px 18px rgba(24, 33, 47, 0.16);
  will-change: transform;
}

.secondary-action {
  min-height: 46px;
  padding: 0 18px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  box-shadow: 0 6px 0 rgba(24, 33, 47, 0.13);
  cursor: pointer;
  font-weight: 950;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.secondary-action:hover,
.secondary-action:focus-visible {
  transform: translateY(-2px);
  background: #f8fbfb;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.13);
  outline: 0;
}

.secondary-action:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(24, 33, 47, 0.13);
}

.icon-action {
  width: 48px;
  padding: 0;
  font-size: 1.35rem;
}

.chooser-shell {
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    #fbfcfb;
  background-size: 34px 34px;
}

.chooser-topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto 20px;
}

.chooser-topbar h1 {
  margin: 3px 0 0;
  font-size: 2.4rem;
}

.category-screen {
  position: relative;
  min-height: calc(100vh - 118px);
  overflow: hidden;
  max-width: 1180px;
  margin: 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcfb 0%, #eef8f8 62%, #fff6df 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

.category-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.category-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-line.main {
  stroke: #2ab7ca;
  stroke-width: 16;
  opacity: 0.7;
}

.category-line.side {
  stroke: #fed766;
  stroke-width: 12;
  opacity: 0.58;
}

.category-station {
  fill: #ffffff;
  stroke: #18212f;
  stroke-width: 6;
}

.category-station.active {
  fill: #fed766;
  animation: landingStationPulse 2.4s ease-in-out infinite;
}

.category-grid {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 24px);
  width: min(1040px, calc(100% - 40px));
  min-height: calc(100vh - 118px);
  align-content: center;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) 0;
}

.category-card {
  position: relative;
  display: grid;
  min-height: 286px;
  justify-items: center;
  gap: 12px;
  padding: 26px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow:
    0 14px 0 rgba(24, 33, 47, 0.12),
    0 24px 44px rgba(24, 33, 47, 0.16);
  color: #18212f;
  cursor: pointer;
  transition:
    transform 180ms cubic-bezier(0.2, 0.85, 0.2, 1.25),
    box-shadow 180ms ease,
    filter 180ms ease;
}

.category-card:hover,
.category-card:focus-visible {
  transform: translateY(-10px) scale(1.04) rotate(-1deg);
  box-shadow:
    0 20px 0 rgba(24, 33, 47, 0.12),
    0 36px 58px rgba(24, 33, 47, 0.18);
  filter: saturate(1.08);
  outline: 0;
}

.category-card.empty {
  opacity: 0.92;
}

.category-card.empty:hover,
.category-card.empty:focus-visible {
  opacity: 1;
}

.category-route-badge {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  border: 5px solid #18212f;
  border-radius: 999px;
  background: #2ab7ca;
  color: #062e35;
  font-size: 2rem;
  font-weight: 950;
  transition:
    transform 180ms ease,
    background 180ms ease;
}

.category-card.yellow .category-route-badge {
  background: #fed766;
}

.category-card.coral .category-route-badge {
  background: #f25f5c;
  color: #2d1010;
}

.category-card:hover .category-route-badge,
.category-card:focus-visible .category-route-badge {
  transform: rotate(-7deg) scale(1.08);
}

.category-card-title {
  font-size: 2.2rem;
  font-weight: 950;
}

.category-card-count {
  color: #526070;
  font-weight: 850;
}

.category-mini-route {
  display: flex;
  align-items: center;
  width: min(260px, 100%);
  margin-top: 6px;
}

.category-mini-route span {
  display: block;
  width: 24px;
  height: 24px;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.category-mini-route span:not(:last-child)::after {
  display: block;
  width: 40px;
  height: 7px;
  margin: 6px 0 0 21px;
  background: #2ab7ca;
  content: "";
}

.category-card-animation {
  position: relative;
  display: block;
  width: min(250px, 100%);
  height: 78px;
  margin-top: 4px;
}

.category-card-line,
.category-card-line::after {
  position: absolute;
  height: 8px;
  border-radius: 999px;
  background: #2ab7ca;
  content: "";
}

.category-card-line.line-one {
  left: 12px;
  right: 26px;
  top: 24px;
  transform: rotate(-9deg);
}

.category-card-line.line-two {
  left: 28px;
  right: 12px;
  top: 48px;
  background: #fed766;
  transform: rotate(7deg);
}

.category-card.coral .category-card-line.line-one,
.category-card.coral .category-card-train {
  background: #f25f5c;
}

.category-card.yellow .category-card-line.line-one,
.category-card.yellow .category-card-train {
  background: #fed766;
}

.category-card-station {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 4px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.category-card-station.station-one {
  left: 26px;
  top: 14px;
}

.category-card-station.station-two {
  right: 24px;
  top: 38px;
}

.category-card-train {
  position: absolute;
  left: 16px;
  top: 14px;
  width: 25px;
  height: 25px;
  border: 4px solid #18212f;
  border-radius: 999px;
  background: #2ab7ca;
  box-shadow: 0 7px 0 rgba(24, 33, 47, 0.13);
  animation: categoryTrain 3.2s ease-in-out infinite;
}

.category-card:hover .category-card-train,
.category-card:focus-visible .category-card-train {
  animation-duration: 1.2s;
}

.level-picker-shell {
  position: relative;
  min-height: calc(100vh - 118px);
  overflow: hidden;
  max-width: 1180px;
  margin: 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcfb 0%, #eef8f8 62%, #fff6df 100%);
  background-size: 38px 38px, 38px 38px, auto;
}

.level-picker-screen {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  padding: clamp(18px, 3vw, 34px);
  margin: 0 auto;
}

.level-picker-item {
  display: grid;
  gap: 12px;
  padding: 10px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  box-shadow: 0 10px 0 rgba(24, 33, 47, 0.12);
  cursor: pointer;
  text-align: left;
  transition:
    transform 180ms cubic-bezier(0.2, 0.85, 0.2, 1.25),
    box-shadow 150ms ease,
    border-color 150ms ease,
    filter 150ms ease;
}

.level-picker-item:hover,
.level-picker-item:focus-visible {
  transform: translateY(-8px) scale(1.035) rotate(-0.7deg);
  border-color: #2ab7ca;
  box-shadow: 0 18px 0 rgba(24, 33, 47, 0.12);
  filter: saturate(1.08);
  outline: 0;
}

.level-picker-item:hover .preview-line,
.level-picker-item:focus-visible .preview-line {
  opacity: 0.76;
  stroke-dasharray: 16 12;
  animation: routePulse 2.5s linear infinite;
}

.level-picker-item.complete {
  background: #f4fbf5;
}

.level-card-title {
  display: block;
  min-height: 44px;
  padding: 0 2px 4px;
  font-weight: 950;
  line-height: 1.15;
}

.level-screenshot {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 2px solid #18212f;
  border-radius: 6px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.05) 1px, transparent 1px),
    #fbfcfb;
  background-size: 18px 18px;
}

.preview-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.preview-line {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.38;
}

.preview-line.cyan {
  stroke: #2ab7ca;
}

.preview-line.yellow {
  stroke: #fed766;
}

.preview-line.coral {
  stroke: #f25f5c;
}

.preview-station {
  fill: #ffffff;
  stroke: #18212f;
  stroke-width: 3;
}

.preview-depot {
  position: absolute;
  left: 8px;
  top: 8px;
  display: grid;
  grid-template-columns: repeat(2, 22px);
  gap: 5px;
  padding: 7px;
  border: 2px solid #18212f;
  border-radius: 6px;
  background: #ffffff;
}

.preview-token {
  --token-color: #2ab7ca;
  --token-ink: #082b33;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(24, 33, 47, 0.88);
  border-radius: 999px;
  background: var(--token-color);
  color: var(--token-ink);
  font-size: 0.58rem;
  font-weight: 950;
}

.preview-token .token-piece,
.preview-visual .token-piece {
  width: 13px;
  height: 13px;
  border-width: 1px;
  font-size: 0.42rem;
}

.preview-machine {
  position: absolute;
  left: 72px;
  right: 9px;
  top: 50%;
  display: grid;
  min-height: 70px;
  place-items: center;
  padding: 8px;
  border: 2px solid #18212f;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.93);
  transform: translateY(-50%);
}

.preview-equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #18212f;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1.05;
}

.preview-static,
.preview-visual {
  display: inline-flex;
  align-items: center;
}

.preview-slot {
  display: inline-grid;
  width: 18px;
  height: 18px;
  border: 2px dashed #526070;
  border-radius: 4px;
  background: #ffffff;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto 14px;
}

.eyebrow,
.mission-label,
.console-label,
.lesson-kicker,
.output-tray p {
  margin: 0;
  color: #526070;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 3px 0 0;
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.level-route {
  display: flex;
  align-items: center;
  min-width: min(420px, 45vw);
}

.route-node {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
}

.route-node:last-child {
  flex: 0 0 auto;
}

.route-dot {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid #d8dee5;
  border-radius: 999px;
  background: #ffffff;
  color: #526070;
  font-weight: 900;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.route-track {
  flex: 1 1 auto;
  height: 6px;
  background: #d8dee5;
}

.route-node.current .route-dot {
  transform: scale(1.08);
  border-color: #18212f;
  background: #fed766;
  color: #18212f;
}

.route-node.complete .route-dot,
.route-node.complete .route-track {
  border-color: #2ab7ca;
  background: #2ab7ca;
  color: #062e35;
}

.mission-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto 16px;
  padding: 12px 16px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(29, 38, 55, 0.08);
}

.mission-concept {
  max-width: 780px;
  margin: 3px 0 0;
  color: #263446;
  font-weight: 650;
  line-height: 1.35;
}

.progress-meter {
  flex: 0 0 min(280px, 28vw);
  height: 14px;
  overflow: hidden;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.progress-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ab7ca, #8bd17c, #fed766);
  transition: width 280ms ease;
}

.factory-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 0.27fr) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  max-width: 1280px;
  min-height: min(640px, calc(100vh - 230px));
  margin: 0 auto;
}

.route-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.route-map svg {
  width: 100%;
  height: 100%;
}

.map-line {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 24 22;
  opacity: 0.22;
  animation: routePulse 4s linear infinite;
}

.map-line.cyan {
  stroke: #2ab7ca;
}

.map-line.yellow {
  stroke: #fed766;
  animation-delay: -1s;
}

.map-line.coral {
  stroke: #f25f5c;
  animation-delay: -2s;
}

.token-yard,
.machine {
  position: relative;
  z-index: 1;
}

.token-yard {
  align-self: stretch;
  padding: 14px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(29, 38, 55, 0.16);
}

.yard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 900;
}

.yard-header small {
  color: #526070;
  font-weight: 800;
}

.token-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 12px;
}

.math-token {
  --token-color: #2ab7ca;
  --token-ink: #082b33;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  padding: 0;
  border: 4px solid rgba(24, 33, 47, 0.88);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.75) 0 17%, transparent 18%),
    var(--token-color);
  color: var(--token-ink);
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.12),
    0 9px 0 rgba(24, 33, 47, 0.17);
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  font-weight: 950;
  letter-spacing: 0;
  touch-action: none;
  user-select: none;
  transition:
    transform 180ms cubic-bezier(0.2, 0.85, 0.2, 1.2),
    box-shadow 180ms ease,
    filter 180ms ease;
}

.bank-token {
  cursor: grab;
}

.bank-token:hover,
.math-token.selected {
  transform: translateY(-5px) scale(1.04);
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.12),
    0 13px 0 rgba(24, 33, 47, 0.18),
    0 0 0 5px rgba(254, 215, 102, 0.45);
}

.bank-token:active {
  cursor: grabbing;
}

.slot-token {
  width: 54px;
  height: 54px;
  padding: 0 8px;
  border-width: 3px;
  box-shadow:
    inset 0 -6px 0 rgba(0, 0, 0, 0.11),
    0 5px 0 rgba(24, 33, 47, 0.12);
  font-size: 1rem;
}

.token-visual,
.visual-output {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.token-piece {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.75) 0 17%, transparent 18%),
    var(--piece-color);
  color: var(--piece-ink);
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1;
}

.bank-token .token-piece {
  width: 38px;
  height: 38px;
}

.slot-token .token-piece {
  width: 29px;
  height: 29px;
  font-size: 0.78rem;
}

.visual-equation-part {
  display: inline-flex;
  align-items: center;
  min-height: 72px;
}

.visual-equation-part .token-piece {
  width: clamp(34px, 4vw, 50px);
  height: clamp(34px, 4vw, 50px);
  border: 3px solid rgba(24, 33, 47, 0.82);
  font-size: clamp(0.85rem, 1.8vw, 1.2rem);
}

.token-joiner {
  display: none;
}

.math-exponent {
  position: relative;
  top: -0.45em;
  margin-left: 0.04em;
  font-size: 0.6em;
  line-height: 0;
}

.token-piece .math-exponent {
  top: -0.35em;
  font-size: 0.56em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.drag-origin {
  opacity: 0.38;
}

.drag-clone {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.08) rotate(4deg);
  filter: drop-shadow(0 18px 22px rgba(24, 33, 47, 0.28));
  animation: dragWiggle 460ms ease-in-out infinite alternate;
}

.machine {
  min-height: 520px;
  overflow: hidden;
  border: 2px solid #18212f;
  border-radius: 8px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    #fbfcfb;
  background-size: 34px 34px;
  box-shadow: 0 14px 30px rgba(29, 38, 55, 0.12);
}

.machine.has-factor-steps {
  min-height: 820px;
}

.machine-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(16px, 2.5vw, 32px);
  background: radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0) 58%);
}

.machine.has-factor-steps .equation-console {
  align-self: start;
  margin-top: clamp(10px, 3vw, 34px);
}

.metro-board {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.metro-line {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.42;
  stroke-dasharray: 22 20;
  animation: routePulse 7s linear infinite;
}

.machine.working .metro-line,
.machine.complete .metro-line {
  opacity: 0.9;
  stroke-dasharray: 0;
  animation: routePulse 3.2s linear infinite;
}

.machine.error .metro-line {
  opacity: 0.28;
}

.line-cyan {
  stroke: #2ab7ca;
}

.line-yellow {
  stroke: #fed766;
}

.line-coral {
  stroke: #f25f5c;
}

.metro-station {
  fill: #ffffff;
  stroke: #18212f;
  stroke-width: 5;
}

.machine.complete .metro-station {
  fill: #8bd17c;
}

.equation-console {
  position: relative;
  z-index: 3;
  align-self: center;
  justify-self: center;
  width: min(780px, 94%);
  padding: clamp(16px, 2.8vw, 30px);
  border: 3px solid #18212f;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow:
    0 14px 0 rgba(24, 33, 47, 0.12),
    0 20px 36px rgba(24, 33, 47, 0.18);
}

.equation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 108px;
  margin-top: 10px;
  color: #18212f;
  font-size: clamp(1.7rem, 4vw, 3.25rem);
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: 0;
}

.equation-static {
  display: inline-flex;
  align-items: center;
  min-height: 72px;
}

.factor-equation-console {
  display: grid;
  gap: 14px;
  width: min(820px, 94%);
}

.factor-source-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  color: #18212f;
  font-size: clamp(1.65rem, 3.6vw, 3rem);
  font-weight: 950;
  line-height: 1.1;
}

.factor-source-line .equation-static {
  min-height: 0;
}

.factor-step-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 12px;
  border: 2px solid rgba(24, 33, 47, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.035) 1px, transparent 1px),
    rgba(255, 255, 255, 0.78);
  background-size: 26px 26px;
  overflow: hidden;
}

.factor-step-svg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.factor-step-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.factor-step {
  --step-color: #2ab7ca;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(46px, auto) minmax(70px, auto);
  align-items: center;
  justify-items: center;
  gap: 36px;
  min-height: 226px;
  padding: 10px 10px 14px;
  border: 2px solid rgba(24, 33, 47, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #18212f;
  font-size: clamp(0.82rem, 1.45vw, 1rem);
  font-weight: 900;
  line-height: 1.15;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.08);
}

.factor-step.yellow {
  --step-color: #fed766;
}

.factor-step.coral {
  --step-color: #f25f5c;
}

.factor-step-label {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--step-color);
  color: #18212f;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.factor-step-source,
.factor-step-target {
  position: relative;
  z-index: 2;
  min-height: 58px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.factor-step-source {
  border: 2px solid rgba(24, 33, 47, 0.14);
}

.factor-step-target {
  border: 2px dashed rgba(82, 96, 112, 0.45);
}

.factor-step-term {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

.factor-step-term .equation-static {
  min-height: 0;
}

.factor-step-term .equation-slot {
  width: 58px;
  min-width: 58px;
  min-height: 58px;
  border-width: 2px;
}

.factor-step-term .equation-slot.colour-socket {
  width: 58px;
  min-width: 58px;
  min-height: 58px;
}

.factor-step-term .slot-token {
  width: 48px;
  height: 48px;
  border-width: 2px;
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.12),
    0 5px 0 rgba(24, 33, 47, 0.14);
  font-size: 0.9rem;
}

.factor-step-term .slot-token .token-piece,
.factor-step-term .visual-equation-part .token-piece {
  width: 31px;
  height: 31px;
  font-size: 0.76rem;
}

.factor-step-arrow {
  position: relative;
  display: block;
  width: 42px;
  height: 28px;
  border-left: 5px solid var(--step-color);
  border-bottom: 5px solid var(--step-color);
  border-radius: 0 0 0 24px;
}

.factor-step-arrow::after {
  position: absolute;
  content: "";
  right: -4px;
  bottom: -10px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid var(--step-color);
}

.factor-final-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding-top: 2px;
  border-top: 2px solid rgba(24, 33, 47, 0.14);
}

.factor-final-equals {
  color: #18212f;
  font-size: clamp(1.7rem, 4vw, 3.25rem);
  font-weight: 950;
}

.factor-final-equation {
  justify-content: flex-start;
  min-height: 84px;
  margin-top: 0;
}

.equation-text-input {
  width: min(420px, 100%);
  min-height: 64px;
  padding: 8px 14px;
  border: 3px dashed #526070;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(42, 183, 202, 0.08), rgba(254, 215, 102, 0.08)),
    #ffffff;
  color: #18212f;
  font: inherit;
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  font-weight: 950;
  text-align: center;
  letter-spacing: 0;
}

.equation-text-input:focus {
  border-style: solid;
  border-color: #2ab7ca;
  box-shadow: 0 0 0 5px rgba(42, 183, 202, 0.18);
  outline: 0;
}

.equation-text-input.correct {
  border-style: solid;
  border-color: #18212f;
  background: #f4fff4;
}

.factor-diagram-console {
  width: min(760px, calc(100vw - 72px));
  max-width: 94%;
  gap: 12px;
}

.factor-diagram-input {
  min-height: 58px;
}

.factor-diagram-input.top-input {
  width: min(460px, 100%);
}

.factor-diagram-input.final-input {
  width: min(520px, 100%);
}

.factor-typed-expression {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 58px;
  padding: 7px 12px;
  border: 3px dashed #526070;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(42, 183, 202, 0.08), rgba(254, 215, 102, 0.08)),
    #ffffff;
  color: #18212f;
  box-shadow: 0 7px 0 rgba(24, 33, 47, 0.1);
}

.factor-typed-expression.correct {
  border-style: solid;
  border-color: #18212f;
  background: #f4fff4;
}

.factor-typed-expression.top-expression {
  width: min(460px, 100%);
}

.factor-typed-expression.final-expression {
  width: min(520px, 100%);
}

.factor-mini-input {
  width: clamp(42px, 6vw, 62px);
  height: 42px;
  border: 2px solid #526070;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  font: inherit;
  font-size: clamp(1.1rem, 2.5vw, 1.55rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
}

.factor-mini-input:focus {
  border-color: #2ab7ca;
  box-shadow: 0 0 0 4px rgba(42, 183, 202, 0.18);
  outline: 0;
}

.factor-mini-input.correct {
  border-color: #18212f;
}

.factor-typed-symbol {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  color: #18212f;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 950;
  line-height: 1;
}

.factor-svg-diagram {
  position: relative;
  width: 100%;
  max-width: 740px;
  aspect-ratio: 740 / 390;
  min-height: 330px;
  margin: 0 auto;
}

.factor-diagram-svg,
.factor-diagram-controls {
  position: absolute;
  inset: 0;
}

.factor-diagram-svg {
  z-index: 0;
  pointer-events: none;
}

.factor-diagram-svg svg {
  display: block;
  width: 100%;
  height: 100%;
}

.factor-diagram-controls {
  z-index: 1;
}

.factor-diagram-anchor {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
}

.factor-diagram-top-input {
  left: 50%;
  top: 8%;
  width: min(460px, 88%);
}

.factor-diagram-final-input {
  left: 50%;
  top: 91%;
  width: min(580px, 92%);
  gap: 10px;
}

.factor-diagram-anchor.top-left-factor {
  left: 36.1%;
  top: 28.7%;
}

.factor-diagram-anchor.top-left-common {
  left: 45.8%;
  top: 28.7%;
}

.factor-diagram-anchor.top-right-factor {
  left: 62%;
  top: 28.7%;
}

.factor-diagram-anchor.top-right-common {
  left: 71.8%;
  top: 28.7%;
}

.factor-diagram-anchor.common-factor {
  left: 21.1%;
  top: 44.6%;
}

.factor-product-static {
  top: 49%;
  pointer-events: none;
}

.factor-product-static.product-left {
  left: 41%;
}

.factor-product-static.product-right {
  left: 66.8%;
}

.factor-product-static .visual-equation-part {
  min-height: 0;
}

.factor-product-static .visual-equation-part .token-piece {
  width: clamp(30px, 3.8vw, 44px);
  height: clamp(30px, 3.8vw, 44px);
  border-width: 3px;
  font-size: clamp(0.78rem, 1.4vw, 1.05rem);
}

.factor-diagram-anchor.bottom-left-factor {
  left: 41.8%;
  top: 73.3%;
}

.factor-diagram-anchor.bottom-right-factor {
  left: 67.6%;
  top: 73.3%;
}

.factor-svg-background-line {
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 18 18;
  opacity: 0.16;
  animation: routePulse 7s linear infinite;
}

.factor-svg-background-line.cyan {
  stroke: #2ab7ca;
}

.factor-svg-background-line.yellow {
  stroke: #fed766;
  animation-delay: -1.2s;
}

.factor-svg-background-line.coral {
  stroke: #f25f5c;
  animation-delay: -2.4s;
}

.factor-svg-background-station {
  fill: #ffffff;
  stroke: #18212f;
  stroke-width: 4;
  opacity: 0.42;
}

.factor-svg-product-grid {
  filter: drop-shadow(0 10px 0 rgba(24, 33, 47, 0.1));
}

.factor-svg-route {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 12 10;
  opacity: 0.9;
  animation: routePulse 3.8s linear infinite;
}

.factor-svg-arrow-head {
  opacity: 0.95;
}

.factor-svg-slot-guide {
  fill: rgba(255, 255, 255, 0.68);
  stroke-dasharray: 7 7;
  opacity: 0.72;
}

.factor-svg-plus {
  fill: #18212f;
  font-size: 32px;
  font-weight: 950;
  font-family: Inter, Arial, sans-serif;
  dominant-baseline: middle;
  text-anchor: middle;
}

.equation-slot {
  display: inline-grid;
  min-width: clamp(84px, 12vw, 128px);
  min-height: 76px;
  place-items: center;
  border: 3px dashed #526070;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(42, 183, 202, 0.12), rgba(254, 215, 102, 0.14)),
    #ffffff;
  color: #526070;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.equation-slot.colour-socket {
  width: clamp(54px, 6vw, 64px);
  min-width: clamp(54px, 6vw, 64px);
  min-height: clamp(54px, 6vw, 64px);
}

.equation-slot.colour-socket .slot-token {
  width: clamp(44px, 5vw, 52px);
  height: clamp(44px, 5vw, 52px);
}

.factor-step-term .equation-slot.colour-socket .slot-token,
.factor-step-term .equation-slot .slot-token {
  width: 48px;
  height: 48px;
}

.equation-slot:hover,
.equation-slot:focus-visible {
  border-color: #18212f;
  box-shadow: 0 0 0 5px rgba(42, 183, 202, 0.18);
  outline: 0;
}

.equation-slot.filled {
  border-style: solid;
  border-color: #18212f;
  background: #ffffff;
}

.equation-slot.error {
  border-color: #f25f5c;
  background: #ffe6e5;
  animation: slotShake 340ms ease-in-out 2;
}

.equation-slot.pop {
  animation: slotPop 460ms cubic-bezier(0.2, 0.85, 0.2, 1.3);
}

.slot-placeholder {
  padding: 0 10px;
  font-size: clamp(0.9rem, 1.7vw, 1.05rem);
  font-weight: 900;
  text-transform: uppercase;
}

.metro-progress-line {
  position: absolute;
  z-index: 2;
  left: 20%;
  right: 20%;
  bottom: 94px;
  display: flex;
  height: 20px;
  overflow: hidden;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.metro-progress-line span {
  flex: 0 0 25%;
  border-right: 3px solid #18212f;
  background: linear-gradient(90deg, #2ab7ca 0 50%, #fed766 50% 100%);
}

.machine.working .metro-progress-line span {
  animation: beltMove 380ms linear infinite;
}

.output-tray {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  right: clamp(16px, 4vw, 54px);
  bottom: clamp(16px, 4vw, 34px);
  min-width: min(320px, calc(100% - 32px));
  padding: 14px 18px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 0 rgba(24, 33, 47, 0.13);
  transform: translateY(18px);
  opacity: 0.78;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.output-tray.show {
  transform: translateY(0);
  opacity: 1;
  animation: outputArrive 520ms cubic-bezier(0.2, 0.85, 0.2, 1.2);
}

.output-tray strong {
  display: block;
  margin-top: 2px;
  color: #18212f;
  font-size: clamp(1.3rem, 2.2vw, 2rem);
  letter-spacing: 0;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.platform-shell {
  background:
    linear-gradient(rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcfb 0%, #eef8f8 58%, #fff6df 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

.platform-login-panel {
  max-width: 860px;
}

.platform-login-copy,
.platform-message {
  position: relative;
  z-index: 5;
  max-width: 680px;
  margin: 0;
  padding: 10px 14px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #263446;
  font-weight: 850;
  line-height: 1.35;
}

.platform-message {
  max-width: 1280px;
  margin: 0 auto 14px;
}

.dashboard-route-hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 230px;
  max-width: 1280px;
  margin: 0 auto 18px;
  overflow: hidden;
  border: 3px solid #18212f;
  border-radius: 8px;
  background:
    radial-gradient(circle at 86% 18%, rgba(254, 215, 102, 0.72) 0 64px, transparent 66px),
    linear-gradient(135deg, #e9fbff 0%, #fff7d8 52%, #ffe4e1 100%);
  box-shadow: 0 14px 0 rgba(24, 33, 47, 0.13);
}

.dashboard-route-hero svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hub-line {
  fill: none;
  stroke-linecap: round;
  stroke-width: 13;
  opacity: 0.82;
  stroke-dasharray: 18 22;
  animation: routeDash 14s linear infinite;
}

.hub-line.cyan {
  stroke: #2ab7ca;
}

.hub-line.yellow {
  stroke: #fed766;
  animation-duration: 17s;
}

.hub-line.coral {
  stroke: #f25f5c;
  animation-duration: 20s;
}

.hub-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: start;
  gap: 12px;
  width: min(620px, calc(100% - 36px));
  margin-left: clamp(18px, 5vw, 56px);
}

.hub-copy h1 {
  max-width: 620px;
  margin: 0;
  color: #18212f;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.95;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.platform-panel,
.platform-card {
  border: 2px solid #18212f;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 0 rgba(24, 33, 47, 0.11);
}

.platform-panel {
  max-width: 1280px;
  margin: 0 auto 16px;
  padding: clamp(16px, 3vw, 28px);
}

.platform-card {
  display: grid;
  min-height: 150px;
  gap: 8px;
  padding: 18px;
  color: #18212f;
  text-align: left;
}

.platform-card p,
.platform-panel p {
  margin: 0;
  color: #263446;
  font-weight: 700;
  line-height: 1.35;
}

.dashboard-hero,
.wide-panel {
  grid-column: span 2;
}

.rank-meter,
.progress-bar {
  width: 100%;
  height: 16px;
  overflow: hidden;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.rank-meter span,
.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ab7ca, #fed766, #f25f5c);
}

.platform-stat {
  color: #2ab7ca;
  font-size: 2.6rem;
  font-weight: 950;
  line-height: 1;
}

.action-card {
  cursor: pointer;
}

.action-card.locked {
  opacity: 0.68;
  cursor: not-allowed;
}

.daily-card {
  background: linear-gradient(145deg, #ffffff 0%, #e4fbff 100%);
}

.challenge-card {
  background: linear-gradient(145deg, #ffffff 0%, #fff0f0 100%);
}

.card-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 3px solid #18212f;
  border-radius: 50%;
  background: #fed766;
  color: #18212f;
  font-weight: 950;
  box-shadow: 0 5px 0 rgba(24, 33, 47, 0.16);
}

.mini-progress-list,
.concept-grid,
.platform-links,
.avatar-grid,
.unlock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.mini-progress-list span,
.concept-card,
.avatar-choice,
.unlock-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: #ffffff;
}

.mini-progress-list em,
.concept-card em,
.unlock-card em {
  color: #526070;
  font-style: normal;
  font-weight: 900;
}

.unlock-card {
  min-height: 112px;
  border-color: #18212f;
}

.unlock-card.unlocked {
  background: linear-gradient(145deg, #ffffff 0%, #ecffe8 100%);
}

.unlock-card.locked {
  background: linear-gradient(145deg, #ffffff 0%, #f5f7f8 100%);
}

.unlock-card small {
  color: #263446;
  font-weight: 750;
  line-height: 1.35;
}

.platform-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #263446;
  font-weight: 900;
}

.platform-field input,
.platform-field textarea,
.teacher-search-field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  font: inherit;
  font-weight: 750;
}

.platform-field textarea {
  min-height: 120px;
}

.platform-field span {
  color: #526070;
  font-size: 0.86rem;
  font-weight: 750;
  line-height: 1.32;
}

.toolbox-editor-screen {
  display: grid;
  grid-template-columns: minmax(250px, 0.42fr) minmax(0, 1fr);
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}

.toolbox-entry-list,
.toolbox-entry-form {
  margin: 0;
}

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

.toolbox-editor-heading h2 {
  margin: 2px 0 0;
}

.toolbox-entry-list-body {
  display: grid;
  gap: 8px;
}

.toolbox-entry-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  cursor: pointer;
  text-align: left;
}

.toolbox-entry-row:hover,
.toolbox-entry-row:focus-visible,
.toolbox-entry-row.selected {
  border-color: #18212f;
  background: #e9fbff;
  outline: 0;
}

.toolbox-entry-row strong,
.toolbox-entry-row span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbox-entry-row strong {
  white-space: nowrap;
}

.toolbox-entry-row span {
  color: #526070;
  font-weight: 800;
  line-height: 1.32;
}

.toolbox-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
}

.toolbox-editor-actions {
  flex-wrap: wrap;
}

.danger-action {
  border-color: #8f1f1d;
  color: #8f1f1d;
}

.checkbox-field {
  display: flex;
  align-items: center;
}

.checkbox-field input {
  width: auto;
}

.avatar-choice {
  min-height: 74px;
  border-color: #18212f;
  background:
    radial-gradient(circle at 20% 20%, var(--avatar-secondary) 0 18%, transparent 19%),
    var(--avatar-primary);
  cursor: pointer;
  font-weight: 950;
}

.avatar-choice.selected {
  box-shadow: 0 0 0 5px rgba(254, 215, 102, 0.55);
}

.avatar-badge {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 3px solid #18212f;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, var(--avatar-secondary) 0 20%, transparent 21%),
    var(--avatar-primary);
  box-shadow: 0 6px 0 rgba(24, 33, 47, 0.13);
}

.avatar-badge span {
  width: 20px;
  height: 20px;
  border: 3px solid var(--avatar-ink);
  border-radius: 50%;
  background: #ffffff;
}

.glossary-list {
  display: grid;
  gap: 14px;
}

.glossary-entry h2,
.how-to-panel h2 {
  margin: 0 0 6px;
}

.glossary-example {
  margin-top: 10px !important;
  padding: 10px;
  border-left: 5px solid #2ab7ca;
  background: #f8fbfb;
}

.how-to-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.how-to-panel article {
  padding: 14px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: #ffffff;
}

.teacher-dashboard-view {
  display: grid;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.teacher-summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.teacher-summary-strip article,
.student-detail-summary article {
  display: grid;
  gap: 6px;
  min-height: 104px;
  align-content: center;
  padding: 16px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.1);
}

.teacher-summary-strip span,
.student-detail-summary span {
  color: #2a8da0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 950;
  line-height: 1;
}

.teacher-summary-strip strong,
.student-detail-summary strong {
  color: #263446;
  font-size: 0.88rem;
  font-weight: 900;
}

.teacher-roster-panel {
  display: grid;
  gap: 14px;
}

.teacher-roster-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.teacher-search-field {
  display: grid;
  gap: 7px;
  color: #263446;
  font-weight: 900;
}

.teacher-search-field span {
  font-size: 0.88rem;
}

.teacher-table {
  display: grid;
  gap: 8px;
}

.teacher-table-head,
.teacher-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.55fr) minmax(210px, 1.15fr) minmax(82px, 0.45fr) minmax(140px, 0.75fr) minmax(96px, 0.5fr);
  gap: 14px;
  align-items: center;
}

.teacher-table-head {
  padding: 0 14px 4px;
  color: #526070;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.teacher-row {
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.teacher-row:hover,
.teacher-row:focus-visible {
  transform: translateY(-2px);
  border-color: #18212f;
  box-shadow: 0 7px 0 rgba(42, 183, 202, 0.22);
  outline: 0;
}

.teacher-student-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.teacher-student-cell .avatar-badge,
.student-detail-header .avatar-badge {
  width: 46px;
  height: 46px;
  border-width: 2px;
}

.teacher-student-cell strong,
.teacher-student-cell em,
.teacher-progress-cell span,
.teacher-rank-cell,
.teacher-metric-cell strong,
.teacher-metric-cell em {
  min-width: 0;
}

.teacher-student-cell strong {
  display: block;
  overflow: hidden;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-student-cell em,
.teacher-metric-cell em,
.student-detail-title p,
.student-progress-row span,
.student-concept-row span {
  color: #526070;
  font-style: normal;
  font-weight: 800;
  line-height: 1.32;
}

.teacher-progress-cell {
  display: grid;
  gap: 7px;
}

.teacher-progress-cell span {
  color: #263446;
  font-weight: 900;
}

.teacher-progress-bar {
  display: block;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.teacher-progress-bar.large {
  height: 18px;
}

.teacher-progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ab7ca, #8bd17c, #fed766);
}

.teacher-metric-cell {
  display: grid;
  gap: 2px;
}

.teacher-metric-cell strong {
  font-size: 1.14rem;
  font-weight: 950;
}

.teacher-rank-cell {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 9px;
  border: 2px solid #dbe3e5;
  border-radius: 999px;
  background: #f8fbfb;
  font-weight: 950;
  line-height: 1.15;
}

.student-detail-view {
  display: grid;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.student-detail-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: clamp(16px, 3vw, 24px);
  border: 2px solid #18212f;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(233, 251, 255, 0.96)),
    #ffffff;
  box-shadow: 0 10px 0 rgba(24, 33, 47, 0.1);
}

.student-detail-title {
  min-width: 0;
}

.student-detail-title h1 {
  overflow-wrap: anywhere;
}

.student-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.student-detail-summary span {
  font-size: clamp(1.3rem, 2.6vw, 2rem);
}

.student-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.student-progress-panel,
.student-streak-panel,
.student-concept-panel {
  margin: 0;
}

.student-concept-panel {
  grid-column: 1 / -1;
}

.student-panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.student-panel-heading h2,
.student-streak-panel h2 {
  margin: 2px 0 0;
}

.student-panel-heading > span {
  color: #2a8da0;
  font-size: 2rem;
  font-weight: 950;
}

.student-progress-list,
.student-concept-list,
.student-stat-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.student-progress-row,
.student-concept-row,
.student-stat-list div {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: #ffffff;
}

.student-progress-row {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 240px);
}

.student-progress-row strong,
.student-concept-row strong {
  display: block;
  margin-bottom: 3px;
}

.student-concept-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.concept-percent {
  display: grid;
  width: 64px;
  height: 44px;
  place-items: center;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #fff7d8;
  color: #18212f !important;
  font-weight: 950 !important;
}

.student-stat-list {
  margin-bottom: 0;
}

.student-stat-list div {
  grid-template-columns: minmax(0, 1fr) auto;
}

.student-stat-list dt {
  color: #526070;
  font-weight: 850;
}

.student-stat-list dd {
  margin: 0;
  color: #18212f;
  font-size: 1.28rem;
  font-weight: 950;
}

.leaderboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.84)),
    linear-gradient(135deg, #2ab7ca, #fed766 54%, #f25f5c);
}

.leaderboard-hero h1 {
  margin: 0 0 6px;
  color: #18212f;
  font-size: clamp(2rem, 4vw, 3.6rem);
}

.leaderboard-position {
  display: grid;
  justify-items: center;
  min-width: 120px;
  padding: 14px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: #fed766;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.14);
}

.leaderboard-position span {
  font-size: 3rem;
  font-weight: 950;
  line-height: 1;
}

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

.leaderboard-row {
  display: grid;
  grid-template-columns: 48px 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: #ffffff;
}

.leaderboard-row.current-user {
  border-color: #18212f;
  background: #fff7d8;
  box-shadow: 0 6px 0 rgba(254, 215, 102, 0.32);
}

.leaderboard-place,
.leaderboard-xp {
  font-weight: 950;
}

.leaderboard-place {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid #18212f;
  border-radius: 50%;
  background: #e9fbff;
}

.empty-state {
  padding: 14px;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  background: #ffffff;
}

.factory-hub-hero {
  min-height: clamp(210px, 28vw, 285px);
}

.next-station-hint {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #263446;
  font-weight: 950;
}

.hub-continue {
  min-width: 190px;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.18);
}

.hero-badge {
  position: absolute;
  right: clamp(18px, 6vw, 80px);
  top: 50%;
  z-index: 1;
  display: grid;
  width: clamp(96px, 16vw, 164px);
  height: clamp(96px, 16vw, 164px);
  place-items: center;
  transform: translateY(-50%);
}

.gear-ring {
  position: absolute;
  inset: 0;
  border: 10px dashed rgba(24, 33, 47, 0.8);
  border-radius: 999px;
  animation: slowSpin 20s linear infinite;
}

.hero-ball {
  width: 52%;
  height: 52%;
  border: 5px solid #18212f;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.75) 0 18%, transparent 19%),
    #f25f5c;
  box-shadow:
    inset 0 -10px 0 rgba(0, 0, 0, 0.14),
    0 10px 0 rgba(24, 33, 47, 0.15);
}

.student-hub {
  display: grid;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.player-status-strip {
  display: grid;
  grid-template-columns: auto minmax(130px, 0.8fr) minmax(220px, 1.5fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96), rgba(233, 251, 255, 0.96)),
    #ffffff;
  box-shadow: 0 10px 0 rgba(24, 33, 47, 0.1);
}

.player-nameplate,
.rank-progress-block {
  display: grid;
  gap: 5px;
}

.player-nameplate strong {
  color: #18212f;
  font-size: 1.15rem;
  font-weight: 950;
}

.player-nameplate span,
.rank-progress-block span {
  color: #526070;
  font-weight: 850;
}

.rank-meter i,
.rank-progress-block .rank-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ab7ca, #8bd17c, #fed766, #f25f5c);
}

.streak-pill {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 8px;
  align-items: center;
  min-width: 138px;
  padding: 9px 12px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #fff7d8;
  box-shadow: inset 0 -5px 0 rgba(254, 215, 102, 0.42);
}

.streak-symbol {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 4px solid #18212f;
  border-radius: 50%;
  background: conic-gradient(from 45deg, #fed766 0 24%, #f25f5c 0 42%, #2ab7ca 0 70%, #8bd17c 0 100%);
}

.streak-pill strong {
  font-size: 1.55rem;
  line-height: 1;
}

.streak-pill em {
  grid-column: 1 / -1;
  color: #526070;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 900;
}

.hub-action-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 14px;
}

.hub-action-card {
  position: relative;
  display: grid;
  min-height: 172px;
  gap: 8px;
  align-content: end;
  overflow: hidden;
  padding: 18px;
  border: 3px solid #18212f;
  border-radius: 8px;
  color: #18212f;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 11px 0 rgba(24, 33, 47, 0.13);
  transition:
    transform 170ms cubic-bezier(0.2, 0.85, 0.2, 1.18),
    box-shadow 170ms ease,
    filter 170ms ease;
}

.hub-action-card:hover,
.hub-action-card:focus-visible {
  transform: translateY(-5px);
  filter: saturate(1.08);
  outline: 4px solid rgba(254, 215, 102, 0.7);
  outline-offset: 2px;
}

.hub-action-card strong {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
  font-weight: 950;
}

.hub-action-card p {
  position: relative;
  z-index: 1;
  max-width: 28ch;
  margin: 0;
  color: #263446;
  font-weight: 850;
}

.continue-card {
  background: linear-gradient(145deg, #e9fbff 0%, #fff7d8 100%);
}

.daily-card {
  background: linear-gradient(145deg, #f0fff1 0%, #e6f8ff 100%);
}

.challenge-card {
  background: linear-gradient(145deg, #fff7d8 0%, #ffe4e1 100%);
}

.hub-action-card.locked {
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.hub-action-card.locked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 12px, rgba(24, 33, 47, 0.05) 12px 24px);
}

.hub-action-card.complete {
  box-shadow:
    0 11px 0 rgba(24, 33, 47, 0.13),
    0 0 0 5px rgba(139, 209, 124, 0.4);
}

.action-illustration {
  position: absolute;
  right: 16px;
  top: 14px;
  width: 86px;
  height: 70px;
  opacity: 0.95;
}

.action-illustration::before,
.action-illustration::after {
  content: "";
  position: absolute;
  border: 4px solid #18212f;
}

.route-illustration::before {
  inset: 24px 0 auto;
  height: 0;
  border-width: 4px 0 0;
  border-style: dashed;
  border-color: #2ab7ca;
}

.route-illustration::after,
.daily-illustration::after,
.challenge-illustration::after {
  right: 4px;
  top: 8px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #fed766;
}

.daily-illustration::before {
  left: 0;
  bottom: 6px;
  width: 54px;
  height: 30px;
  border-radius: 8px;
  background: #8bd17c;
}

.challenge-illustration::before {
  left: 2px;
  bottom: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border-style: dashed;
  background: rgba(242, 95, 92, 0.24);
}

.hub-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(220px, 0.72fr);
  gap: 14px;
}

.hub-panel,
.hub-nav-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 9px 0 rgba(24, 33, 47, 0.1);
}

.route-progress-panel {
  grid-row: span 2;
}

.panel-heading h2 {
  margin: 0;
  color: #18212f;
  font-size: 1.25rem;
}

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

.route-meter-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  text-align: left;
  cursor: pointer;
}

.route-meter-card span,
.route-meter-card strong {
  font-weight: 950;
}

.route-meter-card.cyan {
  background: linear-gradient(145deg, #ffffff 0%, #e9fbff 100%);
}

.route-meter-card.coral {
  background: linear-gradient(145deg, #ffffff 0%, #ffe8e7 100%);
}

.route-meter {
  display: block;
  height: 12px;
  overflow: hidden;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.route-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2ab7ca, #fed766, #f25f5c);
}

.mastery-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.mastery-chip {
  display: grid;
  min-width: 138px;
  gap: 6px;
  padding: 10px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(139, 209, 124, 0.26) var(--mastery), transparent 0),
    #ffffff;
}

.mastery-chip strong {
  font-size: 0.9rem;
}

.mastery-chip em {
  color: #2f7f45;
  font-style: normal;
  font-weight: 950;
}

.league-mini-position {
  display: flex;
  align-items: center;
  gap: 12px;
}

.league-mini-position span {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 3px solid #18212f;
  border-radius: 50%;
  background: #fed766;
  font-size: 1.8rem;
  font-weight: 950;
}

.hub-nav-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-column: span 2;
}

.hub-nav-panel .secondary-action {
  width: 100%;
}

.station-map-shell {
  display: grid;
  align-content: start;
  gap: clamp(16px, 3vw, 28px);
  padding: clamp(16px, 3vw, 34px);
}

.station-map-header {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 0 rgba(24, 33, 47, 0.1);
}

.station-map-header h2 {
  margin: 0 0 4px;
  color: #18212f;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.station-map-header p {
  margin: 0;
  color: #263446;
  font-weight: 850;
}

.station-progress-token {
  position: relative;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  flex: 0 0 auto;
}

.station-progress-token strong {
  position: relative;
  z-index: 1;
  font-size: 1.25rem;
  font-weight: 950;
}

.station-progress-ring {
  position: absolute;
  inset: 0;
  border: 3px solid #18212f;
  border-radius: 50%;
  background: conic-gradient(#2ab7ca var(--progress), #ffffff 0);
  box-shadow: inset 0 0 0 10px #fff7d8;
}

.station-route-map {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: clamp(12px, 2vw, 18px);
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 54px 8px 12px;
}

.station-route-track {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 86px;
  height: 18px;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 7px 0 rgba(24, 33, 47, 0.1);
}

.station-route-track i {
  display: block;
  width: var(--repair-progress);
  height: 100%;
  border-radius: inherit;
  background: repeating-linear-gradient(90deg, #2ab7ca 0 34px, #fed766 34px 68px, #f25f5c 68px 102px);
  transition: width 360ms ease;
}

.station-card {
  position: relative;
  min-height: 258px;
  padding-top: 42px;
}

.station-number-wrap {
  position: absolute;
  left: 50%;
  top: -28px;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 4px;
  transform: translateX(-50%);
}

.station-node {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 4px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  color: #18212f;
  font-size: 1.7rem;
  font-weight: 950;
  box-shadow: 0 9px 0 rgba(24, 33, 47, 0.15);
}

.station-status-badge {
  padding: 5px 9px;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  color: #263446;
  font-size: 0.76rem;
  font-weight: 950;
  white-space: nowrap;
}

.station-card.complete .station-node {
  background: #8bd17c;
  animation: repairedPulse 2.8s ease-in-out infinite;
}

.station-card.complete .station-status-badge {
  background: #e9ffe6;
}

.station-card.next {
  border-color: #f25f5c;
  box-shadow:
    0 12px 0 rgba(24, 33, 47, 0.13),
    0 0 0 5px rgba(242, 95, 92, 0.18);
}

.station-card.next .station-node {
  background: #fed766;
  animation: nextStationPulse 1.7s ease-in-out infinite;
}

.station-card.unplayed .station-node {
  background: #e9fbff;
}

.how-to-guide {
  display: grid;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
}

.guide-hero-panel,
.guide-active-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: clamp(18px, 3vw, 28px);
  border: 3px solid #18212f;
  border-radius: 8px;
  background: linear-gradient(135deg, #e9fbff 0%, #fff7d8 58%, #ffe4e1 100%);
  box-shadow: 0 11px 0 rgba(24, 33, 47, 0.12);
}

.guide-hero-panel h1 {
  margin: 0 0 8px;
  color: #18212f;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.guide-hero-panel p,
.guide-active-card h2 {
  max-width: 52ch;
  margin: 0;
  color: #263446;
  font-weight: 850;
}

.guide-visual {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  gap: 14px;
  align-items: center;
  min-width: 210px;
  min-height: 130px;
  padding: 16px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.05) 1px, transparent 1px),
    #ffffff;
  background-size: 22px 22px;
}

.guide-ball,
.guide-socket,
.guide-badge,
.guide-chain,
.guide-star,
.guide-wrong,
.league-visual span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 4px solid #18212f;
  border-radius: 999px;
  background: #2ab7ca;
  color: #062e35;
  font-weight: 950;
}

.guide-socket {
  background: #ffffff;
  border-style: dashed;
}

.guide-route,
.guide-arrow {
  width: 74px;
  height: 10px;
  border-radius: 999px;
  background: #fed766;
}

.guide-arrow::after {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  margin-left: auto;
  transform: translate(8px, -5px) rotate(45deg);
  border-top: 8px solid #fed766;
  border-right: 8px solid #fed766;
}

.guide-wrong {
  background: #ffe4e1;
}

.guide-meter {
  display: block;
  width: 112px;
  height: 16px;
  overflow: hidden;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.guide-meter i {
  display: block;
  width: 74%;
  height: 100%;
  background: linear-gradient(90deg, #2ab7ca, #8bd17c, #fed766);
}

.guide-badge {
  width: 70px;
  border-radius: 8px;
  background: #fed766;
}

.guide-chain {
  width: 46px;
  height: 46px;
  background: #8bd17c;
}

.guide-star {
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 92%, 50% 70%, 21% 92%, 32% 57%, 2% 35%, 39% 35%);
  border-radius: 0;
  background: #fed766;
}

.guide-stepper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 9px;
}

.guide-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  color: #18212f;
  text-align: left;
  cursor: pointer;
}

.guide-step span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #e9fbff;
  font-weight: 950;
}

.guide-step strong {
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

.guide-step.active {
  background: #fff7d8;
  box-shadow: 0 0 0 4px rgba(254, 215, 102, 0.35);
}

.glossary-workbench {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}

.glossary-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 330px);
  gap: 18px;
  align-items: end;
  padding: 18px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #e9fbff 54%, #fff7d8 100%);
  box-shadow: 0 10px 0 rgba(24, 33, 47, 0.1);
}

.glossary-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.9rem, 4vw, 3.2rem);
}

.glossary-hero p {
  margin: 0;
  color: #263446;
  font-weight: 850;
}

.glossary-search {
  display: grid;
  gap: 7px;
  font-weight: 950;
}

.glossary-search input {
  min-height: 48px;
  padding: 10px 12px;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  color: #18212f;
  font: inherit;
  font-weight: 850;
}

.glossary-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.glossary-filter {
  min-height: 42px;
  padding: 8px 13px;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  color: #18212f;
  cursor: pointer;
  font-weight: 950;
}

.glossary-filter.active {
  background: #fed766;
}

.glossary-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 12px;
}

.glossary-tool-card {
  display: grid;
  overflow: hidden;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.09);
}

.glossary-card-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 132px;
  padding: 12px;
  border: 0;
  background: linear-gradient(145deg, #ffffff 0%, #f8fbfb 100%);
  color: #18212f;
  cursor: pointer;
  text-align: left;
}

.glossary-card-button span:nth-child(2) {
  display: grid;
  gap: 4px;
}

.glossary-card-button strong {
  font-size: 1.15rem;
  font-weight: 950;
}

.glossary-card-button em,
.glossary-card-button small {
  color: #526070;
  font-style: normal;
  font-weight: 850;
  line-height: 1.25;
}

.glossary-card-button small {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff7d8;
  color: #263446;
}

.glossary-token {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 4px solid #18212f;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.72) 0 18%, transparent 19%),
    #2ab7ca;
  color: #062e35;
  font-weight: 950;
}

.glossary-tool-card.open {
  box-shadow:
    0 8px 0 rgba(24, 33, 47, 0.09),
    0 0 0 4px rgba(42, 183, 202, 0.24);
}

.glossary-card-detail {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 2px solid #18212f;
  background: #f8fbfb;
}

.glossary-card-detail p {
  margin: 0;
  color: #263446;
  font-weight: 800;
  line-height: 1.38;
}

.related-level-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.related-level-chips span {
  padding: 5px 8px;
  border: 2px solid #dbe3e5;
  border-radius: 999px;
  background: #ffffff;
  color: #263446;
  font-size: 0.82rem;
  font-weight: 900;
}

.control-room,
.profile-badge-room {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
}

.control-card,
.profile-hero-card,
.profile-edit-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 0 rgba(24, 33, 47, 0.1);
}

.sound-card {
  background: linear-gradient(145deg, #ffffff 0%, #e9fbff 100%);
}

.display-card {
  background: linear-gradient(145deg, #ffffff 0%, #fff7d8 100%);
}

.profile-link-card {
  background: linear-gradient(145deg, #ffffff 0%, #f0fff1 100%);
}

.account-card {
  background: linear-gradient(145deg, #ffffff 0%, #ffe8e7 100%);
}

.control-card-heading,
.profile-hero-card {
  display: flex;
  align-items: center;
  gap: 13px;
}

.control-card h2,
.profile-hero-card h1 {
  margin: 0;
}

.control-card p,
.profile-hero-card p,
.profile-edit-card span {
  margin: 0;
  color: #526070;
  font-weight: 850;
}

.control-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 4px solid #18212f;
  border-radius: 50%;
  background: #fed766;
}

.control-icon::before,
.control-icon::after {
  content: "";
  display: block;
  border: 3px solid #18212f;
}

.speaker-icon::before {
  width: 18px;
  height: 22px;
  border-radius: 4px 10px 10px 4px;
  background: #ffffff;
}

.display-icon::before {
  width: 26px;
  height: 20px;
  border-radius: 4px;
  background: #ffffff;
}

.control-toggle {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 2px solid rgba(24, 33, 47, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.control-toggle input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.toggle-track,
.toggle-copy {
  pointer-events: none;
}

.toggle-track {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 34px;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #dbe3e5;
  box-shadow: inset 0 -4px 0 rgba(24, 33, 47, 0.1);
}

.toggle-track i {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border: 3px solid #18212f;
  border-radius: 50%;
  background: #ffffff;
  transition:
    transform 170ms ease,
    background 170ms ease;
}

.control-toggle input:checked + .toggle-track {
  background: #8bd17c;
}

.control-toggle input:checked + .toggle-track i {
  transform: translateX(29px);
  background: #fed766;
}

.control-toggle input:focus-visible + .toggle-track,
.control-range input:focus-visible,
.glossary-search input:focus-visible {
  outline: 4px solid rgba(254, 215, 102, 0.8);
  outline-offset: 3px;
}

.toggle-copy {
  display: grid;
  gap: 3px;
}

.toggle-copy strong,
.control-range span {
  color: #18212f;
  font-weight: 950;
}

.toggle-copy em {
  color: #526070;
  font-style: normal;
  font-weight: 800;
  line-height: 1.25;
}

.control-range {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.control-range input {
  width: 100%;
  height: 22px;
  appearance: none;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ab7ca, #fed766);
  cursor: pointer;
}

.control-range input::-webkit-slider-thumb {
  width: 30px;
  height: 30px;
  appearance: none;
  border: 3px solid #18212f;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(24, 33, 47, 0.14);
}

.control-range input::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 3px solid #18212f;
  border-radius: 50%;
  background: #ffffff;
}

.mini-action {
  justify-self: start;
}

.control-actions,
.profile-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.logout-action {
  justify-self: start;
}

.profile-hero-card,
.profile-edit-card {
  grid-column: 1 / -1;
}

.profile-hero-card .avatar-badge {
  width: 92px;
  height: 92px;
}

.profile-hero-card .avatar-badge span {
  width: 38px;
  height: 38px;
}

.profile-rank-mini {
  display: grid;
  min-width: min(320px, 100%);
  gap: 6px;
  margin-left: auto;
}

.profile-rank-mini span {
  color: #526070;
  font-weight: 850;
}

.nickname-field input {
  max-width: 440px;
}

.visual-avatar-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.visual-avatar-grid .avatar-choice {
  min-height: 132px;
  justify-items: center;
  align-content: center;
  color: var(--avatar-ink);
}

.avatar-choice-face {
  display: block;
  width: 54px;
  height: 54px;
  border: 4px solid var(--avatar-ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 38%, #ffffff 0 6px, transparent 7px),
    var(--avatar-secondary);
}

.crew-board-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto 14px;
  padding: 20px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background:
    radial-gradient(circle at 78% 18%, rgba(254, 215, 102, 0.72) 0 70px, transparent 72px),
    linear-gradient(135deg, #e9fbff 0%, #fff7d8 54%, #ffe4e1 100%);
  box-shadow: 0 11px 0 rgba(24, 33, 47, 0.12);
}

.crew-board-hero h1 {
  margin: 0 0 6px;
  color: #18212f;
  font-size: clamp(2.2rem, 4.5vw, 4rem);
}

.crew-board-hero p {
  margin: 0 0 10px;
  color: #263446;
  font-weight: 850;
}

.reset-pill {
  display: inline-flex;
  padding: 7px 10px;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  font-weight: 950;
}

.crew-position-card {
  display: grid;
  min-width: 138px;
  justify-items: center;
  gap: 5px;
  padding: 14px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: #fed766;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.14);
}

.crew-position-card span {
  font-size: 3.1rem;
  font-weight: 950;
  line-height: 1;
}

.crew-position-card em {
  color: #263446;
  font-style: normal;
  font-weight: 900;
}

.crew-zone-key {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  max-width: 1120px;
  margin: 0 auto 12px;
}

.zone-key {
  padding: 7px 10px;
  border: 2px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  font-weight: 950;
}

.zone-key.promote {
  background: #e9ffe6;
}

.zone-key.steady {
  background: #e9fbff;
}

.zone-key.regroup {
  background: #fff7d8;
}

.crew-board-list {
  display: grid;
  gap: 10px;
  max-width: 1120px;
  margin: 0 auto;
}

.crew-row {
  border-color: #18212f;
}

.crew-row.promote {
  background: linear-gradient(90deg, #e9ffe6, #ffffff);
}

.crew-row.steady {
  background: linear-gradient(90deg, #e9fbff, #ffffff);
}

.crew-row.regroup {
  background: linear-gradient(90deg, #fff7d8, #ffffff);
}

.crew-row.current-user {
  box-shadow:
    0 7px 0 rgba(254, 215, 102, 0.3),
    0 0 0 5px rgba(254, 215, 102, 0.35);
}

.crew-name {
  display: grid;
  gap: 3px;
}

.crew-name em {
  color: #526070;
  font-size: 0.84rem;
  font-style: normal;
  font-weight: 850;
}

.crew-starter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  background: #ffffff;
}

.ghost-avatar {
  width: 46px;
  height: 46px;
  border: 3px dashed #94a3b8;
  border-radius: 50%;
  background: #e9fbff;
}

.ghost-avatar.yellow {
  background: #fff7d8;
}

.crew-starter-row p {
  margin: 0;
  color: #526070;
  font-weight: 850;
}

.glossary-card-button:hover,
.glossary-card-button:focus-visible,
.glossary-filter:hover,
.glossary-filter:focus-visible,
.guide-step:hover,
.guide-step:focus-visible,
.route-meter-card:hover,
.route-meter-card:focus-visible {
  outline: 4px solid rgba(254, 215, 102, 0.72);
  outline-offset: 2px;
}

.high-contrast-mode {
  filter: contrast(1.15);
}

.reduce-motion-mode *,
.reduce-motion-mode *::before,
.reduce-motion-mode *::after {
  transition-duration: 0.01ms !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
}

.machine-status {
  margin: 0;
  color: #263446;
  font-weight: 800;
  line-height: 1.35;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.platform-topbar .actions {
  justify-content: flex-end;
}

.primary-action {
  min-height: 46px;
  padding: 0 18px;
  border: 3px solid #18212f;
  border-radius: 8px;
  background: #fed766;
  color: #18212f;
  box-shadow: 0 6px 0 rgba(24, 33, 47, 0.18);
  cursor: pointer;
  font-weight: 950;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-2px);
  background: #ffe27e;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.18);
  outline: 0;
}

.primary-action:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(24, 33, 47, 0.18);
}

.lesson-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 20, 31, 0.54);
  backdrop-filter: blur(8px);
}

.lesson-panel {
  width: min(620px, 100%);
  padding: clamp(20px, 3vw, 34px);
  border: 3px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.tutorial-panel {
  width: min(820px, 100%);
}

.tutorial-demo {
  position: relative;
  min-height: 310px;
  margin: 16px 0 12px;
  overflow: hidden;
  border: 3px solid #18212f;
  border-radius: 8px;
  background:
    linear-gradient(rgba(24, 33, 47, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 33, 47, 0.055) 1px, transparent 1px),
    #fbfcfb;
  background-size: 28px 28px;
}

.tutorial-depot {
  position: absolute;
  left: 20px;
  top: 28px;
  width: min(190px, 28%);
  padding: 12px;
  border: 2px solid #18212f;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 0 rgba(24, 33, 47, 0.12);
}

.tutorial-label {
  display: block;
  margin-bottom: 10px;
  color: #526070;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tutorial-depot-balls {
  display: grid;
  grid-template-columns: repeat(2, 48px);
  justify-content: center;
  gap: 10px;
}

.factor-tutorial-demo .tutorial-depot-balls {
  grid-template-columns: repeat(2, 48px);
}

.factor-output-line {
  gap: 8px;
}

.tutorial-token {
  --token-color: #2ab7ca;
  --token-ink: #082b33;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 3px solid rgba(24, 33, 47, 0.88);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.75) 0 17%, transparent 18%),
    var(--token-color);
  color: var(--token-ink);
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.12),
    0 5px 0 rgba(24, 33, 47, 0.14);
}

.tutorial-token .token-piece {
  width: 25px;
  height: 25px;
  font-size: 0.72rem;
}

.tutorial-factor-token {
  width: 38px;
  height: 38px;
}

.tutorial-factor-token .token-piece {
  width: 22px;
  height: 22px;
}

.tutorial-routes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tutorial-route {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 5 4;
  opacity: 0.58;
  animation: tutorialRouteFlow 2.8s linear infinite;
}

.tutorial-route.cyan {
  stroke: #2ab7ca;
}

.tutorial-route.coral {
  stroke: #f25f5c;
  animation-delay: -0.7s;
}

.tutorial-route.yellow {
  stroke: #fed766;
  animation-delay: -1.4s;
}

.tutorial-route.blue {
  stroke: #38aef0;
  animation-delay: -2.1s;
}

.tutorial-equation {
  position: absolute;
  left: 31%;
  right: 22px;
  top: 50%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transform: translateY(-50%);
  color: #18212f;
  font-size: clamp(1.25rem, 2.7vw, 2rem);
  font-weight: 950;
}

.tutorial-input,
.tutorial-output-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tutorial-output-line {
  gap: 7px;
}

.tutorial-plus {
  padding: 0 4px;
}

.tutorial-socket {
  display: inline-grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 3px dashed #526070;
  border-radius: 8px;
  background: #ffffff;
}

.tutorial-target-token {
  opacity: 0;
  transform: scale(0.72);
}

.tutorial-target-token.one {
  animation: tutorialFillOne 10s ease-in-out infinite;
}

.tutorial-target-token.two {
  animation: tutorialFillTwo 10s ease-in-out infinite;
}

.tutorial-target-token.three {
  animation: tutorialFillThree 10s ease-in-out infinite;
}

.tutorial-target-token.four {
  animation: tutorialFillFour 10s ease-in-out infinite;
}

.tutorial-ghost {
  position: absolute;
  z-index: 4;
  left: 24%;
  top: var(--from-y);
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 3px solid rgba(24, 33, 47, 0.88);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.75) 0 17%, transparent 18%),
    var(--token-color);
  color: var(--token-ink);
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.12),
    0 14px 18px rgba(24, 33, 47, 0.22);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
}

.tutorial-ghost .token-piece {
  width: 28px;
  height: 28px;
}

.tutorial-ghost.one {
  --from-y: 41%;
  animation: tutorialDragOne 10s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.tutorial-ghost.two {
  --from-y: 53%;
  animation: tutorialDragTwo 10s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.tutorial-ghost.three {
  --from-y: 65%;
  animation: tutorialDragThree 10s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.tutorial-ghost.four {
  --from-y: 77%;
  animation: tutorialDragFour 10s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.tutorial-hand {
  position: absolute;
  z-index: 5;
  left: 24%;
  top: 41%;
  width: 22px;
  height: 22px;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 6px 0 rgba(24, 33, 47, 0.14);
  opacity: 0;
  transform: translate(8px, 10px);
  animation: tutorialHand 10s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}

.tutorial-hand::after {
  position: absolute;
  content: "";
  right: -8px;
  bottom: -10px;
  width: 13px;
  height: 13px;
  border-right: 3px solid #18212f;
  border-bottom: 3px solid #18212f;
  transform: rotate(26deg);
}

.lesson-animation {
  position: relative;
  height: 108px;
  margin-bottom: 12px;
  overflow: hidden;
}

.lesson-track {
  position: absolute;
  left: 7%;
  right: 13%;
  top: 54px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ab7ca, #fed766, #f25f5c);
}

.lesson-ball {
  position: absolute;
  top: 37px;
  left: 8%;
  width: 42px;
  height: 42px;
  border: 3px solid #18212f;
  border-radius: 999px;
  background: #2ab7ca;
  animation: lessonBall 5.2s ease-in-out infinite;
}

.lesson-ball.ball-two {
  background: #fed766;
  animation-delay: 0.9s;
}

.lesson-ball.ball-three {
  background: #f25f5c;
  animation-delay: 1.8s;
}

.lesson-machine {
  position: absolute;
  right: 7%;
  top: 20px;
  width: 74px;
  height: 74px;
  border: 4px solid #18212f;
  border-radius: 999px;
  background: #ffffff;
}

.lesson-machine::before,
.lesson-machine::after {
  position: absolute;
  content: "";
  top: 31px;
  height: 8px;
  border-radius: 999px;
  background: #2ab7ca;
}

.lesson-machine::before {
  left: -90px;
  width: 88px;
}

.lesson-machine::after {
  right: -64px;
  width: 62px;
  background: #fed766;
}

.lesson-panel h2 {
  margin: 8px 0;
  color: #18212f;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.lesson-equation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  margin: 4px 0 12px;
  padding: 6px 16px;
  border: 2px solid #dbe3e5;
  border-radius: 8px;
  background: #f8fbfb;
  color: #18212f;
  font-size: clamp(1.2rem, 3vw, 1.75rem);
  font-weight: 950;
  letter-spacing: 0;
}

.lesson-panel p[data-testid="lesson-frame"] {
  min-height: 48px;
  margin: 0 auto 14px;
  max-width: 460px;
  color: #263446;
  font-weight: 700;
  line-height: 1.35;
}

.lesson-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.lesson-dots span {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #cbd5dc;
}

.lesson-dots span.active {
  background: #2ab7ca;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -20px;
  left: var(--x);
  width: 12px;
  height: 18px;
  border: 2px solid rgba(24, 33, 47, 0.55);
  border-radius: 3px;
  animation: confettiFall 1.45s ease-in forwards;
  animation-delay: var(--delay);
}

@keyframes routePulse {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -92;
  }
}

@keyframes landingStationPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.16);
  }
}

@keyframes landingTrainCyan {
  0% {
    left: 6%;
    top: 67%;
  }
  45% {
    left: 50%;
    top: 48%;
  }
  100% {
    left: 92%;
    top: 51%;
  }
}

@keyframes landingTrainYellow {
  0% {
    left: 7%;
    top: 35%;
  }
  52% {
    left: 49%;
    top: 26%;
  }
  100% {
    left: 90%;
    top: 34%;
  }
}

@keyframes landingTrainCoral {
  0% {
    left: 8%;
    top: 85%;
  }
  48% {
    left: 50%;
    top: 78%;
  }
  100% {
    left: 91%;
    top: 73%;
  }
}

@keyframes categoryTrain {
  0%,
  100% {
    left: 16px;
    top: 14px;
    transform: scale(1);
  }
  48% {
    left: calc(100% - 48px);
    top: 38px;
    transform: scale(1.08);
  }
  62% {
    transform: scale(0.96);
  }
}

@keyframes tutorialRouteFlow {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: -36;
  }
}

@keyframes tutorialDragOne {
  0%,
  3% {
    left: 24%;
    top: var(--from-y);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  5%,
  17% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
  20% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  23%,
  100% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 0;
  }
}

@keyframes tutorialDragTwo {
  0%,
  24% {
    left: 24%;
    top: var(--from-y);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  27%,
  39% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
  42% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  45%,
  100% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 0;
  }
}

@keyframes tutorialDragThree {
  0%,
  47% {
    left: 24%;
    top: var(--from-y);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  50%,
  62% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
  65% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  68%,
  100% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 0;
  }
}

@keyframes tutorialDragFour {
  0%,
  70% {
    left: 24%;
    top: var(--from-y);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92);
  }
  73%,
  84% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
  }
  88% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  91%,
  100% {
    left: var(--to-x);
    top: var(--to-y);
    opacity: 0;
  }
}

@keyframes tutorialFillOne {
  0%,
  18% {
    opacity: 0;
    transform: scale(0.72);
  }
  22%,
  94% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.72);
  }
}

@keyframes tutorialFillTwo {
  0%,
  40% {
    opacity: 0;
    transform: scale(0.72);
  }
  44%,
  94% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.72);
  }
}

@keyframes tutorialFillThree {
  0%,
  63% {
    opacity: 0;
    transform: scale(0.72);
  }
  67%,
  94% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.72);
  }
}

@keyframes tutorialFillFour {
  0%,
  86% {
    opacity: 0;
    transform: scale(0.72);
  }
  90%,
  94% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.72);
  }
}

@keyframes tutorialHand {
  0%,
  3% {
    left: 24%;
    top: 41%;
    opacity: 0;
  }
  5%,
  17% {
    opacity: 1;
  }
  20% {
    left: 51%;
    top: 53%;
    opacity: 1;
  }
  24% {
    left: 24%;
    top: 53%;
    opacity: 0;
  }
  27%,
  39% {
    opacity: 1;
  }
  42% {
    left: 60%;
    top: 53%;
    opacity: 1;
  }
  47% {
    left: 24%;
    top: 65%;
    opacity: 0;
  }
  50%,
  62% {
    opacity: 1;
  }
  65% {
    left: 76%;
    top: 53%;
    opacity: 1;
  }
  70% {
    left: 24%;
    top: 77%;
    opacity: 0;
  }
  73%,
  84% {
    opacity: 1;
  }
  88% {
    left: 85%;
    top: 53%;
    opacity: 1;
  }
  92%,
  100% {
    left: 85%;
    top: 53%;
    opacity: 0;
  }
}

@keyframes dragWiggle {
  from {
    transform: translate(-50%, -50%) scale(1.08) rotate(-5deg);
  }
  to {
    transform: translate(-50%, -50%) scale(1.08) rotate(5deg);
  }
}

@keyframes slotShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-7px) rotate(-1deg);
  }
  75% {
    transform: translateX(7px) rotate(1deg);
  }
}

@keyframes slotPop {
  0% {
    transform: scale(0.86);
  }
  62% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes beltMove {
  to {
    transform: translateX(25%);
  }
}

@keyframes outputArrive {
  0% {
    transform: translateX(40px) translateY(10px);
  }
  100% {
    transform: translateX(0) translateY(0);
  }
}

@keyframes lessonBall {
  0% {
    transform: translateX(0) scale(0.92);
  }
  55% {
    transform: translateX(390px) scale(1.05);
  }
  100% {
    transform: translateX(390px) scale(0.6);
    opacity: 0;
  }
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(620px) translateX(var(--drift)) rotate(540deg);
    opacity: 0;
  }
}

@keyframes routeDash {
  to {
    stroke-dashoffset: -80;
  }
}

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

@keyframes repairedPulse {
  0%,
  100% {
    box-shadow: 0 9px 0 rgba(24, 33, 47, 0.15);
  }
  50% {
    box-shadow:
      0 9px 0 rgba(24, 33, 47, 0.15),
      0 0 0 9px rgba(139, 209, 124, 0.25);
  }
}

@keyframes nextStationPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.09);
  }
}

@media (max-width: 860px) {
  .landing-title-block h1 {
    font-size: 4rem;
  }

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

  .category-screen {
    min-height: calc(100vh - 118px);
  }

  .category-grid {
    grid-template-columns: 1fr;
    width: min(520px, calc(100% - 28px));
  }

  .level-picker-screen {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .player-status-strip,
  .hub-action-grid,
  .hub-lower-grid,
  .guide-hero-panel,
  .guide-active-card,
  .glossary-hero,
  .control-room,
  .profile-badge-room,
  .crew-board-hero {
    grid-template-columns: 1fr;
  }

  .hero-badge {
    right: 18px;
    opacity: 0.32;
  }

  .hub-nav-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: span 1;
  }

  .station-map-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .station-route-map {
    grid-template-columns: 1fr;
    max-width: 560px;
    padding: 30px 0 10px 74px;
  }

  .station-route-track {
    left: 25px;
    right: auto;
    top: 28px;
    bottom: 28px;
    width: 18px;
    height: auto;
  }

  .station-route-track i {
    width: 100%;
    height: var(--repair-progress);
    background: repeating-linear-gradient(180deg, #2ab7ca 0 34px, #fed766 34px 68px, #f25f5c 68px 102px);
  }

  .station-number-wrap {
    left: -70px;
    top: 24px;
    transform: none;
  }

  .station-card {
    min-height: 220px;
    padding-top: 16px;
  }

  .profile-hero-card,
  .control-card-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-rank-mini {
    width: 100%;
    margin-left: 0;
  }

  .topbar,
  .mission-band,
  .status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .platform-topbar .actions {
    justify-content: flex-start;
    width: 100%;
  }

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

  .dashboard-route-hero {
    min-height: 210px;
  }

  .teacher-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-roster-toolbar,
  .teacher-table-head,
  .teacher-row,
  .toolbox-editor-screen,
  .toolbox-form-grid,
  .student-detail-header,
  .student-detail-summary,
  .student-detail-grid,
  .student-progress-row,
  .student-concept-row,
  .leaderboard-hero {
    grid-template-columns: 1fr;
  }

  .teacher-table-head {
    display: none;
  }

  .teacher-row {
    gap: 10px;
  }

  .level-route {
    width: 100%;
    min-width: 0;
  }

  .progress-meter {
    flex: 0 0 auto;
    width: 100%;
  }

  .factory-stage {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .token-yard {
    order: 2;
  }

  .token-list {
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  }

  .machine {
    min-height: 560px;
  }

  .machine.has-factor-steps {
    min-height: 1340px;
  }

  .equation-console {
    align-self: start;
    margin-top: 70px;
  }

  .equation {
    justify-content: flex-start;
    font-size: clamp(1.35rem, 8vw, 2.4rem);
  }

  .factor-step-map {
    grid-template-columns: 1fr;
  }

  .factor-svg-diagram {
    aspect-ratio: auto;
    height: 360px;
    min-height: 0;
  }

  .factor-diagram-input {
    font-size: clamp(1.05rem, 4.8vw, 1.55rem);
  }

  .factor-diagram-top-input,
  .factor-diagram-final-input {
    width: min(420px, 84%);
  }

  .factor-final-row {
    grid-template-columns: 1fr;
  }

  .factor-final-equation {
    justify-content: flex-start;
  }

  .output-tray {
    left: 16px;
    right: 16px;
  }

  .lesson-panel {
    max-height: calc(100vh - 40px);
    overflow: auto;
  }
}

@media (max-width: 520px) {
  .game-shell {
    padding: 10px;
  }

  .landing-shell,
  .chooser-shell {
    padding: 0;
  }

  .landing-screen {
    padding: 18px;
  }

  .landing-title-block h1 {
    font-size: 3.15rem;
  }

  .landing-actions {
    width: 100%;
  }

  .landing-actions .primary-action,
  .landing-actions .secondary-action {
    width: min(260px, 100%);
  }

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

  .dashboard-hero,
  .wide-panel {
    grid-column: span 1;
  }

  .dashboard-route-hero {
    min-height: 240px;
  }

  .hub-copy {
    width: calc(100% - 28px);
    margin: 0 auto;
  }

  .player-status-strip,
  .teacher-summary-strip,
  .student-detail-summary,
  .hub-action-grid,
  .hub-lower-grid,
  .glossary-card-grid,
  .guide-stepper,
  .hub-nav-panel {
    grid-template-columns: 1fr;
  }

  .hero-badge {
    display: none;
  }

  .hub-action-card {
    min-height: 150px;
  }

  .guide-visual {
    min-width: 0;
    width: 100%;
  }

  .station-map-shell {
    padding: 14px;
  }

  .station-route-map {
    padding-left: 64px;
  }

  .station-node {
    width: 58px;
    height: 58px;
    font-size: 1.4rem;
  }

  .station-number-wrap {
    left: -62px;
  }

  .crew-row {
    grid-template-columns: 42px 56px minmax(0, 1fr);
  }

  .crew-name {
    min-width: 0;
  }

  .leaderboard-row {
    grid-template-columns: 42px 56px minmax(0, 1fr);
  }

  .leaderboard-xp {
    grid-column: 3;
  }

  .chooser-shell {
    padding: 12px;
  }

  .chooser-topbar {
    gap: 10px;
  }

  .chooser-topbar h1 {
    font-size: 1.6rem;
  }

  .category-card {
    min-height: 210px;
    padding: 18px;
  }

  .category-card-title {
    font-size: 1.65rem;
  }

  .level-picker-screen {
    grid-template-columns: 1fr;
  }

  .route-dot {
    width: 30px;
    height: 30px;
    border-width: 2px;
    font-size: 0.9rem;
  }

  .route-track {
    height: 4px;
  }

  .mission-band,
  .status-row,
  .token-yard {
    padding: 10px;
  }

  .math-token {
    width: 62px;
    height: 62px;
    border-width: 3px;
  }

  .equation-slot {
    min-width: 78px;
  }

  .factor-diagram-console {
    width: calc(100vw - 44px);
    max-width: 100%;
    padding: 14px;
  }

  .factor-svg-diagram .equation-slot {
    width: 54px;
    min-width: 54px;
    min-height: 54px;
  }

  .factor-svg-diagram .equation-slot.colour-socket .slot-token,
  .factor-svg-diagram .equation-slot .slot-token {
    width: 44px;
    height: 44px;
  }

  .factor-diagram-anchor.top-left-factor {
    left: 24%;
  }

  .factor-diagram-anchor.top-left-common {
    left: 41%;
  }

  .factor-diagram-anchor.top-right-factor {
    left: 59%;
  }

  .factor-diagram-anchor.top-right-common {
    left: 76%;
  }

  .factor-diagram-anchor.common-factor {
    left: 16%;
  }

  .factor-diagram-anchor.bottom-left-factor {
    left: 35%;
  }

  .factor-diagram-anchor.bottom-right-factor {
    left: 65%;
  }

  .factor-step-arrow {
    width: 42px;
    justify-self: center;
  }

  .machine {
    min-height: 600px;
  }

  .machine.has-factor-steps {
    min-height: 1460px;
  }

  .machine-overlay {
    padding: 12px;
  }

  .metro-progress-line {
    left: 11%;
    right: 11%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
