/* Art is registered to the existing logical board. Mats are separate siblings. */
.table-plane { --board-mat-gap: 18px; gap: var(--board-mat-gap); }
.board-section { height: calc(500px + var(--board-art-top, 24px) + var(--board-art-bottom, 24px)); padding: var(--board-art-top, 24px) 0 var(--board-art-bottom, 24px); box-sizing: border-box; }
.arena-scenery {
  inset: 0; overflow: visible; background: none; filter: none; mask-image: none;
}
.arena-art-surface { position: absolute; display: block; }
.arena-base-art { display: block; width: 100%; height: 100%; }
/* Reserve a real left scenic gutter in the camera's measured table bounds.
   Keep mats outside the artwork and a separate market rail on the right. */
.game-table[data-camera='default'] .table-fit,
.game-table[data-camera='default'] .table-plane { width: 1060px; }
.game-table[data-camera='default'] .table-plane { padding-left: 140px; }
.game-table[data-camera='default'] .market-panel { left: 940px; }
.board-section .board-frame {
  width: 500px; height: 500px; padding: 0; border: 1px solid #d9d9c451;
  border-radius: 2px; background: transparent; box-shadow: inset 0 0 5px #0006;
}
.board-section .board { background: transparent; border: 0; }
.board .tile, .board .tile.hidden, .board .tile.hidden:nth-child(even), .board .tile.revealed {
  background: transparent; border: 0; box-shadow: none;
}
.board .tile.hidden::before, .board .tile.hidden::after { content: none; }
.board .tile.hidden:is(:hover,:focus-visible) { background: #ffffff12; outline: 1px solid #e8eef780; outline-offset: -1px; }
.board .tile.terrain-art::before { display: none; }
.board .tile.revealed:not(.terrain-art)::before { opacity: 1; }
.board .tile.revealed.stronghold::before {
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px var(--element-glow),
    inset 0 0 6px 1px color-mix(in srgb, var(--element-glow) 65%, transparent);
}
.board .tile.terrain-neutral { box-shadow: inset 0 0 0 1px #d3d7d66b; }
.board-art-crop { display: block; position: absolute; overflow: hidden; pointer-events: none; }
.board-art-crop > img { position: absolute; max-width: none; pointer-events: none; }
.terrain-floor { inset: 1%; z-index: 0; border-radius: 2px; opacity: 1; filter: brightness(var(--terrain-brightness, .63)) saturate(var(--terrain-saturation, .50)); }
.board .tile.revealed:not(.terrain-art)::before, .terrain-vortex { filter: brightness(var(--special-terrain-brightness, 1)) saturate(var(--special-terrain-saturation, 1)); }
.board .tile:is(:hover,:focus-visible,.selected,.movable,.enemy-preview) { --terrain-brightness: .63; --terrain-saturation: .50; --special-terrain-brightness: 1; --special-terrain-saturation: 1; }
.terrain-occupied .terrain-floor { opacity: .68; }
.terrain-miniature {
  position: absolute; left: 4%; bottom: 8%; width: 92%; aspect-ratio: 476 / 440;
  z-index: 1; pointer-events: none; transform: scaleY(var(--piece-camera-compensation));
  transform-origin: center bottom; filter: drop-shadow(0 1px 1px #000a);
}
.mountain-miniature { left: 1%; width: 98%; aspect-ratio: 484 / 442; }
.terrain-occupied .mountain-miniature { opacity: .5; z-index: 0; }
.terrain-vortex { inset: 3%; z-index: 0; border-radius: 50%; animation: board-vortex-spin 22s linear infinite; }
.blackhole .terrain-vortex { animation-direction: reverse; animation-duration: 32s; }


.board .tile.selected { outline: 2px solid #fff0c2; outline-offset: -2px; }
.game-table[data-camera='board'] .table-fit,
.game-table[data-camera='board'] .table-plane { width: 890px; }
.game-table[data-camera='board'] .table-plane { padding-left: 140px; }
.game-table[data-camera='board'] .board-section { width: 720px; }
.game-table[data-camera='board'] .arena-scenery { display: block; }
.game-table[data-format='battle-royale'][data-camera='board'] :is(.table-fit,.table-plane) { width:540px; }
.game-table[data-format='battle-royale'][data-camera='board'] .table-plane { padding:20px; }
.game-table[data-format='battle-royale'][data-camera='board'] .board-section { width:500px; height:500px; padding:0; }
.game-table[data-format='battle-royale'] .inert-piece .piece-art { opacity:.6; filter:saturate(.45); }
@keyframes board-vortex-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .terrain-vortex { animation: none; } }

.board-theme-picker { margin: 28px 0; }
.board-theme-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.board-theme-heading h2 { margin: 8px 0 0; font-size: 21px; font-weight: 500; }
.board-theme-heading p { color: #aaa; max-width: 310px; font-size: 13px; line-height: 1.6; margin: 0; }
.board-theme-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; max-width: 532px; }
.menu-root .board-theme-option {
  display: block; min-width: 0; padding: 10px 12px 14px; text-align: left; border: 1px solid #ffffff20;
  border-radius: 12px; background: linear-gradient(145deg,#ffffff09,#ffffff02); color: #eee;
  transition: border-color 180ms, background 180ms;
}
.menu-root .board-theme-option[aria-pressed='true'] { border-color: #ffffff8a; background: linear-gradient(145deg,#ffffff18,#ffffff08); }
.menu-root .board-theme-option:focus-visible { outline: 2px solid white; outline-offset: 3px; }
.board-theme-preview { position: relative; display: block; height: clamp(100px,25vw,160px); margin-bottom: 10px; }
.board-theme-preview > img:first-child { display: block; width: 100%; height: 100%; object-fit: contain; }
.board-theme-name { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.board-theme-check { opacity: 0; }
[aria-pressed='true'] .board-theme-check { opacity: 1; }
.board-theme-description { display: block; margin-top: 8px; color: #a9a9a9; font-size: 11px; line-height: 1.5; }
@media(max-width:900px) { .board-theme-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:580px) { .board-theme-heading { display: block; } .board-theme-heading p { margin-top: 12px; } .board-theme-name { font-size: 12px; } }

/* Target borders sit above terrain artwork and below the pieces. */
.tile-target-ring { position: absolute; inset: 1px; z-index: 2; display: none; pointer-events: none; border-radius: 2px; }
.board .tile:is(.movable, .summon-destination) { --target-color: #79f0c0; }
.board .tile:is(.enemy-preview, .enemy-preview-selected) { --target-color: #ff666e; }
.board .tile:is(.spell-target, .ability-target-selected) { --target-color: #c293ff; }
.board .tile.portal-exit-preview { --target-color: #56b6ff; }
.board .tile:is(.movable, .summon-destination, .enemy-preview, .enemy-preview-selected, .spell-target, .ability-target-selected, .portal-exit-preview) {
  outline: none; box-shadow: none;
}
.board .tile:is(.movable, .summon-destination, .enemy-preview, .enemy-preview-selected, .spell-target, .ability-target-selected, .portal-exit-preview) > .tile-target-ring {
  display: block; border: 2px solid var(--target-color);
  box-shadow: inset 0 0 6px color-mix(in srgb, var(--target-color) 55%, transparent), 0 0 5px color-mix(in srgb, var(--target-color) 60%, transparent);
}
.board .tile:is(.movable, .summon-destination, .enemy-preview, .enemy-preview-selected, .spell-target, .ability-target-selected, .portal-exit-preview) > .tile-hover-light { opacity: 0; }
.board .tile.portal-exit-preview > .tile-target-ring { background: #56b6ff20; }

/* The Standard theme draws its grid inside the playable area. */
.arena-scenery[data-theme="standard"] + .board-frame .board,
.standard-board-preview {
  background-color: #303437;
  background-image: linear-gradient(to right, #62686b 1px, transparent 1px),
                    linear-gradient(to bottom, #62686b 1px, transparent 1px);
  background-size: 6.25% 6.25%;
}
.standard-board-preview {
  display: block;
  height: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid #62686b;
}

.arena-scenery[data-theme="stone"] .royale-stone-surface { margin-inline: auto; }
.stone-board-preview {
  display: block;
  height: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid #7d828761;
  box-shadow: 0 0 0 3px #181b1e;
  filter: saturate(.35) brightness(.85);
}
