@font-face {
  font-family: "DM Sans";
  src: url("/play/assets/fonts/dm-sans-latin.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #101f29;
  --panel: #172d38;
  --line: #3a4e58;
  --text: #f2f2e9;
  --muted: #a8bdc7;
  --lime: #d5f56b;
  --accent: #f5bc8f;
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  color: var(--text);
  background: #263d49;
  border: 1px solid #53646d;
  border-radius: 8px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 600;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover:not(:disabled) {
  background: #355260;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.46;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}
a {
  color: var(--lime);
}
p {
  line-height: 1.5;
  margin: 0 0 14px;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  text-wrap: balance;
  letter-spacing: -0.035em;
}
h1 {
  font-size: clamp(28px, 2.4vw, 40px);
  line-height: 1.1;
}
h2 {
  font-size: 25px;
  line-height: 1.2;
}
h3 {
  font-size: 17px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}
.primary {
  background: var(--lime);
  color: #182719;
  border-color: var(--lime);
  font-weight: 750;
}
.primary:hover:not(:disabled) {
  background: #e5ff91;
}
.quiet {
  background: transparent;
  border-color: transparent;
  padding: 10px;
}
.skip {
  position: absolute;
  top: -100px;
  left: 20px;
  z-index: 100;
  background: var(--lime);
  color: var(--bg);
  padding: 15px;
}
.skip:focus {
  top: 10px;
}
[hidden] {
  display: none !important;
}
.arcade-shell {
  max-width: 1780px;
  margin: auto;
  padding: 0 36px;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 84px 1fr 90px 46px;
  gap: 0;
}
.arcade-header {
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
}
.brand span {
  color: var(--lime);
}
.brand small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-top: 7px;
  font-weight: 500;
}
.play-modes {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}
.play-modes button {
  border-color: transparent;
  background: none;
  color: var(--muted);
  font-size: 14px;
}
.play-modes button[aria-pressed="true"] {
  background: #2b3e47;
  color: var(--text);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  font-size: 14px;
}
main {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(440px, 1fr) auto;
  padding-top: 26px;
  gap: 22px;
}
.mission-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}
.mission-bar > div:first-child {
  max-width: 850px;
}
.mission-bar #brief {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
}
.run-stats {
  display: flex;
  gap: 32px;
  flex-shrink: 0;
}
.run-stats > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.run-stats span {
  font-size: 12px;
  color: var(--muted);
}
.run-stats strong {
  font-size: 30px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.run-stats small {
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
}
.play-stage {
  position: relative;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
}
.detective-stage {
  display: grid;
  grid-template-columns: 245px 1fr 340px;
}
.tool-panel,
.evidence-panel,
.decision-panel,
.journey-panel {
  padding: 24px;
  min-width: 0;
  min-height: 0;
}
.tool-panel {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: #132a35;
}
.tool-panel h2 {
  font-size: 21px;
  margin-bottom: 12px;
}
#tools {
  display: grid;
  gap: 10px;
}
#tools button {
  text-align: left;
  padding: 13px 12px;
  font-size: 14px;
  line-height: 1.35;
  background: #203b49;
  border-color: #4b626e;
}
#tools button[data-seen="true"] {
  border-color: #8caa6c;
  color: #d5f56b;
}
#tools button span {
  float: right;
  font-size: 12px;
}
.detective-art {
  width: 155px;
  height: 155px;
  object-fit: contain;
  margin: auto auto 0;
}
.evidence-panel {
  background: #1b303b;
  overflow: auto;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}
.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}
.panel-heading h2 {
  font-size: 22px;
}
#evidence {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.evidence-card {
  border: 1px solid #465a63;
  border-radius: 9px;
  padding: 18px;
  background: #213944;
  min-height: 160px;
}
.evidence-card h3 {
  font-size: 15px;
  letter-spacing: 0;
  margin-bottom: 12px;
  color: #f5bc8f;
}
.evidence-card pre {
  font:
    500 15px/1.5 "DM Sans",
    sans-serif;
  white-space: pre-wrap;
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}
.evidence-card p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.empty-note {
  color: #a8bdc7;
  max-width: 360px;
  line-height: 1.65;
  padding-top: 50px;
  grid-column: 1/-1;
}
.empty-note b {
  color: var(--text);
  display: block;
  font-size: 21px;
  margin-bottom: 10px;
}
.decision-panel {
  border-left: 1px solid var(--line);
  overflow: auto;
}
.decision-panel h2 {
  margin-bottom: 12px;
}
#decisions {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}
.option {
  text-align: left;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.5;
  padding: 14px 16px;
}
.option::before {
  content: attr(data-letter);
  display: inline-grid;
  place-items: center;
  border: 1px solid #6f8288;
  border-radius: 5px;
  width: 23px;
  height: 23px;
  margin-right: 9px;
  font-size: 12px;
  color: var(--accent);
}
.ready {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: #122c39;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 45px;
  overflow: auto;
}
.ready-copy {
  max-width: 540px;
}
.ready-copy h2 {
  font-size: clamp(36px, 3.6vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.05em;
  margin-bottom: 24px;
}
.ready-copy > p:not(.ready-note) {
  color: #c1d0d6;
  font-size: 17px;
  line-height: 1.6;
}
.ready-copy .primary {
  font-size: 18px;
  min-width: 180px;
  margin: 8px 0 20px;
}
.ready-copy .primary span {
  margin-left: 30px;
}
.ranked-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: #d5dfdf;
}
.ranked-label input {
  accent-color: var(--lime);
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
}
.ready-copy .ready-note {
  font-size: 13px !important;
  margin-top: 12px !important;
  color: var(--muted) !important;
}
.ready-art {
  width: clamp(230px, 27vw, 460px);
  max-height: 95%;
  object-fit: contain;
}
.message-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 70px;
}

.message-bar p {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  max-width: 1120px;
}
.run-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.run-actions button {
  font-size: 14px;
}
.level-strip {
  display: flex;
  gap: 30px;
  align-items: center;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.level-strip > div:first-child {
  min-width: 138px;
}

.level-strip small {
  color: var(--muted);
  font-size: 12px;
}
#levels {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  flex: 1;
}
#levels button {
  padding: 8px 4px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  background: #1c313b;
  border-color: #3c515a;
}
#levels button[aria-current="step"] {
  border-color: var(--lime);
  background: #2c4136;
}
#levels small {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--lime);
}
footer {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 11px;
  color: var(--muted);
}
footer a {
  color: var(--muted);
  text-decoration: none;
}
footer button {
  background: none;
  border: 0;
  font-size: 11px;
  padding: 0;
  font-weight: 400;
  color: var(--muted);
}
#connection {
  margin-left: auto;
}
.quest-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  background: #0a2532;
}
.quest-world {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: url("/play/assets/ocean-background.webp") center/cover;
}
#quest-canvas {
  min-height: 0;
  flex: 1;
  display: block;
  position: relative;
  overflow: hidden;
  outline-offset: -4px !important;
}
#quest-canvas canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.map-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 10px 12px;
  background: #0a2234dd;
  color: #bfd0d7;
  font-size: 12px;
}
.map-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  border: 2px solid var(--lime);
  border-radius: 50%;
  width: 10px;
  height: 10px;
}
.legend-traffic {
  width: 10px;
  height: 10px;
  background: var(--accent);
  transform: rotate(45deg);
}
.journey-panel {
  background: #172d38;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.journey-panel h2 {
  color: var(--lime);
  font-size: 32px;
  margin-bottom: 10px;
}
#delivery-help {
  font-size: 15px;
  color: #c3d1d8;
}
#routing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 12px;
}
#routing button {
  font-size: 13px;
  padding: 9px 5px;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 45px);
  grid-template-rows: 42px 42px;
  gap: 5px;
  justify-content: center;
  margin: 0 0 18px;
}
.dpad button {
  padding: 0;
  font-size: 22px;
}
.dpad [data-dir="up"] {
  grid-column: 2;
}
.dpad [data-dir="left"] {
  grid-column: 1;
  grid-row: 2;
}
.dpad [data-dir="down"] {
  grid-column: 2;
  grid-row: 2;
}
.dpad [data-dir="right"] {
  grid-column: 3;
  grid-row: 2;
}
.journey-heading {
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.journey-heading span {
  font-size: 12px;
  color: var(--muted);
}
#journey-log {
  margin: 10px 0 12px;
  padding: 0;
  list-style: none;
  overflow: auto;
  flex: 1;
  min-height: 75px;
}
#journey-log li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  padding: 8px 0;
  border-bottom: 1px solid #324852;
}
#journey-log li:last-child {
  color: var(--text);
}
#journey-log strong {
  color: var(--accent);
  display: block;
  margin-bottom: 3px;
}
.model-note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}
.quest-stage .ready-art {
  width: 320px;
}
body[data-game="quest"] {
  --accent: #bba9f4;
}
dialog {
  background: #172d38;
  color: var(--text);
  border: 1px solid #5d6e77;
  border-radius: 16px;
  padding: 36px;
  max-width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  width: 100%;
  box-shadow: 0 30px 100px #0008;
}
dialog::backdrop {
  background: #06121dd9;
  backdrop-filter: blur(5px);
}
dialog h2 {
  font-size: 32px;
  margin-bottom: 20px;
}
dialog p,
dialog li {
  font-size: 15px;
  line-height: 1.6;
}
dialog .close {
  position: absolute;
  right: 14px;
  top: 12px;
  font-size: 26px;
  background: none;
  border: 0;
  padding: 0 8px;
}
.help-steps {
  padding-left: 22px;
}
.help-steps li {
  padding: 0 0 15px 5px;
}
.name-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
}
.name-fields label {
  font-size: 13px;
  color: var(--muted);
}
select {
  display: block;
  background: #223c49;
  color: var(--text);
  border: 1px solid #62767e;
  border-radius: 6px;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
}
#name-preview {
  font-size: 24px;
  color: var(--lime);
}
.result-stars {
  color: var(--lime);
  font-size: 38px;
  letter-spacing: 6px;
  margin: 10px 0;
}
.lesson {
  padding: 20px;
  border: 1px solid #5a7157;
  background: #253c43;
  margin: 22px 0;
}
.lesson p {
  margin: 0;
}
.result-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
#score-status {
  font-size: 13px;
  color: var(--muted);
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid #3e515c;
}
th {
  color: var(--muted);
  font-size: 12px;
}
td:nth-child(3) {
  color: var(--lime);
}
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (min-width: 1160px) and (min-height: 850px) {
  .arcade-shell {
    height: 100dvh;
    grid-template-rows: 76px minmax(0, 1fr) 80px 38px;
  }
  main {
    grid-template-rows: 112px minmax(0, 1fr) 76px;
    padding-top: 22px;
    gap: 18px;
  }
  .mission-bar {
    align-items: flex-start;
  }
  .mission-bar #brief {
    font-size: 15px;
  }
  .detective-art {
    max-height: 140px;
  }
  .ready {
    padding: 36px;
  }
}
@media (min-width: 1600px) and (min-height: 1000px) {
  .arcade-shell {
    padding: 0 44px;
    grid-template-rows: 88px minmax(0, 1fr) 90px 42px;
  }
  main {
    grid-template-rows: 126px minmax(0, 1fr) 86px;
    padding-top: 30px;
    gap: 24px;
  }
  .detective-stage {
    grid-template-columns: 270px 1fr 360px;
  }
  .tool-panel,
  .evidence-panel,
  .decision-panel,
  .journey-panel {
    padding: 28px;
  }
  .evidence-card {
    padding: 22px;
    min-height: 195px;
  }
  .detective-art {
    max-height: 190px;
    width: 190px;
    height: 190px;
  }
}
@media (max-width: 1250px) {
  .arcade-shell {
    padding: 0 24px;
  }
  .arcade-header {
    gap: 14px;
  }
  .header-actions {
    font-size: 12px;
  }
  .header-actions .quiet {
    padding: 8px;
  }
  .play-modes {
    margin-left: 0;
  }
  .run-stats {
    gap: 18px;
  }
  .detective-stage {
    grid-template-columns: 220px 1fr 285px;
  }
  .tool-panel,
  .evidence-panel,
  .decision-panel,
  .journey-panel {
    padding: 18px;
  }
  #evidence {
    grid-template-columns: 1fr;
  }
  .evidence-card {
    min-height: 0;
  }
  .evidence-card pre {
    font-size: 14px;
  }
  .quest-stage {
    grid-template-columns: 1fr 310px;
  }
  .ready-art {
    width: 280px;
  }
  .ready {
    gap: 20px;
  }
  footer {
    gap: 12px;
  }
  #levels button {
    flex-direction: column;
    gap: 2px;
  }
  .brand {
    font-size: 21px;
  }
}
@media (max-width: 1000px) {
  .arcade-shell {
    grid-template-rows: auto 1fr auto auto;
    padding: 0 20px;
  }
  .arcade-header {
    flex-wrap: wrap;
    padding: 16px 0;
    gap: 15px;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  .play-modes {
    margin-left: auto;
  }
  .mission-bar {
    align-items: flex-start;
    gap: 25px;
  }
  .run-stats {
    gap: 15px;
  }
  .run-stats strong {
    font-size: 24px;
  }
  .run-stats span {
    font-size: 11px;
  }
  .detective-stage {
    grid-template-columns: 210px 1fr;
  }
  .decision-panel {
    grid-column: 1/-1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  #decisions {
    grid-template-columns: repeat(3, 1fr);
  }
  .detective-art {
    width: 130px;
    height: 130px;
  }
  .quest-stage {
    grid-template-columns: 1fr;
  }
  .quest-world {
    height: 570px;
  }
  .journey-panel {
    display: grid;
    grid-template-columns: 1fr 170px;
    gap: 0 22px;
  }
  .journey-panel h2,
  .journey-panel #delivery-help {
    grid-column: 1;
  }
  .dpad {
    grid-column: 2;
    grid-row: 1/5;
    align-self: center;
  }
  .journey-heading,
  #journey-log,
  .model-note {
    grid-column: 1/-1;
  }
  #journey-log {
    max-height: 150px;
  }
  .map-legend {
    gap: 15px;
  }
  .level-strip {
    padding: 18px 0;
    gap: 15px;
  }
  #levels {
    grid-template-columns: repeat(6, 1fr);
  }
  footer {
    flex-wrap: wrap;
    padding: 16px 0;
    gap: 12px;
  }
  #connection {
    margin: 0;
  }
  .ready {
    align-items: center;
    padding: 28px;
  }
  .ready-art {
    width: 230px;
  }
  .ready-copy h2 {
    font-size: 40px;
  }
  .message-bar {
    padding-bottom: 8px;
  }
  .mission-bar #brief {
    font-size: 14px;
  }
}
@media (max-width: 640px) {
  .arcade-shell {
    padding: 0 14px;
  }
  .arcade-header {
    gap: 10px;
  }
  .brand small {
    display: none;
  }
  .play-modes {
    width: 100%;
    margin: 0;
    order: 3;
  }
  .header-actions {
    order: 4;
    font-size: 12px;
    justify-content: space-between;
  }
  .arcade-header > [data-games-menu] {
    margin-left: auto;
  }
  .play-modes button {
    flex: 1;
  }
  .mission-bar {
    display: block;
  }
  .mission-bar h1 {
    font-size: 30px;
  }
  .run-stats {
    margin-top: 18px;
    justify-content: space-between;
  }
  .run-stats > div {
    gap: 4px;
  }
  .run-stats strong {
    font-size: 24px;
  }
  main {
    padding-top: 22px;
    gap: 20px;
    grid-template-rows: auto minmax(470px, 1fr) auto;
  }
  .detective-stage {
    display: flex;
    flex-direction: column;
  }
  .tool-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .tool-panel h2 {
    font-size: 20px;
  }
  .tool-panel > p.muted {
    margin-bottom: 10px;
  }
  #tools {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #tools button {
    min-height: 60px;
    font-size: 13px;
  }
  .detective-art {
    display: none;
  }
  .evidence-panel {
    min-height: 190px;
    overflow: visible;
  }
  #evidence {
    gap: 10px;
  }
  .empty-note {
    padding-top: 10px;
  }
  .decision-panel {
    overflow: visible;
  }
  #decisions {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 15px;
  }
  .option {
    font-size: 14px;
  }
  .ready {
    padding: 25px;
    flex-direction: column-reverse;
    gap: 0;
    justify-content: center;
  }
  .ready-art {
    width: 150px;
    max-height: 155px;
  }
  .ready-copy h2 {
    font-size: 32px;
    margin-bottom: 15px;
  }
  .ready-copy > p:not(.ready-note) {
    font-size: 15px;
  }
  .ready-copy .primary {
    font-size: 16px;
    margin: 0 0 18px;
  }
  .ranked-label {
    font-size: 12px;
  }

  .message-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
  .message-bar p {
    font-size: 14px;
  }
  .run-actions {
    align-self: flex-end;
  }
  .level-strip {
    align-items: flex-start;
    flex-direction: column;
  }
  #levels {
    width: 100%;
    gap: 6px;
  }
  #levels button {
    padding: 8px 0;
  }
  .level-strip > div:first-child {
    display: flex;
    align-items: center;
    gap: 15px;
  }

  .quest-world {
    height: 360px;
  }
  .map-legend {
    font-size: 10px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .map-legend span:last-child {
    display: none;
  }
  .journey-panel {
    grid-template-columns: 1fr 140px;
    gap: 0 12px;
  }
  .journey-panel h2 {
    font-size: 27px;
  }
  .journey-panel #delivery-help {
    font-size: 13px;
  }
  .quest-stage .ready-art {
    width: 140px;
  }
  #routing {
    grid-column: 1/-1;
    grid-template-columns: repeat(3, 1fr);
  }
  .dpad {
    grid-template-columns: repeat(3, 44px);
    grid-row: 1/4;
    gap: 4px;
  }
  .dpad button {
    font-size: 24px;
  }
  dialog {
    padding: 28px 22px;
  }
  dialog h2 {
    font-size: 28px;
  }
  .name-fields {
    gap: 12px;
  }
  footer {
    font-size: 11px;
  }
  .result-buttons button {
    font-size: 14px;
  }
  .quest-stage:has(.ready:not([hidden])) {
    min-height: 590px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

#routing button,
.dpad button,
#levels button {
  min-height: 44px;
}

.map-legend button {
  padding: 6px 10px;
  font-size: 12px;
  min-height: 34px;
  background: #233e4c;
}

@media (max-width: 640px) {
  .detective-stage:has(.ready:not([hidden])) {
    height: 590px;
    min-height: 590px;
  }
  .detective-stage:has(.ready:not([hidden])) > :not(.ready) {
    display: none;
  }
  .quest-stage:has(.ready:not([hidden])) .journey-panel {
    display: none;
  }
  .quest-stage:has(.ready:not([hidden])) .quest-world {
    height: 590px;
  }
  .ready {
    overflow: visible;
  }
}

/* Direct game presentation: headings lead, context follows. */
h1,
h2 {
  letter-spacing: -0.03em;
}
.mission-context {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
}
.mission-bar #brief {
  margin-top: 8px;
}
.level-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
.board-context {
  color: var(--muted);
  margin-top: -8px;
}
.lesson {
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
}
.lesson h3 {
  margin-bottom: 12px;
}
.ready-copy h2 {
  letter-spacing: -0.03em;
}
.message-bar {
  min-height: 52px;
}
body[data-game="quest"] {
  --accent: #d5f56b;
}
body[data-game="quest"] .arcade-shell {
  max-width: 1840px;
}
body[data-game="quest"] .quest-stage {
  grid-template-columns: minmax(0, 1fr) 315px;
  border: 0;
  border-radius: 10px;
}
body[data-game="quest"] .quest-world {
  position: relative;
  background: #102832;
}
body[data-game="quest"] .journey-panel {
  background: #142832;
  border-left: 0;
  padding: 24px;
}
body[data-game="quest"] .journey-panel h2 {
  font-size: 27px;
  color: var(--text);
}
body[data-game="quest"] #delivery-help {
  font-size: 14px;
  min-height: 63px;
  line-height: 1.5;
}
body[data-game="quest"] .mission-bar {
  align-items: center;
}
body[data-game="quest"] h1 {
  font-size: 32px;
}
body[data-game="quest"] .run-stats {
  gap: 34px;
}
body[data-game="quest"] .run-stats strong {
  font-size: 28px;
}
body[data-game="quest"] .ready {
  inset: 24px auto auto 24px;
  width: 440px;
  max-width: calc(100% - 48px);
  padding: 30px;
  border: 1px solid #4e6267;
  border-radius: 12px;
  background: #11252cf5;
  display: block;
  overflow: visible;
}
body[data-game="quest"] .ready-copy h2 {
  font-size: 49px;
  margin-bottom: 18px;
}
body[data-game="quest"] .ready-copy > p {
  font-size: 16px;
}
body[data-game="quest"] .ready-art {
  position: absolute;
  width: 110px;
  height: 120px;
  right: -30px;
  bottom: 20px;
  transform: rotate(8deg);
  pointer-events: none;
}
body[data-game="quest"] .ready-note {
  max-width: 260px;
  margin-bottom: 0;
}
.start-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: #cedcda;
  margin: 22px 0;
}
kbd {
  font:
    500 12px "DM Sans",
    sans-serif;
  border: 1px solid #6b7e83;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 3px 6px;
  color: #eff2e9;
  background: #29414a;
}
.start-controls kbd {
  min-width: 76px;
  display: inline-block;
  text-align: center;
  margin-right: 8px;
}
.movement-deck {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 8px 0 12px;
}
.movement-deck .dpad {
  margin: 0;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: 42px 42px;
  gap: 4px;
}
.movement-deck .dpad button {
  min-height: 42px;
  touch-action: none;
}
.dash-button {
  min-height: 88px;
  padding: 10px;
  flex: 1;
  min-width: 86px;
  color: #d5f56b;
  border-color: #83975c;
  background: #2c4135;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 16px;
}
.dash-button b {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.dash-button kbd {
  grid-column: 1/-1;
  font-size: 11px;
}
.combo-line {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
  min-height: 20px;
}
.combo-line.active {
  color: #f8dc88;
}
#routing {
  gap: 7px;
  margin: 0 0 14px;
}
#routing button {
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  font-size: 13px;
  min-height: 43px;
  padding: 8px;
}
#routing kbd {
  font-size: 11px;
  padding: 2px 5px;
}
body[data-game="quest"] .journey-heading {
  padding-top: 14px;
}
body[data-game="quest"] #journey-log {
  min-height: 50px;
}
body[data-game="quest"] .map-legend {
  background: #102832;
  justify-content: flex-start;
  gap: 20px;
  padding: 10px 20px;
}
body[data-game="quest"] .map-legend button:first-of-type {
  margin-left: auto;
}
.legend-spark {
  width: 7px;
  height: 7px;
  background: #f8dc88;
  border-radius: 50%;
}
.legend-battery {
  width: 9px;
  height: 13px;
  border: 2px solid #dff4fb;
  background: #8dc7e1;
}
.legend-glitch {
  width: 10px;
  height: 10px;
  background: #ed7f91;
  transform: rotate(45deg);
}
#pause-notice {
  position: absolute;
  inset: 0;
  background: #102832e8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  z-index: 4;
}
#pause-notice h2 {
  font-size: 36px;
}
body[data-game="quest"] #total-stars {
  font-size: 12px;
  font-weight: 500;
  color: var(--lime);
  display: block;
  margin-top: 4px;
}
@media (min-width: 1160px) and (min-height: 850px) {
  body[data-game="quest"] .arcade-shell {
    grid-template-rows: 76px minmax(0, 1fr) 78px 36px;
  }
  body[data-game="quest"] main {
    grid-template-rows: 100px minmax(0, 1fr) 55px;
    padding-top: 16px;
    gap: 14px;
  }
  body[data-game="detective"] main {
    grid-template-rows: 126px minmax(0, 1fr) 60px;
  }
}
@media (max-width: 1159px) {
  body[data-game="quest"] .quest-stage {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  body[data-game="quest"] .journey-panel {
    padding: 18px;
  }
  .movement-deck {
    gap: 10px;
  }
  .movement-deck .dpad {
    grid-template-columns: repeat(3, 40px);
  }
  body[data-game="quest"] .map-legend {
    font-size: 11px;
    gap: 10px;
  }
}
@media (max-width: 1000px) {
  body[data-game="quest"] .quest-stage {
    grid-template-columns: 1fr;
  }
  body[data-game="quest"] .quest-world {
    height: 500px;
  }
  body[data-game="quest"] .journey-panel {
    display: grid;
    grid-template-columns: 1fr 270px;
    gap: 0 20px;
  }
  body[data-game="quest"] .journey-panel h2,
  body[data-game="quest"] #delivery-help {
    grid-column: 1;
  }
  .movement-deck {
    grid-column: 2;
    grid-row: 1/4;
    margin: 0;
  }
  .combo-line {
    grid-column: 2;
  }
  #routing {
    grid-column: 1;
    grid-row: 3/5;
  }
  body[data-game="quest"] .journey-heading,
  body[data-game="quest"] #journey-log,
  body[data-game="quest"] .model-note {
    grid-column: 1/-1;
  }
  body[data-game="quest"] #journey-log {
    max-height: 120px;
  }
  body[data-game="quest"] .level-strip > div:first-child {
    min-width: 138px;
  }
}
@media (max-width: 640px) {
  .mission-context {
    font-size: 12px;
  }
  body[data-game="quest"] .quest-world {
    height: 315px;
  }
  body[data-game="quest"] .quest-stage:has(.ready:not([hidden])) .quest-world {
    height: 525px;
  }
  body[data-game="quest"] .quest-stage:has(.ready:not([hidden])) {
    min-height: 525px;
  }
  body[data-game="quest"] .ready {
    inset: 18px;
    max-width: none;
    width: auto;
    padding: 26px 22px;
  }
  body[data-game="quest"] .ready-copy h2 {
    font-size: 39px;
  }
  body[data-game="quest"] .ready-art {
    display: none;
  }
  body[data-game="quest"] .ready-note {
    max-width: none;
  }
  body[data-game="quest"] .journey-panel {
    grid-template-columns: 1fr;
    padding: 18px;
  }
  body[data-game="quest"] .journey-panel h2 {
    font-size: 25px;
  }
  body[data-game="quest"] #delivery-help {
    min-height: 0;
    font-size: 14px;
    margin-bottom: 12px;
  }
  .movement-deck {
    grid-row: auto;
    grid-column: 1;
    justify-content: space-between;
    margin: 4px 0 12px;
  }
  .movement-deck .dpad {
    grid-template-columns: repeat(3, 48px);
    grid-template-rows: 46px 46px;
    gap: 5px;
  }
  .movement-deck .dpad button {
    min-height: 46px;
  }
  .dash-button {
    max-width: 130px;
    min-height: 97px;
  }
  .combo-line {
    grid-column: 1;
    margin-bottom: 14px;
  }
  #routing {
    grid-column: 1;
    grid-row: auto;
    grid-template-columns: 1fr 1fr;
  }
  body[data-game="quest"] .map-legend {
    gap: 12px;
    padding: 8px;
    justify-content: center;
  }
  body[data-game="quest"] .map-legend span {
    display: flex;
    font-size: 10px;
  }
  body[data-game="quest"] .map-legend button:first-of-type {
    margin-left: 0;
  }
  body[data-game="quest"] .run-stats {
    gap: 24px;
  }
  body[data-game="quest"] #total-stars {
    display: inline;
    margin: 0 0 0 auto;
  }
  .level-label {
    margin: 0;
  }
}
#quest-canvas:focus-visible {
  outline: 2px solid #91ac83;
  outline-offset: -2px !important;
}
