@font-face {
  font-family: Instrument Serif;
  src: url("./assets/instrument-serif.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: Instrument Serif;
  src: url("./assets/instrument-serif-italic.woff2") format("woff2");
  font-style: italic;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #111c17;
  --ivory: #f5edda;
  --muted: #d4ceba;
  --gold: #eed39a;
  --line: #e1d6b241;
  font-family: Arial, sans-serif;
  background: #101b16;
  color: var(--ivory);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #fff1b6;
  outline-offset: 5px;
}
.title-screen {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  background: #142b23 url("./assets/amazon-river.jpg") 61% center/cover
    no-repeat;
}
.title-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(
      90deg,
      #091410ed 0%,
      #0a1710a8 27%,
      #09150e2c 59%,
      transparent 82%
    ),
    linear-gradient(
      0deg,
      #08120edb,
      transparent 24%,
      transparent 79%,
      #08120e9c
    );
}
.title-header,
.title-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-inline: clamp(22px, 5vw, 84px);
}
.title-header {
  padding: 27px 0;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: var(--ivory);
  font-size: 0.64rem;
  line-height: 1.42;
  font-weight: 700;
  letter-spacing: 0.19em;
}
.compass-icon {
  display: grid;
  place-items: center;
  border: 1px solid #e8d7aa9e;
  border-radius: 50%;
  width: 39px;
  height: 39px;
  color: var(--gold);
  font-size: 1.72rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}
nav,
.hud-actions {
  display: flex;
  gap: clamp(11px, 2.5vw, 36px);
  align-items: center;
}
.text-button,
.sound-button,
.secondary,
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  border: 1px solid transparent;
  background: none;
  padding: 0 12px;
  white-space: nowrap;
}
.text-button {
  padding-inline: 2px;
  color: var(--ivory);
  font-size: 0.82rem;
}
.text-button:hover {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 5px;
}
.sound-button,
.secondary {
  border-color: var(--line);
  background: #101c16a8;
  font-size: 0.77rem;
  font-weight: 600;
}
.sound-button:hover,
.secondary:hover {
  border-color: var(--gold);
  background: #27372b;
}
.title-content {
  align-self: center;
  margin: 64px clamp(24px, 8.3vw, 140px) 72px;
  width: min(650px, calc(100% - 48px));
}
.eyebrow,
.title-footer,
.waypoint {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.21em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 11px;
}
.rule {
  width: 30px;
  height: 1px;
  background: #e9ce91;
  display: inline-block;
}
.divider {
  opacity: 0.5;
  padding-inline: 0.2em;
}
h1,
h2 {
  font-family:
    Instrument Serif,
    Georgia,
    serif;
  font-weight: 400;
  margin: 0;
}
h1 {
  font-size: clamp(7rem, 12.1vw, 12.4rem);
  line-height: 0.78;
  letter-spacing: -0.055em;
  margin: 28px 0 0;
}
h1 span {
  display: block;
  margin-top: 19px;
  font-size: 0.37em;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: #ebd7ae;
}
.title-content > p {
  max-width: 355px;
  margin: 26px 0 29px;
  color: #f3efdb;
  font-size: 1rem;
  line-height: 1.65;
  text-wrap: pretty;
}
.title-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 11px;
}
.primary {
  background: #efd69d;
  color: #1b2318;
  border: 1px solid #f7e2b5;
  min-height: 51px;
  min-width: 190px;
  padding: 0 17px;
  font-size: 0.78rem;
  font-weight: 700;
  justify-content: space-between;
  transition: background 0.2s;
}
.primary:hover {
  background: #fff0c4;
}
.primary span {
  font-size: 1.15rem;
}
.title-actions .secondary {
  min-height: 51px;
}
#title-status {
  margin-top: 12px;
  max-width: 420px;
  color: #ffdbac;
  font-size: 0.8rem;
}
#title-status:empty {
  display: none;
}
.title-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: #f4ead2;
  font-size: 0.57rem;
  line-height: 1.45;
}
.location {
  display: flex;
  align-items: center;
  gap: 9px;
}
.location > span:first-child {
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 1;
}
.play-screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #223b32;
}
#world {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.vignette,
.danger,
.flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.vignette {
  background:
    linear-gradient(
      180deg,
      #08141066 0%,
      transparent 22%,
      transparent 72%,
      #07140dbc
    ),
    radial-gradient(ellipse at center, transparent 54%, #09140f4c);
}
.danger {
  box-shadow: inset 0 0 10vw #7a2116;
  opacity: 0;
}
.flash {
  background: #fff1d0;
  opacity: 0;
}
.hud-header,
.hud-footer {
  position: absolute;
  left: clamp(14px, 3vw, 42px);
  right: clamp(14px, 3vw, 42px);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.hud-header {
  top: max(20px, env(safe-area-inset-top));
}
.hud-footer {
  bottom: max(18px, env(safe-area-inset-bottom));
  align-items: flex-end;
}
.mission-card {
  background: #0c1915e6;
  border: 1px solid var(--line);
  padding: 18px 20px 15px;
  max-width: 370px;
  border-left: 2px solid #e2c384;
}
.mission-card h2 {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1.03;
  margin-top: 9px;
}
.mission-card p {
  font-size: 0.78rem;
  line-height: 1.45;
  margin: 7px 0;
  color: #e1dfca;
}
.route-progress {
  height: 2px;
  margin-top: 13px;
  background: #b6c2ad31;
}
.route-progress span,
.meter span {
  height: 100%;
  display: block;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--gold);
}
.hud-actions {
  gap: 7px;
}
.waypoint {
  position: absolute;
  top: 22%;
  left: 50%;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #101b15e6;
  white-space: nowrap;
}
#waypoint-arrow {
  display: block;
  font-size: 1rem;
}
.notice {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  bottom: 22%;
  width: max-content;
  max-width: 85%;
  text-align: center;
  padding: 10px 14px;
  background: #111d17e6;
  border: 1px solid var(--line);
  font-size: 0.84rem;
  line-height: 1.4;
  pointer-events: none;
}
.notice:empty {
  display: none;
}
.condition {
  display: grid;
  gap: 8px;
  padding: 11px 13px;
  background: #0b1813e6;
  border: 1px solid var(--line);
}
.stat {
  display: grid;
  grid-template-columns: 64px minmax(64px, 10vw) 25px;
  gap: 7px;
  align-items: center;
  color: #eee6d4;
  font-size: 0.71rem;
}
.stat output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.meter {
  height: 4px;
  background: #fff2cf30;
}
.energy .meter span {
  background: #8ecfc1;
}
.key-guide {
  color: #f1eedf;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: end;
  text-shadow: 0 1px 4px #000;
}
.key-guide span {
  margin-right: 5px;
}
kbd {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  padding: 2px 4px;
  place-items: center;
  border: 1px solid #e5e1c972;
  background: #101b16d9;
  border-radius: 3px;
  color: #faf1d8;
  font: inherit;
}
.touch-controls {
  display: none;
  position: absolute;
  bottom: 88px;
  left: 18px;
  right: 18px;
  align-items: end;
  gap: 5px;
  pointer-events: none;
}
.touch-controls div {
  display: grid;
  gap: 5px;
}
.touch-controls button {
  width: 48px;
  height: 44px;
  border: 1px solid #e7d7ac90;
  background: #10251ed9;
  font-size: 1.18rem;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
.touch-controls button:active {
  background: #5b6447;
}
.touch-controls .boost {
  margin-left: auto;
  width: 67px;
  font-size: 0.78rem;
}
dialog {
  width: min(490px, calc(100% - 30px));
  max-height: calc(100svh - 28px);
  padding: 0;
  border: 1px solid #e9d3a078;
  color: var(--ivory);
  background: #112019;
  box-shadow: 0 18px 100px #050f0ac9;
}
dialog::backdrop {
  background: #07100dc9;
}
.dialog-inner {
  padding: clamp(23px, 5vw, 42px);
}
dialog h2 {
  font-size: clamp(2.45rem, 6vw, 3.65rem);
  line-height: 0.98;
  margin: 13px 0 16px;
}
dialog p {
  font-size: 0.91rem;
  color: #dfddc7;
  line-height: 1.57;
}
.dialog-actions {
  margin-top: 25px;
}
.dialog-actions .primary {
  justify-content: center;
  min-width: 130px;
}
.dialog-actions .secondary {
  min-height: 51px;
}
.controls-list {
  margin: 0;
}
.controls-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 0.83rem;
}
.controls-list dd {
  margin: 0;
  text-align: right;
}
.journal-entry {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
}
.journal-entry strong {
  display: block;
  margin-top: 8px;
  font-weight: 600;
}
.journal-entry p {
  margin-bottom: 0;
}
@media (pointer: coarse) {
  .touch-controls {
    display: flex;
  }
  .key-guide {
    display: none;
  }
}
@media (max-width: 640px) {
  .title-header {
    padding: 17px 0;
    gap: 8px;
  }
  .brand {
    gap: 7px;
    font-size: 0.5rem;
    letter-spacing: 0.14em;
  }
  .compass-icon {
    width: 29px;
    height: 29px;
    font-size: 1.25rem;
  }
  nav {
    gap: 9px;
  }
  .text-button,
  .sound-button {
    font-size: 0.69rem;
  }
  .sound-button {
    padding-inline: 7px;
  }
  .title-screen {
    background-position: 64% center;
  }
  .title-screen::before {
    background:
      linear-gradient(90deg, #091410e6, #0914107a 65%, #0914103a),
      linear-gradient(0deg, #08120edb, transparent 36%);
  }
  .title-content {
    margin: 55px 24px 45px;
  }
  h1 {
    font-size: clamp(5.9rem, 19vw, 8rem);
  }
  h1 span {
    margin-top: 15px;
  }
  .title-footer {
    padding: 14px 0;
    font-size: 0.51rem;
    letter-spacing: 0.14em;
  }
  .title-footer > div:last-child {
    text-align: right;
  }
  .mission-card {
    padding: 11px 10px;
  }
  .mission-card .eyebrow {
    font-size: 0.54rem;
    gap: 5px;
  }
  .mission-card p {
    font-size: 0.69rem;
  }
  .hud-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .hud-actions button {
    min-height: 34px;
    padding-inline: 8px;
  }
  .waypoint {
    top: 28%;
  }
  .notice {
    bottom: 29%;
  }
}
@media (max-width: 370px) {
  .brand span:last-child {
    display: none;
  }
}
@media (max-height: 510px) and (pointer: coarse) {
  .hud-header {
    top: 9px;
  }
  .hud-footer {
    bottom: 8px;
  }
  .condition {
    padding: 7px;
  }
  .touch-controls {
    bottom: 58px;
  }
  .touch-controls button {
    height: 34px;
  }
  .waypoint {
    top: 10%;
    left: 62%;
  }
}

#world:focus { outline: none; }

.step-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 11px;
  font-size: 0.64rem;
  color: #deca9c;
  font-variant-numeric: tabular-nums;
}

.step-status .route-progress {
  flex: 1;
  margin: 0;
}

.trail-map {
  position: absolute;
  top: 76px;
  right: clamp(14px, 3vw, 42px);
  z-index: 2;
  width: min(280px, calc(100% - 30px));
  padding: 9px;
  border: 1px solid var(--line);
  background: #0d1915f2;
}

.trail-map canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #435347;
}

.map-caption, .map-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  padding: 4px 0 9px;
  color: #eedbb1;
  font-size: 0.7rem;
}

.map-legend {
  padding: 8px 0 1px;
  font-size: 0.64rem;
}

.interaction, .balance {
  position: absolute;
  left: 50%;
  bottom: max(106px, calc(env(safe-area-inset-bottom) + 78px));
  z-index: 1;
  translate: -50% 0;
  background: #101f18f0;
  border: 1px solid #f0d69a89;
  min-width: 190px;
  max-width: calc(100% - 30px);
  color: var(--ivory);
  font-size: 0.8rem;
}

.interaction button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 0;
  background: none;
  text-align: left;
  touch-action: none;
  user-select: none;
}

.interaction button:active, .interaction button:hover {
  background: #405041;
}

.action-progress, .balance-track {
  margin: 0 10px 8px;
  height: 3px;
  background: #fbecbd35;
}

.action-progress > span {
  display: block;
  height: 100%;
  transform-origin: left;
  background: var(--gold);
}

.balance {
  padding: 9px;
  min-width: 205px;
}

.balance > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.balance > div:first-child > span { color: var(--gold); }

.balance-track {
  position: relative;
  height: 9px;
  margin: 0;
  background: linear-gradient(90deg, #9b5138, #58745a 42%, #58745a 58%, #9b5138);
}

.balance-track span {
  position: absolute;
  left: 50%;
  top: -2px;
  translate: -50% 0;
  width: 5px;
  height: 13px;
  background: #ffefbc;
}

.wet .meter span { background: #80b0c1; }

.kit {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 230px;
  font-size: 0.68rem;
  color: #d9d6b7;
}

#injury { color: #ffb194; }

.kit button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  color: #fff0ca;
  border: 1px solid var(--line);
  background: #354331;
  touch-action: none;
}

.play-screen .notice { bottom: 32%; }

.title-actions .primary:first-child:not(:only-child) { min-width: 173px; }

@media (max-width: 640px) {
  .trail-map { top: 105px; width: min(235px, calc(100% - 28px)); }
  .kit { max-width: 180px; }
}

@media (pointer: coarse) {
  .interaction, .balance { bottom: max(205px, calc(env(safe-area-inset-bottom) + 175px)); }
  .play-screen .notice { bottom: 46%; }
  .touch-controls { bottom: max(134px, calc(env(safe-area-inset-bottom) + 116px)); }
  .interaction kbd, .kit kbd { display: none; }
}

@media (max-height: 510px) and (pointer: coarse) {
  .interaction, .balance { bottom: 70px; }
  .touch-controls { bottom: 96px; }
  .trail-map { top: 45px; width: 176px; }
}

.play-screen .waypoint { top: max(161px, 27%); }

@media (max-width: 640px) {
  .play-screen:has(.trail-map:not([hidden])) .waypoint { visibility: hidden; }
}

@media (max-height: 510px) and (pointer: coarse) {
  .play-screen .waypoint { top: 19%; left: 63%; }
}

#world { cursor: default; }
.hud-header, .hud-footer, .waypoint, .balance { pointer-events: none; }
.hud-actions button, .kit button { pointer-events: auto; }
.input-guide { display: grid; justify-items: end; gap: 6px; }
#pointer-guide {
  color: #f4ead2;
  text-shadow: 0 1px 4px #12190f;
  font-size: .76rem;
  text-align: right;
}
@media (pointer: coarse), (max-width: 660px) {
  #pointer-guide { display: none; }
}

.toolbelt {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.toolbelt:has(> button[hidden]:first-child + button[hidden]) { display: none; }
.toolbelt button {
  padding: 3px 5px;
  border: 1px solid var(--line);
  background: #14251e;
  font-size: .69rem;
  pointer-events: auto;
  touch-action: none;
}
.toolbelt button[aria-pressed="true"] { border-color: #e2b96b; color: #ffdc99; }

.fieldcraft {
  position: absolute;
  right: clamp(15px, 3vw, 42px);
  bottom: 94px;
  min-width: 158px;
  z-index: 1;
  background: #101f18f0;
  border: 1px solid #f0d69a89;
}
.fieldcraft button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 0;
  background: none;
  touch-action: none;
  font-size: .76rem;
}
.touch-controls .touch-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.touch-controls .touch-actions button { width: auto; padding-inline: 9px; font-size: .74rem; }
@media (pointer: coarse) {
  .fieldcraft { bottom: 208px; }
  .toolbelt kbd, .fieldcraft kbd { display: none; }
}
