/* Board treatment: every mark is a functional part of the expedition chart. */
.zones { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.zones i { position: absolute; display: grid; width: 24%; aspect-ratio: 1; place-items: center; border: 1px solid rgb(255 245 201 / .9); border-radius: 50%; color: #f8f0cf; background: rgb(19 46 39 / .7); box-shadow: 0 1px 2px rgb(5 24 22 / .7), inset 0 0 0 1px rgb(0 0 0 / .24); font: 900 clamp(8px, .8vw, 13px)/1 var(--utility); font-style: normal; text-shadow: 0 1px 1px #081c1a; transform: translate(-50%, -50%); }
.zones i.occupied-zone { border-color: #fff5c6; color: #4a2c0c; background: #f6c94e; box-shadow: 0 0 0 2px rgb(82 47 10 / .9), 0 0 9px rgb(255 219 94 / .95); }
.cell .gold.zone-gold { right: auto; bottom: auto; z-index: 6; transform: translate(-50%, -50%); pointer-events: none; }
.zones-jungle i:nth-child(1) { left: 24%; top: 76%; }.zones-jungle i:nth-child(2) { left: 76%; top: 24%; }
.zones-desert i:nth-child(1) { left: 75%; top: 76%; }.zones-desert i:nth-child(2) { left: 50%; top: 51%; }.zones-desert i:nth-child(3) { left: 26%; top: 25%; }
.zones-swamp i:nth-child(1) { left: 22%; top: 24%; }.zones-swamp i:nth-child(2) { left: 41%; top: 42%; }.zones-swamp i:nth-child(3) { left: 60%; top: 61%; }.zones-swamp i:nth-child(4) { left: 79%; top: 79%; }
.zones-mountain i:nth-child(1) { left: 24%; top: 24%; }.zones-mountain i:nth-child(2) { left: 76%; top: 24%; }.zones-mountain i:nth-child(3) { left: 50%; top: 50%; }.zones-mountain i:nth-child(4) { left: 24%; top: 76%; }.zones-mountain i:nth-child(5) { left: 76%; top: 76%; }

.tile-art {
  position: absolute;
  z-index: 1;
  inset: 12%;
  width: 76%;
  height: 76%;
  fill: #efc45f;
  stroke: #294e4a;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 rgb(255 255 255 / .6));
  transform-origin: center;
  transition: transform .14s ease, filter .14s ease;
}
.cell:hover .tile-art { filter: drop-shadow(0 2px 1px rgb(39 53 31 / .22)); transform: scale(1.035); }
.tile-art.tile-jungle, .tile-art.tile-swamp { fill: #4c9468; }
.tile-art.tile-desert, .tile-art.tile-mountain { fill: #ca8d43; }
.tile-art.tile-ice { fill: #c9eef2; stroke: #347a90; }
.tile-art.tile-crocodile { fill: #5a9a58; }
.tile-art.tile-cannibal { fill: #af593f; }
.tile-art.tile-rum, .tile-art.tile-cannon { fill: #996036; stroke: #263f43; }
.tile-art.tile-balloon { fill: #c85a48; }
.tile-art.tile-plane { fill: #dcece5; }
.tile-art.tile-treasure_1, .tile-art.tile-treasure_2, .tile-art.tile-treasure_3, .tile-art.tile-treasure_4, .tile-art.tile-treasure_5 { fill: #a96b2e; stroke: #573b1d; }
.tile-art.tile-arrow { fill: #d79a2f; stroke: #234d4b; stroke-width: 5; }
.tile-arrow .arrow-ray { fill: none; stroke-width: 7; }
.tile-arrow .arrow-head { fill: #234d4b; stroke: none; }
.tile-arrow .arrow-core { fill: #fff2bf; stroke-width: 4; }
.tile-art.tile-bitmap { inset: 0; width: 100%; height: 100%; object-fit: cover; stroke: none; filter: none; }
.tile-treasure-value { position: absolute; z-index: 4; top: 49%; left: 50%; display: grid; width: 21px; height: 21px; place-items: center; border: 1px solid #573b1d; border-radius: 50%; color: #fff5c9; background: #58361a; box-shadow: 0 1px 0 #fff8; font: 900 11px/1 var(--utility); transform: translate(-50%, -50%); }

.cell.used-tile .tile-art { opacity: .42; filter: grayscale(.7) contrast(.82); }
.cell.actionable { outline: 0; }
.move-highlight { position: absolute; z-index: 6; inset: 2px; border: 3px solid #ffe06b; box-shadow: inset 0 0 0 1px #70440f, 0 0 0 1px rgb(255 244 183 / .72), 0 0 10px rgb(255 202 72 / .62); pointer-events: none; }
.cell.used-tile::before { position: absolute; z-index: 5; top: 4px; right: 4px; display: grid; width: 16px; height: 16px; place-items: center; border: 1px solid #54715b; border-radius: 50%; content: "✓"; color: #365a43; background: #e7f0d6; font: 900 11px/1 var(--utility); }
.cell.has-gold { box-shadow: inset 0 0 0 3px #d29b24; }
.cell.has-gold .gold { animation: gold-idle 1.45s ease-in-out infinite; }
.cell.fresh-tile { animation: chart-reveal .42s cubic-bezier(.2,.75,.25,1); }

@keyframes gold-idle { 50% { transform: translateY(-2px) scale(1.08); } }
@keyframes chart-reveal { from { opacity: .35; transform: scale(.82) rotate(-1deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes result-flash { 45% { transform: scale(1.05); } }
@keyframes impact { 25% { transform: translateX(-3px) rotate(-1deg); } 65% { transform: translateX(3px) rotate(1deg); } }
@keyframes turn-advance { from { opacity: .25; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.reveal-pop, .gold-spark { animation: result-flash .36s ease-out; }
.impact { animation: impact .34s ease-out; }
#turn.turn-advance { animation: turn-advance .32s ease-out; }

.pirate {
  position: absolute;
  z-index: 7;
  display: grid;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  appearance: none;
  border: 2px solid #fdf7e9;
  border-radius: 50%;
  clip-path: none;
  outline: 0;
  color: #13242d;
  background: #eee;
  box-shadow: 0 0 0 2px #102f3d, 0 0 0 3px rgb(255 255 255 / .55), 0 3px 5px rgb(0 23 33 / .65);
  cursor: pointer;
  font-size: 0;
  isolation: isolate;
  transform: translate(-50%, -50%);
  transition: transform .14s ease, filter .14s ease, opacity .15s ease;
}
.pirate:hover { filter: brightness(1.1); transform: translate(-50%, -50%) scale(1.14); }
.pirate.white { color: #112331; background: #f3f4e8; }
.pirate.yellow { color: #1d2630; background: #f7c52e; }
.pirate.black { color: #fff; background: #26303a; }
.pirate.red { color: #fff; background: #ce5042; }
.pirate.carrying::after { position: absolute; z-index: 2; top: -9px; right: -9px; content: "●"; color: #eabb3e; font: 15px/1 var(--utility); text-shadow: 0 0 0 #78500d, 0 1px 1px #fff; }
.selected-pirate { z-index: 8; outline: 0 !important; box-shadow: 0 0 0 3px #f5ca42, 0 0 0 5px #50371b, 0 3px 5px rgb(0 23 33 / .65); animation: selected-pirate 1s ease-in-out infinite; }
@keyframes selected-pirate { 50% { transform: translate(-50%, -50%) scale(1.12); } }
.pirate.motion-hidden { opacity: 0; }

.ship-token {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  align-content: center;
  place-items: center;
  gap: 1px;
  border: 2px solid rgb(255 255 255 / .92);
  border-radius: 1px;
  color: #fff;
  background: linear-gradient(145deg, #426a73, #183c4d);
  box-shadow: inset 0 0 0 2px #143442, inset 0 -8px 13px rgb(0 20 31 / .42);
  font-size: clamp(31px, 4.5vw, 52px);
  line-height: .7;
}
.ship-token::before { position: absolute; top: 7%; left: 50%; width: 1px; height: 43%; content: ""; background: rgb(255 255 255 / .75); transform: translateX(-50%); }
.ship-token small { position: relative; z-index: 1; color: currentColor; font: 800 8px/1 var(--utility); letter-spacing: .04em; text-shadow: 0 1px 2px #001b2c; text-transform: uppercase; }
.ship-token.white { color: #173447; background: linear-gradient(145deg, #f0f0e5, #9eb7bb); border-color: #fff; }
.ship-token.yellow { background: linear-gradient(145deg, #f6c93b, #ad7517); }
.ship-token.black { background: linear-gradient(145deg, #485868, #111a22); }
.ship-token.red { background: linear-gradient(145deg, #e86957, #8e302d); }

.motion-layer { position: absolute; z-index: 20; inset: 0; pointer-events: none; }
.motion-pirate { position: absolute; display: grid; width: 23px; height: 23px; place-items: center; border: 2px solid #fff; border-radius: 50%; outline: 2px solid #102f3d; color: #14222a; background: #d9d9d9; box-shadow: 0 2px 8px #1d1209aa; transform: translate(-50%, -50%); transition: left .5s cubic-bezier(.22,.8,.25,1), top .5s cubic-bezier(.22,.8,.25,1), opacity .28s ease, transform .28s ease; }
.motion-pirate.white { background: #f5f0dd; }.motion-pirate.yellow { background: #f4bd3d; }.motion-pirate.black { color: #fff; background: #202a32; }.motion-pirate.red { color: #fff; background: #bd4d3d; }
.motion-pirate.carrying { font-size: 12px; }.motion-pirate.defeated { background: #ba453a; }.motion-pirate.vanish { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(130deg); }
.motion-pirate.cannon-shot { transition: left 1.25s cubic-bezier(.15,.78,.2,1), top 1.25s cubic-bezier(.15,.78,.2,1), opacity .28s ease, transform .28s ease; }

.board.custom-board { display: block; height: min(74vh, 800px); aspect-ratio: auto; overflow: hidden; touch-action: none; }
.board.custom-board .cell { min-width: 0; }
.undo-controls { margin: 8px 0 22px; padding: 11px; border: 1px solid #d7b665; border-radius: 8px; background: #fff0c9; }
.undo-controls p { margin: 0 0 8px; font-size: 12px; line-height: 1.4; }.undo-controls .action + .action { margin-top: 6px; }

.recent-panel { margin-top: 33px; padding-top: 21px; border-top: 1px solid #dec898; }
.recent-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.recent-heading h2 { margin: 4px 0 0; font-size: 23px; }.recent-heading span { color: var(--muted); font-size: 12px; text-align: right; }
.recent-games { display: grid; gap: 7px; }.recent-game { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; border: 1px solid #d8bf86; border-radius: 8px; background: #fffdf7; padding: 10px 11px; }
.recent-game strong { display: block; font-size: 13px; }.recent-game small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }.recent-game .ghost { min-height: 32px; padding: 6px 9px; }.recent-game .remove-recent { border: 0; color: #8a5040; background: transparent; cursor: pointer; font-size: 19px; padding: 5px 7px; }

@media (max-width: 1250px) { .recent-heading { display: block; }.recent-heading span { display: block; margin-top: 7px; text-align: left; } }
@media (prefers-reduced-motion: reduce) { .cell.actionable, .cell.has-gold .gold, .cell.fresh-tile, .selected-pirate, #turn.turn-advance { animation: none !important; } }
