* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  color-scheme: dark;
  --ink: #112c34;
  --night: #152e3a;
  --ivory: #fff4cc;
  --gold: #ffd578;
  --mint: #9bf2d5;
  --paper: #fff4d4;
  --edge: clamp(12px, 2.7vmin, 28px);
  font:
    16px/1.35 "Trebuchet MS",
    Verdana,
    sans-serif;
}
html,
body,
#field {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}
body {
  background: #17303d;
  color: var(--ivory);
}
#field {
  position: relative;
  isolation: isolate;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#field
  :where(input, textarea, [contenteditable]:not([contenteditable="false"])) {
  -webkit-user-select: text;
  user-select: text;
}
#world,
#world canvas,
#cover,
#marks,
#hud,
#sheet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#world canvas {
  display: block;
  touch-action: none;
}
#cover {
  background: #2c4350 url("./platform.webp") center center/cover no-repeat;
  pointer-events: none;
}
#cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #10232cf0 0%,
    #152f36c2 27%,
    transparent 70%
  );
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(100%);
}
button {
  font: inherit;
  font-weight: 700;
  color: var(--ivory);
  cursor: pointer;
  background: #1e4248;
  border: 1px solid #62817e;
  min-height: 44px;
  padding: 0.58em 0.95em;
  border-radius: 5px;
  touch-action: manipulation;
}
button:hover {
  background: #31595c;
}
button:focus-visible {
  outline: 3px solid #f09158;
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.primary {
  color: #152b30;
  background: var(--gold);
  border: 1px solid #ffe7a7;
  font-size: 1.06rem;
}
.primary:hover {
  background: #ffe4a1;
}
.primary span {
  margin-left: 1.6em;
}
#sheet {
  z-index: 5;
  display: flex;
  align-items: center;
  padding: max(var(--edge), env(safe-area-inset-top))
    max(6vw, env(safe-area-inset-left));
  background: #142b346b;
  overflow: auto;
  touch-action: pan-y;
}
.placard {
  width: min(100%, 445px);
  background: #132d35f5;
  border: 1px solid #93b5a0;
  border-top: 4px solid var(--gold);
  border-bottom: 4px solid #9bb8a7;
  padding: clamp(16px, 3.4vmin, 32px);
  box-shadow: 5px 6px 0 #081e2780;
}
.line,
.route-id,
#eyebrow,
#detail,
#keys,
#record {
  font:
    700 0.68rem/1.4 "Courier New",
    monospace;
  letter-spacing: 0.07em;
}
.line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #6b8b80;
  padding-bottom: 7px;
  color: #c1d7c5;
}
.line span:last-child {
  color: var(--gold);
}
#eyebrow {
  margin: 1.7em 0 0.3em;
  color: var(--mint);
  letter-spacing: 0.14em;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font:
    italic 800 clamp(2.6rem, 8vmin, 5.6rem) / 0.96 Georgia,
    serif;
  letter-spacing: -0.065em;
  color: var(--paper);
}
h2 {
  text-transform: uppercase;
  font-size: 0.87rem;
  letter-spacing: 0.24em;
  margin: 0.6rem 0 1.1rem;
  color: var(--gold);
}
#story {
  max-width: 35ch;
  font-size: clamp(0.94rem, 2.5vmin, 1.1rem);
  line-height: 1.48;
}
#guide-copy {
  font-size: 0.82rem;
  color: #cee0d7;
  margin-top: 0.75rem;
  line-height: 1.45;
}
#actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1.2em 0 0.7em;
}
#actions .option {
  min-width: 46%;
  flex: 1 1 45%;
  text-align: left;
  color: var(--gold);
}
.option small {
  display: block;
  color: var(--ivory);
  font:
    normal 0.76rem/1.36 "Trebuchet MS",
    sans-serif;
  margin-top: 3px;
}
.prefs {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px dashed #779487;
}
.prefs button {
  padding: 0.2em 0;
  background: none;
  border: 0;
  font-size: 0.8em;
  color: #d9eadf;
  text-decoration: underline;
  text-underline-offset: 4px;
}
#record {
  color: var(--mint);
  margin-left: auto;
  letter-spacing: 0;
}
.ticket,
#pause,
.task,
#keys {
  position: absolute;
  background: #102b34e8;
  box-shadow: 0 2px 0 #10263266;
  color: var(--ivory);
}
#hud {
  pointer-events: none;
  z-index: 3;
}
#hud button,
#stick {
  pointer-events: auto;
}
.ticket {
  top: max(var(--edge), env(safe-area-inset-top));
  left: max(var(--edge), env(safe-area-inset-left));
  border: 1px solid #83ab9c;
  border-radius: 3px;
  display: grid;
  gap: 1px;
  padding: 5px 11px;
  font-size: 0.81rem;
}
.ticket b {
  letter-spacing: 0.035em;
}
#hearts {
  font: 1rem/1.05 Georgia;
  color: #ffa981;
  letter-spacing: 2px;
}
#pause {
  top: max(var(--edge), env(safe-area-inset-top));
  right: max(var(--edge), env(safe-area-inset-right));
  border-color: #93af9e;
  padding: 0.3em 0.7em;
}
.task {
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + 26px);
  width: max-content;
  max-width: 89vw;
  text-align: center;
  border: 1px solid #9db9a7;
  border-radius: 4px;
  padding: 6px 16px;
  display: grid;
  gap: 1px;
}
.route-id {
  font-size: 0.58rem;
  letter-spacing: 0.19em;
  color: var(--mint);
}
#goal {
  font-size: clamp(0.93rem, 2.1vmin, 1.12rem);
}
#detail {
  font-size: 0.76rem;
  color: #f4dfac;
  letter-spacing: 0;
}
.timing #goal {
  color: #ffdb7b;
}
.timing .task {
  border-color: #ffcf69;
}
#keys {
  bottom: max(5px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  white-space: nowrap;
  border-radius: 3px;
  padding: 3px 7px;
  letter-spacing: 0;
}
#marks {
  pointer-events: none;
  z-index: 2;
}
.marker {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.marker#beacon {
  background: #102c35;
  color: #ffe09a;
  border: 1px solid #e8ba64;
  font:
    700 10px/1.2 "Courier New",
    monospace;
  padding: 3px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.marker#keeper {
  width: 10px;
  height: 9px;
  background: var(--mint);
  border: 1px solid #183331;
  transform-origin: center;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}
#touch {
  display: none;
}
.verbs {
  display: flex;
  align-items: end;
  gap: 15px;
}
.verbs button {
  font-size: 0.87rem;
  min-width: 58px;
  min-height: 54px;
  touch-action: none;
  border: 2px solid #fff0ba;
  background: #173f44de;
  border-radius: 40%;
}
.verbs #dash {
  background: #ecd18f;
  color: #18343b;
  min-height: 65px;
}
.verbs button.down {
  background: #99f0c1;
  color: #152e38;
}
#stick {
  width: 91px;
  height: 91px;
  border: 2px solid #d6ecd1a6;
  border-radius: 100%;
  background: #16364099;
  display: grid;
  place-items: center;
  touch-action: none;
}
#stick i {
  width: 39%;
  height: 39%;
  border-radius: 100%;
  border: 2px solid #fff3bf;
  background: #8ec1ab9e;
  pointer-events: none;
}
#field.touch #keys {
  display: none;
}
#field.touch #touch {
  display: flex;
  pointer-events: none;
  position: absolute;
  bottom: max(var(--edge), env(safe-area-inset-bottom));
  left: max(var(--edge), env(safe-area-inset-left));
  right: max(var(--edge), env(safe-area-inset-right));
  justify-content: space-between;
  align-items: end;
}
#field.touch .task {
  bottom: auto;
  top: max(var(--edge), env(safe-area-inset-top));
  max-width: calc(100% - 190px);
}
#field.touch #pause span {
  display: none;
}
#field.touch #pause {
  min-width: 44px;
}
@media (max-width: 620px) and (orientation: portrait) {
  #sheet {
    align-items: flex-end;
    padding: max(var(--edge), env(safe-area-inset-bottom)) var(--edge);
  }
  #field.touch .task {
    top: calc(max(var(--edge), env(safe-area-inset-top)) + 58px);
    max-width: 90vw;
  }
  .placard {
    padding: 18px;
  }
  .task {
    padding: 5px 12px;
  }
}
@media (max-height: 490px) {
  #sheet {
    align-items: flex-start;
    padding: 7px max(var(--edge), env(safe-area-inset-left));
  }
  .placard {
    width: min(64%, 510px);
    margin: auto 0;
    padding: 10px 17px;
  }
  .line {
    padding-bottom: 2px;
  }
  #eyebrow {
    margin: 0.6em 0 0.15em;
  }
  h1 {
    font-size: 2.5rem;
  }
  h2 {
    margin: 0.2em 0 0.4em;
    font-size: 0.73rem;
  }
  #story {
    font-size: 0.9rem;
    line-height: 1.3;
    max-width: 47ch;
  }
  #guide-copy {
    font-size: 0.76rem;
    margin-top: 0.35rem;
  }
  #actions {
    margin: 0.5em 0 0.15em;
  }
  .prefs button {
    min-height: 42px;
  }
  .ticket {
    font-size: 0.74rem;
  }
  #stick {
    width: 76px;
    height: 76px;
  }
  .task {
    padding: 3px 9px;
  }
  .route-id {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
#setup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin-top: 0.55em;
}
#setup label,
#setup small {
  font-size: 0.76rem;
}
#setup select {
  min-height: 44px;
  background: var(--night);
  border: 1px solid #83ab9c;
  border-radius: 4px;
  color: var(--ivory);
  font: inherit;
  padding-inline: 0.55em;
}
#setup small {
  color: var(--mint);
}
.offers:not([hidden]) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.offers button {
  min-height: 44px;
  min-width: 0 !important;
}
.offers button small {
  font-size: 0.72rem;
}
#sheet {
  overscroll-behavior: contain;
}
/* Keep the exit in reach even when the fare catalogue is taller than the phone. */
#checkout:not([hidden]) {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.55rem 0.25rem max(0.55rem, env(safe-area-inset-bottom));
  border-top: 1px solid #83ab9c;
  background: var(--ink);
}
#shop-status {
  font-size: 0.82rem;
}
#leave-shop {
  flex: none;
}
#depot {
  margin-top: 0.55rem;
}
#depot-note,
#rooms {
  font-size: 0.85rem;
  color: var(--ivory);
}
#rooms {
  display: grid;
  gap: 5px;
  margin: 0.4em 0;
}
#rooms button {
  text-align: left;
}
.depot-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#crew-state {
  color: var(--mint);
}
#setup {
  display: grid;
  grid-template-columns: auto 1fr;
}
#setup small {
  grid-column: 1/-1;
}
#setup select {
  max-width: 100%;
}
@media (max-height: 550px) {
  .placard {
    flex-shrink: 0;
  }
  #sheet {
    align-items: safe center;
  }
  #setup small {
    font-size: 0.71rem;
  }
}
#itinerary {
  grid-column: 1/-1;
  list-style: none;
  display: flex;
  margin: 0 0 0.2em;
  padding: 0;
  gap: 0.25em;
  align-items: center;
  flex-wrap: wrap;
  font:
    700 0.65rem/1.3 "Courier New",
    monospace;
  color: #b7c8be;
}
#itinerary li:not(:last-child)::after {
  content: " →";
  color: #8fa59f;
}
#itinerary li[aria-current="step"] {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}
