/* Harbor Diorama: artwork is supplied by the existing scene-art owner. The
   public grid, its real cells, port signs, pan and input plane remain intact. */
.game.game-v36 {
  --v36-top-height:clamp(96px,calc(var(--app-height) * .168),142px);
  --v36-hud-height:64px;
  --v36-fixed-height:200px;
  --v36-board-height:calc(var(--app-height) - var(--v36-top-height) - var(--v36-fixed-height));
  --v36-help-height:34px;
  --v36-tool-height:48px;
  --v36-corner-size:96px;
  --v36-header-padding:8px;
  --v36-header-bottom:calc(var(--v36-top-height) + var(--v36-hud-height) + var(--v36-header-padding) + 12px);
  --harbor-frame-pad:20px;
  min-height:var(--app-height);
  padding:8px 0 12px;
  gap:0;
  background-color:var(--harbor-water-base,#1a9fa4);
  background-image:linear-gradient(to bottom,#fff 0,#fff var(--v36-header-bottom),transparent var(--v36-header-bottom)),var(--v36-landscape,var(--ui-gameBackground));
  background-position:center top,center top;
  background-size:100% 100%,cover;
  background-repeat:no-repeat,no-repeat;
  color:var(--v25-ink,#153f53);
}
.game.game-v36.has-loot-context {
  --v36-fixed-height:216px;
  --v36-help-height:50px;
}

/* The region is a landscape, not a painted HUD. Every label and action below
   remains live text on an isolated model-rendered plate. */
.game.game-v36>.top {
  display:block;
  position:relative;
  width:calc(100% - 24px);
  height:var(--v36-top-height);
  flex:none;
  z-index:5;
}
.game.game-v36>.top>.icon-button {
  position:absolute;
  top:clamp(18px,calc(var(--app-height) * .055),46px);
  left:0;
  width:44px;
  height:44px;
  min-width:44px;
  min-height:44px;
  padding:10px;
  border:0;
  border-image:none;
  background:var(--v36-button-square,var(--v25-icon-button)) center/100% 100% no-repeat;
  box-shadow:none;
  filter:drop-shadow(0 2px 1px #16485430);
}
.game.game-v36>.top>.game-settings-button { left:auto; right:0; }
.game.game-v36>.top .icon { width:24px; height:24px; color:#164c5c; }
.game.game-v36 .brand {
  position:absolute;
  left:50%;
  bottom:26px;
  transform:translateX(-50%);
  width:164px;
  height:39px;
  padding:3px 16px;
  gap:6px;
  border:0;
  border-image:none;
  border-radius:0;
  background:var(--v36-level-frame,var(--v25-route)) center/100% 100% no-repeat;
  box-shadow:none;
  color:#124756;
  font-size:25px;
  line-height:30px;
  font-weight:400;
  text-shadow:0 1px #fff9df;
  filter:drop-shadow(0 2px 1px #16485422);
}
.game.game-v36 .brand:is([data-digits="7"],[data-digits="8"],[data-digits="9"]) { width:190px; font-size:18px; }
.game.game-v36 .brand>.harbor-region-label {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); clip-path:inset(50%); white-space:nowrap;
}
.game.game-v36 .threat-hud {
  width:100%;
  height:var(--v36-hud-height);
  margin:0;
  flex:none;
  z-index:6;
}
.game.game-v36 .corner-portrait {
  position:absolute;
  bottom:0;
  width:var(--v36-corner-size);
  height:var(--v36-corner-size);
  pointer-events:none;
  isolation:isolate;
  z-index:3;
}
.game.game-v36 .corner-captain { left:0; }
.game.game-v36 .corner-navy { right:0; }
.game.game-v36 .corner-portrait>.crew-portrait,
.game.game-v36 .corner-portrait>.admiral-portrait {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  margin:0;
  scale:1;
  transform:none;
  transform-origin:50% 86%;
  animation:none;
  background-repeat:no-repeat;
  filter:drop-shadow(0 1px 1px #163e4c30);
  z-index:1;
}
.game.game-v36 .corner-rail {
  position:absolute;
  inset:0;
  background-position:center bottom;
  background-size:contain;
  background-repeat:no-repeat;
  filter:drop-shadow(0 2px 1px #163e4c38);
  pointer-events:none;
  z-index:4;
}
.game.game-v36 .threat-hud .counter {
  position:absolute;
  left:20%; right:20%; top:10px;
  width:auto; max-width:none; height:44px;
  margin:0; padding:4px 10px 6px; gap:5px;
  border:0; border-image:none; border-radius:0;
  background:var(--v36-counter-frame,var(--v25-primary)) center/100% 100% no-repeat;
  color:#fff8de;
  filter:drop-shadow(0 2px 1px #153f5350);
  z-index:2;
}
.game.game-v36 .counter .cannon { width:23px; height:23px; flex:none; color:#ffd67a; }
.game.game-v36 .counter-copy { gap:5px; font-weight:400; text-shadow:0 1px 1px #084b55; }
.game.game-v36 .counter-copy .label { font-size:11px; line-height:12px; }
.game.game-v36 .counter-copy .moves { font-size:10px; line-height:12px; }
.game.game-v36 .counter-copy strong { font-size:30px; line-height:32px; color:#ffdb84; font-weight:400; }
.game.game-v36 .counter.danger strong { color:#ffbc84; }
.game.game-v36 .counter.danger { filter:drop-shadow(0 0 3px #dc773b88); }
.game.game-v36 .cannon-charge { left:13px; right:13px; bottom:5px; height:2px; opacity:.65; }
.game.game-v36 .last-move-ribbon { bottom:-7px; padding:1px 9px; font-size:8px; line-height:10px; }

/* Portraits rest on the same low, open rail as the accepted corner study.
   Bubbles react to actual actions; they do not add another status row. */
.game.game-v36 .crew-band.battle-radio {
  position:absolute; inset:0; width:auto; height:auto; margin:0;
  display:block; pointer-events:none; z-index:5;
}
.game.game-v36 .battle-radio .crew-speech,
.game.game-v36 .battle-radio .navy-taunt {
  position:absolute;
  top:-22px; bottom:auto; left:78px; right:auto;
  width:calc(50% - 86px); max-width:130px;
  height:auto; min-height:23px;
  margin:0; padding:4px 7px;
  display:flex; align-items:center; justify-content:center;
  border:0; border-image:none;
  background:var(--v36-help-frame,var(--v25-route)) center/100% 100% no-repeat;
  color:#173f4f; font:400 10px/11px 'Bree Serif',Georgia,serif;
  text-align:center; white-space:normal;
  filter:drop-shadow(0 1px 1px #153f5330);
}
.game.game-v36 .battle-radio .crew-speech>span { max-width:100%; }
.game.game-v36 .battle-radio .navy-taunt { left:auto; right:78px; color:#5a4732; }
.game.game-v36 .battle-radio:not(.navy-speaking) .navy-taunt {
  width:1px; height:1px; min-height:0; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); clip-path:inset(50%); white-space:nowrap;
}
.game.game-v36 .battle-radio .navy-taunt::before { display:none; }
.game.game-v36 .navy-strip.diorama-fire-anchors {
  position:absolute; left:20%; right:20%; top:10px;
  width:auto; max-width:none; height:44px; margin:0; padding:0;
  border:0; border-image:none; border-radius:0;
  background:none; box-shadow:none; filter:none;
  pointer-events:none; z-index:7;
}
.game.game-v36 .diorama-fire-anchors>.navy-cannon {
  top:4px; width:24px; height:32px; background:none;
  filter:none; animation:none;
}
.game.game-v36 .diorama-fire-anchors>.cannon-left { left:0; }
.game.game-v36 .diorama-fire-anchors>.cannon-right { right:0; }
.game.game-v36 .diorama-fire-anchors>.navy-cannon::after { display:none; }

/* Square cells determine the board height. Only the scenic padding is a
   fixed size; larger logical boards retain their existing 48px pan cells. */
.game.game-v36 .board-stage {
  width:min(374px,calc(100% - 12px),max(304px,calc((var(--v36-board-height) - var(--harbor-frame-pad) * 2) * .75 + var(--harbor-frame-pad) * 2)));
  max-width:calc(100% - 12px);
  margin:12px auto 0;
  flex:none;
  z-index:2;
}
.game.game-v36 .board-stage:not(.pan-harbor) .board-wrap { padding:var(--harbor-frame-pad); }
.game.game-v36 .board-stage .board-wrap,
.game.game-v36[data-region] .board-stage .board-wrap {
  position:relative;
  border-radius:0;
  background:transparent;
}
.game.game-v36 .board-stage .board-wrap::before {
  /* The full landscape already owns the coastline. A second shoreline
     scaled to the board crops rocks against an unrelated rectangular edge. */
  content:none;
  display:none;
}
/* Reuse the existing decorative host: its fade stays fixed while only its
   small tile layer moves. The original last-move warning ring keeps ::after
   on board-wrap, and both water layers leave the input plane untouched. */
.game.game-v36 .board-stage .board-wrap>.harbor-scenic-fringe {
  position:absolute; inset:0; display:block; padding:0;
  border:0; border-radius:0; background:none;
  overflow:hidden; opacity:.16; pointer-events:none; z-index:0;
  -webkit-mask-image:linear-gradient(to right,transparent,#000 20px,#000 calc(100% - 20px),transparent),linear-gradient(to bottom,transparent,#000 20px,#000 calc(100% - 20px),transparent);
  -webkit-mask-composite:source-in;
  mask-image:linear-gradient(to right,transparent,#000 20px,#000 calc(100% - 20px),transparent),linear-gradient(to bottom,transparent,#000 20px,#000 calc(100% - 20px),transparent);
  mask-composite:intersect;
}
.game.game-v36 .harbor-scenic-fringe::after {
  content:''; position:absolute; inset:-3px;
  background:var(--v36-water,none) 0 0/256px 256px repeat;
  pointer-events:none; transform:translate3d(-3px,0,0);
  animation:diorama-water-sway36 12s ease-in-out infinite alternate;
}
.game.game-v36 .board {
  border:0; border-radius:0;
  background:transparent;
  box-shadow:none;
  z-index:4;
}
.game.game-v36 .board::before { background:none; border-radius:0; }
.game.game-v36 .board::after {
  border:1px solid #e1fff132;
  border-radius:0;
  opacity:.62;
  background-image:linear-gradient(90deg,#e2fff13b 1px,transparent 1px),linear-gradient(#e2fff13b 1px,transparent 1px);
}
.game.game-v36 .board-stage.pan-harbor,
.game.game-v36:has(.mechanic-help.has-loot-note) .board-stage.pan-harbor {
  --cell-size:48px;
  width:min(374px,calc(100% - 12px));
  height:max(300px,var(--v36-board-height));
}
.game.game-v36 .board-stage.pan-harbor[data-columns="7"] { --cell-size:48px; }
/* The scrolling input plane stays above the single landscape coastline. */
.game.game-v36 .pan-harbor>.board-viewport {
  position:relative;
  z-index:1;
  background:transparent;
  border-radius:10px;
  box-shadow:0 1px 3px #16425133;
  scrollbar-color:#e5d3a3 #176d7199;
}
.game.game-v36 .pan-harbor .board-wrap { padding:44px 36px; }
.game.game-v36 .pan-harbor .board { border-radius:0; }
.game.game-v36 .corridor { background:#f9efb708; border-color:#e7f6cf22; }
.game.game-v36 .corridor::before { border-color:#f5fac826; }
.game.game-v36 .corridor.hinted { background:#fff2a52a; border-color:#fff2b3b0; }
.game.game-v36 .corridor.hinted::before { border-color:#fff7bc9c; }
.game.game-v36 .signal-ship-id { opacity:0; }
.game.game-v36 .piece.glow .signal-ship-id { opacity:1; }
.game.game-v36 .signal-heading { border-width:1px; box-shadow:0 1px 2px #153f5750,inset 0 0 0 1px #1c4c5b; }
.game.game-v36 .signal-captain-label { bottom:-3px; height:19px; border-radius:6px; }
.game.game-v36 .signal-pan-cues { bottom:-20px; }
.game.game-v36 .board-pan-hint { bottom:-20px; height:20px; line-height:16px; }

/* A single compact rule panel leaves space for all three real booster
   actions. Optional treasure remains secondary and never obscures a rule. */
.game.game-v36 .mechanic-help {
  width:calc(100% - 36px); max-width:374px;
  min-height:var(--v36-help-height); height:var(--v36-help-height);
  margin:12px 0 0; padding:4px 10px; gap:6px;
  flex:none; flex-wrap:nowrap;
  border:0; border-image:none; border-radius:0;
  background:var(--v36-help-frame,var(--v25-route)) center/100% 100% no-repeat;
  box-shadow:none;
  filter:drop-shadow(0 1px 1px #153f5330);
  text-align:center;
  z-index:4;
}
.game.game-v36 .pan-harbor~.mechanic-help { margin-top:26px; }
.game.game-v36:has(.pan-harbor) { --v36-fixed-height:214px; }
.game.game-v36.has-loot-context:has(.pan-harbor) { --v36-fixed-height:230px; }
.game.game-v36 .mechanic-help>.icon { width:24px; height:24px; color:#aa7426; }
.game.game-v36 .mechanic-help>.mechanic-help-copy { min-width:0; gap:1px; flex:1; }
.game.game-v36 .mechanic-help b { font-size:10px; line-height:11px; }
.game.game-v36 .mechanic-help small { font-size:9px; line-height:10px; }
.game.game-v36 .mechanic-help.has-loot-note { flex-wrap:wrap; align-content:center; row-gap:2px; }
.game.game-v36 .mechanic-help.has-loot-note>.mechanic-help-copy { flex-basis:calc(100% - 32px); }
.game.game-v36 .mechanic-help>.signal-loot-note {
  flex:0 0 100%; min-height:13px; height:13px;
  padding:1px 0 0; gap:4px; border:0;
}
.game.game-v36 .signal-loot-note>.icon { width:13px; height:13px; }
.game.game-v36 .signal-loot-note>span { flex-direction:row; gap:4px; }
.game.game-v36 .signal-loot-note b { font-size:8px; line-height:10px; }
.game.game-v36 .signal-loot-note small { font-size:8px; line-height:10px; }
.game.game-v36 .mechanic-help>.signal-loot-secured { width:54px; height:22px; padding:2px; border:0; background:none; }
.game.game-v36 .signal-loot-secured>.icon { width:16px; height:16px; }
.game.game-v36 .mechanic-help>.signal-loot-secured>b { font-size:7px; line-height:9px; }
.game.game-v36 .booster-tools {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr));
  width:calc(100% - 24px); max-width:390px;
  height:var(--v36-tool-height);
  margin:10px 0 0; gap:7px; flex:none;
  z-index:4;
}
.game.game-v36 .mechanic-help+.booster-tools { margin-top:10px; }
.game.game-v36 .booster-tools .tool {
  display:grid; grid-template-columns:20px minmax(0,1fr); grid-template-rows:22px 12px;
  align-content:center; align-items:center; justify-content:center;
  min-width:0; min-height:var(--v36-tool-height); height:var(--v36-tool-height);
  margin:0; padding:5px 7px; column-gap:3px; row-gap:0;
  border:0; border-image:none; border-radius:0;
  background:var(--v36-button-wood,var(--v25-secondary)) center/100% 100% no-repeat;
  color:#fff5df;
  font-size:13px; line-height:16px; font-weight:400;
  text-shadow:0 1px 1px #68411d;
  box-shadow:none;
  filter:drop-shadow(0 2px 1px #123c5140);
}
.game.game-v36 .booster-tools .tool.primary {
  border:0; border-image:none;
  background-image:var(--v36-button-teal,var(--v25-primary));
  color:#fff7df; text-shadow:0 1px 1px #064b55;
}
.game.game-v36 .booster-tools .tool>.icon { grid-column:1; grid-row:1; width:20px; height:20px; }
.game.game-v36 .booster-tools .tool>span { grid-column:2; grid-row:1; display:flex; align-items:center; justify-content:center; gap:4px; white-space:nowrap; }
.game.game-v36 .booster-tools .tool>small { grid-column:1 / 3; grid-row:2; color:#fff4d2; font-size:9px; line-height:11px; opacity:1; letter-spacing:0; text-shadow:inherit; }
.game.game-v36 .booster-tools .stock { min-width:20px; height:21px; padding:0 4px; border-radius:5px; color:#164b5c; background:#fff0cf; font-size:15px; line-height:20px; text-shadow:none; }
.game.game-v36 .booster-tools .empty-stock { color:#9e542e; background:#f6dfc5; }
.game.game-v36 .booster-tools .tool:disabled { opacity:.6; filter:grayscale(.25); }
.game.game-v36 .screen-rim { display:none; }

@keyframes diorama-water-sway36 { to { transform:translate3d(3px,0,0); } }
.motion-paused .game.game-v36 .harbor-scenic-fringe::after,
.game.game-v36.threat-paused .harbor-scenic-fringe::after { animation-play-state:paused; }
@media (min-width:351px) {
  .game.game-v36 .signal-exit:is(.signal-exit-left,.signal-exit-right) { width:40px; }
  .game.game-v36 .signal-exit:is(.signal-exit-left,.signal-exit-right) .signal-word-full { display:inline; font-size:8px; }
  .game.game-v36 .signal-exit:is(.signal-exit-left,.signal-exit-right) .signal-word-short { display:none; }
  .game.game-v36 .board-stage:not(.pan-harbor) .signal-exit-left { margin-left:max(4px,min(16px,calc(4px + (410px - 100vw) / 2))); }
  .game.game-v36 .board-stage:not(.pan-harbor) .signal-exit-right { margin-left:calc(-1 * max(4px,min(16px,calc(4px + (410px - 100vw) / 2)))); }
  .game.game-v36 .pan-harbor .signal-exit-left { margin-left:6px; }
  .game.game-v36 .pan-harbor .signal-exit-right { margin-left:-6px; }
}
@media (prefers-reduced-motion:reduce) {
  .game.game-v36 .harbor-scenic-fringe::after { animation:none; transform:none; }
}

@media (max-height:780px) {
  .game.game-v36 { --v36-header-padding:7px; }
  .game.game-v36 { --v36-top-height:104px; --v36-hud-height:60px; --v36-fixed-height:192px; --v36-corner-size:90px; padding-top:7px; padding-bottom:9px; }
  .game.game-v36.has-loot-context { --v36-fixed-height:208px; }
  .game.game-v36:has(.pan-harbor) { --v36-fixed-height:206px; }
  .game.game-v36.has-loot-context:has(.pan-harbor) { --v36-fixed-height:222px; }
  .game.game-v36>.top>.icon-button { top:16px; }
  .game.game-v36 .brand { bottom:25px; }
  .game.game-v36 .threat-hud .counter { top:8px; }
  .game.game-v36 .navy-strip.diorama-fire-anchors { top:8px; }
}
@media (max-height:700px) {
  .game.game-v36 { --v36-header-padding:6px; }
  .game.game-v36 { --v36-top-height:72px; --v36-hud-height:54px; --v36-fixed-height:184px; --v36-help-height:32px; --v36-tool-height:46px; --v36-corner-size:82px; padding-top:6px; padding-bottom:8px; }
  .game.game-v36.has-loot-context { --v36-fixed-height:200px; --v36-help-height:48px; }
  .game.game-v36:has(.pan-harbor) { --v36-fixed-height:198px; }
  .game.game-v36.has-loot-context:has(.pan-harbor) { --v36-fixed-height:214px; }
  .game.game-v36>.top>.icon-button { top:2px; }
  .game.game-v36 .brand { bottom:25px; height:35px; font-size:23px; }
  .game.game-v36 .threat-hud .counter { top:5px; height:42px; }
  .game.game-v36 .navy-strip.diorama-fire-anchors { top:5px; height:42px; }
  .game.game-v36 .battle-radio .crew-speech,.game.game-v36 .battle-radio .navy-taunt { top:-23px; }
  .game.game-v36 .counter-copy strong { font-size:28px; line-height:30px; }
}
@media (max-width:350px) {
  .game.game-v36 { --harbor-frame-pad:10px; --v36-corner-size:82px; }
  .game.game-v36>.top { width:calc(100% - 16px); }
  .game.game-v36 .brand { width:152px; font-size:23px; }
  .game.game-v36 .brand:is([data-digits="7"],[data-digits="8"],[data-digits="9"]) { width:176px; font-size:16px; }
  .game.game-v36 .threat-hud .counter { left:19%; right:19%; gap:3px; padding-left:8px; padding-right:8px; }
  .game.game-v36 .counter .cannon { width:18px; height:18px; }
  .game.game-v36 .counter-copy { gap:3px; }
  .game.game-v36 .counter-copy .label { font-size:9px; line-height:10px; }
  .game.game-v36 .counter-copy .moves { font-size:8px; line-height:10px; }
  .game.game-v36 .counter-copy strong { font-size:26px; line-height:28px; }
  .game.game-v36 .battle-radio .crew-speech { left:64px; width:calc(50% - 70px); padding:4px 6px; font-size:9px; line-height:10px; }
  .game.game-v36 .battle-radio .navy-taunt { right:64px; width:calc(50% - 70px); padding:4px 6px; font-size:9px; line-height:10px; }
  .game.game-v36 .navy-strip.diorama-fire-anchors { left:19%; right:19%; }
  .game.game-v36 .mechanic-help { width:calc(100% - 24px); padding-left:7px; padding-right:7px; gap:4px; }
  .game.game-v36 .mechanic-help>.icon { width:21px; height:21px; }
  .game.game-v36 .mechanic-help b { font-size:9px; line-height:10px; }
  .game.game-v36 .mechanic-help small { font-size:8px; line-height:9px; }
  .game.game-v36 .signal-loot-note>span { gap:3px; }
  .game.game-v36 .signal-loot-note b { font-size:8px; }
  .game.game-v36 .signal-loot-note small { font-size:8px; }
  .game.game-v36 .booster-tools { width:calc(100% - 16px); gap:5px; }
  .game.game-v36 .booster-tools .tool { grid-template-columns:16px minmax(0,1fr); padding-left:5px; padding-right:5px; column-gap:1px; font-size:11px; }
  .game.game-v36 .booster-tools .tool>.icon { width:17px; height:17px; }
  .game.game-v36 .booster-tools .tool>span { gap:3px; }
  .game.game-v36 .booster-tools .stock { min-width:17px; height:19px; padding:0 3px; font-size:13px; line-height:18px; }
  .game.game-v36 .booster-tools .tool>small { font-size:8px; line-height:10px; }
}
@media (max-width:320px) {
  .game.game-v36 .booster-tools .tool { grid-template-columns:14px minmax(0,1fr); padding-left:4px; padding-right:4px; font-size:10px; }
  .game.game-v36 .booster-tools .tool>.icon { width:15px; height:15px; }
  .game.game-v36 .booster-tools .stock { min-width:16px; padding:0 2px; }
}
