/* The printed frame stays outside the playable squares in every language. */
.board-coordinates {
  --board-guide-gutter: 20px;
  --board-guide-border: 6px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: var(--board-guide-gutter) minmax(0, 1fr) var(--board-guide-gutter);
  grid-template-rows: var(--board-guide-gutter) minmax(0, 1fr) var(--board-guide-gutter);
  width: min(100%, 600px);
  min-width: 0;
  margin: 0 auto;
  direction: ltr;
  color: #243d50;
  font: 700 12px/1 system-ui, sans-serif;
}
.board-coordinates > .game-grid-board { grid-column: 2; grid-row: 2; margin: 0; }
html:not(.km-playing) .board-coordinates > .game-grid-board { width: 100%; box-sizing: border-box; }
.board-coordinate-files, .board-coordinate-ranks { box-sizing: border-box; display: grid; text-align: center; direction: ltr; }
.board-coordinate-files { grid-column: 2; grid-template-columns: repeat(var(--board-coordinate-count, 8), minmax(0, 1fr)); padding: 0 var(--board-guide-border); align-items: center; }
.board-coordinate-top { grid-row: 1; }
.board-coordinate-bottom { grid-row: 3; }
.board-coordinate-ranks { grid-row: 2; grid-template-rows: repeat(var(--board-coordinate-count, 8), minmax(0, 1fr)); padding: var(--board-guide-border) 0; align-items: center; }
.board-coordinate-left { grid-column: 1; }
.board-coordinate-right { grid-column: 3; }
.board-coordinate-files > span, .board-coordinate-ranks > span { display: block; min-width: 0; }
#board:is([data-board-style=living][data-board-ready=true], [data-chess-style=living]) .board-coordinates { color: #513a23; }
html[data-km-contrast=high] .board-coordinates { color: #102837; }
html.km-playing .board-coordinates { width: var(--km-coordinate-frame-width); max-width: none; }
@media (max-width: 700px) {
  .board-coordinates { --board-guide-gutter: 16px; width: min(100%, 592px); font-size: 11px; }
}

/* Both navies have the same public inventory; only complete losses are marked. */
.battle-field { min-width: 0; }
.battle-roster { box-sizing: border-box; width: 100%; margin: 12px auto 0; padding: 9px; border: 1px solid #acc5d4; border-radius: 12px; background: #f9fcffdf; color: #22445c; }
.battle-roster-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.battle-roster-item { box-sizing: border-box; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; min-width: 0; gap: 5px; padding: 7px 4px; border: 1px solid #b8cdd9; border-radius: 8px; background: #fff; }
.battle-roster-icon { position: relative; display: block; width: 100%; max-width: 70px; height: 27px; isolation: isolate; }
.battle-roster-icon > svg { display: block; width: 100%; height: 100%; color: #456b84; }
.battle-roster-length { display: flex; justify-content: center; gap: 2px; direction: ltr; }
.battle-roster-length > span { width: 7px; height: 7px; border: 1px solid currentColor; border-radius: 1px; background: #567a91; }
.battle-roster-status { width: 100%; min-width: 0; color: #294d61; font: 650 11px/1.3 system-ui, sans-serif; text-align: center; overflow-wrap: anywhere; }
.battle-roster-item[data-sunk=true] { background: #e8edf0; border-color: #748a96; }
.battle-roster-item[data-sunk=true] .battle-roster-icon { opacity: .5; filter: grayscale(1); }
.battle-roster-item[data-sunk=true]::after { content: '×'; position: absolute; top: 3px; inset-inline-end: 4px; z-index: 3; display: grid; place-items: center; width: 18px; height: 18px; color: #772638; background: #fff; border: 1px solid #772638; border-radius: 50%; font: 800 18px/1 system-ui, sans-serif; }
.battle-roster-item[data-sunk=true] .battle-roster-length > span { background: #78838b; }
.battle-roster-item[data-sunk=true] .battle-roster-status { color: #662f3c; font-weight: 750; }
#board[data-board-style=living][data-board-ready=true] .battle-roster { background: #fcf5e6f2; border-color: #b59a6e; color: #513f29; }
#board[data-board-style=living][data-board-ready=true] .battle-roster-item { background: #fffaf1; border-color: #c7b28c; }
#board[data-board-style=living][data-board-ready=true] .battle-roster-icon > svg { visibility: hidden; }
#board[data-board-style=living][data-board-ready=true] .battle-roster-item[data-sunk=true] { background: #e6e3dc; }
html[data-km-contrast=high] .battle-roster { background: #fff; border: 2px solid #19394f; }
html[data-km-contrast=high] .battle-roster-item { border: 2px solid #19394f; }
html[data-km-contrast=high] .battle-roster-status { color: #112d3f; }
html[data-km-contrast=high] .battle-roster-item[data-sunk=true] .battle-roster-status { color: #6f1830; }
@media (max-width: 700px) {
  .battle-roster-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .battle-roster-item { padding: 6px 4px; }
}
html.km-playing.km-phone-landscape .battle-layout:not(.fleet-editing) { align-items: start; }

/* Background pictures cannot supply the puzzle's ordinary-page width. */
html:not(.km-playing) .jigsaw-grid { width: 100%; box-sizing: border-box; }

.board-rule-controls {display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 auto 12px;max-width:940px;min-width:0}
.board-rule-controls .select {max-width:100%;min-height:44px}
.international-square-number {position:absolute;inset-block-end:2px;inset-inline-end:3px;z-index:4;border-radius:3px;padding:1px 2px;background:#ffffffd9;color:#203444;font:700 9px/1.1 system-ui,sans-serif;pointer-events:none}
.checkers-grid .cell.captured-in-chain {opacity:.6}
.checkers-grid .cell.captured-in-chain::after {content:'×';position:absolute;inset:0;z-index:5;display:grid;place-items:center;color:#9b1740;font:800 30px/1 system-ui,sans-serif;pointer-events:none}
html.km-clean .board-rule-controls {display:none!important}
