/* THE CABIN (look-and-feel overhaul, owner 2026-10-22): windows are dark oiled wood with brass
   trim; anything that's really paper (the chart, notices, letters) is parchment and ink. Book
   type (EB Garamond) for reading, the chart's lettering (IM Fell) for headings. */
:root {
  --panel: rgba(38, 26, 17, 0.92);
  --panel-solid: #2b1d14;
  --wood-dark: #21160f;
  --wood-light: #3a2819;
  --line: rgba(184, 137, 58, 0.26);
  --brass: #b8893a;
  --brass-dim: #5a3f22;
  --text: #ecdcbc;
  --muted: #a8977a;
  --gold: #e2b45c;
  --good: #a9cf8a;
  --okay: #e2b45c;
  --bad: #ec8a70;
  --accent: #c9973f;
  --paper: #f3e6c8;
  --parchment: #e9dcbc;
  --ink: #2f2414;
  --ink-red: #6b2a1c;
  --body: 'EB Garamond', Georgia, serif;
  /* wood grain: stretched noise (long along the plank, tight across it), dark streaks only */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.11' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.03 0 0 0 0 0.01 0.9 0 0 0 -0.32'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #165a7a; color: var(--text); font: 16px/1.4 var(--body); }
canvas#game, canvas#game3d { position: fixed; inset: 0; display: block; }
canvas#game { pointer-events: none; } /* drawn over the WebGL canvas; input is handled on the window */
h2, h3, .tb-title { font-family: 'IM Fell English', Georgia, serif; font-weight: 400; margin: 0 0 8px; }
h2 { font-size: 28px; color: var(--gold); }
h3 { font-size: 20px; color: var(--paper); }
h4 { margin: 0 0 6px; font-size: 15px; font-weight: 500; letter-spacing: 0.1em; font-variant: small-caps; text-transform: lowercase; color: var(--gold); }
p { margin: 0 0 10px; }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.muted { color: var(--muted); }
.tone-good { color: var(--good); }
.tone-okay { color: var(--okay); }
.tone-bad { color: var(--bad); }
.tone-neutral { color: var(--text); }
a { color: var(--gold); }

/* ---------- HUD ---------- */
#hud > * { position: fixed; }
#topbar { top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
#topbar > * { pointer-events: auto; }
.tb-block { background: var(--grain), var(--panel); border: 1px solid var(--brass); border-radius: 2px; padding: 8px 12px; box-shadow: inset 0 0 0 3px var(--panel-solid), inset 0 0 0 4px var(--brass-dim), 0 4px 14px rgba(0, 0, 0, 0.35); }
.tb-title { font-size: 21px; margin: 0; color: var(--gold); }
.tb-block .small { line-height: 1.25; } /* the book face is taller: keep the plates compact */
.hull { font-size: 15px; }
#hull-bar { width: 150px; margin: 2px 0 4px; height: 6px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--brass-dim); border-radius: 0; overflow: hidden; }
#hull-fill { height: 100%; background: var(--good); transition: width 0.2s; }
#hull-fill.low { background: var(--bad); }
.wind { display: flex; gap: 10px; align-items: center; min-width: 230px; }
.compass { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--brass); display: grid; place-items: center; background: rgba(0, 0, 0, 0.2); }
#wind-arrow { color: var(--gold); font-size: 20px; transition: transform 0.4s; }
.tb-center { display: flex; gap: 6px; align-items: flex-start; }
.name-input { background: var(--wood-dark); color: var(--text); border: 1px solid var(--brass-dim); border-radius: 2px; padding: 5px 8px; font: 14px var(--body); width: 11em; }
.note-input { width: 100%; background: var(--wood-dark); color: var(--text); border: 1px solid var(--brass-dim); border-radius: 2px; padding: 10px; font: 14px var(--body); resize: vertical; }
.mood-chip { border: 1px solid var(--brass); border-radius: 2px; padding: 5px 14px; background: var(--grain), var(--panel); color: var(--text); font: 500 15px var(--body); cursor: pointer; }
.level-0 { border-color: rgba(143, 209, 139, 0.6); }
.level-1 { border-color: rgba(232, 194, 106, 0.6); }
.level-2 { border-color: rgba(232, 160, 90, 0.8); }
.level-3 { border-color: rgba(239, 127, 108, 0.9); }
.level-4 { border-color: #ff4d3a; box-shadow: 0 0 12px rgba(255, 77, 58, 0.6); }
.mood-chip.level-3, .mood-chip.level-4 { color: #ffb4a8; }

#crew-strip { top: 126px; left: 10px; width: 250px; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 300px); overflow-y: auto; }
.strip-row { display: grid; grid-template-columns: 30px 1fr 10px; grid-template-rows: auto 3px; column-gap: 8px; align-items: center; background: var(--grain), var(--panel); border: 1px solid var(--brass-dim); border-radius: 2px; padding: 4px 8px; cursor: pointer; }
.strip-row:hover { border-color: var(--accent); }
.strip-row .portrait { grid-row: 1 / 3; border-radius: 2px; }
.strip-name { font-weight: 500; font-size: 15px; color: var(--paper); }
.strip-act { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-cowering .strip-act, .act-resting .strip-act { color: var(--bad); }
.act-guns .strip-act, .act-repair .strip-act { color: var(--gold); }
.hpbar { height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; }
.hpbar > div { height: 100%; background: #6fbf73; }
.hpbar.mini { grid-column: 2 / 4; height: 3px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.good { background: var(--good); }
.dot.neutral { background: #c9c3b5; }
.dot.okay { background: var(--okay); }
.dot.bad { background: var(--bad); }

#log { top: 120px; right: 10px; width: 330px; max-height: 38vh; background: var(--grain), var(--panel); border: 1px solid var(--brass); border-radius: 2px; box-shadow: inset 0 0 0 3px var(--panel-solid), inset 0 0 0 4px var(--brass-dim); padding: 8px 10px; display: flex; flex-direction: column; }
.log-title { font-family: 'IM Fell English', serif; font-size: 18px; color: var(--gold); margin-bottom: 4px; }
#log-entries { overflow-y: auto; font-size: 15px; line-height: 1.3; display: flex; flex-direction: column; gap: 3px; }
.log-good { color: var(--good); }
.log-bad, .log-warn { color: var(--bad); }
.log-death { color: #ff8f80; font-weight: 600; }
.log-event { color: var(--gold); }
.log-reveal { color: #c9a8ff; }
.log-speech { color: #bfe6ff; font-style: italic; }
.log-crew { color: #f2d38a; }
.log-order { color: #d8d8d8; }
.log-day { color: var(--muted); border-top: 1px solid var(--line); padding-top: 3px; }
.log-combat { color: #ffb48a; }
.log-officer { color: #f6e2b3; }
.log-weather { color: #bcd7e6; font-style: italic; }

#prompt { bottom: 150px; left: calc(50% - 90px); /* moved to just above the order board in hud.js */ transform: translateX(-50%); background: rgba(33, 22, 15, 0.88); border: 1px solid var(--brass-dim); padding: 5px 16px; border-radius: 2px; font-style: italic; font-size: 17px; display: none; color: #f2d488; width: max-content; max-width: calc(100vw - 220px); }
#prompt .okey { font-style: normal; margin-right: 6px; }
/* THE ORDER BOARD: one wooden board along the bottom, a column per officer (2026-10-22) */
#orders { bottom: 10px; left: calc(50% - 90px); transform: translateX(-50%); display: flex; flex-wrap: wrap; row-gap: 6px; align-items: flex-start; width: max-content; max-width: calc(100vw - 220px); /* centred in the space left of the minimap */ background: var(--grain), var(--panel); border: 1px solid var(--brass); border-radius: 2px; padding: 8px 4px 7px; box-shadow: inset 0 0 0 3px var(--panel-solid), inset 0 0 0 4px var(--brass-dim), 0 4px 14px rgba(0, 0, 0, 0.35); }
/* Folded away (Tab, or click the tab): the board slides below the screen edge and only its tab
   peeks out, like a folder in a drawer (owner, 2026-10-29). */
#orders { transition: transform 0.25s ease, bottom 0.25s ease; }
#orders.tucked { bottom: 0; transform: translate(-50%, 100%); }
.orders-tab { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: -1px; padding: 2px 16px 1px; background: var(--panel-solid); border: 1px solid var(--brass); border-bottom: 0; border-radius: 5px 5px 0 0; font-family: 'IM Fell English', serif; font-size: 14px; color: var(--gold); cursor: pointer; }
.orders-tab:hover { color: var(--text); }
#orders:not(.tucked) .orders-tab { opacity: 0.75; }
.ogroup { padding: 0 12px; border-left: 1px solid var(--brass-dim); }
.ogroup.first { border-left: 0; } /* the first column showing (set in hud.js) */
.ohead { font-family: 'IM Fell English', serif; font-size: 16px; color: var(--gold); margin: 0 0 3px 2px; white-space: nowrap; }
.oname { font-family: var(--body); font-style: italic; font-size: 13.5px; color: var(--muted); margin-left: 6px; }
.ohead.vacant { color: #9a8a6a; font-style: italic; }
.obuttons { display: flex; flex-direction: column; gap: 1px; }
#supplies.low { color: var(--bad); }
.order { background: none; border: 0; color: var(--text); border-radius: 1px; padding: 1px 6px 1px 2px; cursor: pointer; display: flex; align-items: center; gap: 7px; font: 400 15px var(--body); white-space: nowrap; text-align: left; }
.order:hover { background: rgba(226, 180, 92, 0.1); color: var(--paper); }
/* the key, as a small brass tag */
.okey { display: inline-block; min-width: 19px; text-align: center; border: 1px solid #8a6a32; color: var(--gold); font: 500 12.5px/16px var(--body); padding: 0 3px; border-radius: 1px; }
.order.active { color: #f2d488; background: rgba(226, 180, 92, 0.14); }
.order.active .okey { background: #6b4a1c; border-color: var(--gold); }
.order.ready { color: var(--good); }
.order.ready .okey { border-color: var(--good); color: var(--good); box-shadow: 0 0 6px rgba(169, 207, 138, 0.45); }
#minimap { bottom: 14px; right: 10px; border-radius: 2px; border: 1px solid var(--brass); width: 170px; height: 170px; }

/* ---------- Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 18, 0.5); display: grid; place-items: center; z-index: 10; padding: 16px; }
/* a brass edge, a strip of wood, then a thin inner brass line: the cabin frame */
.modal { position: relative; background: var(--grain), var(--panel-solid); border: 1px solid var(--brass); border-radius: 2px; padding: 24px 28px; width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: inset 0 0 0 5px var(--panel-solid), inset 0 0 0 6px var(--brass-dim), 0 20px 60px rgba(0, 0, 0, 0.55); }
.modal > div { display: flex; flex-direction: column; min-height: 0; }
.modal.wide { width: min(1080px, 100%); }
.modal-body { overflow-y: auto; min-height: 0; padding-right: 4px; }
.modal-x { position: absolute; top: 10px; right: 14px; background: none; border: 0; color: var(--brass); font-size: 24px; cursor: pointer; }
.choices { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.choices.vertical { flex-direction: column; align-items: stretch; }
.choices.vertical .btn { text-align: left; }
.btn { background: var(--wood-light); color: var(--text); border: 1px solid #8a6a32; border-radius: 2px; padding: 7px 16px; cursor: pointer; font: 500 16px var(--body); }
.btn:hover:not(:disabled) { border-color: var(--gold); background: #46301c; color: var(--paper); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: #6b4a1c; border-color: var(--gold); color: #fbe9bf; }
.btn.primary:hover:not(:disabled) { background: #7d571f; }
.btn.danger { border-color: #8a3a2a; color: #f0b4a2; }
.btn.tiny { padding: 2px 8px; font-size: 13px; }
.card { background: rgba(0, 0, 0, 0.16); border: 1px solid var(--brass-dim); border-radius: 2px; padding: 12px; margin-bottom: 10px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card.row { justify-content: space-between; }
select { background: var(--wood-dark); color: var(--text); border: 1px solid var(--brass-dim); border-radius: 2px; padding: 5px 8px; font: 15px var(--body); }
.check { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.portrait { border-radius: 2px; display: block; flex-shrink: 0; }

.mood-banner { border: 1px solid; border-radius: 2px; padding: 8px 12px; margin-bottom: 12px; background: rgba(0, 0, 0, 0.2); }

/* Crew panel */
.crew-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; min-height: 0; flex: 1; }
.crew-list { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.crew-row { display: grid; grid-template-columns: 40px 1fr 12px; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 2px; border: 1px solid transparent; cursor: pointer; }
.crew-row:hover { background: rgba(255, 255, 255, 0.04); }
.crew-row.selected { border-color: var(--accent); background: rgba(217, 164, 65, 0.1); }
.crew-row .name { font-weight: 500; color: var(--paper); }
.crew-detail { max-height: calc(100vh - 230px); }
.detail-head { display: flex; gap: 16px; margin-bottom: 12px; }
.perception { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.section { border-top: 1px solid var(--line); padding: 10px 0; }
.traits { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.trait { background: rgba(217, 164, 65, 0.12); border: 1px solid #8a6a32; color: #f4dca5; padding: 1px 9px; border-radius: 2px; font-size: 14px; cursor: help; }
.trait.unknown { background: rgba(255, 255, 255, 0.05); border-style: dashed; border-color: var(--muted); color: var(--muted); }
.facts { margin: 0; padding-left: 18px; }
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; }
.skills.compact { grid-template-columns: 1fr; gap: 1px; margin: 8px 0; font-size: 12px; line-height: 1.25; }
.skill { display: grid; grid-template-columns: 82px 1fr 64px; gap: 8px; align-items: center; }
.skill .bar { height: 5px; background: rgba(0, 0, 0, 0.3); border-radius: 0; overflow: hidden; }
.skill .bar > div { height: 100%; background: var(--accent); }
.skill .num { text-align: right; color: var(--muted); font-size: 14px; font-style: italic; }
.rels, .memories { margin: 0; padding-left: 18px; }
.memories li.grievance { color: #f3b1a5; }
.memories li.fond { color: #bfe3b9; }

/* Port */
.port-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.port-res { color: var(--gold); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--brass-dim); margin: 8px 0 12px; flex-wrap: wrap; }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 12px; cursor: pointer; font: 500 17px var(--body); border-bottom: 2px solid transparent; }
.tab.active { color: #f2d488; border-bottom-color: var(--gold); }
.port-body { max-height: calc(100vh - 260px); }
/* The port window keeps one size on every tab, so the tabs and Set sail never move under the mouse. */
.modal.port-window { height: min(760px, calc(100vh - 32px)); }
.port-window > .port { flex: 1; }
.port-window .port-body { flex: 1; max-height: none; }
.port-scene { font-style: italic; color: #d8ceb6; font-size: 17px; }
/* The notice board: jobs pinned up as parchment notes, a little crooked */
.notice-board { margin-bottom: 14px; }
.notices { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding: 4px 4px 8px; }
.notice { position: relative; background: var(--parchment); color: var(--ink); border: 1px solid #6b5636; padding: 14px 14px 12px; display: flex; flex-direction: column; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
.notice::before { content: ''; position: absolute; top: 5px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: #5a4630; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); } /* the tack */
.notice.tilt-0 { transform: rotate(-0.9deg); }
.notice.tilt-1 { transform: rotate(0.7deg); }
.notice.tilt-2 { transform: rotate(-0.4deg); }
.notice-title { font-family: 'IM Fell English', serif; font-size: 19px; line-height: 1.15; margin-top: 4px; }
.notice-kind { font-size: 14px; font-style: italic; color: #6b5636; margin: 2px 0 6px; }
.notice p { font-size: 15px; line-height: 1.35; margin: 0 0 10px; }
.notice-take { margin-top: auto; align-self: flex-start; background: none; border: 1px solid var(--ink-red); color: var(--ink-red); font: 500 15px var(--body); padding: 3px 10px; cursor: pointer; border-radius: 1px; }
.notice-take:hover:not(:disabled) { background: var(--ink-red); color: var(--parchment); }
.notice-take:disabled { opacity: 0.45; cursor: not-allowed; }
.recruits { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.recruit { display: flex; flex-direction: column; }
.recruit-head { display: flex; gap: 12px; margin-bottom: 8px; }
.recruit h3 { font-size: 18px; margin: 0; }
.recruit .btn { margin-top: auto; }
.recruit .facts { margin-bottom: 8px; }
.quote { font-family: 'IM Fell English', serif; font-style: italic; font-size: 16px; color: var(--paper); margin-bottom: 8px; }
.quote.big { font-size: 22px; }
.rumor { background: rgba(0, 0, 0, 0.18); border-left: 3px solid var(--accent); padding: 6px 8px; margin-bottom: 8px; color: #e8d7b0; font-style: italic; }
.crew-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-bottom: 10px; }
.crew-card { display: flex; gap: 10px; cursor: pointer; margin: 0; }
.crew-card:hover { border-color: var(--accent); }
.comment { display: flex; gap: 16px; align-items: center; }

/* Events */
.event-cast { display: flex; gap: 12px; margin-bottom: 10px; }
.cast { text-align: center; width: 80px; }
.cast .portrait { margin: 0 auto 4px; }
.event-text { font-size: 17.5px; line-height: 1.5; }
.event-result { font-family: 'IM Fell English', serif; font-size: 18px; color: var(--gold); border-left: 2px solid var(--brass); padding-left: 10px; }

.advice { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 6px; padding: 10px; border-radius: 2px; background: rgba(0, 0, 0, 0.2); }
.advice-row { display: flex; gap: 10px; align-items: flex-start; }
.small-quote { font-size: 15px; margin: 0; }

/* Loot */
.schemes { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.scheme { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 2px; border: 1px solid var(--line); cursor: pointer; }
.scheme.selected { border-color: var(--accent); background: rgba(217, 164, 65, 0.1); }
.shares { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; }
.shares th, .shares td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.shares td:last-child, .shares th:last-child { text-align: right; }
.reactions { display: flex; flex-direction: column; gap: 10px; }
.reaction { display: flex; gap: 12px; align-items: center; }

/* Boarding */
.board-status { display: flex; gap: 18px; color: var(--gold); margin-bottom: 10px; font-weight: 500; }
.board-people { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.bp { display: flex; gap: 6px; align-items: center; background: rgba(0, 0, 0, 0.16); border: 1px solid var(--brass-dim); border-radius: 2px; padding: 4px 8px 4px 4px; width: 150px; }
.bp .hpbar { width: 80px; margin-top: 2px; }
.bp.st-charging { border-color: #ffb36b; }
.bp.st-refused, .bp.st-hanging { opacity: 0.75; border-style: dashed; }
.bp.st-dead { opacity: 0.45; filter: grayscale(1); border-color: var(--bad); }
.bp.st-wounded { border-color: rgba(239, 127, 108, 0.6); }
.bp.st-aboard { opacity: 0.5; }
.boarding-log { background: rgba(0, 0, 0, 0.25); border-radius: 2px; padding: 10px 12px; height: 300px; display: flex; flex-direction: column; gap: 3px; }
.bl-title { font-family: 'IM Fell English', serif; font-size: 17px; color: var(--paper); }
.bl-round { color: var(--muted); font-size: 12px; margin-top: 6px; }
.bl-good { color: var(--good); }
.bl-bad { color: #f3b1a5; }
.bl-crew { color: #f2d38a; }
.bl-death { color: #ff7a6a; font-weight: 600; }
.bl-peril { color: #ff9a6a; font-weight: 600; }
.peril { margin-top: 10px; padding: 8px 12px; border: 1px solid #ff9a6a; border-radius: 2px; background: rgba(255, 120, 80, 0.12); }

/* Debug (developer mode only: ?dev in the URL) */
#dev-badge { position: fixed; top: 4px; left: 50%; transform: translateX(-50%); background: #7a1f1f; color: #fff; font: 600 11px ui-monospace, Menlo, monospace; padding: 2px 8px; border-radius: 4px; z-index: 21; opacity: 0.85; pointer-events: none; }
#debug-panel { display: none; position: fixed; left: 10px; bottom: 10px; width: min(1100px, calc(100vw - 20px)); max-height: 45vh; overflow: auto; background: rgba(0, 0, 0, 0.88); border: 1px solid #555; border-radius: 8px; padding: 8px 10px; z-index: 20; font: 11.5px ui-monospace, Menlo, monospace; }
.debug-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.debug-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.debug-table { border-collapse: collapse; margin-top: 6px; }
.debug-table th, .debug-table td { padding: 2px 6px; border-bottom: 1px solid #333; text-align: left; white-space: nowrap; }

@media (max-width: 900px) {
  #log { width: 240px; max-height: 26vh; }
  #crew-strip { width: 200px; }
  #orders { max-width: calc(100vw - 140px); left: 8px; transform: none; bottom: 8px; flex-wrap: wrap; }
  #orders.tucked { bottom: 0; transform: translateY(100%); }
  .orders-tab { left: 24px; transform: none; }
  .ogroup { padding: 0 7px; }
  .order { font-size: 13.5px; }
  #crew-strip { max-height: calc(100vh - 420px); }
  #minimap { width: 120px; height: 120px; }
  #prompt { bottom: auto; top: 50%; margin-top: 70px; }
  .crew-layout { grid-template-columns: 1fr; }
  .crew-list { flex-direction: row; overflow-x: auto; }
}

/* Shipwright: fittings and paint swatches */
.fitting { padding: 6px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.fitting p { margin: 4px 0 6px; }
.swatches { flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.swatch { display: inline-flex; align-items: center; gap: 6px; }
.swatch .chip { width: 16px; height: 16px; border-radius: 4px; border: 2px solid; display: inline-block; }
.swatch.active { outline: 2px solid #c9a23a; opacity: 1; }

/* Captain's tips (first-voyage guide) */
.log-tip { color: #ffe3a3; border-left: 2px solid #c9a23a; padding-left: 6px; margin: 2px 0; }
.log-tip kbd { display: inline-block; font: 500 12.5px var(--body); color: var(--gold); background: none; border: 1px solid #8a6a32; border-radius: 1px; padding: 0 4px; margin: 0 1px; }

/* Contract line under the supplies */
.contract-line { color: #ffe3a3; margin-top: 2px; }
.contract-line:empty { display: none; }

/* ---------- The title screen (ui/title.js; owner, 2026-10-29) ----------
   No box: the name and choices sit on the world itself, lower left, over a soft shadow that
   keeps them readable by day or night. The HUD stays hidden until a voyage starts. */
body.title-up #hud { display: none; }
#title { position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0; transition: opacity 1.6s ease;
  background: radial-gradient(ellipse 60% 55% at 0% 100%, rgba(8, 6, 4, 0.62), rgba(8, 6, 4, 0) 70%); }
#title.shown { opacity: 1; }
#title.leaving { opacity: 0; transition-duration: 0.8s; }
.title-block { position: absolute; left: max(28px, 6vw); bottom: max(28px, 11vh); pointer-events: auto; }
.title-name { font-family: 'IM Fell English', serif; font-weight: 400; font-size: clamp(38px, 5.2vw, 64px); line-height: 1; letter-spacing: 0.01em; color: var(--text); margin: 0 0 18px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.title-menu { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.title-menu button { background: none; border: 0; padding: 4px 0; font-family: var(--body); font-size: 21px; color: var(--muted); cursor: pointer; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); transition: color 0.2s; }
.title-menu button.main { color: var(--gold); }
.title-menu button:hover, .title-menu button:focus-visible { color: var(--text); outline: none; }
.title-menu button::before { content: '—'; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; transition: width 0.2s; } /* a dash slides in on hover */
.title-menu button:hover::before, .title-menu button:focus-visible::before { width: 1.2em; }
.title-note { margin: 14px 0 0; font-family: var(--body); font-style: italic; font-size: 15px; color: var(--muted); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7); }

/* The crew list (left) and the log (right) fold off the sides like the order board, leaving a
   tab on the screen edge (owner, 2026-10-29). hud.js places each tab on its panel's outer edge. */
#crew-strip, #log { transition: transform 0.25s ease; }
#crew-strip.tucked { transform: translateX(calc(-100% - 12px)); }
#log.tucked { transform: translateX(calc(100% + 12px)); }
.side-tab { writing-mode: vertical-rl; padding: 12px 2px; background: var(--panel-solid); border: 1px solid var(--brass); font-family: 'IM Fell English', serif; font-size: 14px; color: var(--gold); cursor: pointer; opacity: 0.8; }
.side-tab.left { transform: rotate(180deg); border-right: 0; border-radius: 5px 0 0 5px; } /* turned to read bottom to top, so its open (right) border shows on the left, against the list */
.side-tab.right { border-right: 0; border-radius: 5px 0 0 5px; }
.side-tab:hover { color: var(--text); opacity: 1; }
/* Dev tools in folding groups (2026-10-29) */
.debug-section { border-top: 1px solid #333; padding: 3px 0; }
.debug-section > summary { cursor: pointer; font-weight: 600; color: #cfc6b0; padding: 2px 0; }
.debug-section .debug-actions { margin: 4px 0 2px; }
.debug-section .small.muted { margin: 2px 0; }
