:root {
  font-family: Georgia, serif;
  font-synthesis: none;
  color: #193e43;
  background: #e9dfc7;
  --sw-on-surface: #193e43;
  --sw-on-raised: #193e43;
  --sw-raised: #eee4ce;
  --sw-action: #286765;
  --sw-on-action: #fff8e9;
  --sw-focus: #a45439;
  --sw-positive: #25644e;
  --sw-danger: #a43f2d;
  --sw-radius: 4px;
  --sw-quick: 120ms;
  --sw-body: Georgia, serif;
  --sw-display: Georgia, serif;
  --sw-muted: #516965;
  --sw-surface: #faf5e8;
  --sw-border: #c7b28e;
  --sw-accent: #286765;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 70% 0, #f7ecd4, #e9dfc7 65%);
}
button, input, select { font: inherit; }
button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #286765;
  color: #fff8e9;
  padding: .7rem .9rem;
  font-weight: bold;
}
button:hover { background: #3c807b; }
button:disabled { cursor: default; opacity: .5; }
button.secondary, button.quiet {
  background: #ede4d0;
  color: #305d5a;
  border-color: #bba886;
}
button.secondary:hover, button.quiet:hover { background: #ded2b8; }
:focus-visible { outline: 3px solid #a45439; outline-offset: 3px; }
.mast {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding: .5rem max(4vw, 1rem);
  border-bottom: 1px solid #bfaa87;
}
.mast > a {
  font: 700 .75rem system-ui;
  color: #45696a;
  text-decoration: none;
  text-transform: uppercase;
}
.brand { display: flex; align-items: center; gap: .6rem; margin: auto; font-size: 1.15rem; }
.mast-controls { display: flex; flex: 0 0 auto; align-items: center; gap: .4rem; }
#keyboard-help { padding-inline: .6rem; }
dialog.shortcut-help {
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  padding: clamp(.9rem, 3vw, 1.5rem);
  border: 1px solid #a98c60;
  border-radius: .4rem;
  background: #fbf2de;
  color: #173f40;
  box-shadow: 0 1rem 3rem #10292960;
}
dialog.shortcut-help::backdrop { background: #102e30a8; }
@media (max-width: 420px) {
  .mast-controls { gap: .3rem; }
  .mast .brand { gap: .2rem; }
  .mast .compass { font-size: 1.3rem; }
  .mast-controls #sound-toggle { padding-inline: .35rem; }
  .mast-controls #lobby-button { max-width: 5.1rem; }
}
.compass { font-size: 1.9rem; color: #a95f42; }
main { max-width: 1450px; margin: auto; padding: 1.25rem max(4vw, 1rem) 4rem; }
#notice:not(:empty) {
  background: #fff5d8;
  padding: .75rem;
  margin-bottom: 1rem;
  border-left: 3px solid #b46c4b;
  overflow-wrap: anywhere;
}
.intro { display: flex; justify-content: space-between; align-items: center; min-height: 245px; gap: 1rem; }
.intro > div:first-child { max-width: 560px; }
h1 { font-size: clamp(2.35rem, 5vw, 4.7rem); line-height: 1; margin: .5rem 0 1rem; font-weight: normal; }
h1 em { color: #9d5139; }
h2 { font-size: 1.35rem; font-weight: normal; margin: .3rem 0 .75rem; }
p { line-height: 1.5; }
.intro-art {
  width: 280px;
  height: 200px;
  position: relative;
  overflow: hidden;
  background: #bbd1c1;
  border-radius: 50% 50% 12% 12%;
}
.sun { position: absolute; right: 42px; top: 28px; width: 53px; height: 53px; background: #e9a478; border-radius: 50%; }
.sail { position: absolute; left: 112px; top: 53px; border-bottom: 80px solid #fff5db; border-right: 52px solid transparent; }
.boat {
  position: absolute;
  top: 142px;
  left: 91px;
  width: 105px;
  height: 24px;
  background: #a4553e;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.wave {
  position: absolute;
  bottom: 0;
  background: #518e8d;
  color: #c5e0cf;
  width: 100%;
  height: 37px;
  text-align: center;
  font-size: 2rem;
}
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card {
  min-width: 0;
  background: #faf5e8;
  border: 1px solid #d4c9af;
  border-radius: 4px;
  padding: 1.05rem;
  box-shadow: 0 3px 12px #644f2910;
}
.stack { display: grid; gap: .5rem; margin: 1rem 0; }
.stack button { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; text-align: left; }
.stack button span { font: .74rem system-ui; }
.muted { font: .8rem/1.5 system-ui; color: #516965; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .55rem 0;
  border-bottom: 1px solid #e5dece;
  overflow-wrap: anywhere;
}
.list-row button { padding: .45rem .7rem; font-size: .8rem; }
#show-record { margin: .5rem 0 1.1rem; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.game-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: .1rem 0; }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  grid-template-areas: 'board actions';
  align-items: start;
  gap: 1rem;
}
.layout > #board { grid-area: board; }
.layout > #actions { grid-area: actions; }

/* Stations are positioned over the landforms drawn in chart.js. */
.board {
  position: relative;
  height: 710px;
  border: 8px solid #745440;
  border-radius: 4px;
  box-shadow: 0 4px 0 #503c30;
  background: #79aaa3;
  overflow: hidden;
}
#harbor-map, #ports { position: absolute; inset: 0; width: 100%; height: 100%; }
#harbor-map { display: block; }
.tile {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  width: 16.4%;
  min-height: 82px;
  padding: .35rem;
  background: #f6ead1;
  border: 1px solid #dac6a2;
  border-top: 4px solid var(--group-color, #527e78);
  border-radius: 3px;
  box-shadow: 0 2px 4px #274a4950;
  overflow-wrap: anywhere;
}
[data-group="0"] { --group-color: #ad5d45; }
[data-group="1"] { --group-color: #966c32; }
[data-group="2"] { --group-color: #4d8780; }
[data-group="3"] { --group-color: #796584; }
.tile.tide { background: #dfebd8; }
.tile strong { font-size: clamp(.66rem, 1.1vw, .95rem); line-height: 1.12; margin-bottom: .32rem; }
.stop { font: 700 .59rem system-ui; color: #815d48; margin-bottom: .13rem; }
.deed { margin-top: auto; font: 700 .62rem/1.18 system-ui; color: #315954; }
.tile:nth-child(1) { left: 10%; top: 56%; }
.tile:nth-child(2) { left: 14%; top: 40%; }
.tile:nth-child(3) { left: 22%; top: 22%; }
.tile:nth-child(4) { left: 35%; top: 12%; }
.tile:nth-child(5) { left: 52%; top: 14%; }
.tile:nth-child(6) { left: 56%; top: 32%; }
.tile:nth-child(7) { left: 69%; top: 20%; }
.tile:nth-child(8) { left: 80%; top: 30%; }
.tile:nth-child(9) { left: 88%; top: 44%; }
.tile:nth-child(10) { left: 90%; top: 58%; }
.tile:nth-child(11) { left: 82%; top: 74%; }
.tile:nth-child(12) { left: 70%; top: 86%; }
.tile:nth-child(13) { left: 54%; top: 76%; }
.tile:nth-child(14) { left: 37%; top: 86%; }
.tile:nth-child(15) { left: 21%; top: 20.600%; }
.seat-0 { --c: #a34430; }
.seat-1 { --c: #245977; }
.seat-2 { --c: #806125; }
.seat-3 { --c: #655078; }
.tokens { display: flex; flex-wrap: wrap; gap: 2px; }
.tokens:not(:empty) { margin-top: .22rem; }
.token {
  width: 23px;
  height: 20px;
  display: grid;
  place-items: end center;
  padding-bottom: 2px;
  background: var(--c);
  color: #fff8eb;
  clip-path: polygon(49% 0, 78% 58%, 100% 58%, 84% 100%, 16% 100%, 0 58%, 41% 58%);
  font: 700 .64rem system-ui;
}
.players { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr)); gap: .5rem; }
.player { padding: .55rem; border-left: 4px solid var(--c); background: #f0eadb; overflow-wrap: anywhere; }
.player strong, .player small { display: block; }
.player small { font: .71rem system-ui; margin-top: .3rem; }
.groups { display: flex; flex-wrap: wrap; gap: .45rem .9rem; padding: 0; list-style: none; font: .7rem system-ui; }
.groups li::before { content: ''; display: inline-block; background: var(--group-color); width: .65rem; height: .65rem; margin-right: .3rem; }
.action-card h2 { font-size: 1.55rem; }
.action-card button { width: 100%; margin: .25rem 0; }
.action-card select, .action-card input {
  width: 100%;
  padding: .45rem;
  margin: .25rem 0 .65rem;
  border: 1px solid #c9bda6;
  background: #fffdf5;
}
.action-card label { font: 700 .75rem system-ui; color: #516965; }
.log p { font: .8rem/1.5 system-ui; border-bottom: 1px solid #ece4d3; padding-bottom: .5rem; overflow-wrap: anywhere; }
.offer { background: #e6efe3; padding: .7rem; margin: .6rem 0; overflow-wrap: anywhere; }
.turn-attention {
  padding: .55rem .7rem;
  margin: .35rem 0 .6rem;
  border: 1px solid #c59350;
  border-inline-start: .28rem solid #9b6527;
  border-radius: .3rem;
  background: #fff0cc;
  overflow-wrap: anywhere;
}
.turn-attention p { margin: .35rem 0 .5rem; }
.counteroffer dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: .45rem 0; }
.counteroffer dl > div { padding: .4rem .5rem; background: #fff8e8; border-radius: .25rem; }
.counteroffer dt { font: 700 .73rem system-ui, sans-serif; }
.counteroffer dd { margin: .15rem 0 0; font-weight: bold; }
.counteroffer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.counteroffer-actions button { padding-inline: .35rem; }
.turn-round { margin: .3rem 0 .55rem; }
.fast-queue:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .35rem;
  font: 650 .76rem/1.2 system-ui, sans-serif;
}
.action-card .fast-queue button { width: auto; margin: 0; padding: .25rem .4rem; }
.dice { font-size: 1.1rem; letter-spacing: .12em; }
details { margin-top: .85rem; border-top: 1px solid #ddd3be; padding-top: .65rem; }
summary { cursor: pointer; font-weight: bold; }
details[open] summary { margin-bottom: .6rem; }

@media (max-width: 850px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: 'actions' 'board';
  }
}

@media (max-width: 600px) {
  .brand { font-size: .98rem; gap: .35rem; }
  .mast > a { font-size: .6rem; }
  .mast button { padding: .45rem .55rem; }
  .intro-art { width: 110px; height: 130px; flex-shrink: 0; }
  .intro-art .sail { left: 36px; top: 34px; transform: scale(.65); transform-origin: top left; }
  .intro-art .boat { left: 21px; top: 95px; transform: scale(.65); transform-origin: top left; }
  .intro-art .sun { width: 30px; height: 30px; right: 10px; }
  .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .board { height: 610px; border-width: 5px; }
  .tile { width: 17%; min-height: 62px; padding: .22rem; border-top-width: 3px; }
  .tile strong { font-size: .67rem; }
  .deed { font-size: .55rem; }
  .token { width: 15px; height: 15px; font-size: .48rem; }
}

/* Forty-stop atlas: numbered stations keep the entire route legible; select one for its deed. */
main{max-width:none;padding:1rem clamp(.6rem,1.2vw,1.2rem) 3rem}.mast{padding-inline:clamp(.6rem,1.2vw,1.2rem)}
.layout{grid-template-columns:minmax(0,1fr) minmax(245px,300px)}
.board{height:clamp(630px,calc(100vh - 220px),860px)}
#ports[data-count="40"] .tile{width:min(4.6%,44px);height:auto;min-height:0;max-height:none;aspect-ratio:1;display:grid;place-items:center;padding:0;border:2px solid #f7ead2;border-radius:50%;background:#493224;color:#fff8e8;box-shadow:0 1px 3px #173f40;font:700 clamp(.55rem,.7vw,.8rem) system-ui;overflow:visible}
#ports[data-count="40"] .tile[data-group] { background: var(--group-color); }
[data-group="0"] { --group-color: #96382c; }
[data-group="1"] { --group-color: #795016; }
[data-group="2"] { --group-color: #235f43; }
[data-group="3"] { --group-color: #075a64; }
[data-group="4"] { --group-color: #254c9a; }
[data-group="5"] { --group-color: #64377f; }
[data-group="6"] { --group-color: #8a2d67; }
[data-group="7"] { --group-color: #763d27; }
#ports[data-count="40"] .tile strong,#ports[data-count="40"] .tile .deed,#ports[data-count="40"] .tile .art{display:none}#ports[data-count="40"] .tile small.stop{font:inherit;color:inherit}#ports[data-count="40"] .tile .tokens{position:absolute;top:-.6rem;left:65%;display:flex;z-index:3}#ports[data-count="40"] .token {
  width: 26px;
  height: 26px;
  place-items: center;
  padding: 0;
  border: 2px solid #fff6d8;
  border-radius: 50%;
  clip-path: none;
  font-size: .78rem;
}
#ports .tile.traversed{outline:4px solid #f8ca55;z-index:5}.sailing-ship{position:absolute;display:grid;place-items:center;transform:translate(-50%,-50%);width:28px;height:28px;border-radius:50%;background:var(--c);color:#fff;border:3px solid #fff5dc;font:700 13px system-ui;z-index:8;box-shadow:0 2px 8px #2348;pointer-events:none;transition:left .2s ease,top .2s ease}
.port-detail {
  position: absolute;
  top: 43%;
  left: 47%;
  transform: translate(-50%, -50%);
  width: min(54%, 15rem);
  z-index: 2;
  display: grid;
  gap: .2rem;
  padding: .65rem .8rem;
  border-left: 4px solid #a44731;
  border-radius: 3px;
  background: #fff1cd;
  color: #163f40;
  box-shadow: 0 2px 8px #142b3b77;
  pointer-events: none;
}.port-detail small{font:700 .62rem system-ui;letter-spacing:.1em;color:#a45640}.port-detail strong{font-size:1.2rem}.port-detail span{font:.78rem system-ui}
@media(max-width:850px){.layout{grid-template-columns:1fr}.board{height:760px}}
@media(max-width:600px){main{padding-inline:.5rem}.board{height:690px}#ports[data-count="40"] .tile{width:7%;min-height:0;max-height:none;font-size:.55rem}#ports[data-count="40"] .token{width:21px;height:21px;font-size:.68rem}}
@media(prefers-reduced-motion:reduce){.sailing-ship{transition:none}}
/* Stronger wayfinding for a busy exchange. */
body{background:#e9ddc1;color:#173f40}.mast{background:#183f40;color:#f7e9c9;border:0;min-height:76px}.mast>a{color:#e8d5ae}.mast .compass{color:#e4a675}.mast .quiet{background:transparent;color:#f6e8ca;border-color:#8ead9f}.brand strong{font-size:1.35rem;letter-spacing:.02em}.intro{min-height:235px}.intro h1{letter-spacing:-.045em}.intro p{font-size:1.05rem;max-width:56ch}.card{border:1px solid #c3ad85;box-shadow:0 4px 14px #5f4b2514}.action-card{border-top:6px solid #ae6348}.action-card h2{font-size:1.75rem}.action-card>p{font-size:1rem}.ledger{border-top:6px solid #52867d}.log{border-top:6px solid #bf9756}.game-head h1{font-size:clamp(2rem,3vw,3rem);letter-spacing:-.035em}.board{box-shadow:0 5px 0 #503c30,0 12px 30px #624a2b2b}.player{background:#eee5d2;border-left-width:6px}.player strong{font-size:1rem}.player small{line-height:1.4}.tile:focus-visible{outline:4px solid #f6cd67;z-index:10}.tile:hover{filter:brightness(1.12)}
@media(max-width:600px){.mast{min-height:65px;height:auto;padding-block:.6rem}.brand strong{font-size:1rem}.game-head h1{font-size:1.8rem}.intro p{font-size:.92rem}.action-card h2{font-size:1.4rem}}
/* Captain marks match the ships on the chart, including for colour-blind players. */
.captain-strip{margin:0 0 .85rem}.captain-strip .players{grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:.4rem}.captain-strip .player{background:#fbf3df;padding:.55rem .75rem;min-width:0}.captain-mark{display:inline-grid;place-items:center;vertical-align:middle;background:var(--c);color:white;border:2px solid #fff6e2;width:25px;height:25px;border-radius:50%;font:700 .75rem system-ui}.captain-strip .player small{margin-left:2rem;overflow-wrap:anywhere}.token.in-motion{visibility:hidden}
#ports[data-count="40"] .tile.owned{box-shadow:0 0 0 3px var(--owner),0 2px 4px #173f40}
.owner-0{--owner:#bd694e}.owner-1{--owner:#356e7a}.owner-2{--owner:#b2904e}.owner-3{--owner:#786d92}
#ports[data-count="40"] .tile.active-port{outline:3px solid #fff0a2;outline-offset:2px;z-index:4}
#ports[data-count="40"] .tile .tokens{top:-.7rem;left:58%;filter:drop-shadow(0 1px 2px #173f40)}
.port-directory{margin:.7rem 0}.port-directory summary{padding:.55rem 0}.port-directory #port-directory{max-height:22rem;overflow:auto;margin-top:.5rem}.port-directory button{width:100%;display:flex;justify-content:space-between;gap:.5rem;text-align:left;border:0;border-bottom:1px solid #d9cbb2;border-radius:0;background:transparent;color:#244e4d;font:600 .75rem system-ui;padding:.55rem .2rem}.port-directory button:hover,.port-directory button:focus-visible{background:#e4ecdb}.port-directory button small{white-space:nowrap;font:400 .7rem system-ui;color:#6d7665}
@media(max-width:600px){.captain-strip .players{grid-template-columns:repeat(2,minmax(0,1fr))}.captain-strip .player{padding:.4rem;font-size:.8rem}.captain-strip .player small{margin-left:0;font-size:.67rem}.captain-mark{width:22px;height:22px}.board{height:650px}#ports[data-count="40"] .tile{width:7.2%}}

/* The wide chart puts deed cards around the water, with controls in the open sea. */
.layout:has(#ports[data-count="40"]) {
  position: relative;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: 'board board';
}
.layout:has(#ports[data-count="40"]) > #actions {
  position: absolute;
  left: 12%;
  top: 15%;
  z-index: 4;
  grid-area: auto;
  width: clamp(15rem, 29%, 22rem);
  max-height: min(31rem, 64vh);
  overflow: auto;
}
.board:has(#ports[data-count="40"]) {
  height: clamp(700px, calc(100vh - 155px), 840px);
}
.board:has(#ports[data-count="40"]) .port-detail { left: 64%; }
#ports[data-count="40"] .tile {
  width: 6.22%;
  height: min(11%, 90px);
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  gap: .12rem;
  padding: .24rem .24rem .27rem;
  border: 1px solid #c7b38b;
  border-top: 4px solid var(--group-color, #256c65);
  border-radius: 4px;
  background: #fff4dc;
  color: #163c3b;
  box-shadow: 0 2px 5px #15353666;
  font: inherit;
  overflow: hidden;
}
#ports[data-count="40"] .tile[data-group] { background: #fff4dc; }
#ports[data-count="40"] .tile.tide { background: #e0eddb; }
#ports[data-count="40"] .tile strong {
  display: block;
  font: 700 clamp(.68rem, .78vw, .92rem)/1.04 Georgia, serif;
  overflow-wrap: anywhere;
  margin: 0;
}
#ports[data-count="40"] .tile .deed {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .04rem .15rem;
  font: 600 clamp(.59rem, .66vw, .75rem)/1.12 system-ui;
  color: #234844;
  min-width: 0;
}
.tile .property-owner {
  display: block;
  flex: 0 0 100%;
  font-weight: 750;
  color: #123f48;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.tile .available { color: #315c31; }
.tile .property-rent { color: #53431e; }
#ports[data-count="40"] .tile small.stop { font: 700 .58rem/1 system-ui; color: #724836; margin: 0; }
#ports[data-count="40"] .tile .tokens {
  position: absolute;
  inset: .16rem .18rem auto auto;
  max-width: 58%;
  justify-content: end;
  filter: none;
}
#ports[data-count="40"] .tile .token {
  width: 17px;
  height: 17px;
  border-width: 1px;
  font-size: .59rem;
}
.tile .tier {
  position: absolute;
  top: .15rem;
  right: .2rem;
  background: #513a6b;
  color: white;
  padding: .12rem .2rem;
  border-radius: 2px;
  font: 700 .53rem/1 system-ui;
}
.tile:has(.token) .tier { top: auto; bottom: .14rem; }
#ports[data-count="40"] .tile.owned { box-shadow: inset 0 0 0 2px var(--owner), 0 2px 5px #15353655; }
#ports[data-count="40"] .tile.active-port { outline: 3px solid #ffd667; outline-offset: 1px; }
#ports[data-count="40"] .tile.traversed { outline: 4px solid #fbb833; outline-offset: 2px; }
.sailing-ship { transition: left .2s ease, top .2s ease; }
.controls-link { display: none; }
.development {
  margin-bottom: .7rem;
  padding: .6rem .75rem;
  border: 1px solid #95aa84;
  border-radius: 4px;
  background: #e8efdf;
}
.development h3 { margin: .1rem 0 .25rem; font-size: 1rem; }
.development p { margin: .25rem 0; font-size: .84rem; }
.development select { min-width: 0; }

@media (max-width: 1000px) {
  .layout:has(#ports[data-count="40"]) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'actions' 'board';
  }
  .layout:has(#ports[data-count="40"]) > #actions {
    position: static;
    grid-area: actions;
    width: auto;
    max-height: none;
  }
  .layout:has(#ports[data-count="40"]) .controls-link {
    display: block;
    position: fixed;
    right: .65rem;
    bottom: .65rem;
    padding: .5rem .75rem;
    border: 1px solid #ffedc5;
    border-radius: 4px;
    z-index: 9;
    color: #fff4dc;
    background: #1b4749;
    text-decoration: none;
    font: 700 .75rem system-ui;
  }
  .board:has(#ports[data-count="40"]) {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: auto;
    padding: 6px;
  }
  .board:has(#ports[data-count="40"]) .port-detail {
    position: relative;
    order: -1;
    width: auto;
    inset: auto;
    transform: none;
  }
  #ports[data-count="40"] {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    height: auto;
  }
  #ports[data-count="40"] .tile {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    height: auto;
    min-height: 87px;
    padding: .35rem;
  }
  #ports[data-count="40"] .tile strong { font-size: .83rem; }
  #ports[data-count="40"] .tile .deed { font-size: .72rem; }
}
@media (max-width: 520px) {
  #ports[data-count="40"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1001px) {
  #ports[data-count="40"] .tile:nth-child(1) { left: 7.000%; top: 9.200%; }
  #ports[data-count="40"] .tile:nth-child(2) { left: 13.615%; top: 8.862%; }
  #ports[data-count="40"] .tile:nth-child(3) { left: 20.231%; top: 8.523%; }
  #ports[data-count="40"] .tile:nth-child(4) { left: 26.846%; top: 8.185%; }
  #ports[data-count="40"] .tile:nth-child(5) { left: 33.462%; top: 7.846%; }
  #ports[data-count="40"] .tile:nth-child(6) { left: 40.077%; top: 7.508%; }
  #ports[data-count="40"] .tile:nth-child(7) { left: 46.692%; top: 7.169%; }
  #ports[data-count="40"] .tile:nth-child(8) { left: 53.308%; top: 7.169%; }
  #ports[data-count="40"] .tile:nth-child(9) { left: 59.923%; top: 7.508%; }
  #ports[data-count="40"] .tile:nth-child(10) { left: 66.538%; top: 7.846%; }
  #ports[data-count="40"] .tile:nth-child(11) { left: 73.154%; top: 8.185%; }
  #ports[data-count="40"] .tile:nth-child(12) { left: 79.769%; top: 8.523%; }
  #ports[data-count="40"] .tile:nth-child(13) { left: 86.385%; top: 8.862%; }
  #ports[data-count="40"] .tile:nth-child(14) { left: 93.000%; top: 9.200%; }
  #ports[data-count="40"] .tile:nth-child(15) { left: 95.000%; top: 20.600%; }
  #ports[data-count="40"] .tile:nth-child(16) { left: 95.700%; top: 32.000%; }
  #ports[data-count="40"] .tile:nth-child(17) { left: 95.800%; top: 43.500%; }
  #ports[data-count="40"] .tile:nth-child(18) { left: 94.700%; top: 55.000%; }
  #ports[data-count="40"] .tile:nth-child(19) { left: 95.200%; top: 66.500%; }
  #ports[data-count="40"] .tile:nth-child(20) { left: 94.900%; top: 78.300%; }
  #ports[data-count="40"] .tile:nth-child(21) { left: 93.000%; top: 90.000%; }
  #ports[data-count="40"] .tile:nth-child(22) { left: 86.385%; top: 90.308%; }
  #ports[data-count="40"] .tile:nth-child(23) { left: 79.769%; top: 90.615%; }
  #ports[data-count="40"] .tile:nth-child(24) { left: 73.154%; top: 90.923%; }
  #ports[data-count="40"] .tile:nth-child(25) { left: 66.538%; top: 91.231%; }
  #ports[data-count="40"] .tile:nth-child(26) { left: 59.923%; top: 91.538%; }
  #ports[data-count="40"] .tile:nth-child(27) { left: 53.308%; top: 91.846%; }
  #ports[data-count="40"] .tile:nth-child(28) { left: 46.692%; top: 91.846%; }
  #ports[data-count="40"] .tile:nth-child(29) { left: 40.077%; top: 91.538%; }
  #ports[data-count="40"] .tile:nth-child(30) { left: 33.462%; top: 91.231%; }
  #ports[data-count="40"] .tile:nth-child(31) { left: 26.846%; top: 90.923%; }
  #ports[data-count="40"] .tile:nth-child(32) { left: 20.231%; top: 90.615%; }
  #ports[data-count="40"] .tile:nth-child(33) { left: 13.615%; top: 90.308%; }
  #ports[data-count="40"] .tile:nth-child(34) { left: 7.000%; top: 90.000%; }
  #ports[data-count="40"] .tile:nth-child(35) { left: 4.800%; top: 78.300%; }
  #ports[data-count="40"] .tile:nth-child(36) { left: 4.200%; top: 66.500%; }
  #ports[data-count="40"] .tile:nth-child(37) { left: 4.500%; top: 55.000%; }
  #ports[data-count="40"] .tile:nth-child(38) { left: 4.350%; top: 43.500%; }
  #ports[data-count="40"] .tile:nth-child(39) { left: 4.200%; top: 32.000%; }
  #ports[data-count="40"] .tile:nth-child(40) { left: 4.600%; top: 20.600%; }
}

/* The table occupies the window; its atlas and panels scroll independently. */
html:has(#game:not([hidden])),body:has(#game:not([hidden])){height:100%;overflow:hidden}
body:has(#game:not([hidden])){display:flex;flex-direction:column}
body:has(#game:not([hidden])) .mast{flex:0 0 auto}
body:has(#game:not([hidden])) main{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;width:100%;padding:.5rem clamp(.4rem,.8vw,.9rem)}
body:has(#game:not([hidden])) #notice:not(:empty){flex:0 0 auto;margin:0 0 .35rem;padding:.35rem .6rem}
#game:not([hidden]){display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
#game-heading,.captain-strip{flex:0 0 auto}#game-heading .game-head{margin-bottom:.35rem}#game-heading h1{font-size:clamp(1.35rem,2vw,2rem)}
.captain-strip{margin-bottom:.35rem}.captain-strip .player{padding:.3rem .55rem}
#game .layout{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;align-content:start}
#game .board{min-height:0}
#bot-settings{margin:1rem 0;border:1px solid #c9b593;border-radius:4px;padding:.65rem}#bot-settings legend{font-weight:bold;padding:0 .3rem}#bot-settings p{font:.75rem/1.4 system-ui;color:#5c716a;margin:.2rem 0 .65rem}#bot-difficulties{display:flex;flex-wrap:wrap;gap:.5rem}#bot-difficulties label{font:700 .7rem system-ui;display:grid;gap:.2rem}#bot-difficulties select{padding:.35rem;border:1px solid #b8a787;background:#fffaf0;color:#234d49}
.tile .property-improvement{display:block;flex:0 0 100%;font:700 .57rem/1.05 system-ui;color:#653e69}.tile .property-improvement[data-hall="true"]{color:#8b482d}
#sound-toggle{font-size:.72rem;padding:.5rem .7rem;white-space:nowrap}
@media(min-width:1001px){#game .board:has(#ports[data-count="40"]){height:max(650px,calc(100svh - 180px))}#game .layout:has(#ports[data-count="40"]) > #actions{max-height:min(42rem,60vh)}}
@media(max-width:1000px){#game .layout:has(#ports[data-count="40"]){display:flex;flex-direction:column;gap:.5rem}#game .layout:has(#ports[data-count="40"]) > #actions{flex:0 0 auto;max-height:28svh;overflow:auto;width:100%}#game .board:has(#ports[data-count="40"]){flex:0 0 auto;width:100%;height:55svh;max-height:55svh;overflow:auto;overscroll-behavior:contain}#game .layout>.ledger,#game .layout>.log{width:100%;flex:0 0 auto}#game .controls-link{display:none!important}.captain-strip .players{display:flex;overflow:auto;gap:.3rem}.captain-strip .player{flex:0 0 155px}.captain-strip .player strong{font-size:.75rem}.captain-strip .player small{font-size:.62rem}.mast{min-height:48px!important}.game-head h1{font-size:1.15rem!important}}
.hall-mark{display:inline-block;margin-left:.12rem;color:#86503d;white-space:nowrap}.property-improvement[data-hall="true"] .hall-mark{background:#8d563d;color:#fff6dc;border-radius:2px;padding:0 .15rem}

/* Harbor marks: the numbered captain flag and deed tint use the same four inks. */
.seat-0{--c:#b4382c}.seat-1{--c:#075f9e}.seat-2{--c:#986400}.seat-3{--c:#713d94}
.owner-0{--owner:#b4382c}.owner-1{--owner:#075f9e}.owner-2{--owner:#986400}.owner-3{--owner:#713d94}
[data-group="8"]{--group-color:#145b78}[data-group="9"]{--group-color:#96571b}
#ports[data-count="40"] .tile.owned.owner-0{background:#f8d7c8}#ports[data-count="40"] .tile.owned.owner-1{background:#d7e8f2}#ports[data-count="40"] .tile.owned.owner-2{background:#f6e7bc}#ports[data-count="40"] .tile.owned.owner-3{background:#e9dbf1}
#ports[data-count="40"] .tile.bank-vacant{background:#fff8e9;color:#173d39}#ports[data-count="40"] .tile.complete-group{border-bottom:4px double #a46926}
.owner-mark{position:absolute;top:.15rem;left:1.25rem;display:grid;place-items:center;width:16px;height:16px;border-radius:50%;background:var(--c);border:1px solid white;color:white;font:800 .6rem system-ui;z-index:2}
#ports[data-count="40"] .tile .tokens{top:.15rem;right:.12rem}.stock{color:#29594f}.stock strong{color:#173d39}
.intro-art{background:#2b6967 url('./harbor-illustration.webp') center/cover no-repeat;border:5px solid #f4e4bf;box-shadow:0 8px 24px #5f4b2530}.intro-art .sun,.intro-art .sail,.intro-art .boat,.intro-art .wave{display:none}
@media(min-width:1001px){#game .board:has(#ports[data-count="40"]){height:clamp(510px,calc(100svh - 205px),840px)}#game .layout:has(#ports[data-count="40"]) > #actions{max-height:min(38rem,65vh)}}

/* A harbor at the edge of the chart, and a compact notation for its warehouses. */
.intro{min-height:270px;margin-bottom:1rem;padding:1.5rem clamp(1rem,3vw,3rem);border:4px solid #ead6ad;border-radius:5px;background:linear-gradient(90deg,rgba(8,48,55,.94) 0%,rgba(8,48,55,.78) 37%,rgba(8,48,55,.04) 78%),url('./harbor-illustration.webp') center 55%/cover no-repeat;box-shadow:0 5px 18px #4c432a2b;color:#fff4db}
.intro h1{color:#fff4db;text-shadow:0 2px 8px #123c3d}.intro h1 em{color:#fac498}.intro p{color:#f7ecd6}.intro-art{display:none}
.tile .property-improvement{white-space:nowrap;display:flex;align-items:center;gap:.12rem;line-height:1;overflow:hidden}
.warehouse-boxes{display:inline-flex;gap:1px;flex:none}.warehouse-boxes i{display:block;width:5px;height:5px;border:1px solid #67466b;background:transparent}.warehouse-boxes i.filled{background:#67466b}.hall-mark{margin:0;font-size:.55rem}
@media(max-width:1000px){
 .intro{min-height:225px;padding:1.2rem;background-position:center}.intro h1{font-size:clamp(2.4rem,8vw,4rem)}.intro p{max-width:40ch}
 #game .layout:has(#ports[data-count="40"]){position:relative;overflow:hidden;align-content:stretch}
 #game .layout:has(#ports[data-count="40"]) > #actions{flex:0 0 auto;max-height:27svh;min-height:0;overflow:auto;scrollbar-gutter:stable}
 #game .board:has(#ports[data-count="40"]){flex:1 1 auto;height:auto;max-height:none;min-height:0;overflow:auto}
}
@media(max-width:520px){.intro{min-height:230px}.intro h1{font-size:2.3rem}.intro p{font-size:.85rem}.warehouse-boxes i{width:6px;height:6px}}

/* The atlas and log float above the route without taking up a grid row. */
.reference-dock {
  position: absolute;
  right: 13%;
  bottom: 16%;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  width: min(55%, 42rem);
  max-height: 33%;
  pointer-events: none;
}
.reference-panels, .reference-buttons {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  min-height: 0;
}
.reference-sheet {
  width: min(100%, 22rem);
  margin: 0;
  padding: .55rem .7rem;
  overflow: auto;
  overscroll-behavior: contain;
  background: #f8f0dd;
  border: 1px solid #b5976d;
  border-radius: 4px;
  box-shadow: 0 4px 16px #173f4055;
  color: #173f40;
  pointer-events: auto;
}
.reference-sheet h2 { margin: 0 0 .2rem; font-size: .95rem; font-weight: 700; }
.reference-sheet .port-directory { margin: 0; padding: 0; }
.reference-sheet .port-directory summary { padding: .24rem 0; font: 700 .73rem system-ui; }
.reference-sheet .groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .2rem .4rem;
  margin: .4rem 0 .12rem;
  font-size: .59rem;
}
.reference-sheet .groups li { min-width: 0; }
.reference-sheet .legend-mark { flex: 0 0 auto; }
.reference-sheet.log { width: min(100%, 19rem); }
.reference-sheet #log { font: .75rem/1.45 system-ui; }
.reference-sheet #log p { margin: 0; padding: .3rem 0; border-bottom: 1px solid #e3d6b8; }
.reference-buttons button {
  padding: .4rem .6rem;
  border-color: #dcc39a;
  background: #183f40;
  box-shadow: 0 2px 8px #173f4055;
  font: 700 .73rem system-ui;
  pointer-events: auto;
}
.reference-buttons button[aria-expanded="true"] { border-color: #965b37; background: #f3e5c7; color: #153e40; }
@media (min-width: 1001px) {
  #game .layout:has(#ports[data-count="40"]) {
    grid-template: 'board' minmax(0, 1fr) / minmax(0, 1fr);
    overflow: hidden;
  }
  #game .board:has(#ports[data-count="40"]) { height: 100%; min-height: 0; }
  #game .layout:has(#ports[data-count="40"]) > #actions { max-height: 66%; }
}
@media (max-width: 1000px) {
  .reference-dock { right: .55rem; bottom: .55rem; width: min(calc(100% - 1.1rem), 22rem); max-height: 62%; }
  .reference-sheet.log { width: 100%; }
}
@media (min-width: 1001px) and (max-height: 820px) {
  #ports[data-count="40"] .tile { padding: .13rem .22rem; gap: 0; }
  #ports[data-count="40"] .tile strong { font-size: .69rem; }
}

html, body { height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; }
body > .mast { flex: 0 0 auto; }
main { width: 100%; min-height: 0; display: flex; flex-direction: column; flex: 1 1 auto; }
#lobby:not([hidden]) { flex: 1 1 auto; min-height: 0; overflow: auto; }
#game .layout { position: relative; }

/* Captain portraits and selected-port illustrations are decorative; labels carry the information. */
.captain-strip .player { min-height: 51px; overflow: hidden; }
.captain-portrait {
  float: left;
  width: 43px;
  height: 43px;
  margin-right: .5rem;
  border: 2px solid var(--c);
  border-radius: 50%;
  background: #dfc7a1 center / cover;
  box-shadow: 0 0 0 2px #fff5df;
}
.portrait-0 { background-image: url('./media/captain-coral.webp'); }
.portrait-1 { background-image: url('./media/captain-blue.webp'); }
.portrait-2 { background-image: url('./media/captain-gold.webp'); }
.portrait-3 { background-image: url('./media/captain-violet.webp'); }
.captain-strip .player small { margin-left: 0; }
.intro {
  background-image: linear-gradient(90deg, #083037f0 0%, #083037c7 37%, #0830370a 78%),
    url('./media/map-harbor.webp'), url('./harbor-illustration.webp');
}
.port-detail {
  isolation: isolate;
  overflow: hidden;
  min-height: 80px;
  width: min(54%, 19rem);
  grid-template-columns: minmax(0, 1fr) 41%;
}
.port-detail > * { grid-column: 1; }
.port-detail::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 0 0 54%;
  background: center / cover;
  mask-image: linear-gradient(90deg, transparent, #000 40%);
  opacity: .75;
}
.port-detail[data-art="west"]::before { background-image: url('./media/district-west.webp'); }
.port-detail[data-art="trade"]::before { background-image: url('./media/district-trade.webp'); }
.port-detail[data-art="east"]::before { background-image: url('./media/district-east.webp'); }
.port-detail[data-art="africa"]::before { background-image: url('./media/district-africa.webp'); }
.port-detail[data-art="harbor"]::before { background-image: url('./media/map-harbor.webp'); }
.port-detail[data-art="dispatch"]::before { background-image: url('./media/map-dispatch.webp'); }

@media (max-width: 1000px) {
  .captain-portrait { width: 32px; height: 32px; margin-right: .35rem; }
  .captain-strip .player { min-height: 42px; }
  .port-detail { min-height: 70px; }
  .board:has(#ports[data-count="40"]) .port-detail { position: sticky; top: 0; z-index: 6; flex: none; }
  #ports[data-count="40"] .tile { scroll-margin-top: 82px; }
}

@media (max-width: 600px) {
  .captain-strip .players { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
}

/* Circuit ribbons, ownership seals and ships each have their own visual treatment. */
[data-group="0"] { --group-color: #953e42; }
[data-group="1"] { --group-color: #916411; }
[data-group="2"] { --group-color: #ac4822; }
[data-group="3"] { --group-color: #426d39; }
[data-group="4"] { --group-color: #147470; }
[data-group="5"] { --group-color: #295985; }
[data-group="6"] { --group-color: #634182; }
[data-group="7"] { --group-color: #923d65; }
[data-group="8"] { --group-color: #273740; }
[data-group="9"] { --group-color: #735044; }
[data-kind="charter"] { --group-color: #225655; }
[data-kind="event"] { --group-color: #54455f; }
[data-kind="tax"] { --group-color: #5e5044; }
[data-kind="shelter"] { --group-color: #466657; }

.intro {
  background-image: linear-gradient(90deg, #09272def 0%, #09272dc7 37%, #09272d02 84%),
    url('./media/scenery-coast.webp'), url('./media/map-harbor.webp'), url('./harbor-illustration.webp');
}

#ports[data-count="40"] .tile {
  width: 6.4%;
  padding: 0 .23rem .22rem;
  gap: 1px;
  border: 1px solid #bbaa8c;
  border-radius: 5px;
  overflow: visible;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 3px #081f2a75;
}

#ports[data-count="40"] .tile[data-kind="event"] { background: #f2e7f0; }
#ports[data-count="40"] .tile[data-kind="tax"] { background: #eddfca; }
#ports[data-count="40"] .tile[data-kind="shelter"] { background: #e1eddf; }
#ports[data-count="40"] .tile.owned {
  box-shadow: inset 2px 0 0 var(--owner), 0 2px 3px #081f2a75;
}

.tile .set-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  flex: 0 0 auto;
  min-height: 13px;
  padding: 1px .23rem;
  margin: 0 -.23rem 1px;
  border-radius: 4px 4px 0 0;
  background: var(--group-color, #3e6161);
  color: #fff7e3;
  font: 800 .58rem/1 system-ui;
  letter-spacing: .025em;
}
.set-banner { white-space: nowrap; }
#ports[data-count="40"] .tile .set-banner small.stop { color: inherit; font: inherit; flex: 0 0 auto; }
.set-mark { text-transform: uppercase; white-space: nowrap; }
.tile .owner-line {
  display: flex;
  align-items: center;
  flex: 0 0 100%;
  gap: 3px;
  min-width: 0;
}
.tile .owner-line .property-owner { flex: 0 1 auto; }
.tile .owner-mark {
  position: static;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  border: 0;
  border-radius: 1px;
  background: var(--owner);
  font: 850 .62rem/1 system-ui;
}
.tile .property-improvement { gap: 3px; }
.tile .warehouse-boxes { gap: 2px; }
.warehouse-boxes i {
  width: 6px;
  height: 7px;
  clip-path: polygon(50% 0, 100% 33%, 100% 100%, 0 100%, 0 33%);
  border: 0;
  background: #a3ada0;
}
.warehouse-boxes i.filled { background: #365e41; }
.property-improvement[data-hall="true"] .hall-mark {
  padding: 0 3px;
  border-radius: 1px;
  background: #75542d;
  color: #fff4d6;
}

.ship-pennant {
  position: relative;
  display: inline-grid;
  place-items: end center;
  width: 26px;
  height: 27px;
  flex: none;
  filter: drop-shadow(1px 1px 1px #192529e6) drop-shadow(-1px 0 1px #192529b3);
}
.ship-pennant > i {
  position: absolute;
  top: 0;
  left: 3px;
  width: 19px;
  height: 15px;
  clip-path: polygon(45% 0, 100% 90%, 50% 90%, 50% 37%, 40% 90%, 0 90%);
  background: #fff4d6;
}
.ship-pennant > b {
  display: grid;
  place-items: start center;
  width: 100%;
  height: 14px;
  padding-top: 1px;
  clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%);
  background: var(--c);
  border-top: 1px solid #fff4d6;
  color: white;
  font: 900 .66rem/1 system-ui;
}
#ports[data-count="40"] .tile .tokens {
  inset: auto .18rem -13px auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  align-items: center;
  justify-content: end;
  max-width: none;
  pointer-events: none;
}
#ports[data-count="40"] .tile .tokens:has(.token:nth-child(3)) {
  width: 55px;
  flex-wrap: wrap;
}
#ports[data-count="40"] .tile .token,
.tile .token {
  display: inline-flex;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  clip-path: none;
}
.tile .current-token .ship-pennant { filter: drop-shadow(0 0 2px #261c12) drop-shadow(0 0 3px #ffd369); }
#ports[data-count="40"] .tile.moored { z-index: 5; }
.sailing-ship {
  width: 38px;
  height: 38px;
  border: 2px solid #f9e7b0;
  background: #142631;
  box-shadow: 0 0 4px 2px #ae7922;
  color: white;
}
.sailing-ship .ship-pennant { transform: translateY(-2px); }

.captain-strip .players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: .3rem;
}
.captain-strip .player {
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: .1rem .4rem;
  width: 100%;
  padding: .3rem .42rem;
  border: 1px solid #c5ad80;
  border-left: 4px solid var(--c);
  border-radius: 3px;
  background: #fff7e6;
  color: #262a2f;
  text-align: left;
}
.captain-strip .player:hover { background: #ffedbd; }
.captain-strip .player.on-watch { box-shadow: inset 0 0 0 1px #cc9c48; }
.captain-strip .player.retired-captain .crew-location { opacity: .6; }
.crew-identity { position: relative; grid-row: span 2; align-self: center; }
.crew-identity .captain-portrait { float: none; display: block; width: 35px; height: 35px; margin: 0; }
.crew-identity .ship-pennant { position: absolute; right: -4px; bottom: -3px; transform: scale(.69); transform-origin: bottom right; }
.crew-name, .crew-location { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.captain-strip .crew-name { font: 750 clamp(.78rem, 1.2vw, 1rem)/1.18 Georgia, serif; }
.captain-strip .crew-name small { display: inline; margin: 0; color: #6c502f; font-size: .62rem; }
.crew-state, .crew-location, .crew-wallet { font: 650 .67rem/1.1 system-ui; }
.crew-state { color: #70624d; text-transform: capitalize; text-align: right; white-space: nowrap; }
.on-watch .crew-state { color: #62461f; }
.crew-location { color: #26545c; }
.crew-wallet { text-align: right; white-space: nowrap; }

.port-detail {
  left: 47%;
  width: min(54%, 21rem);
  grid-template-columns: minmax(0, 1fr);
  gap: .22rem;
  min-height: 95px;
  border: 1px solid #d8ba88;
  padding: 0 .65rem .56rem;
  border-radius: 5px;
  background: #fff2d5;
  pointer-events: auto;
}
.port-detail::before {
  inset: 17px 0 0 48%;
  mask-image: linear-gradient(90deg, transparent, #0005 35%, #000 70%);
  opacity: .85;
}
.port-detail > :is(strong, span) { max-width: 70%; }
.port-detail > .detail-set {
  margin-inline: -.65rem;
  padding: .3rem .65rem;
  background: var(--group-color, #3e6161);
  color: #fff3db;
  font: 750 .61rem/1.19 system-ui;
  letter-spacing: .02em;
}
.port-detail > strong { margin-top: .12rem; }
.port-detail .detail-owner { font-weight: 750; }
.port-detail .detail-flavor { font: italic .79rem/1.21 Georgia, serif; color: #594731; }
.port-detail .rent-ladder {
  margin: .1rem 0 0;
  border: 0;
  padding: 0;
  font: .66rem/1.15 system-ui;
}
.rent-ladder summary { width: max-content; max-width: 100%; padding: .1rem 0; }
.rent-ladder[open] summary { margin-bottom: .2rem; }
.rent-ladder > div { display: flex; gap: 1px; border: 1px solid #c8ad80; border-radius: 2px; background: #c8ad80; }
.port-detail .rent-ladder span { flex: 1; background: #fff6df; padding: .18rem; text-align: center; font: inherit; }
.port-detail .rent-ladder small { display: block; font: 700 .58rem/1.1 system-ui; letter-spacing: 0; color: #625443; }
.port-detail .rent-ladder b { font-variant-numeric: tabular-nums; }
.port-detail .rent-ladder [aria-current="true"] { background: #e0edd4; color: #244b29; }
.port-detail .rent-ladder [aria-current="true"] small { color: inherit; }
.development .build-preview { margin: 0 0 .4rem; color: #334339; font: 700 .76rem/1.25 system-ui; }
.port-detail[data-art="location-gades"]::before { background-image: url('./media/location-gades.webp'); }
.port-detail[data-art="location-carthago-nova"]::before { background-image: url('./media/location-carthago-nova.webp'); }
.port-detail[data-art="location-massalia"]::before { background-image: url('./media/location-massalia.webp'); }
.port-detail[data-art="location-ostia"]::before { background-image: url('./media/location-ostia.webp'); }
.port-detail[data-art="location-piraeus"]::before { background-image: url('./media/location-piraeus.webp'); }
.port-detail[data-art="location-tyre"]::before { background-image: url('./media/location-tyre.webp'); }
.port-detail[data-art="location-alexandria"]::before { background-image: url('./media/location-alexandria.webp'); }
.port-detail[data-art="location-carthage"]::before { background-image: url('./media/location-carthage.webp'); }
.groups li { display: flex; align-items: center; gap: .3rem; }
.groups li::before { content: none; }
.legend-mark { background: var(--group-color); border-radius: 2px; color: #fff7e3; font-weight: 800; padding: 2px 4px; }

@media (min-width: 1001px) {
  #game .layout:has(#ports[data-count="40"]) > #actions { top: 20%; max-height: 63%; }
  #ports[data-count="40"] .tile:nth-child(-n+14) .tokens { inset: calc(100% - 6px) auto auto 50%; transform: translateX(-50%); }
  #ports[data-count="40"] .tile:nth-child(-n+14) .tokens:has(.token:nth-child(3)) { width: auto; flex-wrap: nowrap; }
  #ports[data-count="40"] .tile:first-child .tokens { left: 70%; transform: none; }
  #ports[data-count="40"] .tile:nth-child(14) .tokens { left: auto; right: 70%; transform: none; }
  #ports[data-count="40"] .tile:nth-child(n+15):nth-child(-n+20) .tokens { inset: auto calc(100% - 6px) 0 auto; }
  #ports[data-count="40"] .tile:nth-child(n+21):nth-child(-n+34) .tokens { inset: auto auto calc(100% - 7px) 50%; transform: translateX(-50%); }
  #ports[data-count="40"] .tile:nth-child(21) .tokens { left: auto; right: 24%; transform: none; }
  #ports[data-count="40"] .tile:nth-child(34) .tokens { left: 24%; transform: none; }
  #ports[data-count="40"] .tile:nth-child(n+35) .tokens { inset: auto auto 0 calc(100% - 6px); }
}
@media (min-width: 1001px) and (max-height: 820px) {
  #ports[data-count="40"] .tile { height: min(11.35%, 90px); gap: 0; padding-bottom: .11rem; }
  #ports[data-count="40"] .tile .deed { font-size: .56rem; line-height: 1.04; }
  #ports[data-count="40"] .tile[data-kind="permit"] .deed { font-size: .53rem; }
  .tile .set-banner { min-height: 11px; }
  .tile .property-improvement { font-size: .53rem; }
}
@media (max-width: 1000px) {
  #ports[data-count="40"] .tile { width: auto; min-height: 93px; }
  #ports[data-count="40"] .tile .tokens { inset: 11px .15rem auto auto; }
  #ports[data-count="40"] .tile.moored strong { margin-right: 29px; }
  #ports[data-count="40"] .tile:has(.token:nth-child(2)) strong { margin-right: 58px; }
  #ports[data-count="40"] .tile .tokens:has(.token:nth-child(3)) { width: auto; flex-wrap: nowrap; }
  #ports[data-count="40"] .tile:has(.token:nth-child(3)) .tokens { transform: scale(.82); transform-origin: right top; }
  #ports[data-count="40"] .tile:has(.token:nth-child(3)) strong { margin-right: 72px; }
  #ports[data-count="40"] .tile:has(.token:nth-child(4)) strong { margin-right: 93px; }
  .board:has(#ports[data-count="40"]) .port-detail { z-index: 7; }
  #ports[data-count="40"] .tile { scroll-margin-top: 116px; }
}
@media (max-width: 600px) {
  .captain-strip .players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .captain-strip .player { grid-template-columns: 30px minmax(0, 1fr) auto; gap: .1rem .25rem; }
  .crew-identity .captain-portrait { width: 28px; height: 28px; }
  .crew-state { display: none; }
  .crew-wallet { grid-column: 3; grid-row: 1; font-size: .57rem; }
  .crew-location { grid-column: 2 / 4; grid-row: 2; font-size: .67rem; white-space: normal; }
}
