:root {
  color-scheme: dark;
  --sea: #10242b;
  --paper: #f4f0e1;
  --muted: #b3c3ba;
  --brass: #e5bb70;
  --line: #567074;
  --serif: "STIX Two Text", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
  font-family: var(--sans);
  color: var(--paper);
  background: var(--sea);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 4px; }
[hidden] { display: none !important; }
.mast, .spread { max-width: 88rem; margin: 0 auto; padding-inline: clamp(1.25rem, 5vw, 5rem); }
.mast { height: 6rem; display: flex; align-items: center; justify-content: space-between; }
.wordmark { font: 600 1.55rem var(--serif); letter-spacing: -.045em; }
.guide-link { background: none; border: 0; border-bottom: 1px solid var(--line); padding: .3rem 0; color: var(--muted); font-size: .94rem; }
.guide-link:hover { color: var(--paper); border-color: var(--paper); }
.spread { display: grid; grid-template-columns: 1.13fr 1fr; align-items: center; gap: clamp(2rem, 5vw, 5rem); padding-top: clamp(1rem, 5vh, 4rem); padding-bottom: 3rem; }
.plate { margin: 0; position: relative; }
.plate img { display: block; width: 100%; height: clamp(30rem, 65vh, 44rem); object-fit: cover; object-position: 50% 52%; border: 1px solid var(--line); }
.plate figcaption { font: italic .94rem var(--serif); color: var(--muted); margin-top: .65rem; }
.sheet { min-width: 0; padding-bottom: 1.75rem; }
.folio, .label { font: 600 .78rem/1.5 var(--sans); text-transform: uppercase; letter-spacing: .13em; }
.folio { color: var(--brass); display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .8rem; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.055em; line-height: .98; }
h1 { font-size: clamp(4rem, 7.4vw, 7.3rem); margin: 1.9rem 0 1.5rem; text-wrap: balance; }
h1 em { color: var(--brass); }
.intro, .details, .ending { font: 1.35rem/1.55 var(--serif); max-width: 34em; }
.intro { margin: 0 0 2.1rem; }
.primary { padding: .88rem 1.45rem; border: 1px solid var(--brass); border-radius: 2px; background: var(--brass); color: #18282b; font-weight: 650; }
.primary:hover { background: #f6d299; }
.save-note { color: var(--muted); font-size: .92rem; margin: .85rem 0 0; }
.active h1 { font-size: clamp(2.75rem, 4.8vw, 5rem); margin: 1.55rem 0 1rem; }
.details p, .ending { margin: .4rem 0; }
.ending { color: var(--brass); }
.ledger { margin: 1.3rem 0; padding: .85rem 0; border-block: 1px solid var(--line); display: grid; gap: .7rem; }
.ledger > div { display: grid; grid-template-columns: 6.2rem 1fr; align-items: baseline; }
.label { color: var(--muted); }
.exits { display: flex; flex-wrap: wrap; gap: .85rem; }
.exits button { color: var(--brass); border: 0; background: none; padding: .18rem 0; font-size: 1rem; text-decoration: underline; text-underline-offset: .18rem; }
form .label { display: block; margin-bottom: .5rem; }
.entry { display: flex; gap: .5rem; }
.entry input { min-width: 0; flex: 1; background: #0b1c22; border: 1px solid var(--line); color: var(--paper); border-radius: 2px; padding: .8rem; font-family: ui-monospace, monospace; }
.entry input::placeholder { color: #a2b4b3; }
#feedback { white-space: pre-line; color: var(--brass); margin: .85rem 0 0; font-size: 1rem; }
dialog { max-width: min(30rem, 90vw); width: 100%; color: var(--paper); background: var(--sea); border: 1px solid var(--line); padding: 1.6rem; }
dialog::backdrop { background: #041014c9; }
dialog h2 { font-size: 2.5rem; margin: 1.5rem 0; }
dialog dt { color: var(--brass); font: 1rem ui-monospace, monospace; }
dialog dd { line-height: 1.55; margin: .3rem 0 1.1rem; }
@media (max-width: 740px) {
  .mast { height: 4.5rem; }
  .spread { display: flex; flex-direction: column; align-items: stretch; gap: 1.5rem; padding-top: .5rem; }
  .plate img { height: auto; max-height: 34vh; object-position: 50% 43%; }
  .sheet { padding-bottom: 0; }
  h1 { margin-top: 1.15rem; }
  .active .sheet { order: -1; }
  .active .plate img { max-height: 23vh; }
  .intro, .details { font-size: 1.2rem; }
}
