:root {
  color-scheme: light;
  --paper: #f5f3ec;
  --card: #fffefa;
  --ink: #202f2b;
  --muted: #52615a;
  --line: #e4e5da;
  --teal: #19574c;
  --orange: #bb4b27;
  --mint: #e3eee5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled, button[aria-disabled="true"] { cursor: default; }
button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 3px solid #ab421e;
  outline-offset: 4px;
}
a { color: var(--teal); }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.wrap { width: min(1120px, calc(100% - 72px)); margin-inline: auto; }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wordmark {
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -.055em;
}
.wordmark-games { color: var(--teal); }
.brand-dot, .intro h1 span { color: var(--orange); }
.brand-icon {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  grid-template-rows: repeat(2, 5px);
  place-content: center;
  gap: 2px;
  width: 26px;
  height: 26px;
  background: var(--teal);
  border-radius: 7px;
}
.brand-icon i { background: #fff8e5; border-radius: 1px; }
.brand-icon i:nth-child(2) { background: #ffab72; transform: translateY(-2px); }

.rules-button, .secondary-button, .text-button, .primary-button, .close-button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  min-height: 42px;
  font-size: .84rem;
  font-weight: 750;
  padding: 0 13px;
  white-space: nowrap;
}
.rules-button span, .secondary-button span { margin-inline-end: 3px; }
.rules-button span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 50%;
  line-height: 1;
  font-size: .7rem;
}
.rules-button:hover, .secondary-button:hover:not(:disabled), .text-button:hover:not(:disabled), .close-button:hover {
  background: var(--mint);
}
button:disabled { opacity: .49; }
.text-button { background: transparent; border-color: transparent; }
.primary-button { background: var(--teal); border-color: var(--teal); color: #fff; }
.primary-button:hover { background: #123c35; }
.primary-button span { margin-inline-start: 4px; }

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 34px 0 24px;
}
.edition {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: .82rem;
}
.edition strong { color: var(--teal); font-size: .73rem; letter-spacing: .1em; }
.intro h1 {
  font-size: clamp(3.2rem, 7.2vw, 5.1rem);
  line-height: 1;
  font-weight: 850;
  letter-spacing: -.06em;
  margin: 5px 0 8px;
}
.intro p { color: var(--muted); font-size: clamp(.92rem, 2vw, 1.06rem); }
.intro-meta { display: flex; flex-direction: column; align-items: end; gap: 8px; }
.intro-meta a { font-size: .82rem; text-align: right; }
.duration { color: var(--muted); font-size: .82rem; white-space: nowrap; padding-bottom: 2px; }
.duration span { font-size: 1.1rem; vertical-align: -.04em; }

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.19fr) minmax(280px, 1fr);
  align-items: start;
  gap: 18px;
}
.board-card, .cargo-card, .result {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 2px 3px #202f2b08;
  overflow: hidden;
}
.board-heading, .cargo-heading, .board-footer, .order-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.board-heading { min-height: 64px; padding: 10px 19px; }
.board-heading h2, .cargo-heading h2, .result h2 {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -.025em;
}
.fuel, .capacity {
  font-size: .8rem;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fuel { background: var(--mint); padding: 5px 9px; border-radius: 7px; }
.fuel strong { margin-inline-start: 3px; }
.fuel-dot {
  display: inline-block;
  margin-inline-end: 3px;
  width: 7px;
  height: 9px;
  background: var(--teal);
  border-radius: 80% 15% 65% 70%;
  transform: rotate(-38deg);
}

.map {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 1.76;
  min-height: 275px;
  isolation: isolate;
  overflow: clip;
  background:
    radial-gradient(ellipse at 10% 48%, #dbead3 0%, transparent 57%),
    radial-gradient(ellipse at 71% 31%, #d8ebdd 0%, transparent 47%),
    #c6e1d8;
  border-block: 1px solid #b8d5cc;
}
.map-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background-image:
    repeating-linear-gradient(0deg, #477d731c 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, #477d731c 0 1px, transparent 1px 34px),
    radial-gradient(ellipse at 110% 110%, transparent 0 20%, #56877938 20.3% 20.7%, transparent 21% 24%, #56877938 24.3% 24.7%, transparent 25% 28%, #56877938 28.3% 28.7%, transparent 29% 32%, #56877938 32.3% 32.7%, transparent 33% 36%, #56877938 36.3% 36.7%, transparent 37%);
}
#routes, #islands { position: absolute; inset: 0; width: 100%; height: 100%; }
#routes { pointer-events: none; }
.compass {
  display: grid;
  justify-items: center;
  position: absolute;
  top: 14px;
  right: 20px;
  gap: 3px;
  color: #365d55;
  font-size: .65rem;
  font-weight: 800;
}
.compass i {
  width: 13px;
  height: 24px;
  background: linear-gradient(90deg, #4a796e 50%, #719b90 50%);
  clip-path: polygon(50% 0, 100% 100%, 50% 74%, 0 100%);
}
.island {
  --island-color: #72995b;
  --shore: #efdfa4;
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: clamp(54px, 11cqw, 83px);
  height: clamp(39px, 8cqw, 60px);
  border: 0;
  padding: 0;
  border-radius: 48%;
  background: none;
  line-height: 1;
}
.land {
  position: absolute;
  inset: 1px 1px 2px;
  border-radius: 58% 42% 54% 46% / 47% 61% 39% 53%;
  border: 4px solid var(--shore);
  background:
    radial-gradient(ellipse at 45% 18%, #fff7cf4a 15%, transparent 65%),
    var(--island-color);
  box-shadow: 0 3px #54887d65, 0 0 0 4px #f7f9e5a0, 0 0 0 8px #a5cdc280;
  transform: rotate(-13deg);
}
.island-0 { --island-color: #6d9b82; }
.island-0 .land { border-radius: 44% 54% 60% 37% / 55% 65% 37% 45%; }
.island-1 { --island-color: #9ca861; --shore: #f5e4a8; }
.island-1 .land { transform: rotate(14deg); }
.island-2 { --island-color: #75936e; }
.island-2 .land { border-radius: 38% 70% 58% 44% / 52% 42% 65% 51%; }
.island-3 { --island-color: #779a75; }
.island-3 .land { transform: rotate(12deg); }
.island-4 { --island-color: #86a261; }
.island-4 .land { border-radius: 61% 54% 60% 43% / 69% 57% 43% 36%; }
.landmark, .landmark::before, .landmark::after { position: absolute; }
.landmark { left: 50%; top: 43%; transform: translate(-50%, -50%); }
.landmark::before, .landmark::after { content: ""; }
.island-0 .landmark {
  width: 16px;
  height: 14px;
  background: #fff3c9;
  border-radius: 2px;
  box-shadow: 4px 4px #25413748;
}
.island-0 .landmark::before { inset: -7px -3px auto; height: 9px; background: #a94431; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.island-0 .landmark::after { inset: 5px 6px 0; background: #477166; }
.island-1 .landmark {
  width: 20px;
  height: 11px;
  border-radius: 100% 30% 5% 5%;
  background: #f3dfa6;
  transform: translate(-50%, -45%) rotate(6deg);
  box-shadow: 8px 4px #e0cb8a;
}
.island-2 .landmark {
  width: 12px;
  height: 24px;
  background: repeating-linear-gradient(#fff3ca 0 5px, #a94431 5px 10px);
  transform: translate(-50%, -60%) rotate(13deg);
  clip-path: polygon(17% 18%, 0 18%, 50% 0, 100% 18%, 83% 18%, 100% 100%, 0 100%);
}
.island-3 .landmark {
  width: 29px;
  height: 12px;
  border-bottom: 4px solid #cfeae0;
  border-radius: 50%;
  transform: translate(-50%, -65%) rotate(-22deg);
}
.island-4 .landmark {
  width: 7px;
  height: 15px;
  background: #355e48;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.island-4 .land { background: radial-gradient(circle at 35% 61%, #638151 9%, transparent 11%), radial-gradient(circle at 60% 67%, #637d4d 12%, transparent 14%), var(--island-color); }

.island-name {
  z-index: 1;
  position: absolute;
  top: calc(100% + 4px);
  padding: 4px 7px;
  color: #203a31;
  background: #f5f7e9;
  border: 1px solid #8eb0a27a;
  border-radius: 7px;
  font-size: clamp(.67rem, 2.1cqw, .84rem);
  font-weight: 750;
  white-space: nowrap;
}
.island[data-reachable="true"] .island-name { color: #fff; background: var(--teal); border-color: var(--teal); }
.island[data-reachable="true"]:hover .land,
.island[data-reachable="true"]:focus-visible .land {
  box-shadow: 0 3px #54887d65, 0 0 0 5px #f7f9e5, 0 0 0 9px #2e6b58a0;
}
.island[data-active="true"] .island-name { background: #994725; color: #fffefa; border-color: #994725; }
.island[data-delivered="true"] .island-name::after { content: " ✓"; }
.island[data-active="true"] { z-index: 2; }
.boat {
  display: none;
  position: absolute;
  top: -11px;
  right: -4px;
  width: 32px;
  height: 26px;
  border-radius: 8px;
  background: #fff7dc;
  border: 1px solid #994725;
  box-shadow: 0 2px 3px #1d514641;
}
.island[data-active="true"] .boat { display: grid; place-items: center; }
.boat i { position: relative; width: 20px; height: 16px; }
.boat i::before, .boat i::after { content: ""; position: absolute; background: #994725; }
.boat i::before { inset: 7px 0 1px; clip-path: polygon(0 0, 100% 0, 75% 95%, 19% 95%); }
.boat i::after { inset: 2px 5px 9px; border-radius: 2px 2px 0 0; }

.board-footer { padding: 12px 16px 12px 19px; min-height: 64px; }
.board-footer p { color: var(--muted); font-size: .84rem; }
.board-actions { display: flex; gap: 4px; flex-shrink: 0; }
.board-actions button { min-height: 38px; }
[data-tide="low"] { border-bottom-color: #bd785c; }

.cargo-card { padding: 17px 17px 13px; }
.capacity { font-weight: 700; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 13px 0 20px; }
.slots span {
  display: grid;
  place-items: center;
  height: 40px;
  border: 1px dashed #bcc8bd;
  border-radius: 8px;
  background: #f5f6f0;
}
.slots span[data-filled="true"] { background: #f3e4c9; border: 1px solid #d9b382; }
.slots span[data-filled="true"]::after, .parcels i {
  content: "";
  display: block;
  width: 17px;
  height: 15px;
  border: 1px solid #a77b50;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent 37%, #f4ddae 37% 62%, transparent 62%), #d5a46f;
}
.order-heading { margin-bottom: 8px; }
.order-heading h3 { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }
.order-heading span, .load-note { color: var(--muted); font-size: .75rem; }
.orders { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.order {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  text-align: left;
  gap: 7px;
  min-height: 45px;
  padding: 7px 9px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: .83rem;
}
.order[aria-disabled="false"]:hover, .order[data-state="loaded"] { background: #eef5e9; border-color: #acc8b1; }
.order[aria-disabled="true"] { color: var(--muted); }
.order[data-state="delivered"] { background: #f4f5ee; }
.order-action {
  color: var(--teal);
  font-size: .73rem;
  font-weight: 750;
  white-space: nowrap;
}
.order[aria-disabled="true"] .order-action { color: var(--muted); }
.order[data-state="delivered"] .order-action::before { content: "✓ "; }
.parcels { display: flex; gap: 2px; }
.parcels i { width: 11px; height: 10px; border-radius: 2px; }
.load-note { padding: 10px 0 1px; }

.result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 16px;
  padding: 15px 18px;
  border-color: #adc7af;
  background: #e7f1e6;
}
.result p { margin-top: 2px; font-size: .85rem; color: var(--muted); }
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 19px 1px 22px;
  font-size: .76rem;
  color: var(--muted);
}
.site-footer span:last-child { white-space: nowrap; }
.notice { padding-bottom: 14px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

dialog {
  width: min(500px, calc(100% - 24px));
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}
dialog::backdrop { background: #192e2bad; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { font-size: 1.3rem; letter-spacing: -.04em; }
.close-button { min-width: 38px; min-height: 38px; padding: 0 8px; font-size: 1.2rem; }
dialog ol { padding-inline-start: 24px; }
dialog li { padding-inline-start: 3px; margin-bottom: 8px; }
dialog p, dialog label { color: var(--muted); }
dialog > form { margin-top: 16px; }
dialog textarea {
  display: block;
  width: 100%;
  margin-top: 12px;
  border: 1px solid #aebbb0;
  padding: 9px;
  border-radius: 7px;
  background: #f3f6ef;
  color: var(--ink);
  font: inherit;
}

@media (max-width: 800px) {
  .wrap { width: calc(100% - 36px); }
  .game-grid { gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(235px, .63fr); }
  .board-footer { flex-wrap: wrap; gap: 7px; }
  .cargo-card { padding-inline: 12px; }
}

@media (max-width: 620px) {
  .game-grid { grid-template-columns: 1fr; }
  .wrap { width: calc(100% - 24px); }
  .header-inner { min-height: 57px; }
  .intro { align-items: flex-start; padding: 20px 0 16px; }
  .intro-meta { align-self: end; }
  .board-heading { min-height: 50px; padding: 8px 12px; }
  .board-footer { padding: 8px 11px 9px; }
  .cargo-card { padding: 12px; }
  .slots { margin: 8px 0 13px; }
  .site-footer { padding-top: 13px; }
}

@media (max-width: 384px) {
  .intro { flex-direction: column; gap: 5px; }
  .intro-meta { align-self: start; align-items: start; }
  .intro-meta a { text-align: left; }
  .compass { right: 12px; }
}
