:root {
  color-scheme: dark;
  --night: #112a29;
  --rail: #32524b;
  --paper: #fbf1d4;
  --ink: #18332e;
  --muted: #abc7b8;
  --mint: #d0ec9c;
  --red: #a9342a;
  --mono: ui-monospace, "Courier New", monospace;
  font:
    16px/1.5 "Trebuchet MS",
    Arial,
    sans-serif;
  background: var(--night);
  color: var(--paper);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100svh;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 55px,
    #183430 55px 56px
  );
}
main {
  max-width: 920px;
  margin: auto;
  padding: clamp(12px, 4vw, 46px);
}
header,
.hud,
.controls {
  display: flex;
  align-items: center;
  gap: 14px;
}
header {
  border-bottom: 1px solid var(--rail);
  padding: 0 0 14px;
  margin-bottom: clamp(16px, 4vw, 38px);
}
.wordmark {
  font:
    900 1.25rem/1 Georgia,
    serif;
  letter-spacing: -0.06em;
}
.wordmark span {
  color: var(--mint);
  padding: 0 3px;
}
.kicker,
.eyebrow,
small,
.tear {
  font: 700 0.72rem/1.5 var(--mono);
  letter-spacing: 0.1em;
}
.kicker {
  color: var(--muted);
}
header .quiet {
  margin-left: auto;
}
.ticket,
.panel {
  background: var(--paper);
  color: var(--ink);
}
.ticket {
  max-width: 660px;
  border-radius: 2px;
  overflow: hidden;
}
.stripe {
  height: 15px;
  background: repeating-linear-gradient(
    112deg,
    var(--red) 0 18px,
    var(--paper) 18px 34px
  );
}
.ticket-body,
.panel {
  padding: clamp(18px, 5vw, 44px);
}
.eyebrow {
  color: #446957;
  margin: 0 0 12px;
}
h1,
h2,
p {
  margin: 0 0 12px;
}
h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  font-weight: bold;
  letter-spacing: -0.055em;
}
h1 {
  font-size: clamp(3.4rem, 10vw, 6.2rem);
}
h1 i {
  color: var(--red);
}
h2 {
  font-size: clamp(2.1rem, 5vw, 3.1rem);
}
.lede {
  font-size: 1.35rem;
  font-weight: bold;
}
#open-rooms {
  border-top: 1px dashed #839585;
  margin-top: 24px;
  padding-top: 18px;
}
.lobby-head,
#room-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lobby-head h2 {
  font-size: 1.8rem;
  letter-spacing: -0.035em;
  margin: 0;
}
#room-status {
  font-size: 0.9rem;
  color: #486051;
  margin: 8px 0;
}
#room-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#room-list li {
  padding: 9px 0;
  border-top: 1px solid #a6b3a1;
}
#room-list strong {
  margin-right: auto;
}
#room-list small {
  color: #486051;
  white-space: nowrap;
}
button {
  font: inherit;
}
button {
  min-height: 44px;
  padding: 8px 14px;
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  font-weight: bold;
  cursor: pointer;
  border-radius: 3px;
}
button:focus-visible,
#stage:focus-visible {
  outline: 3px solid #ec9748;
  outline-offset: 3px;
}
button:hover:not(:disabled) {
  filter: brightness(0.94);
}
button:disabled {
  opacity: 0.64;
  cursor: default;
}
.primary {
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
}
.quiet {
  background: none;
  color: var(--paper);
  border: 1px solid var(--rail);
  font: 600 0.82rem var(--mono);
}
.tear {
  padding: 12px clamp(18px, 5vw, 44px);
  border-top: 1px dashed #839585;
  color: #43614d;
}
.hud {
  padding: 10px 0 15px;
  gap: clamp(12px, 4vw, 36px);
}
.hud div {
  display: grid;
}
.hud small {
  color: var(--muted);
  font-size: 0.65rem;
}
.hud b {
  font: 700 clamp(1rem, 4vw, 1.45rem) var(--mono);
  font-variant-numeric: tabular-nums;
}
.hud button {
  margin-left: auto;
}
.inventory {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, 24%);
  gap: 16px;
}
.inventory h3 {
  font: 700 0.8rem var(--mono);
  margin: 15px 0 6px;
}
.shelf {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.shelf button {
  background: #fffaeb;
  padding: 6px 3px;
  font-size: 0.82rem;
}
.shelf button span {
  display: block;
  font: 700 0.7rem var(--mono);
}
.shelf button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--mint);
  opacity: 1;
}
aside {
  align-self: center;
  color: #486051;
  font-size: 0.8rem;
}
#map {
  width: 100%;
  height: auto;
  background: #153e35;
  border-radius: 2px;
}
#lock {
  margin-top: 18px;
}
#stage {
  height: clamp(265px, 59svh, 590px);
  position: relative;
  background: #213c39;
  overflow: hidden;
  touch-action: none;
  border: 1px solid var(--rail);
  cursor: crosshair;
}
#stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}
#reticle {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  color: #fff;
  font: 700 1.3rem var(--mono);
  text-shadow: 0 0 3px #152820;
}
#stage-note {
  position: absolute;
  left: 12px;
  bottom: 12px;
  color: var(--paper);
  background: var(--night);
  padding: 4px 9px;
  pointer-events: none;
}
#stage-note:empty {
  display: none;
}
.controls {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0;
}
.controls p,
#hint,
#notice {
  color: var(--muted);
  font-size: 0.9rem;
}
.controls p {
  margin: 0;
}
#hint:not(:empty),
#notice:not(:empty) {
  padding: 8px 0;
  color: var(--mint);
}
#touchpad {
  display: none;
  gap: 5px;
}
#touchpad button {
  touch-action: none;
  user-select: none;
  min-width: 44px;
}
#result {
  margin-top: 8px;
}
#result button {
  margin-top: 6px;
}
@media (pointer: coarse), (max-width: 680px) {
  #touchpad {
    display: flex;
  }
}
@media (max-width: 540px) {
  .inventory {
    grid-template-columns: 1fr;
  }
  .inventory aside {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }
  .inventory aside p {
    margin: 0;
  }
  .shelf button {
    min-height: 46px;
  }
  .hud {
    gap: 12px;
  }
  .kicker {
    font-size: 0.58rem;
  }
  .panel {
    padding: 16px;
  }
  .controls p {
    font-size: 0.78rem;
  }
  .hud .quiet {
    padding: 5px 8px;
  }
  header {
    margin-bottom: 10px;
  }
}
