.levels-workspace {
  max-width: 1400px;
  margin: auto;
}
.levels-workspace:not([data-world='sprint']) .levels-track-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.levels-workspace:not([data-world='sprint']) .levels-track-links [aria-current='page'] {
  font-weight: 700;
}
.levels-workspace:not([data-world='sprint']) .levels-map {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 1.5rem 0;
}
.levels-workspace:not([data-world='sprint']) .levels-map button {
  font: inherit;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  padding: 0.7rem;
  text-align: left;
  min-width: 0;
}
.levels-workspace:not([data-world='sprint']) .levels-map button[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.levels-workspace:not([data-world='sprint']) .levels-map button:disabled {
  opacity: 0.45;
}
.levels-workspace:not([data-world='sprint']) .levels-map button span {
  display: block;
  font-weight: 700;
}
.levels-workspace:not([data-world='sprint']) .levels-map button small {
  display: block;
  overflow-wrap: anywhere;
}
.levels-attempt-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.levels-continue {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin: 1rem 0;
}
.levels-continue input {
  width: auto;
  flex: none;
  margin-top: 0.2rem;
}
.levels-scene {
  min-width: 0;
}
.levels-cases {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.7rem 0;
}
.levels-outcome {
  font-weight: 600;
}
.levels-attempt-prompt p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.levels-help {
  margin: 1rem 0;
}
.levels-vocabulary,
.levels-example {
  font-size: 0.9rem;
  line-height: 1.6;
}
.levels-status {
  min-height: 2.5rem;
}
.levels-workspace textarea {
  min-height: 220px;
}
.levels-save-status {
  min-height: 1.5em;
}
#level-history {
  width: 100%;
}
@media (max-width: 760px) {
  .levels-workspace:not([data-world='sprint']) .levels-map {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .levels-workspace:not([data-world='sprint']) .levels-track-links {
    gap: 0.7rem;
  }
  .levels-workspace .workspace-heading {
    display: block;
  }
  .levels-workspace:not([data-world='sprint']) .levels-map button {
    min-height: 65px;
  }
  .levels-continue {
    line-height: 1.5;
  }
}
@media (max-width: 370px) {
  .levels-workspace:not([data-world='sprint']) .levels-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.levels-workspace [hidden] {
  display: none !important;
}

#nav.nav-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Level state is HTML over the approved illustrated, pannable park. */
.levels-workspace[data-world='sprint'] {
  max-width: 1280px;
  min-width: 0;
  margin: 0 auto;
}
.levels-workspace [hidden] {
  display: none !important;
}
.levels-journey {
  max-width: 1200px;
  min-width: 0;
  margin: auto;
}
.journey-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.5rem 0 1.2rem;
}
.journey-heading h1 {
  font-size: clamp(2rem, 4.5vw, 3.3rem);
  letter-spacing: -0.055em;
  line-height: 1.05;
  margin: 0.35rem 0 0.5rem;
}
.journey-heading p {
  margin: 0;
  color: var(--muted);
}
.journey-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
}
.journey-progress-icon {
  font-size: 2.4rem;
  color: var(--accent);
}
.journey-progress strong,
.journey-progress small {
  display: block;
}
.journey-progress strong {
  font-size: 1.25rem;
}
.journey-progress small {
  font-size: 0.75rem;
  color: var(--muted);
}
.levels-journey .levels-track-links {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 1.15rem;
  padding: 0.3rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
}
.levels-journey .levels-track-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  min-height: 48px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 100px;
  padding: 0.5rem;
  color: var(--muted);
  text-decoration: none;
}
.levels-journey .levels-track-links a span {
  font-size: 1.4rem;
}
.levels-journey .levels-track-links [aria-current='page'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--text) 8%, transparent);
}
.journey-board {
  min-width: 0;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px color-mix(in srgb, var(--text) 8%, transparent);
  background: var(--paint-sage);
}
.journey-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.journey-region {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.journey-find,
.journey-back {
  font: inherit;
  border: 0;
  background: transparent;
  color: var(--accent);
  min-height: 44px;
  padding: 0.4rem 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.journey-find span {
  margin-left: 0.4rem;
}
.journey-map-scroll {
  height: clamp(380px, 64svh, 680px);
  max-width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--paint-moss) var(--paint-sage);
  scrollbar-width: thin;
  position: relative;
  touch-action: pan-x pan-y;
}
.journey-map-scroll:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.journey-land {
  width: 1200px;
  height: 800px;
  position: relative;
  isolation: isolate;
}
.journey-landscape,
.levels-journey .levels-map {
  position: absolute;
  inset: 0;
}
.journey-landscape {
  pointer-events: none;
  overflow: hidden;
}
.journey-world-image {
  width: 1200px;
  height: 800px;
  object-fit: fill;
  display: block;
}
.levels-journey .levels-map {
  z-index: 2;
}
.journey-node {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  transform: translate(-50%, -50%);
  width: 98px;
  min-height: 70px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  overflow: visible;
  appearance: none;
}
.journey-node-disc {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 56px;
  height: 56px;
  margin: auto;
  border-radius: 50%;
  border: 4px solid var(--paint-sand);
  background: linear-gradient(145deg, var(--paint-white), var(--paint-teal-soft));
  box-shadow:
    inset 0 2px 0 var(--paint-white),
    0 5px 0 var(--paint-amber),
    0 8px 10px color-mix(in srgb, var(--paint-night) 25%, transparent);
  transition: transform 0.15s;
}
.journey-node-number {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}
.journey-node small {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.67rem;
  line-height: 1.15;
  font-weight: 700;
  max-width: 98px;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 2px 4px color-mix(in srgb, var(--paint-night) 12%, transparent);
}
.journey-node:not(:disabled):hover .journey-node-disc {
  transform: translateY(-3px);
}
.journey-node:focus-visible {
  outline: 0;
}
.journey-node:focus-visible .journey-node-disc {
  outline: 3px solid var(--paint-ink);
  outline-offset: 5px;
}
.journey-node.cleared .journey-node-disc {
  background: linear-gradient(145deg, var(--paint-teal), var(--paint-teal-dark));
  border-color: var(--paint-teal-soft);
  color: var(--paint-white);
  box-shadow:
    inset 0 2px 0 var(--paint-teal-soft),
    0 5px 0 var(--paint-teal-dark),
    0 8px 10px color-mix(in srgb, var(--paint-night) 20%, transparent);
}
.journey-node-state {
  position: absolute;
  right: -7px;
  top: -7px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  background: var(--surface);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 800;
}
.journey-node.current .journey-node-disc {
  border-color: var(--paint-amber);
  background: linear-gradient(145deg, var(--paint-surface), var(--paint-sand));
  box-shadow:
    inset 0 2px 0 var(--paint-white),
    0 5px 0 var(--paint-amber),
    0 0 0 6px color-mix(in srgb, var(--paint-surface) 75%, transparent),
    0 12px 20px color-mix(in srgb, var(--paint-night) 25%, transparent);
}
.journey-node.current .journey-node-number {
  font-size: 1.6rem;
}
.journey-node.locked {
  cursor: default;
}
.journey-node.locked .journey-node-disc {
  background: linear-gradient(145deg, var(--paint-surface), var(--paint-line));
  border-color: var(--paint-line);
  color: var(--paint-muted);
  box-shadow: 0 5px 0 var(--paint-subtle);
}
.journey-node.locked small {
  color: var(--muted);
}
.journey-lock {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 22px;
  padding: 3px;
  border-radius: 5px;
  background: var(--paint-muted);
  color: var(--paint-surface);
}
.journey-here {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  border-radius: 50px;
  background: var(--paint-ink);
  color: var(--paint-surface);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
}
.journey-here:after {
  content: '';
  position: absolute;
  top: 100%;
  left: calc(50% - 4px);
  border: 4px solid transparent;
  border-top-color: var(--paint-ink);
}
.journey-place {
  position: absolute;
  z-index: 1;
  max-width: 145px;
  font-size: 0.65rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--paint-forest);
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  background: color-mix(in srgb, var(--paint-surface) 90%, transparent);
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px color-mix(in srgb, var(--paint-night) 10%, transparent);
}
.journey-place-one {
  left: 10%;
  top: 14%;
}
.journey-place-two {
  left: 46%;
  top: 13%;
}
.journey-place-three {
  left: 80%;
  top: 33%;
}
/* The map mascot may walk between earned stops; game replay uses recorded geometry. */
.journey-avatar {
  position: absolute;
  left: var(--avatar-x, 9.1667%);
  top: var(--avatar-y, 35.625%);
  z-index: 3;
  width: 88px;
  height: 88px;
  pointer-events: none;
  transform: translate(-50%, -100%);
  background-image: url('/promza-robot-walk-v1.webp');
  background-repeat: no-repeat;
  background-size: 200% 200%;
  background-position: 100% 0;
  filter: drop-shadow(0 5px 3px color-mix(in srgb, var(--paint-night) 22%, transparent));
}
.journey-avatar.walking,
.journey-avatar.is-walking {
  animation: journey-robot-steps 0.52s steps(1, end) infinite;
}
@keyframes journey-robot-steps {
  0%,
  100% {
    background-position: 0 0;
  }
  25% {
    background-position: 100% 0;
  }
  50% {
    background-position: 0 100%;
  }
  75% {
    background-position: 100% 100%;
  }
}
.journey-launch {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.journey-launch-number {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 700;
}
.journey-launch-copy {
  flex: 1;
  min-width: 0;
}
.journey-launch h2 {
  font-size: 1.25rem;
  margin: 0.2rem 0 0;
  line-height: 1.2;
}
.journey-launch .eyebrow {
  font-size: 0.62rem;
}
.journey-launch .btn {
  min-height: 48px;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--paint-teal-dark);
  border-radius: 16px;
  padding: 0.75rem 1.4rem;
}
.journey-footnote {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 1rem 0 0;
}
/* Strategy → attempt → replay stays in shared workshop panes. */
.levels-play-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.levels-play-nav > span {
  font-size: 0.85rem;
  color: var(--muted);
}
.levels-play-progress {
  margin-left: auto;
}
.journey-back {
  font-size: 0.9rem;
}
.journey-back > span {
  font-size: 1.2rem;
  margin-right: 0.3rem;
}
.levels-play .workspace-grid {
  margin-top: 0;
}
.levels-play .simple-editor,
.levels-play .workshop-tests {
  border-radius: 22px;
}
.levels-brief {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.3rem;
}
.levels-title {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
  margin: 0.4rem 0 0.6rem;
}
.levels-objective {
  font-weight: 600;
}
.levels-lesson {
  color: var(--muted);
}
.levels-attempt-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.levels-attempt-controls .btn {
  min-height: 46px;
  border-radius: 14px;
}
.levels-continue {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin: 1rem 0;
}
.levels-continue input {
  width: auto;
  flex: none;
  margin-top: 0.2rem;
}
.levels-scene {
  min-width: 0;
}
.levels-cases {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.7rem 0;
}
.levels-outcome {
  font-weight: 600;
}
.levels-attempt-prompt p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.levels-help {
  margin: 1rem 0;
}
.levels-vocabulary,
.levels-example {
  font-size: 0.9rem;
  line-height: 1.6;
}
.levels-status {
  min-height: 2.5rem;
}
.levels-workspace textarea {
  min-height: 220px;
}
.levels-save-status {
  min-height: 1.5em;
}
#level-history {
  width: 100%;
}
.levels-victory {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.2rem;
  margin: 1rem 0;
  background: var(--accent-soft);
  border: 1px solid var(--paint-sage);
  border-radius: 18px;
}
.victory-medal {
  display: grid;
  place-items: center;
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--paint-sand);
  color: var(--paint-forest);
  font-size: 2rem;
  border: 3px solid var(--paint-amber);
  box-shadow: 0 3px 0 var(--paint-amber);
}
.levels-victory h3 {
  font-size: 1.3rem;
  margin: 0.2rem 0 0.4rem;
}
.levels-victory p {
  font-size: 0.85rem;
  margin: 0.3rem 0 0.5rem;
}
#nav.nav-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 760px) {
  main:has(.levels-journey:not([hidden])) {
    padding-top: 12px;
  }
  .journey-heading {
    gap: 0.5rem;
    margin: 0.15rem 0 0.6rem;
  }
  .journey-heading .eyebrow {
    display: none;
  }
  .journey-heading h1 {
    font-size: 1.5rem;
    letter-spacing: -0.045em;
    margin: 0.2rem 0 0.3rem;
  }
  .journey-heading p {
    font-size: 0.72rem;
    line-height: 1.3;
  }
  .journey-progress {
    gap: 0.3rem;
  }
  .journey-progress-icon {
    font-size: 1.6rem;
  }
  .journey-progress strong {
    font-size: 0.85rem;
  }
  .journey-progress small {
    display: none;
  }
  .levels-journey .levels-track-links {
    gap: 0;
    border-radius: 16px;
    padding: 0.25rem;
    margin-bottom: 0.65rem;
  }
  .levels-journey .levels-track-links a {
    font-size: 0.66rem;
    line-height: 1.2;
    min-height: 44px;
    border-radius: 12px;
    text-align: center;
  }
  .levels-journey .levels-track-links a > span {
    display: none;
  }
  .journey-board {
    border-radius: 22px;
  }
  .journey-map-toolbar {
    padding: 0 0.65rem;
  }
  .journey-region {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }
  .journey-find {
    font-size: 0.7rem;
  }
  .journey-map-scroll {
    height: clamp(300px, calc(100svh - 375px), 510px);
  }
  .journey-launch {
    padding: 0.75rem 0.7rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .journey-launch-number {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }
  .journey-launch h2 {
    font-size: 0.95rem;
  }
  .journey-launch .btn {
    min-height: 44px;
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
  .journey-launch .eyebrow {
    font-size: 0.55rem;
  }
  .journey-footnote {
    display: none;
  }
  .levels-play-nav {
    gap: 0.6rem;
  }
  .levels-play-nav > span {
    font-size: 0.7rem;
  }
  .levels-continue {
    line-height: 1.5;
  }
}
@media (max-width: 370px) {
  .journey-map-scroll {
    height: clamp(220px, calc(100svh - 435px), 390px);
  }
  .journey-progress-icon {
    display: none;
  }
  .journey-launch .btn {
    width: 100%;
    margin-top: 0.25rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .journey-node-disc {
    transition: none;
  }
  .journey-avatar.walking,
  .journey-avatar.is-walking {
    animation: none;
    background-position: 100% 0;
  }
}
.levels-workspace[data-world='bridge'] .journey-place-one {
  left: 8%;
  top: 17%;
}
.levels-workspace[data-world='bridge'] .journey-place-two {
  left: 31%;
  top: 38%;
}
.levels-workspace[data-world='bridge'] .journey-place-three {
  left: 57%;
  top: 68%;
}
.levels-workspace[data-world='defense'] .journey-place-one {
  left: 12%;
  top: 17%;
}
.levels-workspace[data-world='defense'] .journey-place-two {
  left: 46%;
  top: 44%;
}
.levels-workspace[data-world='defense'] .journey-place-three {
  left: 83%;
  top: 23%;
}
