* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  font-family: 'Trebuchet MS', Verdana, sans-serif;
  color: #172c39;
  background: #142f3d;
  --cream: #fff2d4;
  --paper: #f6e5bc;
  --green: #115e53;
  --ink: #182f3b;
}
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 40% 4%, #355668 0, transparent 68%);
  padding: 0 24px;
}
main {
  width: min(994px, 100%);
  margin: auto;
}
button,
select,
input {
  font: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  border: 2px solid #243944;
  border-radius: 5px;
  background: #f8e6bc;
  color: #182f3b;
  padding: 9px 13px;
  font-weight: bold;
  box-shadow: 0 2px 0 #172d36;
}
button:hover {
  filter: brightness(1.07);
}
button:active {
  transform: translateY(1px);
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid #ffad2f;
  outline-offset: 3px;
}
button[aria-pressed='true'] {
  background: #ffcf6d;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
.primary {
  color: white;
  background: var(--green);
  padding: 11px 24px;
}
.mast {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff2d4;
  padding: 22px 0 19px;
  border-bottom: 1px solid #719799;
  letter-spacing: 0.02em;
}
.mast b {
  display: block;
  font-size: 1.03rem;
}
.mast div > span {
  display: block;
  margin-top: 2px;
  color: #b6ced1;
  font-size: 0.86rem;
}
.insignia {
  display: grid;
  place-items: center;
  background: #f1c260;
  color: #284353;
  width: 39px;
  height: 44px;
  clip-path: polygon(0 0, 100% 0, 95% 73%, 50% 100%, 5% 73%);
  font: bold italic 32px Georgia;
}
.mast #sound {
  margin-left: auto;
  color: #f5eed6;
  background: transparent;
  border: 1px solid #72959b;
  box-shadow: none;
  font-size: 0.85rem;
}
#archive {
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.8fr);
  background: #204755;
  padding: 13px;
  border: 2px solid #0a222d;
  border-radius: 10px;
  box-shadow:
    0 6px 0 #0b222c,
    0 15px 33px #0c1f2845;
  gap: 13px;
}
.drawer {
  padding: 13px 4px 14px 8px;
}
.drawer h1 {
  color: #fff0cb;
  font:
    bold 1.65rem Georgia,
    serif;
  margin: 0 0 14px;
}
#file-index {
  display: grid;
  gap: 3px;
}
#file-index button {
  position: relative;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 10px;
  padding: 10px 8px;
  width: 100%;
  font-size: 0.92rem;
  line-height: 1.2;
  border: 0;
  border-left: 3px solid transparent;
  color: #e8f3ef;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
#file-index button[aria-current='true'] {
  border-color: #f4b84c;
  background: #40616a;
  color: #fff5d3;
}
#file-index small {
  font:
    600 0.75rem Consolas,
    monospace;
  color: #accac5;
}
#file-index img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  margin-left: auto;
}
.dossier {
  min-height: 500px;
  background: linear-gradient(100deg, #dfc996 0, #f8ebcb 3%, #fbefd3 85%, #efdfb8);
  border-radius: 4px 12px 5px 4px;
  box-shadow:
    -3px 0 #c0ac81,
    0 2px 4px #0a263a;
  padding: 20px clamp(16px, 3vw, 32px);
  color: var(--ink);
}
.file-edge,
.eyebrow {
  font:
    700 0.76rem Consolas,
    monospace;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #495d61;
}
.file-edge {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #bba77e;
  padding-bottom: 10px;
}
figure {
  margin: 17px 0 12px;
  position: relative;
  background: #fffaf0;
  padding: 5px 5px 20px;
  box-shadow: 0 2px 6px #765c363f;
  transform: rotate(-0.9deg);
}
figure img {
  width: 100%;
  height: clamp(155px, 19vw, 210px);
  object-fit: cover;
  object-position: 50% 56%;
  display: block;
}
figcaption {
  position: absolute;
  bottom: 2px;
  right: 8px;
  font: italic 14px Georgia;
}
.dossier h2 {
  font:
    bold clamp(1.7rem, 3.6vw, 2.8rem)/1.02 Georgia,
    serif;
  margin: 0.25em 0;
}
.dossier-copy > p:not(.eyebrow) {
  font-size: 1.04rem;
  line-height: 1.5;
  max-width: 48ch;
  margin: 0.6em 0 1em;
}
.eyebrow {
  margin: 18px 0 4px;
}
.field-header,
.tray,
.toolbelt {
  display: flex;
  align-items: center;
}
.field-header {
  justify-content: space-between;
  gap: 8px;
  background: #254a59;
  color: var(--cream);
  padding: 9px 12px;
}
.field-header strong {
  text-align: center;
}
.field-header button,
.sheet-top button {
  font-size: 0.82rem;
  padding: 6px 9px;
}
.field-header button:first-child {
  border: 1px solid #91a9a5;
  box-shadow: none;
  color: #edead4;
  background: transparent;
}
#game {
  width: min(850px, 100%);
  margin: 18px auto 0;
  background: #284d5b;
  border: 3px solid #0c2635;
  border-radius: 9px;
  box-shadow: 0 6px 0 #0b222c;
  overflow: hidden;
}
.room {
  position: relative;
  background: #0a2431;
  aspect-ratio: 4 / 3;
  isolation: isolate;
}
.room > img {
  width: 100%;
  height: 100%;
  display: block;
}
.room-tab {
  position: absolute;
  top: 0;
  left: 0;
  background: #fff1cced;
  padding: 6px 14px;
  border-radius: 0 0 8px 0;
  font-weight: bold;
  box-shadow: 0 2px 0 #182e32;
  z-index: 2;
  pointer-events: none;
}
.target {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: grid;
  place-items: center;
  min-width: 38px;
  min-height: 38px;
  width: 12%;
  height: 15%;
  border-radius: 15px;
  touch-action: manipulation;
}
.target:active {
  transform: translate(-50%, -50%);
}
.target:hover,
.target:focus-visible,
.scanning .target {
  background: #fff1b022;
  outline: 2px dashed #fff4be;
  outline-offset: 1px;
  z-index: 3;
}
.target img {
  object-fit: contain;
  width: 72%;
  height: 72%;
  filter: drop-shadow(1px 3px 1px #192e4070);
  pointer-events: none;
}
.target.person {
  height: 39%;
  width: 25%;
  transform: translate(-50%, -91%);
}
.target.person img {
  height: 100%;
  width: 100%;
}
.target .label {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: clamp(0.63rem, 1.5vw, 0.84rem);
  background: #173440;
  color: white;
  padding: 3px 5px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
}
.target:hover .label,
.target:focus-visible .label,
.scanning .target .label {
  opacity: 1;
}
#speech {
  position: absolute;
  bottom: 2%;
  left: 2%;
  right: 2%;
  background: #fff7de;
  color: #192e3c;
  border: 3px solid #273441;
  border-radius: 13px;
  box-shadow: 0 4px 0 #1e314671;
  padding: 12px 16px;
  z-index: 5;
  line-height: 1.4;
}
#speech b {
  color: #0b605c;
}
#speech p {
  margin: 2px 0 7px;
}
.responses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.responses button {
  font-size: 0.9rem;
  padding: 5px 10px;
}
.tray {
  background: #f2daa5;
  gap: 4px;
  padding: 7px;
  justify-content: center;
  border-top: 3px solid #223b46;
}
.tray button {
  flex: 1;
  background: #f9ebc8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 3px;
}
.tray span {
  font-size: 1.35rem;
  color: var(--green);
}
.tray b {
  font-weight: inherit;
}
.tray i {
  font-style: normal;
  background: #27525a;
  color: white;
  border-radius: 50%;
  padding: 0 5px;
  font: 13px/18px Consolas;
}
.toolbelt {
  min-height: 35px;
  padding: 5px 10px;
  gap: 8px;
  color: #eff5e9;
  font-size: 0.89rem;
}
.toolbelt button {
  padding: 1px 8px;
  font-size: 0.8rem;
}
.toolbelt #held {
  flex: 1;
}
footer {
  text-align: center;
  color: #bdd0d1;
  font-size: 0.8rem;
  margin: 21px 0;
}
footer span {
  color: #e5d29e;
}
dialog {
  border: 3px solid #1c333e;
  padding: 0;
  border-radius: 10px;
  background: #fff0cb;
  color: var(--ink);
  max-width: min(610px, 94vw);
  width: 600px;
  max-height: 88dvh;
  box-shadow: 0 12px 46px #071d29a8;
}
dialog::backdrop {
  background: #051925b5;
}
.sheet-top {
  background: #254b59;
  color: #ffefcc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
}
.sheet-top strong {
  letter-spacing: 0.04em;
}
#sheet-body {
  padding: 17px 20px 22px;
}
#sheet-body h2 {
  font: bold 1.6rem Georgia;
  margin: 0 0 6px;
}
#sheet-body p {
  line-height: 1.45;
  margin: 6px 0 13px;
}
.map-plate {
  position: relative;
  aspect-ratio: 4/3;
  margin: -7px;
  background: center/cover url(./art/map.webp);
  border: 2px solid #24455c;
  border-radius: 4px;
}
.map-plate button {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: clamp(0.72rem, 2vw, 0.94rem);
  padding: 7px 8px;
  white-space: nowrap;
}
.map-plate button[aria-current='true'] {
  background: #ffcb61;
}
.pockets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
}
.pockets button {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 95px;
  background: #fee9b6;
}
.pockets button img {
  height: 45px;
  max-width: 90px;
  object-fit: contain;
}
.journal {
  padding-left: 22px;
}
.journal li {
  margin: 0.6rem 0;
  line-height: 1.4;
}
.gift {
  color: #145e51;
  font-weight: bold;
}
.medal {
  width: 100px;
  height: 118px;
  object-fit: contain;
  float: right;
  margin: 0 0 10px 12px;
}
.diagram {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid #243e47;
  border-radius: 6px;
}
.bench-controls,
.bench-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.bench-controls button,
.bench-footer button {
  padding: 7px 11px;
  font-size: 0.93rem;
}
.bench-footer {
  justify-content: space-between;
  margin-top: 15px;
}
.bench-message {
  min-height: 1.4em;
  color: #1c6359;
  font-weight: bold;
}
.strips > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #a68e69;
  padding: 7px 9px;
  background: #fdf5df;
  font: 700 1.08rem Georgia;
}
.strips button {
  font:
    600 0.8rem 'Trebuchet MS',
    sans-serif;
  padding: 5px;
}
.flats,
.tins {
  display: flex;
  gap: 5px;
  padding: 12px 5px;
  background: #214552;
  border: 3px solid #1c3540;
  border-radius: 4px;
}
.flats button,
.tins label {
  flex: 1;
  text-align: center;
  display: grid;
  gap: 7px;
  place-items: center;
}
.flats [data-flat]::before {
  font: 42px Georgia;
}
.flats [data-flat='Moon']::before {
  content: '☾';
}
.flats [data-flat='Stars']::before {
  content: '✦';
}
.flats [data-flat='Waves']::before {
  content: '≈';
}
.flats small {
  font: 13px Georgia;
}
.tins label {
  color: white;
  font-size: 0.84rem;
}
.tins select {
  display: block;
  width: 95%;
  padding: 7px;
  color: #183948;
  background: #f3e6bf;
}
.bench-controls label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-weight: bold;
}
.bench-controls input {
  flex: 1;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.status-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  body {
    padding: 0 9px;
  }
  .mast {
    padding: 11px 1px;
  }
  .insignia {
    width: 31px;
    height: 35px;
    font-size: 26px;
  }
  #archive {
    display: flex;
    flex-direction: column;
    padding: 9px;
    margin-top: 12px;
    gap: 6px;
  }
  .drawer {
    padding: 4px;
  }
  .drawer h1 {
    font-size: 1.1rem;
    margin: 0 0 6px;
  }
  #file-index {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  #file-index button {
    width: auto;
    flex: 0 0 auto;
    font-size: 0.84rem;
    max-width: 145px;
    padding: 5px;
    gap: 5px;
  }
  #file-index img {
    width: 14px;
  }
  .dossier {
    min-height: 0;
    padding: 14px;
  }
  figure img {
    height: clamp(120px, 39vw, 220px);
  }
  .dossier h2 {
    font-size: 1.85rem;
  }
  .dossier-copy > p:not(.eyebrow) {
    font-size: 1rem;
  }
  #game {
    margin-top: 10px;
  }
  .field-header {
    font-size: 0.85rem;
    padding: 5px;
  }
  .field-header button {
    font-size: 0.7rem;
  }
  .room-tab {
    font-size: 0.8rem;
  }
  .tray {
    padding: 5px 3px;
    gap: 3px;
  }
  .tray button {
    font-size: 0.75rem;
    gap: 2px;
    flex-direction: column;
    position: relative;
  }
  .tray i {
    position: absolute;
    top: 2px;
    right: 4px;
  }
  .tray span {
    font-size: 1.15rem;
    line-height: 1.1;
  }
  #speech {
    font-size: 0.86rem;
    padding: 7px 9px;
  }
  .responses button {
    font-size: 0.78rem;
  }
  #sheet-body {
    padding: 12px;
  }
  .target .label {
    white-space: normal;
    min-width: 50px;
    line-height: 1.1;
  }
  .toolbelt {
    font-size: 0.8rem;
  }
  .flats button {
    padding: 5px;
  }
  .bench-controls button {
    font-size: 0.85rem;
  }
  footer {
    margin: 14px 0;
  }
}
@media (min-width: 701px) and (min-aspect-ratio: 4/3) {
  #game {
    max-width: min(850px, max(580px, calc((100dvh - 235px) * 1.3333)));
  }
}

.ending {
  width: 100%;
  max-height: min(34dvh, 220px);
  object-fit: cover;
  border: 3px solid #2b4140;
  border-radius: 5px;
  margin-bottom: 12px;
}
.cipher {
  font:
    bold 1.4rem Consolas,
    monospace;
  letter-spacing: 0.14em;
  padding: 10px;
  background: #e2cda1;
  text-align: center;
}
.code-card {
  border-collapse: collapse;
  background: #fff9e4;
  margin: 8px auto;
  width: 85%;
  text-align: center;
}
.code-card td,
.code-card th {
  border: 1px solid #a49977;
  padding: 3px;
}
.code-card th {
  background: #245044;
  color: #fff5d2;
}
details {
  border-block: 1px solid #bfae85;
  padding: 8px 1px;
  margin-block: 12px;
}
summary {
  cursor: pointer;
  font-weight: bold;
}
#sheet-body form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#sheet-body form input {
  max-width: 8em;
  padding: 5px;
}
#sheet-body form p {
  flex-basis: 100%;
}
.medal {
  height: 86px;
  width: 80px;
}
@media (min-width: 701px) {
  #game {
    max-width: min(850px, max(540px, calc((100dvh - 245px) * 1.3333)));
  }
}
.storage-note {
  max-width: 48rem;
  margin: 1rem auto;
  color: #fff2c9;
  text-align: center;
}
.placed { position:absolute;pointer-events:none;transform:translate(-50%,-50%);filter:drop-shadow(0 2px 1px #17333a66) }
@media(prefers-reduced-motion:no-preference) {
 .placed.bob { animation:float-on-water 2.5s ease-in-out infinite }
 .placed.wind { animation:pennant-in-wind 1.8s ease-in-out infinite alternate }
 .placed.spool { animation:tape-playing 5s linear infinite }
 .target.person img { transform-origin:50% 95%;animation:penguin-idle 3.4s ease-in-out infinite alternate }
}
@keyframes float-on-water { 0%,100%{transform:translate(-50%,-50%) rotate(-7deg)}50%{transform:translate(-50%,-43%) rotate(5deg)} }
@keyframes pennant-in-wind { from{transform:translate(-50%,-50%) rotate(-9deg)} to{transform:translate(-50%,-54%) rotate(8deg)} }
@keyframes tape-playing { to{transform:translate(-50%,-50%) rotate(360deg)} }
@keyframes penguin-idle { from{transform:rotate(-.7deg)} to{transform:rotate(.7deg) scaleY(.99)} }
