@font-face {
  font-family: 'Jersey 15';
  src: url('./jersey-15.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
.town {
  --ink: #332f26;
  --paper: #faf4df;
  --line: #cfc5aa;
  --muted: #635e4e;
  --red: #943a31;
  --type: 'DM Sans', system-ui, sans-serif;
  --display: 'Jersey 15', var(--type);
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--type);
}
.town :is(button, a):hover {
  color: var(--red);
}
.town :is(button, a, input, select, summary):focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.game {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.viewport {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  background: #93cf78;
}
#world {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
}
#world:focus {
  outline: none;
}
.game:has(#world:focus-visible) .location h2 {
  text-decoration: underline dotted;
  text-underline-offset: 5px;
}
.controls,
#touch-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  background: var(--paper);
  border-top: 2px solid #605a44;
}
.controls {
  padding-bottom: env(safe-area-inset-bottom);
}
.location,
.controls nav {
  display: flex;
  align-items: center;
}
.location {
  gap: 10px;
  min-width: 0;
}
.location canvas,
#dialogue-art,
.destinations canvas {
  image-rendering: pixelated;
  flex: none;
}
.location canvas {
  width: 34px;
  height: 34px;
}
.location h2 {
  font: 400 clamp(25px, 2vw, 30px)/1 var(--display);
  margin: 0;
}
.controls nav {
  margin-left: 10px;
  gap: clamp(12px, 2.3vw, 34px);
}
.controls nav button,
.paper-head button {
  font: 400 23px/1 var(--display);
  min-height: 46px;
  padding: 4px 2px;
  white-space: nowrap;
}
#nearby,
#dialogue,
.town dialog {
  color: var(--ink);
  background: var(--paper);
}
#dialogue,
#nearby {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px #403b2c65;
}
#nearby {
  font: 500 15px/1.3 var(--type);
  padding: 10px 16px;
  min-height: 44px;
  max-width: 94%;
  width: max-content;
}
#dialogue {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: start;
  gap: 14px;
  padding: 15px 20px 5px;
  width: min(580px, calc(100% - 24px));
}
#dialogue-art {
  width: 48px;
  height: 48px;
  margin-top: 3px;
}
#speaker {
  font: 400 25px/1 var(--display);
  margin: 0 0 5px;
}
#message {
  font-size: 16px;
  line-height: 1.45;
  margin: 0;
}
.dialogue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  justify-content: flex-end;
}
.dialogue-actions button {
  min-height: 42px;
  font: 400 22px var(--display);
}
#story {
  color: var(--red);
}
.town dialog:not(.story-reader) {
  border: 2px solid var(--ink);
  padding: 0;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  box-shadow: 4px 4px #32382555;
}
.town dialog::backdrop {
  background: #29342780;
}
.paper-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 20px;
  border-bottom: 1px solid var(--line);
}
.paper-head h2 {
  font: 400 38px/1 var(--display);
  margin: 0;
}
.paper-head button {
  min-height: 54px;
  color: var(--muted);
}
#start-menu {
  width: min(295px, calc(100vw - 24px));
  position: fixed;
  margin: 0;
  inset: auto 14px calc(57px + env(safe-area-inset-bottom)) auto;
}
.menu-options {
  padding: 7px 20px;
}
.menu-options button {
  display: block;
  text-align: left;
  width: 100%;
  min-height: 44px;
  font: 400 26px var(--display);
}
#start-menu details {
  border-top: 1px solid var(--line);
  margin: 0 20px;
  font-size: 14px;
}
#start-menu summary {
  cursor: pointer;
  padding: 13px 0;
  font: 17px var(--type);
}
#start-menu details p {
  margin: 0 0 10px;
}
#start-menu dl {
  margin: 0;
}
#start-menu dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
#start-menu dd {
  margin: 0;
  color: var(--muted);
}
#start-menu details label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 5px 0;
}
#enable-pad {
  accent-color: var(--red);
  width: 16px;
  height: 16px;
}
#touch-controls {
  padding-block: 6px max(6px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.pad {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(2, 44px);
}
.pad button,
.action-pad button {
  font: 18px var(--type);
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  touch-action: none;
}
.pad button:first-child {
  grid-column: 2;
}
.pad button:nth-child(2) {
  grid-column: 1;
  grid-row: 2;
}
.pad button:nth-child(3),
.pad button:nth-child(4) {
  grid-row: 2;
}
.action-pad {
  display: flex;
  gap: 8px;
}
.action-pad button {
  border-radius: 50%;
}
#atlas {
  width: min(990px, calc(100vw - 32px));
}
.atlas-body {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(220px, 1fr);
  align-items: start;
  gap: 24px;
  padding: 18px 20px 15px;
}
.atlas-body figure {
  min-width: 0;
  margin: 0;
}
.map-paper {
  position: relative;
  background: #a6ce7a;
  border: 1px solid #9aa482;
}
#overview {
  display: block;
  width: 100%;
  image-rendering: pixelated;
  cursor: pointer;
}
#map-pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#map-pins button {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 1px 2px #3e493f66;
  font: 700 13px/1 var(--type);
}
#map-pins button::before {
  content: '';
  position: absolute;
  inset: -6px;
}
#map-pins button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.map-key {
  display: flex;
  align-items: center;
  gap: 7px;
}
.map-key::before {
  content: '';
  width: 7px;
  height: 7px;
  display: inline-block;
  background: var(--red);
}
.map-directory label {
  font: 13px var(--type);
  color: var(--muted);
  display: block;
}
#choose-district {
  font: 400 clamp(27px, 2.2vw, 30px)/1.1 var(--display);
  color: var(--ink);
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  cursor: pointer;
}
#district-note {
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 12px;
}
.destinations button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  min-height: 44px;
  padding: 5px 2px;
  border-top: 1px solid var(--line);
  font: 500 15px/1.3 var(--type);
}
.destinations button::after {
  content: '›';
  margin-left: auto;
  color: var(--muted);
}
.destinations button.seen::after {
  content: '✓';
  color: #416442;
}
.destinations canvas {
  width: 32px;
  height: 32px;
}
.town .story-reader {
  border: 0;
  backdrop-filter: none;
}
.town .reader-top {
  padding: 0 4vw;
  background: var(--paper);
  border-color: var(--line);
  font: 17px var(--type);
}
.town .reader-top button {
  min-height: 48px;
  text-decoration: none;
}
.town #reader-context {
  display: none;
}
.town :is(.reader-award, .reader-figures, .reader-personal h3) {
  font-family: var(--type);
}
.town .reader-content {
  padding-top: clamp(24px, 4vw, 58px);
}
.town .reader-title {
  font: 700 clamp(32px, 4.2vw, 60px)/1.05 var(--type);
}
.town
  :is(.reader-meta, .reader-prose, .reader-prose h3, .reader-personal p, .index-entry small, .index-list h2) {
  color: var(--muted);
}
.town :is(.reader-meta, .index-list h2, .index-entry small) {
  font-family: 'DM Sans', sans-serif;
}
.town :is(.reader-award, .reader-personal h3, .reader-figures strong, .index-entry:hover strong) {
  color: var(--red);
}
.town :is(.index-entry, .reader-award) {
  border-color: var(--line);
}
.town .reader-portrait {
  mix-blend-mode: normal;
  filter: none;
  opacity: 1;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.no-game {
  position: fixed;
  inset: 25% 12% auto;
  padding: 24px;
  background: var(--paper);
}
@media (max-width: 640px) {
  .controls {
    padding-inline: max(10px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
  }
  .location {
    gap: 6px;
  }
  .controls nav {
    gap: 12px;
  }
  #atlas {
    width: calc(100vw - 18px);
  }
  .atlas-body {
    display: block;
    padding: 12px;
  }
  .atlas-body figure {
    width: min(100%, 48dvh);
    margin: 0 auto;
  }
  .map-directory {
    margin-top: 14px;
  }
  .paper-head {
    margin: 0 12px;
  }
  #dialogue {
    gap: 8px;
    grid-template-columns: 34px 1fr;
    padding: 12px 12px 3px;
  }
  #dialogue-art {
    width: 34px;
    height: 34px;
  }
}
@media (max-height: 480px) and (orientation: landscape) {
  #atlas .atlas-body {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
  }
  .atlas-body figure {
    width: min(100%, 92dvh);
  }
  .map-directory {
    margin-top: 0;
  }
  #dialogue {
    bottom: 5px;
  }
  .pad {
    display: flex;
  }
  #start-menu {
    bottom: 5px;
  }
}
