/* NO QUARTER — P0 identity (§10.4): parchment cards, ink rules,
   IM Fell English. Blood-red only for warnings. */

:root {
  --parchment: #e6d7b4;
  --parchment-dk: #d9c69c;
  --ink: #33241a;
  --ink-soft: #5a4634;
  --teal: #0e3a41;
  --brass: #b08d3e;
  --blood: #b33a2b;
}

* { box-sizing: border-box; }

/* display:flex on #composer/#notice must not defeat the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  touch-action: none; /* no pinch-zoom / double-tap-zoom — the viewport is fixed */
  overscroll-behavior: none;
  background: var(--teal);
  color: var(--ink);
  font-family: "IM Fell English", Georgia, serif;
}

.wordmark {
  font-family: "IM Fell English SC", "IM Fell English", Georgia, serif;
  font-weight: normal;
  letter-spacing: 0.14em;
  color: var(--parchment);
  margin: 0;
}

/* ---------- gate ---------- */

#gate {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(176 141 62 / .12), transparent 60%),
    var(--teal);
}

#gate .wordmark { font-size: clamp(40px, 7vw, 72px); text-shadow: 0 2px 0 rgba(0 0 0 / .35); }

.subtitle {
  color: var(--parchment-dk);
  font-style: italic;
  margin: 4px 0 36px;
  letter-spacing: 0.08em;
}

/* the fleet's directory on the gate (§worlds): one plaque per world */
#worldPicker { margin: -24px 0 24px; }
#worldList { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
#worldList .world {
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  padding: 6px 14px;
  font-size: 14px;
  color: var(--ink);
}
#worldList .world.here { box-shadow: 0 1px 0 var(--ink) inset; }
#worldList .world.sailable { cursor: pointer; }
#worldList .world.sailable:hover { border-color: var(--ink); box-shadow: 0 4px 10px rgba(0 0 0 / .35); }
#worldList .world.dark { opacity: .45; }
#landingHint { color: var(--parchment-dk); font-style: italic; margin: 14px 0 0; }
/* the landing (§no-pets): the bare domain is a pure select page */
#gate.landing .cards { display: none; }
#gate.landing #worldList .world { font-size: 17px; padding: 12px 22px; }

.cards { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; align-items: center; }

/* The articles come rolled up; click the scroll and it opens out. */
.rolledScroll {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: transparent; border: none; padding: 12px;
  color: var(--parchment); cursor: pointer; font: inherit;
}
.rolledScroll img {
  width: 78px; image-rendering: pixelated;
  filter: drop-shadow(0 6px 14px rgba(0 0 0 / .5));
  transition: transform .15s ease;
}
.rolledScroll:hover img { transform: translateY(-4px) rotate(-2deg); }
.rolledScroll span {
  font-family: "IM Fell English SC", Georgia, serif;
  font-size: 19px; text-shadow: 0 2px 0 rgba(0 0 0 / .35);
}
#registerForm.unrolling { animation: unroll .28s ease-out; transform-origin: left center; }
@keyframes unroll {
  from { transform: scaleX(.08); opacity: .3; }
  to { transform: scaleX(1); opacity: 1; }
}

.card {
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 1px 0 var(--ink) inset, 0 0 0 4px var(--parchment) inset,
    0 6px 18px rgba(0 0 0 / .45);
  padding: 22px 26px 24px;
  width: 280px;
}

.card h2 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal;
  font-size: 22px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--ink-soft);
  padding-bottom: 8px;
}

.card label { display: block; margin: 10px 0 2px; font-size: 15px; }

.card input[type="text"], .card input:not([type]), .card input[type="password"] {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--ink-soft);
  background: transparent;
  font: inherit;
  color: var(--ink);
  padding: 3px 1px;
  outline: none;
}
.card input:focus { border-bottom-color: var(--ink); }

.tintrow { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 15px; }
.tint input { position: absolute; opacity: 0; }
.tint i {
  display: inline-block; width: 20px; height: 20px;
  background: var(--c);
  border: 1px solid var(--ink);
  cursor: pointer;
}
.tint input:checked + i { outline: 2px solid var(--brass); outline-offset: 1px; }

.sexpick { cursor: pointer; }
.sexpick input { position: absolute; opacity: 0; }
.sexpick b {
  display: inline-block; font-weight: normal;
  border: 1px solid var(--ink-soft); background: transparent;
  padding: 2px 12px; margin-right: 4px; color: var(--ink);
}
.sexpick input:checked + b { background: var(--ink); color: var(--parchment); border-color: var(--ink); }

.card button {
  margin-top: 18px;
  width: 100%;
  font: inherit;
  font-size: 16px;
  background: var(--ink);
  color: var(--parchment);
  border: 1px solid var(--ink);
  padding: 8px 0;
  cursor: pointer;
  letter-spacing: 0.05em;
}
.card button:hover { background: var(--ink-soft); }

.err { color: var(--blood); font-size: 14px; min-height: 1.2em; margin: 10px 0 0; }

/* ---------- world ---------- */

#world { position: fixed; inset: 0; overflow: hidden; }

/* image-rendering: pixelated keeps the world crisp when the 1x-backed canvas
   (see renderDpr) is upscaled to fill a retina display — nearest-neighbour, not
   a bilinear blur. No effect at devicePixelRatio 1 (no upscale). */
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; image-rendering: pixelated; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 14px;
  background: linear-gradient(rgba(51 36 26 / .88), rgba(51 36 26 / .74));
  border-bottom: 1px solid var(--brass);
  color: var(--parchment);
  font-size: 15px;
  user-select: none;
}
#topbar .wordmark.small { font-size: 17px; }
#topbar .rule { flex: 0 0 1px; height: 24px; background: var(--brass); opacity: .6; }
#onlineCount { margin-left: auto; font-style: italic; color: var(--parchment-dk); }

#topbar .stat {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; color: var(--parchment-dk);
}
#topbar .stat img { height: 24px; image-rendering: pixelated; }

#runToggle[aria-pressed="true"] { outline: 2px solid var(--brass); outline-offset: -2px; }

#logoutBtn {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 13px; letter-spacing: .08em;
  background: transparent; color: var(--parchment-dk);
  border: 1px solid var(--ink-soft); border-radius: 2px;
  padding: 2px 8px; cursor: pointer;
}
#logoutBtn:hover { color: var(--blood); border-color: var(--blood); }

#muteToggle {
  display: inline-flex; align-items: center; gap: 5px;
  font: inherit; font-size: 13px; letter-spacing: .08em;
  background: transparent; color: var(--parchment-dk);
  border: 1px solid var(--ink-soft); border-radius: 2px;
  padding: 2px 8px; cursor: pointer;
}
#muteToggle[aria-pressed="true"] { color: var(--brass); border-color: var(--brass); }
#muteToggle[aria-pressed="true"] .waves { opacity: 0; }

#soundPanel {
  position: absolute; top: 38px; right: 88px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--parchment); color: var(--ink);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 1px 0 var(--ink) inset, 0 0 0 3px var(--parchment) inset,
    0 4px 14px rgba(0 0 0 / .45);
  padding: 12px 16px;
  font-size: 14px;
  z-index: 5;
}
#soundPanel label { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
#soundPanel input[type="range"] { width: 120px; accent-color: var(--brass); }
#soundPanel button {
  font: inherit; font-size: 13px;
  background: var(--ink); color: var(--parchment);
  border: 1px solid var(--ink); padding: 3px 10px; cursor: pointer;
}
#soundPanel button[aria-pressed="true"] { background: var(--blood, #8a2a20); border-color: var(--blood, #8a2a20); }

.xpbar {
  width: 132px; height: 7px;
  margin: -4px 0 8px 24px;
  background: var(--parchment-dk);
  border: 1px solid var(--ink-soft);
}
.xpbar i { display: block; height: 100%; background: var(--brass); width: 0; }

/* ---------- the bottom tray (bag, skills, coins) ---------- */

#tray {
  position: absolute; left: 50%; bottom: 8px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 1px 0 var(--ink) inset, 0 0 0 3px var(--parchment) inset,
    0 4px 14px rgba(0 0 0 / .45);
  padding: 9px 20px;
  color: var(--ink);
  user-select: none;
}
#tray .stat { display: inline-flex; align-items: center; gap: 8px; font-size: 27px; }
#tray .stat img { height: 33px; image-rendering: pixelated; }
#tray .trayRule { width: 1px; height: 42px; background: var(--ink-soft); opacity: .45; }
#trayErrand img { height: 36px; }

.trayBtn {
  width: 63px; height: 63px;
  background: var(--parchment-dk);
  border: 1px solid var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.trayBtn img { max-width: 45px; max-height: 45px; image-rendering: pixelated; }
.trayBtn { font-size: 33px; } /* emoji buttons (careen) size like the icon ones */
.coinChip { display: inline-flex; align-items: center; gap: 7px; margin-left: auto;
  margin-right: 10px; font-size: 24px; font-weight: normal; }
.coinChip img { height: 27px; image-rendering: pixelated; }
#bagPanel h3, #gearPanel h3 { display: flex; align-items: center; }
.trayBtn:hover, .trayBtn.open { outline: 2px solid var(--brass); outline-offset: -2px; }

/* slot grids: the bag panel's 6×4, wardrobe */
#bagGrid, #wardrobe { list-style: none; margin: 0; padding: 0; display: flex; gap: 5px; }
#bagGrid li, #wardrobe li, .gearSlot {
  position: relative;
  width: 54px; height: 54px;
  background: var(--parchment-dk);
  border: 1px solid var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
#bagGrid li img, #wardrobe li img, .gearSlot img {
  max-width: 42px; max-height: 42px; image-rendering: pixelated;
}
#bagGrid li .n {
  position: absolute; right: 2px; bottom: 1px;
  font-size: 13px; font-weight: bold; color: var(--ink);
  text-shadow: 0 0 3px var(--parchment), 0 0 3px var(--parchment);
}
#bagGrid li .n.frac { font-size: 11px; letter-spacing: -0.5px; } /* "7/20" fits the corner (§container-fill) */
#hudHealth .heart { color: var(--blood); font-size: 18px; line-height: 1; }
#bagGrid { display: grid; grid-template-columns: repeat(5, 54px); gap: 5px; } /* 6 rows of 5 */
#bagGrid li.held, #wardrobe li.worn { outline: 2px solid var(--brass); outline-offset: -2px; }

#bagPanel, #gearPanel {
  position: absolute; bottom: 64px;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 6px 20px rgba(0 0 0 / .5);
  padding: 12px 14px;
  color: var(--ink);
}
#bagPanel { right: 16px; }
#gearPanel { left: 16px; }
#bagPanel h3, #gearPanel h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 18px; margin: 0 0 8px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 5px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 20px;
}
.panelClose {
  font: inherit; font-size: 18px; line-height: 1;
  background: none; border: none; color: var(--ink-soft); cursor: pointer;
}
.hint { font-size: 12px; font-style: italic; color: var(--ink-soft); margin: 8px 0 4px; max-width: 240px; }
.gearRow { display: flex; gap: 14px; align-items: flex-start; }
.skill { font-size: 21px; margin: 6px 0; display: flex; align-items: center; gap: 9px; }
.skill img { height: 24px; image-rendering: pixelated; }
.skill span { margin-left: auto; font-weight: bold; }
#skillList { max-height: 480px; overflow-y: auto; min-width: 255px; padding-right: 9px; }

.phrase {
  font-family: "IM Fell English SC", Georgia, serif;
  font-size: 20px; letter-spacing: 1px; text-align: center;
  background: var(--parchment-dk); border: 1px dashed var(--ink-soft);
  padding: 12px 10px; margin: 10px 0; user-select: all;
}

#holdPanel {
  position: absolute; bottom: 64px; right: 300px;
  background: var(--parchment); border: 1px solid var(--ink-soft);
  box-shadow: 0 6px 20px rgba(0 0 0 / .5);
  padding: 12px 14px; color: var(--ink);
}
#holdPanel h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 18px; margin: 0 0 8px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 5px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
#holdGrid {
  list-style: none; margin: 0; padding: 0;
  /* track width MUST match the li box — a narrower track makes tiles overlap
     and bury the stack count under the right-hand neighbour (Luke, 2026-08-04) */
  display: grid; grid-template-columns: repeat(6, 54px); gap: 5px;
}
#holdGrid li {
  width: 54px; height: 54px; background: var(--parchment-dk);
  border: 1px solid var(--ink-soft); position: relative; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
#holdGrid li img { max-width: 42px; max-height: 42px; image-rendering: pixelated; }
#holdGrid li .n {
  position: absolute; right: 2px; bottom: 1px; font-size: 13px; font-weight: bold;
  color: var(--ink); text-shadow: 0 0 3px var(--parchment), 0 0 3px var(--parchment);
}

/* ---------- crafting stations ---------- */
#craftPanel {
  position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
  background: var(--parchment); border: 1px solid var(--ink-soft);
  box-shadow: 0 6px 20px rgba(0 0 0 / .5);
  padding: 12px 14px; color: var(--ink); min-width: 280px;
}
#craftPanel h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 18px; margin: 0 0 8px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 5px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 20px;
}
#craftList { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
#craftList li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px;
  align-items: center; padding: 6px 0;
  border-bottom: 1px dashed rgba(0 0 0 / .15);
}
#craftList li:last-child { border-bottom: none; }
#craftList .craftName { margin: 0; font-weight: bold; font-size: 14px; }
#craftList .hint { margin: 0; grid-column: 1; }
#craftList button {
  grid-column: 2; grid-row: 1 / span 2; font: inherit; font-size: 13px;
  padding: 4px 12px; cursor: pointer;
  background: var(--parchment-dk); border: 1px solid var(--ink-soft); color: var(--ink);
}
#craftList button:disabled { opacity: .45; cursor: default; }
#gearPreview { background: var(--parchment-dk); border: 1px solid var(--ink-soft); image-rendering: pixelated; }
.gearSlot { width: 40px; height: 40px; }

/* ---------- drag-and-drop equip ---------- */
#bagGrid li, #wardrobe li { cursor: grab; }
.drag-ghost {
  position: fixed; z-index: 30; pointer-events: none;
  width: 34px; height: 34px; image-rendering: pixelated;
  transform: translate(-50%, -50%); opacity: .9;
  filter: drop-shadow(0 3px 4px rgba(0 0 0 / .55));
}
.droptarget { outline: 2px dashed var(--brass); outline-offset: -2px; animation: dropPulse .9s ease-in-out infinite; }
@keyframes dropPulse { 50% { background: rgba(176 141 62 / .28); } }

/* ---------- chess ---------- */

#ctxMenu {
  position: absolute;
  z-index: 14;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 4px 14px rgba(0 0 0 / .5);
  display: flex; flex-direction: column;
  min-width: 150px;
}
#ctxMenu button {
  font: inherit; font-size: 14px; text-align: left;
  background: none; border: none; color: var(--ink);
  padding: 7px 12px; cursor: pointer;
  border-bottom: 1px dotted rgba(90 70 52 / .3);
}
#ctxMenu button:last-child { border-bottom: none; color: var(--ink-soft); font-style: italic; }
#ctxMenu button:hover { background: var(--parchment-dk); }

#tradeReq {
  position: absolute; top: 18%; left: 50%;
  transform: translateX(-50%);
  z-index: 13;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 6px 20px rgba(0 0 0 / .5);
  padding: 12px 18px;
  color: var(--ink);
}
#tradeReq p { margin: 0 0 10px; font-size: 15px; }

#tradePanel {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 8px 24px rgba(0 0 0 / .55);
  padding: 12px 16px;
  color: var(--ink);
  min-width: 380px;
}
#tradePanel h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 18px; margin: 0 0 8px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 5px;
  display: flex; justify-content: space-between; gap: 20px;
}
.tradeCols { display: flex; gap: 16px; }
.tradeCol { flex: 1; }
.tradeList {
  list-style: none; margin: 0; padding: 4px;
  display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start;
  min-height: 78px; width: 170px;
  background: var(--parchment-dk);
  border: 1px solid var(--ink-soft);
}
.tradeList li {
  position: relative; width: 32px; height: 32px;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.tradeList li img { max-width: 24px; max-height: 24px; image-rendering: pixelated; }
.tradeList li .n {
  position: absolute; right: 1px; bottom: 0;
  font-size: 10px; font-weight: bold;
  text-shadow: 0 0 2px var(--parchment);
}
#tradeTheirs li canvas, #tradeMine li canvas { image-rendering: pixelated; }
#tradeReview:disabled { opacity: .45; cursor: default; }
.tradeCoins { font-size: 14px; display: block; margin-top: 6px; }
.tradeCoins input {
  width: 70px; font: inherit;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  padding: 1px 4px;
}
#tradePanel.locked .tradeList, #tradePanel.locked .tradeCoins { opacity: .55; pointer-events: none; }

#betDlg {
  position: absolute; top: 10%; left: 50%;
  transform: translate(-50%, 0);
  z-index: 12; /* above the chess board, which a spectator may have open */
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 8px 24px rgba(0 0 0 / .55);
  padding: 12px 16px;
}
#betDlg h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 16px;
  margin: 0 0 10px; text-align: center;
}
#betDlg .chessBtns { gap: 8px; margin-top: 0; }

#chessDlg {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 8px 24px rgba(0 0 0 / .55);
  padding: 18px 24px 18px; /* board scaled 1.5x (2026-07-30) — chrome follows */
}
#chessDlg h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 27px;
  margin: 0 0 12px; text-align: center;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 9px;
}
#chessBoard {
  display: grid;
  grid-template-columns: repeat(8, 63px);
  grid-template-rows: repeat(8, 63px); /* squares authored at 63px, drawn 1:1 */
  border: 2px solid var(--ink);
}
#chessBoard .sq {
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
#chessBoard .sq.light { background: url(assets/chess-sq-light.png); background-size: 100% 100%; }
#chessBoard .sq.dark { background: url(assets/chess-sq-dark.png); background-size: 100% 100%; }
#chessBoard .sq.sel { outline: 4px solid var(--brass); outline-offset: -4px; }
#chessBoard .sq.last { box-shadow: inset 0 0 0 63px rgba(176 141 62 / .25); }
#chessBoard .sq.flash { animation: sqFlash .7s ease-out; }
@keyframes sqFlash {
  0% { box-shadow: inset 0 0 0 63px rgba(216 185 106 / .8); }
  100% { box-shadow: inset 0 0 0 63px rgba(176 141 62 / .25); }
}
#chessBoard .sq img { filter: drop-shadow(0 2px 2px rgba(0 0 0 / .35)); }
.chessBtns { display: flex; justify-content: space-between; margin-top: 10px; }
#chessDlg .chessBtns { justify-content: center; margin-top: 15px; }
#chessDlg .chessBtns button { font-size: 21px; padding: 9px 24px; }
.chessBtns button {
  font: inherit; font-size: 14px;
  background: var(--ink); color: var(--parchment);
  border: 1px solid var(--ink); padding: 3px 14px; cursor: pointer;
}
.chessBtns button:hover { background: var(--ink-soft); }

#syslog {
  position: absolute; left: 12px; bottom: 64px;
  display: flex; flex-direction: column; gap: 2px;
  pointer-events: none;
}
.sysline {
  color: var(--parchment-dk);
  font-style: italic;
  font-size: 20px;
  text-shadow: 0 1px 3px rgba(0 0 0 / .8);
  animation: sysfade 8s forwards;
}
@keyframes sysfade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

#composer {
  /* ABOVE the tray (Joel, 2026-08-08): a long message must stay readable
     while you type, not sink behind the bottom bar */
  position: absolute; left: 12px; right: 12px; bottom: 92px;
  display: flex; align-items: baseline; /* no flex gap: the caret must hug the text */
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  padding: 7px 12px;
  font-size: 16px;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(0 0 0 / .4);
}
#composer .quill { color: var(--ink-soft); margin-right: 8px; }
#composer .chan { margin-right: 8px; padding: 1px 7px; border-radius: 3px; font-size: 12px;
  letter-spacing: .04em; background: var(--blood, #8a2a20); color: #f3e7cf; font-style: normal; }
#composerText { white-space: pre; } /* trailing spaces hold, so the caret advances on space */
#composer .count { margin-left: auto; font-size: 12px; color: var(--ink-soft); font-style: italic; }
#composer .count.zero { color: var(--blood, #8a2a20); font-weight: bold; font-style: normal; }
#composer.overfull { animation: composerNo .18s ease; }
@keyframes composerNo {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
#composer .caret {
  display: inline-block; width: 1px; height: 1em;
  background: var(--ink); transform: translateY(2px);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

#roster {
  position: absolute; top: 48px; right: 14px;
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  padding: 12px 18px;
  min-width: 160px;
  box-shadow: 0 4px 14px rgba(0 0 0 / .4);
}
#roster h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; margin: 0 0 6px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 4px;
}
#roster ul { list-style: none; margin: 0; padding: 0; font-size: 15px; }
#roster li { padding: 1px 0; }

#shop {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  padding: 14px 20px 12px;
  min-width: 280px;
  box-shadow: 0 6px 20px rgba(0 0 0 / .5);
}
#shop h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; margin: 0 0 8px; font-size: 20px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 6px;
  display: flex; justify-content: space-between; align-items: baseline;
}
#shopClose {
  font: inherit; font-size: 18px; line-height: 1;
  background: none; border: none; color: var(--ink-soft); cursor: pointer;
}
#shop ul { list-style: none; margin: 0; padding: 0; }
#shop li {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 15px;
  border-bottom: 1px dotted rgba(90 70 52 / .35);
}
#shop li .swatch { width: 26px; height: 26px; image-rendering: pixelated; }
#shop li.shopEmpty { justify-content: center; font-style: italic; color: var(--ink-soft); border: none; padding: 12px 0; }
#shop li .hatname { flex: 1; }
#shop li .price { font-style: italic; color: var(--ink-soft); }
#shop li button {
  font: inherit; font-size: 13px;
  background: var(--ink); color: var(--parchment);
  border: 1px solid var(--ink); padding: 2px 10px; cursor: pointer;
}
#shop li button:hover { background: var(--ink-soft); }
#shop li button.worn { background: var(--brass); border-color: var(--brass); color: var(--ink); }
#shop .shopCoins { font-size: 13px; font-style: italic; color: var(--ink-soft); margin: 8px 0 0; }

/* ---------- ship controls in the tray (ocean only) ---------- */
#landHud, #shipHud { display: inline-flex; align-items: center; gap: 14px; }
#shipHud #hudHull { font-size: 17px; }
/* §crew-helm: a riding passenger keeps only the hull readout and the way back */
#shipHud.riding > *:not(#hudHull):not(#returnDeckBtn) { display: none; }
#returnDeckBtn { font: inherit; font-size: 13px; letter-spacing: .04em;
  background: var(--brass); color: #1a1208; border: 1px solid #d8a95a;
  border-radius: 3px; padding: 3px 10px; cursor: pointer; }
.trayGrp { display: inline-flex; align-items: center; gap: 5px; }
.trayGrp b { font-family: "IM Fell English SC", Georgia, serif; font-weight: normal; font-size: 15px; }
.trayGrp button {
  font: inherit; font-size: 14px; background: var(--parchment-dk);
  border: 1px solid var(--ink-soft); color: var(--ink); padding: 3px 10px; cursor: pointer;
}
.trayGrp button.active { background: var(--ink); color: var(--parchment); border-color: var(--ink); }
.trayGrp button:not(.active):hover { background: var(--ink-soft); color: var(--parchment); }
.trayGrp.guns button { background: var(--blood); color: var(--parchment); border-color: var(--ink); }
.trayGrp.guns button:hover { background: #c94636; }
.trayGrp.guns button:disabled { background: var(--parchment-dk); color: var(--ink-soft); cursor: default; }
#anchorBtn {
  font: inherit; font-size: 14px; background: var(--brass); color: var(--ink);
  border: 1px solid var(--ink); padding: 3px 12px; cursor: pointer;
}
#anchorBtn:hover { background: #c9a860; }
#boardBtn {
  font: inherit; font-size: 14px; background: var(--parchment-dk); color: var(--ink-soft);
  border: 1px solid var(--ink); padding: 3px 12px; cursor: pointer; font-weight: bold;
}
#boardBtn.ready { background: var(--blood); color: var(--parchment); animation: boardPulse 1s ease-in-out infinite; }
#boardBtn:hover { background: #c94636; color: var(--parchment); }
@keyframes boardPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(178, 34, 34, 0.6); } 50% { box-shadow: 0 0 6px 3px rgba(178, 34, 34, 0.6); } }

#bagGrid li.unsellable { opacity: .35; }

#notice {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14 58 65 / .82);
  color: var(--parchment);
  font-size: 22px; font-style: italic;
  text-align: center; padding: 24px;
}

@media (prefers-reduced-motion: reduce) {
  #composer .caret { animation: none; }
}

/* ---------- zones of law ---------- */
#zoneBanner {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  font-family: "IM Fell English SC", Georgia, serif; font-size: 20px;
  letter-spacing: 1px; padding: 8px 22px; pointer-events: none;
  background: rgba(20, 12, 8, .82); border: 1px solid var(--ink-soft);
  color: var(--parchment); text-align: center;
}
#zoneBanner.zone-lawless { color: #e05a3a; }

/* the trade's loud moments: the other side moved first — don't miss it */
#tradeStatus.urgent {
  color: var(--brass); font-weight: bold; font-style: normal;
  animation: tradePulse 1.1s ease-in-out infinite alternate;
}
@keyframes tradePulse { from { opacity: 1; } to { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { #tradeStatus.urgent { animation: none; } }

/* the chat log (§chat-log): the bubble fades, the log remembers */
#chatLogPanel {
  /* default berth sits CLEAR of the composer (Joel: you must see what you
     type) — and every panel is draggable by its header anyway (§panels) */
  position: absolute; bottom: 140px; left: 16px; width: 360px;
  background: var(--parchment); border: 1px solid var(--ink-soft);
  box-shadow: 0 6px 20px rgba(0 0 0 / .5);
  padding: 12px 14px; color: var(--ink);
}
#chatLogPanel h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 18px; margin: 0 0 8px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 5px;
  display: flex; justify-content: space-between; align-items: baseline;
}
#chatLogTabs { display: flex; gap: 4px; margin: 0 0 6px; }
#chatLogTabs .logTab {
  font-family: "IM Fell English SC", Georgia, serif; font-size: 13px;
  background: none; border: 1px solid var(--ink-soft); color: var(--ink-soft);
  padding: 1px 10px; cursor: pointer;
}
#chatLogTabs .logTab.active {
  color: var(--ink); border-color: var(--ink); background: rgba(0 0 0 / .05);
}
#chatLogLines { max-height: 260px; overflow-y: auto; font-size: 13px; line-height: 1.45; }
#chatLogLines .chatline { padding: 1px 0; overflow-wrap: break-word; }
#chatLogLines .when { color: var(--ink-soft); font-size: 11px; margin-right: 2px; }
#chatLogLines .sys { color: var(--ink-soft); font-style: italic; }
#chatLogLines .quest { color: var(--brass); font-style: italic; }
#chatLogLines .who-player { color: #1f4e79; font-weight: bold; }
#chatLogLines .who-npc { color: #7a4d1f; font-weight: bold; }
#chatLogLines .who-quest { color: #a8842a; font-weight: bold; } /* quest speech: gold (§log-colors) */
#chatLogLines .who-matey { color: #3e7d46; font-weight: bold; } /* a matey's words: green (§me-mateys) */

/* the roster's Me Mateys section (§me-mateys) */
#rosterList .rosterHead {
  font-family: "IM Fell English SC", Georgia, serif; font-size: 13px;
  color: var(--ink-soft); border-bottom: 1px solid var(--ink-soft);
  margin-top: 4px; padding-bottom: 2px;
}
#rosterList .matey { color: #3e7d46; }
#rosterList .ashore { color: var(--ink-soft); font-style: italic; }
#chatBtn.unread { outline: 2px solid var(--brass); outline-offset: -2px; }

/* the in-game tooltip (§tooltip): instant, parchment, follows the cursor */
#tooltip {
  position: fixed; z-index: 40; pointer-events: none;
  background: var(--parchment); color: var(--ink);
  border: 1px solid var(--ink-soft); box-shadow: 0 3px 10px rgba(0 0 0 / .4);
  padding: 4px 10px; font-size: 13px; max-width: 280px; line-height: 1.4;
}

/* what's new (§whats-new): the last release's log, for returning souls */
#newsPanel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--parchment); border: 1px solid var(--ink-soft);
  box-shadow: 0 8px 24px rgba(0 0 0 / .55);
  padding: 16px 22px; color: var(--ink);
  width: min(560px, 86vw);
}
#newsPanel h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 22px; margin: 0 0 8px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 6px;
  display: flex; justify-content: space-between; align-items: baseline;
}
#newsLines {
  margin: 0 0 12px; padding-left: 20px; max-height: 46vh; overflow-y: auto;
  font-size: 14px; line-height: 1.5;
}
#newsLines li { margin: 4px 0; }
#newsOk {
  display: block; margin: 0 auto;
  font-family: "IM Fell English SC", Georgia, serif; font-size: 16px;
  background: none; border: 1px solid var(--ink); color: var(--ink);
  padding: 4px 18px; cursor: pointer;
}
#newsOk:hover { color: var(--brass); border-color: var(--brass); }

/* the flag designer (§flags): paint the colors your ship will fly */
#flagPanel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--parchment); border: 1px solid var(--ink-soft);
  box-shadow: 0 8px 24px rgba(0 0 0 / .55);
  padding: 14px 18px; color: var(--ink);
}
#flagPanel h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 18px; margin: 0 0 6px;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 5px;
  display: flex; justify-content: space-between; align-items: baseline;
}
#flagGrid {
  display: grid; gap: 1px; width: max-content; margin: 10px auto;
  border: 1px solid var(--ink-soft); background: var(--ink-soft); padding: 1px;
}
#flagGrid .flagCell { width: 22px; height: 22px; cursor: crosshair; touch-action: none; }
#flagRow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#flagSwatches { display: flex; gap: 4px; }
#flagSwatches .flagPot {
  width: 22px; height: 22px; border: 1px solid var(--ink-soft); cursor: pointer; padding: 0;
}
#flagSwatches .flagPot.active { outline: 2px solid var(--brass); outline-offset: 1px; }
#flagHoist {
  font-family: "IM Fell English SC", Georgia, serif; font-size: 15px;
  background: none; border: 1px solid var(--ink); color: var(--ink);
  padding: 3px 14px; cursor: pointer;
}
#flagHoist:hover { color: var(--brass); border-color: var(--brass); }

/* the law chip: always on the tray once the law is known */
#hudZone.zone-lawful { color: #7da87a; }
#hudZone.zone-lawless { color: #e05a3a; }

/* named regions: a quieter ribbon under the law banner */
#regionBanner {
  position: absolute; top: 110px; left: 50%; transform: translateX(-50%);
  font-family: "IM Fell English", Georgia, serif; font-style: italic;
  font-size: 17px; letter-spacing: 1px; padding: 5px 18px; pointer-events: none;
  background: rgba(20, 12, 8, .66); border: 1px solid var(--ink-soft);
  color: var(--parchment); text-align: center;
}
#regionBanner.region-dangerous { color: #e05a3a; }
#regionBanner.region-safe { color: #9ad08a; }

/* ---------- the honor board ---------- */
#honorDlg {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--parchment);
  border: 1px solid var(--ink-soft);
  box-shadow: 0 8px 24px rgba(0 0 0 / .55);
  padding: 18px 26px; min-width: 380px;
}
#honorDlg h3 {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: normal; font-size: 24px;
  margin: 0 0 10px; text-align: center;
  border-bottom: 1px solid var(--ink-soft); padding-bottom: 8px;
}
#honorRows { list-style: none; margin: 0; padding: 0; font-size: 17px; }
#honorRows li { display: flex; gap: 10px; padding: 3px 0; align-items: baseline; }
#honorRows .rank { width: 26px; text-align: right; color: var(--ink-soft); }
#honorRows .name { flex: 1; }
#honorRows .elo { font-weight: bold; min-width: 48px; text-align: right; }
#honorRows .rec { color: var(--ink-soft); min-width: 64px; text-align: right; font-style: italic; }
#honorRows .honorEmpty { font-style: italic; color: var(--ink-soft); justify-content: center; }
