.river-game, .packing-game, .hall-game { display: grid; gap: 10px; }
.board-stats {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px;
  padding: 7px 10px; border: 1px solid #6f5134; border-radius: 5px; background: #2a1d13;
  color: #d9be96; font-size: 13px;
}
.board-stats strong { color: #f9db9e; font-size: 16px; font-variant-numeric: tabular-nums; }
.board-stats small { color: #d6b68f; }
.board-stats .reading-high { color: #ffad95; }

.harbor-board {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 2px;
  padding: 5px; border: 1px solid #847054; border-radius: 7px; overflow: hidden;
  background: #1a2625; box-shadow: inset 0 0 0 4px #141916, 0 4px 10px #0004;
}
.nav-cell {
  display: grid; place-items: center; min-width: 0; aspect-ratio: 1.23; padding: 0;
  border: 1px solid #77978d2a; border-radius: 3px; color: #e4dfbf; font: 700 clamp(10px, 1.15vw, 15px)/1 var(--serif);
  background: repeating-linear-gradient(169deg, #9fc4ae0d 0 1px, transparent 1.5px 9px), #273b38;
}
.nav-cell.shoal {
  color: #bba373; border-color: #a48b524d;
  background: repeating-linear-gradient(135deg, #b0925244 0 1px, transparent 1.5px 5px), #4b4432;
}
.shoal-mark { letter-spacing: .2em; }
.nav-cell.origin, .nav-cell.berth { color: #f5d7a0; border-color: #af855e; background-color: #59422b; }
.nav-cell.beacon { color: #e7c072; font-size: clamp(14px, 1.6vw, 23px); }
.nav-cell.lit { color: #ffe5a4; background: radial-gradient(circle, #89683d, #405345); text-shadow: 0 0 8px #ffe1a5; }
.nav-cell.current { color: #bcdfd2; font-size: clamp(15px, 1.8vw, 25px); background-color: #385f59; }
.nav-cell.on-trail { box-shadow: inset 0 0 0 1px #adc09a79; background-color: #455a43; }
.nav-cell.at-boat {
  z-index: 1; color: #ffe7b8; border-color: #f1c884;
  background: linear-gradient(145deg, #8c6035, #61451f); box-shadow: 0 0 10px #deb46d70, inset 0 0 0 1px #fcdaad75;
}
.nav-cell.at-boat svg { width: 70%; height: 70%; max-width: 26px; max-height: 26px; }
.harbor-key { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 11px; color: #d8c4aa; font-size: 11px; }
.harbor-key span { display: inline-flex; align-items: center; gap: 4px; }
.harbor-key i { display: grid; place-items: center; width: 15px; height: 13px; border-radius: 2px; font-style: normal; }
.key-beacon { color: #e7c072; }
.key-current { color: #c4ebe0; background: #385f59; }
.key-shoal { background: repeating-linear-gradient(135deg, #aa8d57 0 1px, #514633 1.5px 4px); }
.key-dock { border: 1px solid #af855e; background: #59422b; }
.river-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.steering { display: grid; grid-template-columns: repeat(3, 37px); gap: 3px; }
.steering button {
  display: grid; place-items: center; min-height: 34px; padding: 0; border: 1px solid #846645; border-radius: 4px;
  color: #f1d4a1; background: #33241a; font-size: 19px; line-height: 1;
}
.steer-n { grid-area: 1 / 2; }
.steer-w { grid-area: 2 / 1; }
.steer-s { grid-area: 2 / 2; }
.steer-e { grid-area: 2 / 3; }

.load-balance { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; align-items: center; gap: 12px; color: #ebce9f; font-size: 12px; }
.weight-beam { position: relative; display: grid; place-items: center; justify-self: center; width: min(100%, 132px); height: 24px; }
.weight-beam::after {
  content: ""; position: absolute; bottom: 2px; width: 11px; height: 9px;
  background: #af8753; clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}
.weight-beam i { width: 100%; height: 3px; background: #e2bb80; transform: rotate(var(--lean)); transition: transform .2s ease; }
.cart-board {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px;
  align-self: start; width: min(100%, 332px); justify-self: center; padding: 5px; border: 1px solid #715337; border-radius: 9px;
  background: #19130e; box-shadow: 0 6px 12px #0004;
}
.cart-square {
  display: grid; place-items: center; min-width: 0; aspect-ratio: 1.46; padding: 0;
  border: 1px solid #8e6b46; border-radius: 3px; background: repeating-linear-gradient(176deg, #c4894924 0 1px, transparent 1.5px 7px), #443021;
  color: #f5dfb5; font: 700 15px/1 var(--serif);
}
.cart-corner { border-style: dashed; border-color: #4d3928; background: repeating-linear-gradient(135deg, #3e3024 0 1px, #211912 1.5px 7px); }
.cart-square.center-line { border-inline-color: #d4a865; color: #eed197; background-color: #513825; }
.cargo-tea { --piece: #526847; --piece-line: #99b17a; }
.cargo-paper { --piece: #776848; --piece-line: #d4bc85; }
.cargo-cloth { --piece: #415d75; --piece-line: #8eafc6; }
.cargo-herbs { --piece: #774e32; --piece-line: #d2966b; }
.cargo-rope { --piece: #754642; --piece-line: #d49382; }
.cart-square.loaded {
  color: #fff0d4; border-color: var(--piece-line);
  background: repeating-linear-gradient(155deg, #ffffff0c 0 1px, transparent 1.5px 6px), var(--piece);
}
.cart-square.active-load { box-shadow: inset 0 0 0 2px #ffe6a5; }
.cart-caption { color: #ccb395; font-size: 11px; text-align: center; }
.cargo-tray { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.cargo-choice {
  position: relative; display: grid; align-content: center; justify-items: center; gap: 3px; min-width: 0;
  min-height: 76px; padding: 5px 1px; border: 1px solid #755738; border-radius: 5px; background: #2f2218; color: #f1d9b1;
  font-size: clamp(11px, 1.2vw, 13px); line-height: 1.23; cursor: grab;
}
.cargo-choice:active { cursor: grabbing; }
.cargo-sample { display: grid; grid-template: repeat(3, 7px) / repeat(3, 7px); gap: 1px; place-self: center; }
.cargo-sample i {
  grid-column: var(--sample-x); grid-row: var(--sample-y);
  border: 1px solid var(--piece-line); border-radius: 1px; background: var(--piece);
}
.cargo-choice small { font-size: 10px; color: #dcc199; }
.loaded-tag { color: #cfe4b4; font-size: 10px; }

.hall-puzzle {
  position: relative; display: grid; grid-template: repeat(3, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr)); gap: 2px; aspect-ratio: 16 / 9;
  padding: 4px; border: 1px solid #9e754c; border-radius: 6px; background: #19130f; box-shadow: 0 6px 16px #0006;
}
.hall-tile {
  position: relative; display: block; min-width: 0; min-height: 0; overflow: hidden; padding: 0; border: 0; border-radius: 2px;
  background-color: #483025; background-size: 300% 300%; background-position: var(--tile-x) var(--tile-y); background-repeat: no-repeat;
}
.hall-tile span {
  position: absolute; left: 4px; top: 4px; padding: 1px 4px; border-radius: 2px;
  color: #f8deb6; background: #1e150de6; font-size: 10px; font-variant-numeric: tabular-nums;
}
.hall-tile span:empty { display: none; }
.hall-tile:is(.join-right, .join-down)::after {
  content: ""; position: absolute; inset: 0; border: 0 solid #ffda7d; pointer-events: none;
}
.hall-tile.join-right::after { border-right-width: 3px; }
.hall-tile.join-down::after { border-bottom-width: 3px; }
.hall-reference {
  position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); border-radius: 3px;
  object-fit: fill; pointer-events: none;
}
.hall-workbench { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px 12px; }
.hall-spare { display: flex; align-items: center; gap: 8px; color: #f0d6a9; font-size: 12px; }
.hall-spare strong, .hall-spare small { display: block; }
.hall-spare small { color: #d7b994; font-size: 11px; }
.hall-tray-tile { width: 66px; aspect-ratio: 16 / 9; outline: 1px dashed #b68b5b; outline-offset: 2px; }
.hall-restored { width: 100%; border-radius: 4px; }
.challenge-feedback[data-tone="info"] { border-color: #b09865; color: #f1dcac; background: #30281a; }

.challenge-board .actions { gap: 6px; }
.challenge-board .actions .button { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.challenge-board button:disabled { opacity: .48; cursor: default; }
.challenge-board .hall-tile:disabled { opacity: 1; }
:is(button.nav-cell, .steering button, button.cart-square, .cargo-choice, .hall-tile):not(:disabled):is(:hover, :focus-visible),
:is(.cargo-choice, .hall-tile)[aria-pressed="true"] {
  z-index: 1; box-shadow: inset 0 0 0 2px #f2c984, 0 0 8px #f2c98455;
}
.cargo-choice[aria-pressed="true"] { background: #4b3421; color: #ffebbb; }
.hall-tile[aria-pressed="true"] { filter: brightness(1.15); }
.cart-board button.cart-square.drop-preview { box-shadow: inset 0 0 0 2px #b7ca88; background-color: #516044; }
.cart-board button.cart-square.blocked-preview { box-shadow: inset 0 0 0 2px #ed9b80; background-color: #663c30; }

@media (max-width: 500px) {
  .cart-square { min-height: 37px; }
  .cargo-tray { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cargo-choice { min-height: 65px; }
  .steering { grid-template-columns: repeat(3, 42px); }
  .steering button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .weight-beam i { transition: none; }
}
