:root {
  color-scheme: dark;
  --sky: #161638;
  --ink: #18142e;
  --paper: #fbf9f1;
  --mint: #9cf1cb;
  --lime: #ddff9c;
  --gold: #ffcf84;
  --violet: #6352d4;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 22% 0%, #37316a, transparent 64%), var(--sky);
  color: #fff;
  line-height: 1.55;
}
a { color: inherit; text-underline-offset: .2em; }
button, input { font: inherit; }
h1, h2, p { margin: 0; }
a:focus-visible, button:focus-visible, summary:focus-visible,
.courier-option:has(input:focus-visible) { outline: 3px solid #7970f2; outline-offset: 3px; }
.courier-console h2:focus { outline: none; }

.courier-top, .courier-shell {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}
.courier-top {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ffffff28;
  font-size: .87rem;
}
.courier-top .courier-brand {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 1.3rem;
  font-weight: 850;
  text-decoration: none;
}
.courier-intro { padding: 32px 0 24px; }
.courier-eyebrow { color: var(--mint); font-size: .68rem; font-weight: 850; letter-spacing: .12em; }
.courier-intro h1 { font-size: clamp(2rem, 4.8vw, 4.15rem); letter-spacing: -.055em; line-height: 1; margin: 6px 0 11px; }
.courier-intro > p:last-child { color: #dedcf0; max-width: 52ch; }
.courier-game { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); border: 1px solid #ffffff2e; border-radius: 26px; overflow: hidden; }
.courier-world { background: #22234b; padding: 22px; min-width: 0; }
.courier-map-top, .courier-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.courier-map-top h2 { font-size: clamp(1.15rem, 2.5vw, 1.65rem); line-height: 1.2; }
.courier-pill { flex-shrink: 0; border-radius: 100px; background: #11142d; color: var(--mint); padding: 4px 10px; font-size: .75rem; font-weight: 730; }
.courier-board {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  min-height: 196px;
  margin-top: 14px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid #ffffff29;
  background: repeating-linear-gradient(0deg, #333759 0 1px, transparent 1px 18px),
    repeating-linear-gradient(90deg, #333759 0 1px, #272b49 1px 18px);
}
.courier-endpoint {
  grid-row: 1 / -1;
  align-self: center;
  display: grid;
  justify-items: center;
  gap: 5px;
  color: #e0e0f7;
  font-size: .59rem;
  letter-spacing: .05em;
}
.courier-endpoint span { display: block; width: 30px; height: 34px; border: 2px solid #646d98; border-radius: 5px 5px 2px 2px; background: #171b36; box-shadow: inset 4px 0 #303451; }
.courier-class { grid-column: 3; }
.courier-class span { background: #5f477d; border-color: #c3aad6; }
.courier-board[data-delivered] .courier-class span { background: #3a8267; border-color: var(--lime); box-shadow: 0 0 12px #afff9c75; }
.courier-lane { grid-column: 2; min-width: 0; display: grid; align-content: center; gap: 4px; text-align: center; }
.courier-lane-short { grid-row: 1; }
.courier-lane-clear { grid-row: 2; }
.courier-lane p { font-size: .76rem; line-height: 1.25; color: #f2efff; }
.courier-lane p strong { color: var(--gold); white-space: nowrap; }
.courier-lane small { font-size: .64rem; line-height: 1.2; color: #d7d5e5; }
.courier-floor {
  position: relative;
  height: 26px;
  border-radius: 7px;
  border: 1px solid #7783a2;
  background: repeating-linear-gradient(90deg, #65708c 0 11px, transparent 11px 17px)
    center / 100% 1px no-repeat, #283751;
}
.courier-lane-short .courier-floor { border-color: #a0868d; background-color: #473c55; }
.courier-board[data-route="short"] .courier-lane-short .courier-floor { outline: 2px solid var(--gold); }
.courier-board[data-route="clear"] .courier-lane-clear .courier-floor { outline: 2px solid var(--mint); }
.courier-crowd { position: absolute; inset: 0; left: 51%; display: flex; align-items: center; gap: 4px; }
.courier-crowd i { width: 9px; height: 11px; border-radius: 5px 5px 3px 3px; background: var(--gold); box-shadow: 0 2px #0004; }
.courier-crowd i:nth-child(2) { background: #f5a5bb; translate: 0 -3px; }
.courier-crowd i:nth-child(3) { background: #bec8ff; translate: 0 3px; }
.courier-cart {
  position: absolute;
  z-index: 2;
  left: 27px;
  top: 50%;
  translate: -50% -50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 23px;
  height: 18px;
  border: 2px solid #151935;
  border-radius: 7px;
  background: var(--mint);
  box-shadow: 0 3px #10142d;
}
.courier-cart i { width: 3px; height: 5px; border-radius: 4px; background: #182944; }
.courier-board[data-route="short"] { --cart-lane: 27%; }
.courier-board[data-route="clear"] { --cart-lane: 73%; }
.courier-board[data-phase="stop"] { --cart-x: 53%; --cart-y: var(--cart-lane); }
.courier-board[data-phase="deliver"] { --cart-x: calc(100% - 30px); --cart-y: 50%; }
.courier-board[data-route] .courier-cart { animation: courier-drive 1s ease-in-out both; }
@keyframes courier-drive {
  0% { left: 27px; top: 50%; }
  19% { left: 27px; top: var(--cart-lane); }
  85% { left: var(--cart-x); top: var(--cart-lane); }
  100% { left: var(--cart-x); top: var(--cart-y); }
}
.courier-observation { font-size: .85rem; color: #eee9ff; }
.courier-observation:not(:empty) { margin-top: 12px; }
.courier-log { margin-top: 14px; border-radius: 12px; background: #161731; padding: 3px 12px; font-size: .79rem; }
.courier-log details + details { border-top: 1px solid #ffffff2a; }
.courier-log summary { padding-block: 8px; cursor: pointer; font-weight: 750; color: var(--mint); }
.courier-rule-caption { margin-bottom: 4px; color: #d4d1ec; }
.courier-log dl { margin: 0 0 7px; }
.courier-log dl div { display: flex; justify-content: space-between; gap: 10px; }
.courier-log dd { margin: 0; color: var(--gold); font-weight: 750; flex-shrink: 0; }

.courier-console { padding: 22px 24px; background: var(--paper); color: var(--ink); min-width: 0; }
.courier-steps { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0 0 14px; padding: 0; }
.courier-steps li { border-radius: 30px; background: #eeebf4; color: #554c66; padding: 4px 7px; font-size: .66rem; line-height: 1.2; font-weight: 700; }
.courier-steps .is-past { background: #ddf4eb; color: #225b4a; }
.courier-steps [aria-current] { background: #ddd5ff; color: #33237b; }
.courier-console h2 { font-size: clamp(1.3rem, 2.9vw, 2rem); letter-spacing: -.04em; line-height: 1.1; margin-bottom: 7px; }
.courier-console > p { font-size: .9rem; color: #514862; }
.courier-evidence { list-style: none; padding: 0; margin: 10px 0 0; border-radius: 10px; background: #ece9f3; color: #362e4b; font-size: .78rem; }
.courier-evidence li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 10px; padding: 4px 10px; }
.courier-evidence li + li { border-top: 1px solid #d8d0e4; }
.courier-console fieldset { min-width: 0; border: 0; padding: 0; margin: 12px 0 0; }
.courier-console legend { font-size: .8rem; font-weight: 800; margin-bottom: 6px; padding: 0; }
.courier-options { display: grid; gap: 6px; }
.courier-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  min-height: 46px;
  border: 1px solid #d7d0e6;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.courier-option:has(input:checked) { border-color: var(--violet); background: #eeeaff; }
.courier-option input { color-scheme: light; accent-color: #5644b7; margin: 0; flex: 0 0 auto; }
.courier-option strong, .courier-option small { display: block; line-height: 1.35; }
.courier-option strong { font-size: .9rem; }
.courier-option small { color: #584e6a; font-size: .75rem; margin-top: 2px; }
.courier-primary, .courier-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid transparent;
  font-size: .85rem;
  font-weight: 820;
  text-decoration: none;
  cursor: pointer;
}
.courier-primary { background: #4834ad; color: #fff; }
.courier-primary:disabled { background: #e5def2; color: #67597f; cursor: default; }
.courier-secondary { background: none; color: #432a8a; text-decoration: underline; }
.courier-console .courier-response:not(:empty) { margin-top: 8px; font-weight: 700; color: #753c26; }
.courier-footer { padding: 14px 0 22px; color: #dad8ed; font-size: .73rem; }

@media (max-width: 780px) {
  .courier-top, .courier-shell { width: min(600px, calc(100% - 20px)); }
  .courier-top { min-height: 52px; }
  .courier-intro { padding: 12px 4px; }
  .courier-intro h1 { margin-bottom: 5px; }
  .courier-intro > p:last-child { font-size: .84rem; }
  .courier-game { grid-template-columns: minmax(0, 1fr); border-radius: 16px; }
  .courier-world, .courier-console { padding: 12px; }
  .courier-board { min-height: 128px; margin-top: 7px; padding: 4px; grid-template-columns: 32px minmax(0, 1fr) 32px; }
  .courier-floor { height: 17px; }
  .courier-endpoint span { width: 23px; height: 26px; }
  .courier-steps { margin-bottom: 8px; }
  .courier-console fieldset { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .courier-board[data-route] .courier-cart { animation-duration: .01ms; }
}
