.page-game .game-shell.theme-paths:has(.hexbridge-room) {
  --hex-stage:#fbf3e4;
  --hex-ink:#1e3745;
  background:var(--hex-stage);
  color:var(--hex-ink);
}
.page-game .game-shell.theme-paths:has(.hexbridge-room) .game-toolbar {
  background:var(--hex-stage);
  color:var(--hex-ink);
  border-color:#b9a88e;
}
.page-game .game-shell.theme-paths.wide .play:has(.hexbridge-room) {
  max-width: 100rem;
  min-height: 0;
  margin-block:0;
  justify-content: flex-start;
  padding: clamp(1rem, 4dvh, 2.45rem) clamp(.8rem, 2vw, 2rem);
}
.hexbridge-room {
  --bridge-water: #477985;
  --bridge-ink: var(--hex-ink);
  --bridge-light: #fff3d8;
  --bridge-a: #294579;
  --bridge-b: #a04932;
  --bridge-line: #887354;
  width: 100%;
  min-width: 0;
  max-width: 82rem;
  margin-inline: auto;
}
.game-shell .play .hexbridge-room { text-align: start; }
.game-shell .play .hexbridge-room .hexbridge-head {
  padding: .4rem 0 clamp(.55rem, 1.6dvh, 1rem);
}
.game-shell .play .hexbridge-room .hexbridge-head h2 {
  color: var(--bridge-ink);
  margin: 0;
  text-align: start;
  font-size: clamp(1.48rem, min(3.9vw, 5.3dvh), 3.6rem);
  line-height: 1.13;
  outline: none;
  text-wrap: balance;
}
.game-shell .play .hexbridge-room p { max-width: none; margin-inline: 0; }
.game-shell .play .hexbridge-room .hexbridge-head p {
  margin: 0 0 .16rem;
  font-weight: 700;
  color: #48605a;
}
.hexbridge-desk {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(.7rem, 4vw, 3.65rem);
}
.hexbridge-table {
  min-width: 0;
  container-type: inline-size;
  padding: clamp(.38rem, 2vw, 1.5rem);
  background:
    repeating-radial-gradient(ellipse at 0% 55%,#ffffff25 0 1px,transparent 2px 30px),
    linear-gradient(155deg,#4c8c94,#315868aa),
    var(--bridge-water);
  border:1px solid #345b67;
  border-radius:.8rem;
  box-shadow:inset 0 1px 0 #ffffff40,0 .3rem 0 #284d5a;
}
.hexbridge-board {
  --tile: clamp(44px, min(calc(100cqw / 7), 12dvh), 108px);
  --hex-slide: calc(var(--tile) / 2);
  --tile-edge: polygon(26% 0%, 74% 0%, 100% 50%, 74% 100%, 26% 100%, 0% 50%);
  width: calc(var(--tile) * 5 + var(--hex-slide) * 4);
  max-width: 100%;
  margin: 0 auto;
}
.hexbridge-row {
  display: flex;
  gap: 0;
  margin-inline-start: calc(var(--hex-row) * var(--hex-slide));
}
.hexbridge-row + .hexbridge-row { margin-top: calc(var(--tile) * -.24); }
.hexbridge-cell {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  flex: 0 0 var(--tile);
  width: var(--tile);
  min-height: var(--tile);
  height: var(--tile);
  padding: 0;
  border: 0;
  color: #213d4d;
  background: transparent;
  font: inherit;
  cursor: pointer;
  isolation: isolate;
}
.hexbridge-cell::before, .hexbridge-cell::after {
  content: "";
  z-index: -1;
  position: absolute;
  clip-path: var(--tile-edge);
  inset: 1px;
  background: var(--bridge-line);
}
.hexbridge-cell::after {inset:3px;background:linear-gradient(#fff9e8,var(--bridge-light))}
.hexbridge-cell:disabled { cursor: default; opacity: 1; }
.hexbridge-cell[data-kind="empty"]:not([data-hexbridge-mark="pending"]):not(:disabled):hover::after {background:#fffdf4}
.hexbridge-cell:not(:disabled):focus-visible { outline: none; z-index: 1; }
.hexbridge-cell:not(:disabled):focus-visible::before {background:#ffe2a1}
.hexbridge-cell:is([data-kind="circle"],[data-kind="cross"]) { color: white; }
.hexbridge-cell[data-kind="circle"]::after { background: var(--bridge-a); }
.hexbridge-cell[data-kind="cross"]::after { background: var(--bridge-b); }
.hexbridge-cell[data-kind="shoal"]::after {
  background:repeating-linear-gradient(35deg,#99b2b4 0 4px,#c1d1ce 4px 8px);
}
.hexbridge-cell[data-hexbridge-mark="pending"]::before {background:#693e16}
.hexbridge-cell[data-hexbridge-mark="pending"]::after {background:#ffd689;inset:5px}
.hexbridge-cell[data-hexbridge-mark="pin"]::before,.hexbridge-cell[data-hexbridge-mark="contact"]::before {
  background:#ffd689;
}
.hexbridge-cell[data-hexbridge-mark="pin"]::after {inset:5px}
.hexbridge-cell[data-hexbridge-mark="contact"]::after { inset: 5px; }
.hexbridge-cell[data-hexbridge-mark="route"]::before { background: #efcf79; }
.hexbridge-cell[data-hexbridge-mark="route"]::after { inset: 5px; }
.hexbridge-piece:not(:empty) { font-size: clamp(1.04rem, 3vw, 2.4rem); font-weight: 800; line-height: 1; }
.hexbridge-coordinate { font-size: clamp(.72rem, 1.28vw, .92rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.hexbridge-edge-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem .65rem;
  margin-top: .35rem;
  font-weight: 720;
  font-size: .91rem;
}
.hexbridge-edge-a, .hexbridge-edge-b {
  display: inline-block;
  padding-inline: .3rem;
  background: #fff5df;
  border-bottom: 2px solid currentColor;
}
.hexbridge-edge-a { color: #265670; }
.hexbridge-edge-b { color: #7c432f; border-bottom-style: dashed; }
.hexbridge-panel {
  min-width: 0;
  padding-block-start: .4rem;
  border-top: 1px solid #abc0b8;
}
.game-shell .play .hexbridge-panel h3 { color: #264642; margin: .55rem 0; font-size: clamp(1.15rem, 2vw, 1.65rem); }
.hexbridge-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .52rem 0;
}
.game-shell .play .hexbridge-controls .button {
  min-height: 44px;
  white-space: normal;
  text-align: center;
  font-size: .92rem;
}
.hexbridge-controls .button.secondary {
  background: #fbfcf9;
  color: #345a52;
  border-color: #a6b9ad;
}
.hexbridge-controls .button[aria-pressed="true"] {
  background: #d8e6dc;
  border-color: #557f6d;
}
.hexbridge-controls .button:focus-visible { outline: 2px solid #68488b; outline-offset: 3px; }
.hexbridge-panel [data-hexbridge-pending], .hexbridge-pin-title strong { color: #4f3766; }
.hexbridge-route-caption {
  padding: .35rem .55rem;
  border-inline-start: .22rem solid #b07e27;
  background: #fff4d6;
}
.hexbridge-panel [data-hexbridge-contacts] {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: .35rem .5rem;
  margin: .4rem 0;
  padding: 0;
}
.hexbridge-panel [data-hexbridge-contact] {
  padding: .27rem .55rem;
  color: #294641;
  background: #fbfcf9;
  border-inline-start: .2rem solid #ad783f;
}
.page-game .game-shell.theme-paths:has(.hexbridge-room) .game-toolbar .button,
.page-game .game-shell.theme-paths .play .hexbridge-room .button.secondary {
  background:#fffaf0;color:#224151;border-color:#9a876c;
}
.page-game .game-shell.theme-paths .play .hexbridge-room .button:not(.secondary) {
  background:#244d72;color:white;border-color:#244d72;
}
.page-game .game-shell.theme-paths .play .hexbridge-room .button:not(.secondary):enabled:hover {background:#173857}
.page-game .game-shell.theme-paths .play .hexbridge-room .button[aria-pressed="true"] {
  background:#dce9e9;border-color:#527783;color:#163b45;
}
.page-game .game-shell.theme-paths .play .hexbridge-room .button:disabled {
  background:#e8e0d1;border-color:#af9f8b;color:#536068;opacity:1;
}
.hexbridge-panel [data-hexbridge-pending],.hexbridge-pin-title strong {color:#714a20}
@media (max-width: 730px) {
  .page-game .game-shell.theme-paths.wide .play:has(.hexbridge-room) { justify-content: flex-start; padding-block: 1rem; }
  .hexbridge-desk { grid-template-columns: minmax(0,1fr); gap: .85rem; }
  .hexbridge-table { padding-inline: 0; }
  .hexbridge-board { --tile: clamp(44px, 11vw, 75px); --hex-slide: clamp(4px, calc((100cqw - var(--tile) * 5) / 4),16px); }
}
@media (prefers-reduced-motion: no-preference) {
  .hexbridge-room[data-hexbridge-phase="result"] .hexbridge-cell[data-hexbridge-mark="route"] .hexbridge-piece {
    animation: bridge-join .32s ease-out both;
  }
  @keyframes bridge-join {
    from { transform: scale(.78); opacity: .56; }
    to { transform: scale(1); opacity: 1; }
  }
}
