:root {
  color-scheme: dark;
  font-family: Inter, "Noto Sans TC", system-ui, sans-serif;
  background: #07111d;
  color: #eaf4ff;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #12385a 0, #07111d 44%, #04080f 100%); }
body.result-open { overflow: hidden; }
button, input { font: inherit; }
button { border: 1px solid #41617d; border-radius: 10px; padding: 10px 16px; background: #13293d; color: #eaf4ff; cursor: pointer; }
button:hover { filter: brightness(1.15); }
button:disabled { cursor: not-allowed; opacity: .45; }
.primary { border-color: #50d6ff; background: linear-gradient(135deg, #0b73aa, #00a3c7); font-weight: 800; }
#confirmShipsButton.ready-to-submit {
  border-color: #fff0a8;
  background: linear-gradient(135deg, #b5650e, #f1a51f 58%, #ffd15b);
  color: #1d1405;
  font-weight: 950;
  box-shadow: 0 0 0 3px rgba(255,209,91,.2), 0 0 24px rgba(255,174,45,.52);
  animation: placement-submit-pulse 1.15s ease-in-out infinite alternate;
}
@keyframes placement-submit-pulse {
  to { filter: brightness(1.14); box-shadow: 0 0 0 5px rgba(255,209,91,.28), 0 0 38px rgba(255,174,45,.72); transform: translateY(-2px) scale(1.025); }
}
.shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 72px; }
.hero, .section-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.hero { margin-bottom: 24px; }
h1 { margin: 4px 0 8px; font-size: clamp(34px, 6vw, 68px); letter-spacing: -.04em; }
h2, h3, p { margin-top: 0; }
.eyebrow { margin-bottom: 5px; color: #64dfff; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.panel { margin-top: 22px; padding: 24px; border: 1px solid rgba(129, 199, 255, .2); border-radius: 20px; background: rgba(8, 25, 41, .88); box-shadow: 0 20px 60px rgba(0,0,0,.25); backdrop-filter: blur(14px); }
.hidden { display: none !important; }
.status-pill, .identity { padding: 9px 14px; border: 1px solid #3d6c8e; border-radius: 999px; background: rgba(13, 45, 68, .8); white-space: nowrap; }
.battle-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.battle-heading-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.battle-heading-kicker .eyebrow { margin: 0; }
.battle-heading-kicker + h2 { margin-bottom: 0; }
.action-countdown { --fuse-progress: 1; display: grid; gap: 6px; width: 100%; margin-bottom: 8px; padding: 8px 11px 10px; border: 1px solid rgba(255,185,75,.3); border-radius: 10px; background: linear-gradient(90deg, rgba(45,31,15,.86), rgba(13,25,31,.9)); color: #ffe0a0; font-variant-numeric: tabular-nums; overflow: hidden; }
.countdown-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.action-countdown span { color: #d6b36f; font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.action-countdown strong { min-width: 48px; font-size: 15px; text-align: right; }
.fuse-track { position: relative; height: 7px; border-radius: 999px; background: rgba(0,0,0,.42); box-shadow: inset 0 1px 3px rgba(0,0,0,.8); }
.fuse-line { position: absolute; top: 2px; left: 0; width: calc(var(--fuse-progress) * 100%); height: 3px; border-radius: inherit; background: repeating-linear-gradient(90deg, #8a632e 0 5px, #d7a64e 5px 9px); box-shadow: 0 0 5px rgba(255,177,58,.35); transition: width .25s linear; }
.fuse-spark { position: absolute; top: 50%; left: calc(var(--fuse-progress) * 100%); width: 10px; height: 10px; border-radius: 50%; background: #fff4b0; box-shadow: 0 0 4px 2px #ffcb45, 0 0 11px 5px rgba(255,92,27,.72); transform: translate(-50%, -50%); transition: left .25s linear; animation: fuse-spark .34s steps(2, end) infinite; }
.fuse-spark::before, .fuse-spark::after { content: ""; position: absolute; inset: -5px 4px; border-radius: 50%; background: #ff792e; transform: rotate(45deg); }
.fuse-spark::after { transform: rotate(-45deg); }
.action-countdown.urgent { border-color: rgba(255,87,59,.68); background: linear-gradient(90deg, rgba(89,25,18,.88), rgba(30,19,20,.92)); color: #ffd0c4; animation: countdown-urgent .55s ease-in-out infinite alternate; }
.action-countdown.urgent .fuse-line { background: repeating-linear-gradient(90deg, #8b2f24 0 5px, #ff694e 5px 9px); box-shadow: 0 0 7px rgba(255,75,45,.62); }
@keyframes fuse-spark { 50% { filter: brightness(1.45); transform: translate(-50%, -50%) scale(.72) rotate(18deg); } }
@keyframes countdown-urgent { to { box-shadow: 0 0 16px rgba(255,64,43,.2); } }
.exit-solo-button { padding: 5px 9px; border-color: rgba(255,133,105,.4); border-radius: 8px; color: #ffc0ae; background: rgba(86,31,29,.46); font-size: 12px; }
.exit-solo-button:hover { border-color: #ff8d73; background: rgba(118,40,34,.68); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.mode-heading { margin-bottom: 20px; text-align: center; }
.mode-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.mode-card { display: grid; justify-items: center; gap: 10px; min-height: 230px; padding: 30px 22px; border-color: rgba(99,196,255,.3); background: radial-gradient(circle at top, #153d55, #091725 68%); text-align: center; transition: transform .2s, border-color .2s, box-shadow .2s; }
.mode-card.featured { border-color: rgba(255,205,91,.48); background: radial-gradient(circle at top, #4b391b, #0b1b28 70%); }
.mode-card.featured strong { color: #ffe29a; }
.mode-card:hover { border-color: #64dfff; transform: translateY(-3px); box-shadow: 0 16px 35px rgba(0,0,0,.3); }
.mode-icon { font-size: 58px; }
.mode-card strong { color: #b9f4ff; font-size: 25px; }
.mode-card small { max-width: 310px; color: #9bb2c2; font-size: 15px; line-height: 1.65; }
.back-mode-button { margin-bottom: 18px; padding: 7px 11px; border: 0; background: transparent; color: #9deaff; }
label { display: grid; gap: 8px; color: #b6cadb; }
input { width: 100%; border: 1px solid #35546d; border-radius: 10px; padding: 12px 14px; color: white; background: #081828; outline: none; }
input:focus { border-color: #5fe2ff; box-shadow: 0 0 0 3px rgba(95,226,255,.12); }
.message { min-height: 1.5em; margin: 12px 0 0; color: #ffd17a; }
.matchmaking-waiting { display: grid; justify-items: center; max-width: 680px; margin-right: auto; margin-left: auto; padding: 42px 24px; text-align: center; }
.matchmaking-radar { position: relative; display: grid; place-items: center; width: 112px; height: 112px; margin-bottom: 20px; overflow: hidden; border: 1px solid rgba(100,223,255,.48); border-radius: 50%; background: repeating-radial-gradient(circle, rgba(62,190,225,.11) 0 1px, transparent 1px 25%); box-shadow: inset 0 0 28px rgba(56,208,245,.12), 0 0 24px rgba(56,208,245,.1); }
.matchmaking-radar::before, .matchmaking-radar::after { content: ""; position: absolute; background: rgba(100,223,255,.24); }
.matchmaking-radar::before { width: 1px; height: 100%; }
.matchmaking-radar::after { width: 100%; height: 1px; }
.matchmaking-radar i { position: absolute; inset: 50% 50% 0; width: 50%; background: linear-gradient(90deg, rgba(100,223,255,.36), transparent); transform: translateZ(0); -webkit-transform: translateZ(0); transform-origin: left top; will-change: transform; animation: matchmaking-sweep 1.8s linear infinite; }
.matchmaking-radar span { position: relative; z-index: 1; font-size: 29px; filter: drop-shadow(0 0 8px rgba(100,223,255,.75)); }
.matchmaking-radar.matched { border-color: rgba(127,255,178,.72); box-shadow: inset 0 0 28px rgba(80,235,166,.15), 0 0 30px rgba(80,235,166,.16); }
.matchmaking-confirm-countdown { margin: 4px 0 14px; color: #ffe09b; font-size: 18px; font-variant-numeric: tabular-nums; }
.matchmaking-waiting #confirmMatchmakingButton { min-width: 210px; margin-bottom: 10px; }
@keyframes matchmaking-sweep { to { transform: translateZ(0) rotate(360deg); } }
@-webkit-keyframes matchmaking-sweep { to { -webkit-transform: translateZ(0) rotate(360deg); } }
.solo-finished-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 18px; width: min(100%, 860px); margin: 18px auto 0; padding: 16px 18px; border: 1px solid rgba(127,255,178,.3); border-radius: 14px; background: linear-gradient(135deg, rgba(18,68,58,.72), rgba(6,24,34,.88)); }
.solo-finished-actions > p:first-child { display: grid; gap: 4px; margin: 0; }
.solo-finished-actions strong { color: #9fffc2; font-size: 17px; }
.solo-finished-actions span { color: #a9bfcb; font-size: 13px; }
.solo-finished-actions .message { grid-column: 1 / -1; min-height: 0; margin: 0; }
.player-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.player-card { padding: 14px; border: 1px solid #29465d; border-radius: 12px; background: #0a1b2a; }
.player-card.me { border-color: #5fe2ff; }
.player-card.offline { opacity: .55; }
.last-seen { display: block; margin-top: 6px; color: #8faabd; font-size: 12px; }
.remove-player-button { width: 100%; margin-top: 10px; padding: 6px 10px; border-color: #704451; color: #ffc1c8; font-size: 12px; }
.brackets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.my-group-section, .tournament-overview { grid-column: 1 / -1; }
.section-caption { margin: 0 0 8px; color: #64dfff; font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.tournament-overview { padding: 18px; border: 1px solid rgba(99,196,255,.25); border-radius: 16px; background: rgba(8,25,41,.75); }
.tournament-overview > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #9deaff; font-size: 18px; font-weight: 900; cursor: pointer; user-select: none; }
.tournament-overview > summary small { color: #8faabd; font-size: 13px; font-weight: 600; }
.tournament-overview[open] > summary { margin-bottom: 16px; }
.other-group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.group-card { padding: 20px; border: 1px solid rgba(99, 196, 255, .25); border-radius: 18px; background: rgba(8, 25, 41, .88); }
.group-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.knockout-tree { position: relative; width: min(100%, 620px); height: 375px; margin: 18px auto 0; }
.knockout-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.knockout-lines path { fill: none; stroke: #4e7895; stroke-width: 3; vector-effect: non-scaling-stroke; }
.knockout-lines path.advanced { stroke: #58ddff; stroke-width: 4; filter: drop-shadow(0 0 4px rgba(88,221,255,.75)); }
.knockout-lines path.champion-path { stroke: #7fffb2; stroke-width: 5; filter: drop-shadow(0 0 5px rgba(127,255,178,.8)); }
.knockout-round-label { position: absolute; left: 0; width: 100%; margin: 0; color: #80a6bf; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-align: center; }
.champion-label { top: 0; }
.finalist-label { top: 126px; }
.entrant-label { top: 281px; }
.knockout-player { position: absolute; z-index: 1; display: grid; place-items: center; min-width: 0; height: 48px; padding: 7px; border: 1px solid #35546d; border-radius: 10px; background: #091725; text-align: center; }
.knockout-player span { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knockout-player.champion { height: 58px; border-color: rgba(127,255,178,.55); background: radial-gradient(circle at top, #174f45, #091725 72%); color: #8affbd; font-size: 18px; font-weight: 900; }
.knockout-player.current { border-color: #58ddff; box-shadow: 0 0 0 2px rgba(88,221,255,.12); }
.knockout-player.advanced { border-color: #58ddff; color: #b9f4ff; box-shadow: 0 0 14px rgba(88,221,255,.16); }
.champion-position { top: 24px; left: 25%; width: 50%; height: 58px; }
.finalist-position { top: 150px; width: 38%; }
.finalist-1 { left: 8.5%; }
.finalist-2 { right: 8.5%; }
.entrant-position { top: 305px; width: 22%; font-size: 13px; }
.entrant-1 { left: 1.5%; }
.entrant-2 { left: 26.5%; }
.entrant-3 { left: 51.5%; }
.entrant-4 { left: 76.5%; }
.knockout-final-status { margin: 0; color: #ffd17a; font-size: 13px; text-align: center; }
.match-details { margin-top: 18px; border-top: 1px solid rgba(99,196,255,.18); padding-top: 12px; }
.match-details summary { color: #9deaff; font-weight: 800; cursor: pointer; user-select: none; }
.match-details[open] summary { margin-bottom: 12px; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-card { padding: 14px; border: 1px solid #29465d; border-radius: 12px; background: #091725; }
.match-card.current { border-color: #58ddff; box-shadow: 0 0 0 2px rgba(88,221,255,.1); }
.match-card.final { grid-column: 1 / -1; }
.match-card p { margin: 4px 0; }
.match-meta { color: #80a6bf; font-size: 13px; }
.winner { color: #7fffb2; font-weight: 800; }
.boards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 18px; }
.own-zone { min-width: 0; }
.own-zone > summary { margin: 0 0 1em; color: #eaf4ff; font-size: 1.17em; font-weight: 800; cursor: pointer; list-style-position: inside; }
.own-zone > summary small { margin-left: 7px; color: #7897aa; font-size: 12px; font-weight: 600; }
.coordinate-board { --coordinate-size: 20px; display: grid; grid-template-columns: var(--coordinate-size) minmax(0, 1fr); grid-template-rows: var(--coordinate-size) minmax(0, 1fr); width: 100%; max-width: 540px; }
.coordinate-board .board { grid-column: 2; grid-row: 2; width: 100%; max-width: none; }
.column-coordinates { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); align-items: end; }
.row-coordinates { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(10, minmax(0, 1fr)); align-items: center; }
.column-coordinates span, .row-coordinates span { color: #78a9c4; font-size: 10px; font-weight: 800; line-height: 1; text-align: center; text-shadow: 0 0 7px rgba(80,214,255,.25); }
.placement-phase .boards { grid-template-columns: minmax(0, 560px); justify-content: center; }
.placement-phase .enemy-zone,
.placement-phase .enemy-activity { display: none !important; }
.placement-phase .own-zone { width: 100%; max-width: 560px; }
.placement-phase .own-coordinate-board { --coordinate-size: 28px; max-width: 560px; }
.placement-phase .column-coordinates,
.placement-phase .row-coordinates { background: rgba(24,72,98,.22); }
.placement-phase .column-coordinates { padding-bottom: 5px; border-radius: 8px 8px 0 0; }
.placement-phase .row-coordinates { padding-right: 5px; border-radius: 8px 0 0 8px; }
.placement-phase .column-coordinates span,
.placement-phase .row-coordinates span { color: #b9efff; font-size: 12px; text-shadow: 0 0 8px rgba(80,214,255,.48); }
.combat-phase .boards { grid-template-columns: minmax(0, 1fr) minmax(210px, .52fr); grid-template-areas: "enemy radar" "enemy activity"; grid-template-rows: auto 1fr; align-items: start; }
.combat-phase .enemy-zone { grid-area: enemy; }
.combat-phase .own-zone { grid-area: radar; padding: 14px; border: 1px solid rgba(99,196,255,.18); border-radius: 14px; background: rgba(5,16,27,.45); }
.combat-phase .enemy-activity { grid-area: activity; align-self: start; margin-top: 12px; }
.combat-phase .own-zone > summary { margin-bottom: 12px; font-size: 15px; }
.combat-phase .own-zone .board {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  border-width: 1px;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  overflow: hidden;
}
.combat-phase .own-coordinate-board { max-width: 300px; margin: 0 auto; }
.combat-phase .enemy-coordinate-board { max-width: 580px; }
.combat-phase .own-zone .cell { min-width: 0; width: auto; padding: 0; border-radius: 0; }
.combat-phase .enemy-zone .board { width: 100%; max-width: 560px; }
.combat-phase .own-zone .cell.hit::after,
.combat-phase .own-zone .cell.miss::after {
  inset: auto;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
  transform: translate(-50%, -50%);
}
.combat-phase .own-zone .cell.hit::after { font-size: clamp(10px, 1vw, 15px); }
.combat-phase .own-zone .cell.miss::after { font-size: clamp(11px, 1.1vw, 16px); }
.enemy-activity { padding: 12px; border: 1px solid rgba(255,112,91,.22); border-radius: 12px; background: linear-gradient(145deg, rgba(42,20,22,.72), rgba(5,17,28,.88)); }
.enemy-activity-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: #ffb29e; font-size: 13px; font-weight: 900; letter-spacing: .08em; cursor: pointer; list-style: none; }
.enemy-activity-heading::-webkit-details-marker { display: none; }
.enemy-activity-heading small { max-width: 150px; overflow: hidden; color: #7e98a9; font-size: 9px; letter-spacing: .04em; text-overflow: ellipsis; white-space: nowrap; }
.enemy-activity-toggle { display: none; font-style: normal; }
.enemy-activity ol { display: grid; gap: 6px; margin: 0; padding: 0; overflow: visible; list-style: none; }
.enemy-activity li { display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 7px; padding: 7px 8px; border-radius: 8px; color: #8fa8b8; font-size: 11px; line-height: 1.35; opacity: .65; }
.enemy-activity li.latest { border: 1px solid rgba(255,133,105,.2); background: rgba(110,35,31,.25); color: #f3d9d0; opacity: 1; animation: activity-arrive .42s ease-out; }
.enemy-activity li span { text-align: center; }
.enemy-activity li p { margin: 0; }
.board.under-fire { animation: radar-impact .38s ease-out 2; }
.cell.impact-miss { z-index: 5; animation: impact-miss 1.25s ease-out; }
.cell.impact-hit { z-index: 5; animation: impact-hit 1.25s ease-out; }
.cell.impact-armor { z-index: 5; animation: impact-armor 1.25s ease-out; }
.combat-phase { position: relative; }
.combat-phase > #battleMessage { display: none; }

@media (min-width: 901px) {
  .combat-phase > .section-header,
  .combat-phase .boards,
  .combat-phase > .message { width: min(100%, 860px); margin-right: auto; margin-left: auto; }
  .combat-phase .boards { grid-template-columns: minmax(0, 560px) 240px; justify-content: center; gap: 32px; }
  .combat-phase .own-zone { width: 240px; }
  .combat-phase .enemy-activity { width: 240px; }
  .combat-phase .own-zone .board { width: 210px; max-width: 210px; }
  .combat-phase .own-zone .coordinate-board { width: 210px; }
  .combat-phase .own-zone .coordinate-board .board { width: 100%; max-width: none; }
  .combat-phase .enemy-coordinate-board { max-width: 580px; }
  .combat-phase .enemy-zone .board { max-width: 560px; }
}
.board { position: relative; display: grid; grid-template-columns: repeat(10, minmax(22px, 1fr)); aspect-ratio: 1; max-width: 520px; border: 2px solid #5b91b6; background: #05101b; }
.cell { position: relative; border: 1px solid rgba(102, 178, 224, .21); background: #0b2840; cursor: default; }
.enemy .cell.available { cursor: crosshair; }
.enemy .cell.available:hover { background: #146082; }
.cell.ship { background: #0b2840; }
.cell.ship-shaped {
  --ship-light: #718795;
  --ship-mid: #405764;
  --ship-dark: #1c303b;
  --ship-edge: rgba(194, 222, 233, .55);
  overflow: visible;
}
.cell.ship-shaped::before {
  content: "";
  position: absolute;
  z-index: 1;
  background:
    linear-gradient(90deg, transparent 48%, rgba(215,235,242,.18) 49% 51%, transparent 52%),
    linear-gradient(135deg, var(--ship-light), var(--ship-mid) 38%, var(--ship-dark) 78%);
  box-shadow:
    inset 0 1px 0 var(--ship-edge), inset 0 -2px 2px rgba(4, 16, 23, .65),
    0 3px 7px rgba(0, 0, 0, .5);
}
.cell.ship-shaped:not(.hit)::after {
  content: none;
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(210, 230, 237, .5);
  background: linear-gradient(135deg, #80939d, #354c58 65%);
  box-shadow: 0 1px 2px rgba(0,0,0,.65);
}
.cell.ship-horizontal::before {
  inset: 22% -1px;
  background:
    linear-gradient(0deg, rgba(8,24,32,.55), var(--ship-dark) 12%, var(--ship-mid) 48%, var(--ship-light) 88%, rgba(218,235,241,.65));
}
.cell.ship-horizontal::after { top: 34%; left: 32%; }
.cell.ship-horizontal.ship-bow::before {
  left: 4%;
  border-radius: 70% 2px 2px 70%;
  clip-path: polygon(34% 8%, 100% 0, 100% 100%, 34% 92%, 0 50%);
}
.cell.ship-horizontal.ship-stern::before {
  right: 13%;
  border-radius: 2px 5px 5px 2px;
  clip-path: polygon(0 0, 100% 12%, 100% 88%, 0 100%);
}
.cell.ship-vertical::before {
  inset: -1px 22%;
  background:
    linear-gradient(90deg, rgba(218,235,241,.65), var(--ship-light) 12%, var(--ship-mid) 52%, var(--ship-dark) 88%, rgba(8,24,32,.55));
}
.cell.ship-vertical::after { top: 32%; left: 34%; }
.cell.ship-vertical.ship-bow::before {
  top: 4%;
  border-radius: 70% 70% 2px 2px;
  clip-path: polygon(50% 0, 92% 34%, 100% 100%, 0 100%, 8% 34%);
}
.cell.ship-vertical.ship-stern::before {
  bottom: 13%;
  border-radius: 2px 2px 5px 5px;
  clip-path: polygon(0 0, 100% 0, 88% 100%, 12% 100%);
}
.cell.ship-bow:not(.hit)::after {
  content: "";
  border-radius: 45%;
}
.cell.ship-horizontal.ship-bow:not(.hit)::after { left: 43%; top: 40%; width: 32%; height: 18%; }
.cell.ship-vertical.ship-bow:not(.hit)::after { left: 40%; top: 43%; width: 18%; height: 32%; }
.cell.ship-segment-1:not(.hit)::after {
  content: "";
  width: 34%;
  height: 34%;
  border-radius: 3px;
}
.cell.ship-horizontal.ship-segment-1:not(.hit)::after { left: 33%; top: 33%; }
.cell.ship-vertical.ship-segment-1:not(.hit)::after { left: 33%; top: 33%; }
/* The two-cell destroyer needs a compact, asymmetric deck layout. */
.cell.ship-size-2.ship-bow:not(.hit)::after {
  width: 20%;
  height: 20%;
}
.cell.ship-size-2.ship-horizontal.ship-bow:not(.hit)::after { left: 55%; top: 40%; }
.cell.ship-size-2.ship-vertical.ship-bow:not(.hit)::after { left: 40%; top: 55%; }
.cell.ship-size-2.ship-segment-1:not(.hit)::after {
  width: 30%;
  height: 28%;
  border-radius: 40% 3px 3px 40%;
}
.cell.ship-size-2.ship-horizontal.ship-segment-1:not(.hit)::after { left: 10%; top: 36%; }
.cell.ship-size-2.ship-vertical.ship-segment-1:not(.hit)::after {
  left: 36%;
  top: 10%;
  border-radius: 40% 40% 3px 3px;
}

/* Every vessel type has its own top-down silhouette and deck plan. */
.cell.ship-carrier { --ship-light: #7d9099; --ship-mid: #4d626c; --ship-dark: #263b45; }
.cell.ship-carrier.ship-horizontal::before {
  inset: 15% -1px;
  background: linear-gradient(0deg, #263b45, #536873 46%, rgba(220,232,236,.58) 48% 51%, #647781 53%, #8798a0);
}
.cell.ship-carrier.ship-vertical::before {
  inset: -1px 15%;
  background: linear-gradient(90deg, #8798a0, #647781 47%, rgba(220,232,236,.58) 49% 52%, #536873 54%, #263b45);
}
.cell.ship-carrier.ship-bow::before { border-radius: 5px 2px 2px 5px; }
.cell.ship-carrier.ship-horizontal.ship-bow::before { left: 5%; clip-path: polygon(24% 4%, 100% 0, 100% 100%, 24% 96%, 0 70%, 0 30%); }
.cell.ship-carrier.ship-vertical.ship-bow::before { top: 5%; clip-path: polygon(30% 0, 70% 0, 96% 24%, 100% 100%, 0 100%, 4% 24%); }
.cell.ship-carrier.ship-stern::before { border-radius: 2px; }
.cell.ship-carrier.ship-horizontal.ship-stern::before { right: 5%; clip-path: polygon(0 0, 96% 4%, 100% 18%, 100% 82%, 96% 96%, 0 100%); }
.cell.ship-carrier.ship-vertical.ship-stern::before { bottom: 5%; clip-path: polygon(0 0, 100% 0, 96% 96%, 82% 100%, 18% 100%, 4% 96%); }
.cell.ship-carrier.ship-bow:not(.hit)::after,
.cell.ship-carrier.ship-segment-1:not(.hit)::after { content: none; }
.cell.ship-carrier.ship-segment-3:not(.hit)::after {
  content: "";
  width: 22%;
  height: 46%;
  border-radius: 3px;
  background: linear-gradient(135deg, #94a5ac, #354b55 70%);
}
.cell.ship-carrier.ship-horizontal.ship-segment-3:not(.hit)::after { left: 57%; top: 27%; }
.cell.ship-carrier.ship-vertical.ship-segment-3:not(.hit)::after { left: 27%; top: 57%; width: 46%; height: 22%; }

.cell.ship-battleship { --ship-light: #82949c; --ship-mid: #465c67; --ship-dark: #1d323d; }
.cell.ship-battleship.ship-horizontal::before { inset: 20% -1px; }
.cell.ship-battleship.ship-vertical::before { inset: -1px 20%; }
.cell.ship-battleship.ship-segment-2:not(.hit)::after {
  content: "";
  width: 29%;
  height: 29%;
  border-radius: 50%;
}
.cell.ship-battleship.ship-horizontal.ship-segment-2:not(.hit)::after { left: 35%; top: 35%; }
.cell.ship-battleship.ship-vertical.ship-segment-2:not(.hit)::after { left: 35%; top: 35%; }

.cell.ship-cruiser.ship-horizontal::before { inset: 24% -1px; }
.cell.ship-cruiser.ship-vertical::before { inset: -1px 24%; }
.cell.ship-cruiser.ship-segment-1:not(.hit)::after { width: 30%; height: 30%; border-radius: 2px 45% 45% 2px; }
.cell.ship-cruiser.ship-vertical.ship-segment-1:not(.hit)::after { border-radius: 2px 2px 45% 45%; }

.cell.ship-submarine { --ship-light: #607580; --ship-mid: #344b56; --ship-dark: #172c36; }
.cell.ship-submarine.ship-horizontal::before { inset: 31% -1px; border-radius: 0; }
.cell.ship-submarine.ship-vertical::before { inset: -1px 31%; border-radius: 0; }
.cell.ship-submarine.ship-horizontal.ship-bow::before { left: 8%; clip-path: none; border-radius: 70% 0 0 70%; }
.cell.ship-submarine.ship-vertical.ship-bow::before { top: 8%; clip-path: none; border-radius: 70% 70% 0 0; }
.cell.ship-submarine.ship-horizontal.ship-stern::before { right: 8%; clip-path: none; border-radius: 0 70% 70% 0; }
.cell.ship-submarine.ship-vertical.ship-stern::before { bottom: 8%; clip-path: none; border-radius: 0 0 70% 70%; }
.cell.ship-submarine.ship-bow:not(.hit)::after { content: none; }
.cell.ship-submarine.ship-segment-1:not(.hit)::after {
  content: "";
  border-radius: 45%;
  background: #718791;
}
.cell.ship-submarine.ship-horizontal.ship-segment-1:not(.hit)::after { left: 35%; top: 31%; width: 30%; height: 38%; }
.cell.ship-submarine.ship-vertical.ship-segment-1:not(.hit)::after { left: 31%; top: 35%; width: 38%; height: 30%; }

.cell.ship-destroyer { --ship-light: #758b96; --ship-mid: #3d5561; --ship-dark: #192e39; }
.cell.ship-destroyer.ship-horizontal::before { inset: 28% -1px; }
.cell.ship-destroyer.ship-vertical::before { inset: -1px 28%; }
.cell.hit { background: #ad3140; }
.cell.hit.ship-shaped {
  --ship-light: #d18483;
  --ship-mid: #8e444b;
  --ship-dark: #45242d;
  --ship-edge: rgba(255, 202, 192, .42);
}
.cell.hit.sunk-enemy-ship::before {
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, rgba(48,10,8,.3) 8px 10px),
    linear-gradient(135deg, #e08a68, #913f38 55%, #4e2224);
  box-shadow: inset 0 1px 0 rgba(255,225,195,.4), inset 0 -2px 2px rgba(48,10,8,.5), 0 0 9px rgba(255,117,76,.6);
}
.cell.hit::after { content: "×"; position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: clamp(14px, 2vw, 26px); }
.cell.miss { background: #12344e; }
.cell.miss::after { content: "•"; position: absolute; inset: 0; display: grid; place-items: center; color: #9bd9ff; font-size: 24px; }
.cell.preview { background: #3b9bbb; }
.cell.treasure::after {
  content: "🎁";
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(15px, 2.3vw, 27px);
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.65));
  animation: treasure-float 1.8s ease-in-out infinite;
}
.cell.treasure { background: radial-gradient(circle, rgba(255,205,85,.25), #0b2840 65%); }
.cell.sonar-area { z-index: 4; background: rgba(54,217,255,.13); box-shadow: inset 0 0 0 1px rgba(100,229,255,.5); }
.sonar-zone-pulse {
  position: absolute;
  z-index: 6;
  border: 0;
  background: radial-gradient(circle, rgba(163,244,255,.52) 0 5%, rgba(74,220,255,.12) 7% 26%, transparent 48%);
  pointer-events: none;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  transform-origin: center;
}
.sonar-zone-pulse > i {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(126,237,255,.9);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 9px rgba(72,218,255,.52), inset 0 0 8px rgba(72,218,255,.22);
  transform: scale(.18);
  -webkit-transform: scale(.18);
  transform-origin: center;
  will-change: transform, opacity;
  animation: sonar-zone-ring 1.9s ease-out infinite;
}
.sonar-zone-pulse > i:nth-child(2) { animation-delay: -.63s; }
.sonar-zone-pulse > i:nth-child(3) { animation-delay: -1.26s; }
.cell.armored-cell { box-shadow: inset 0 0 0 3px rgba(103,210,255,.72), inset 0 0 12px rgba(103,210,255,.34); }
.cell.armored-cell::after { content: "◆" !important; position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; color: #9ee8ff; font-size: clamp(10px, 1.5vw, 18px); text-shadow: 0 0 6px #36bde9; }
.cell.armor-damaged { background: radial-gradient(circle, rgba(255,173,62,.38), #0b2840 70%); box-shadow: inset 0 0 0 3px #f0a43b, 0 0 9px rgba(240,164,59,.4); }
.cell.armor-damaged::after { content: "◈" !important; position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; color: #ffd17a; font-size: clamp(15px, 2.5vw, 28px); font-weight: 900; text-shadow: 0 0 6px #9b4d16; }
.cell.smoke-cell {
  background-color: #405866;
  background-image: linear-gradient(135deg, rgba(237,242,241,.12), rgba(137,154,159,.2));
  border-color: rgba(222,233,234,.18);
  box-shadow: inset 0 0 10px rgba(235,242,241,.1);
  cursor: not-allowed;
}
.smoke-zone-clouds {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  border-radius: 17% 25% 19% 22%;
  opacity: .72;
  background:
    radial-gradient(ellipse at 8% 40%, rgba(255,255,252,.78) 0 9%, rgba(238,242,240,.42) 20%, transparent 38%),
    radial-gradient(ellipse at 31% 68%, rgba(248,250,247,.72) 0 13%, rgba(222,229,227,.36) 26%, transparent 44%),
    radial-gradient(ellipse at 52% 28%, rgba(255,255,253,.76) 0 14%, rgba(231,236,234,.4) 27%, transparent 47%),
    radial-gradient(ellipse at 73% 65%, rgba(245,248,245,.7) 0 15%, rgba(216,224,222,.34) 29%, transparent 49%),
    radial-gradient(ellipse at 94% 38%, rgba(255,255,253,.72) 0 11%, rgba(230,235,233,.36) 24%, transparent 42%),
    linear-gradient(120deg, rgba(229,235,233,.28), rgba(255,255,253,.13));
  box-shadow: inset 0 0 24px rgba(255,255,253,.18), 0 0 12px rgba(222,231,230,.2);
  filter: blur(3px);
  transform-origin: center;
  animation: smoke-zone-drift 4.8s ease-in-out infinite alternate;
}
.smoke-zone-clouds::before,
.smoke-zone-clouds::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(248,250,247,.35);
  filter: blur(7px);
}
.smoke-zone-clouds::before { left: -4%; top: 15%; width: 58%; height: 58%; }
.smoke-zone-clouds::after { right: -5%; bottom: 10%; width: 62%; height: 54%; opacity: .75; }
.enemy .cell.smoke-cell:hover { filter: none; }
.combat-phase .own-zone .cell.armored-cell { box-shadow: inset 0 0 0 1px rgba(103,210,255,.8); }
.combat-phase .own-zone .cell.armor-damaged { box-shadow: inset 0 0 0 1px #f0a43b; }
.combat-phase .own-zone .cell.armored-cell::after,
.combat-phase .own-zone .cell.armor-damaged::after {
  content: "" !important;
  position: absolute;
  z-index: 7;
  inset: 50% auto auto 50%;
  display: block;
  width: 5px;
  height: 5px;
  border: 1px solid #b9efff;
  background: #36bde9;
  box-shadow: 0 0 3px rgba(54,189,233,.8);
  transform: translate(-50%, -50%) rotate(45deg);
}
.combat-phase .own-zone .cell.armor-damaged::after {
  border-color: #ffe0a3;
  background: #e58b25;
  box-shadow: 0 0 3px rgba(229,139,37,.8);
}
.placement-controls { padding: 14px; border-radius: 12px; background: #0a1a28; }
.placement-locked { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 14px 16px; border: 1px solid rgba(100,229,255,.3); border-radius: 12px; background: rgba(13,45,68,.68); }
.placement-locked > span { font-size: 26px; }
.placement-locked div { display: grid; gap: 3px; }
.placement-locked strong { color: #9deaff; }
.placement-locked small { color: #9bb2c2; line-height: 1.45; }
.ability-overlay { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 20px; background: rgba(2,8,15,.9); backdrop-filter: blur(10px); }
.ability-panel { width: min(760px, 100%); padding: 30px; border: 1px solid rgba(255,209,122,.55); border-radius: 24px; background: radial-gradient(circle at top, #403619, #091725 62%); box-shadow: 0 24px 80px rgba(0,0,0,.65); text-align: center; }
.ability-panel h2 { margin-bottom: 8px; font-size: clamp(28px, 5vw, 46px); }
.ability-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 24px; }
.ability-card { position: relative; display: grid; justify-items: center; gap: 9px; min-height: 190px; padding: 22px 14px; overflow: hidden; border-color: var(--ability-border, rgba(255,209,122,.38)); background: var(--ability-background, linear-gradient(160deg, #1b3343, #0b1d2b)); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.ability-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 0, var(--ability-glow, rgba(255,255,255,.08)), transparent 58%); opacity: .9; }
.ability-card:hover { border-color: var(--ability-accent, #ffd17a); transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.38), 0 0 20px var(--ability-shadow, rgba(255,209,122,.16)), inset 0 1px 0 rgba(255,255,255,.13); }
.ability-card-icon { display: inline-grid; place-items: center; width: 58px; height: 58px; font-size: 44px; }
.smoke-sight-icon {
  position: relative;
  width: 64px;
  height: 58px;
  border-radius: 50%;
  background:
    linear-gradient(rgba(255,221,133,.38), rgba(255,221,133,.38)) center / 2px 52px no-repeat,
    linear-gradient(90deg, rgba(255,221,133,.38), rgba(255,221,133,.38)) center / 52px 2px no-repeat,
    radial-gradient(circle, transparent 0 15px, rgba(255,221,133,.42) 16px 17px, transparent 18px);
  filter: drop-shadow(0 3px 7px rgba(0,0,0,.42));
}
.smoke-sight-icon::before {
  content: "";
  position: absolute;
  left: 14px;
  bottom: 8px;
  width: 36px;
  height: 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #f1f4f2, #9ca8a9 78%);
  box-shadow:
    -12px 3px 0 -3px #b8c1c0,
    12px 2px 0 -2px #cbd1cf,
    -4px -10px 0 -3px #dfe4e1,
    8px -8px 0 -2px #adb7b6;
  opacity: .96;
}
.smoke-sight-icon::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 13px;
  width: 28px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  filter: blur(2px);
}
.ability-card strong { position: relative; color: var(--ability-title, #ffe09b); font-size: 19px; text-shadow: 0 0 10px var(--ability-shadow, rgba(255,209,122,.18)); }
.ability-card small { color: #b9ccda; line-height: 1.5; }
.ability-card > * { z-index: 1; }
.ability-card[data-quality="red"] {
  --ability-border: rgba(255,92,105,.52);
  --ability-accent: #ff6877;
  --ability-title: #ffb0b8;
  --ability-glow: rgba(220,38,56,.42);
  --ability-shadow: rgba(255,53,73,.28);
  --ability-background: linear-gradient(155deg, #5a1824, #25111a 58%, #0d1721);
}
.ability-card[data-quality="gold"] {
  --ability-border: rgba(255,205,83,.52);
  --ability-accent: #ffd35f;
  --ability-title: #ffe39a;
  --ability-glow: rgba(222,164,32,.4);
  --ability-shadow: rgba(255,197,61,.25);
  --ability-background: linear-gradient(155deg, #5a4618, #292210 58%, #0d1721);
}
.ability-card[data-quality="blue"] {
  --ability-border: rgba(79,180,255,.52);
  --ability-accent: #64c5ff;
  --ability-title: #a9ddff;
  --ability-glow: rgba(29,128,210,.42);
  --ability-shadow: rgba(56,166,255,.25);
  --ability-background: linear-gradient(155deg, #153f61, #11283c 58%, #0d1721);
}
.ability-card[data-quality="green"] {
  --ability-border: rgba(81,220,143,.5);
  --ability-accent: #65e5a0;
  --ability-title: #a5f3c8;
  --ability-glow: rgba(34,167,94,.38);
  --ability-shadow: rgba(55,215,127,.23);
  --ability-background: linear-gradient(155deg, #174b35, #132c25 58%, #0d1721);
}
.ability-active-overlay { position: fixed; inset: 0; z-index: 1250; display: grid; place-items: center; padding: 20px; background: rgba(2,8,15,.88); backdrop-filter: blur(10px); }
.ability-active-panel { width: min(500px, 100%); padding: 34px 28px; border: 1px solid rgba(100,229,255,.58); border-radius: 24px; background: radial-gradient(circle at top, #16445a, #091725 64%); box-shadow: 0 24px 90px rgba(0,0,0,.65), 0 0 45px rgba(100,229,255,.14); text-align: center; animation: result-pop .4s cubic-bezier(.2,.9,.2,1.15); }
.ability-active-icon { display: inline-grid; place-items: center; margin-bottom: 6px; font-size: 64px; filter: drop-shadow(0 0 18px rgba(100,229,255,.42)); }
.ability-active-icon.smoke-sight-icon { width: 86px; height: 76px; margin-inline: auto; transform: scale(1.2); }
.ability-active-panel h2 { margin: 5px 0 12px; color: #9deaff; font-size: clamp(32px, 7vw, 52px); }
.ability-active-panel p:not(.eyebrow) { color: #d8e8f3; font-size: 17px; line-height: 1.65; }
.ability-active-panel .primary { min-width: 180px; margin-top: 10px; }
.ability-notice-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.ability-notice-actions button { min-width: 140px; }
.ability-notice-actions .primary { margin-top: 0; }
@keyframes treasure-float { 50% { transform: translateY(-3px) rotate(3deg); } }
@keyframes sonar-pulse { 70% { opacity: .35; transform: scale(1.2); } }
@keyframes sonar-zone-ring {
  0% { opacity: 0; transform: scale(.18); }
  18% { opacity: .95; }
  78% { opacity: .35; }
  100% { opacity: 0; transform: scale(1.08); }
}
.combat-hud { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 14px; min-height: 68px; margin-bottom: 12px; padding: 8px 13px 13px; border: 1px solid rgba(91,145,182,.35); border-radius: 12px; background: linear-gradient(135deg, rgba(10,34,51,.92), rgba(7,23,35,.92)); transition: border-color .2s, background .2s, box-shadow .2s; overflow: hidden; }
.combat-hud.active-turn { border-color: rgba(255,209,122,.62); background: linear-gradient(135deg, rgba(76,54,16,.88), rgba(22,29,28,.94)); box-shadow: 0 0 22px rgba(255,193,72,.12); }
.turn-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; color: #dcebf3; }
.turn-alert > span { font-size: 24px; }
.turn-alert > div { display: grid; gap: 2px; min-width: 0; }
.turn-alert strong { font-size: 16px; }
.turn-alert small { color: #8da9b9; font-size: 11px; }
.active-turn .turn-alert { color: #fff2c4; }
.active-turn .turn-alert small { color: #dfc98d; }
.ammo-status { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 250px; min-height: 48px; padding-left: 14px; border-left: 1px solid rgba(132,174,198,.2); }
.combat-hud .turn-alert { grid-column: 1; grid-row: 1; }
.combat-hud .ammo-status { grid-column: 3; grid-row: 1; }
.hud-countdown { display: block; grid-column: 2; grid-row: 1; align-self: center; width: auto; min-width: 48px; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; }
.hud-countdown .countdown-heading span { display: none; }
.hud-countdown .countdown-heading strong { color: #ffe0a0; font-size: 15px; }
.hud-countdown .fuse-track { position: absolute; right: 0; bottom: 0; left: 0; height: 6px; border-radius: 0; }
.hud-countdown.urgent { border: 0; background: transparent; }
.hud-countdown.urgent .countdown-heading strong { color: #ffad96; }
.placement-countdown { margin: 10px 0 0; }
.ammo-status.inactive { opacity: .62; }
.enemy-zone { min-width: 0; }
.ammo-label { color: #ffe09b; font-size: 13px; font-weight: 900; letter-spacing: .1em; }
.ammo-rack { display: flex; align-items: flex-end; gap: 9px; min-height: 37px; }
.ammo-rack.waiting-rack { align-items: center; justify-content: center; min-width: 82px; }
.waiting-dots { display: flex; gap: 7px; }
.waiting-dots i { width: 7px; height: 7px; border-radius: 50%; background: #7393a7; animation: waiting-dot 1.3s ease-in-out infinite; }
.waiting-dots i:nth-child(2) { animation-delay: -.86s; }
.waiting-dots i:nth-child(3) { animation-delay: -.43s; }
.ammo-slot { position: relative; display: grid; place-items: end center; width: 18px; height: 37px; border-bottom: 3px solid #725526; }
.ammo-shell { position: relative; display: block; width: 12px; height: 30px; border-radius: 7px 7px 3px 3px; background: linear-gradient(90deg, #8f651d, #ffe08a 42%, #b17b24 76%, #684713); box-shadow: inset 0 -5px 0 #79501b, 0 2px 5px rgba(0,0,0,.5), 0 0 8px rgba(255,208,91,.25); transform-origin: bottom; transition: opacity .25s, filter .25s, transform .25s; }
.ammo-shell::before { content: ""; position: absolute; top: -5px; left: 2px; width: 8px; height: 10px; border-radius: 50% 50% 2px 2px; background: linear-gradient(90deg, #8e621d, #ffdc78 48%, #755019); transform: rotate(45deg); z-index: -1; }
.ammo-slot.loaded .ammo-shell { animation: shell-ready 1.8s ease-in-out infinite; }
.ammo-slot.spent .ammo-shell { opacity: .13; filter: grayscale(1); transform: scale(.88); box-shadow: none; }
.ammo-rack.bombardment-rack { align-items: center; min-width: 78px; }
.bombardment-pattern { position: relative; display: block; width: 76px; height: 38px; border: 1px dashed rgba(255,178,74,.32); border-radius: 50%; background: radial-gradient(circle, rgba(255,124,48,.12), transparent 68%); }
.bombardment-pattern i { position: absolute; width: 17px; height: 17px; border: 2px solid #ffad4a; border-radius: 50%; box-shadow: 0 0 7px rgba(255,119,48,.55); animation: bombardment-target 1.6s ease-in-out infinite; }
.bombardment-pattern i::before,
.bombardment-pattern i::after { content: ""; position: absolute; top: 50%; left: 50%; background: #ffd17a; transform: translate(-50%, -50%); }
.bombardment-pattern i::before { width: 23px; height: 1px; }
.bombardment-pattern i::after { width: 1px; height: 23px; }
.bombardment-pattern i:nth-child(1) { top: 3px; left: 9px; }
.bombardment-pattern i:nth-child(2) { top: 16px; left: 31px; animation-delay: -.5s; }
.bombardment-pattern i:nth-child(3) { top: 4px; right: 8px; animation-delay: -1s; }
@keyframes bombardment-target { 50% { opacity: .55; transform: scale(.82); } }
@keyframes shell-ready { 50% { filter: brightness(1.16); transform: translateY(-1px); } }
@keyframes waiting-dot { 50% { opacity: .3; transform: translateY(-2px); } }
@keyframes activity-arrive { from { opacity: 0; transform: translateX(8px); } }
@keyframes enemy-alert-pulse { 50% { opacity: .45; transform: scale(.82); } }
@keyframes radar-impact { 35% { transform: translateX(-2px); filter: brightness(1.3); } 70% { transform: translateX(2px); } }
.enemy.outgoing-fire { animation: outgoing-recoil .28s ease-out; }
.enemy .cell.impact-targeting { z-index: 8; background: rgba(255,191,71,.2); box-shadow: inset 0 0 0 2px #ffd36a, 0 0 16px rgba(255,181,55,.65); }
.enemy .cell.impact-targeting::after {
  content: "◎" !important;
  position: absolute;
  z-index: 9;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff0b0;
  font-size: clamp(22px, 4vw, 38px);
  text-shadow: 0 0 8px #ff8e32;
  animation: outgoing-lock .42s ease-out infinite alternate;
}
.cell.impact-treasure { z-index: 8; animation: impact-treasure 1.3s ease-out; }
.cell.impact-sequence { animation-delay: calc(var(--impact-delay, 0s) + .42s); }
.falling-bomb {
  position: absolute;
  z-index: 12;
  inset: 0;
  pointer-events: none;
}
.falling-bomb::before { content: ""; position: absolute; top: 50%; left: 50%; width: 7px; height: 17px; border-radius: 50% 50% 3px 3px; opacity: 0; background: linear-gradient(90deg, #6d4515, #ffe29a 44%, #9a621c 75%, #42290f); box-shadow: 0 -9px 10px rgba(255,172,62,.7), 0 2px 5px rgba(0,0,0,.6); transform: translate(-50%, -420%) scale(.72); animation: falling-bomb-drop .62s cubic-bezier(.28,.72,.38,1) forwards; animation-delay: var(--impact-delay, 0s); }
.falling-bomb::after { content: ""; position: absolute; top: 50%; left: 50%; width: 8px; height: 8px; border: 2px solid #fff0ae; border-radius: 50%; opacity: 0; transform: translate(-50%, -50%) scale(.2); animation: falling-bomb-burst .55s ease-out forwards; animation-delay: calc(var(--impact-delay, 0s) + .5s); }
@keyframes impact-miss { 0%, 100% { box-shadow: none; } 24% { background: #dff8ff; box-shadow: 0 0 18px 7px rgba(112,218,255,.9); } }
@keyframes impact-hit { 0%, 100% { box-shadow: none; } 20% { background: #fff1c4; box-shadow: 0 0 20px 8px rgba(255,70,48,.95); } 48% { background: #9f1e28; } }
@keyframes impact-armor { 0%, 100% { box-shadow: none; } 20% { background: #dffaff; box-shadow: 0 0 22px 9px rgba(75,205,255,.95), inset 0 0 0 3px #d7f7ff; } 52% { background: #176487; } }
@keyframes impact-treasure { 18% { background: #fff4ba; box-shadow: 0 0 24px 11px rgba(255,202,61,.95); transform: scale(1.08); } 55% { background: #9b6d18; } }
@keyframes falling-bomb-drop {
  0% { opacity: 0; transform: translate(-50%, -420%) scale(.72); }
  18% { opacity: 1; }
  82% { opacity: 1; transform: translate(-50%, -75%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -45%) scale(.82); }
}
@keyframes falling-bomb-burst {
  0%, 10% { opacity: 0; transform: translate(-50%, -50%) scale(.2); }
  28% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(4.2); }
}
@keyframes outgoing-recoil { 38% { transform: scale(.992); filter: brightness(1.2); } }
@keyframes outgoing-lock { from { opacity: .55; transform: scale(.82); } to { opacity: 1; transform: scale(1.06); } }
@keyframes smoke-zone-drift {
  from { transform: translate3d(-1.5%, 1%, 0) scale(.985); filter: blur(3px) brightness(.96); }
  to { transform: translate3d(1.8%, -1.2%, 0) scale(1.025); filter: blur(4px) brightness(1.05); }
}
.turn-alert-enter { animation: turn-alert-in .65s cubic-bezier(.2,.9,.2,1.15), turn-alert-glow 1.4s ease-in-out 3 .65s; }
.battle-panel.my-turn .enemy,
#battlePanel.my-turn .enemy {
  border-color: #ffd77f;
  box-shadow: 0 0 0 4px rgba(255,215,127,.16), 0 0 32px rgba(255,193,72,.28);
}
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 900px) {
  .mode-grid { grid-template-columns: 1fr; }
  .brackets, .boards, .form-grid { grid-template-columns: 1fr; }
  .combat-phase .boards { grid-template-columns: 1fr; grid-template-areas: "enemy" "activity"; grid-template-rows: auto auto; }
  .combat-phase > .section-header { min-height: 150px; padding-right: 145px; }
  .combat-phase .enemy-zone { grid-area: enemy; }
  .combat-phase .enemy-activity { grid-area: activity; width: 100%; margin-top: -10px; }
  .combat-hud { position: sticky; top: 8px; z-index: 30; box-shadow: 0 8px 22px rgba(0,0,0,.38); }
  .enemy-activity { padding: 10px 12px; }
  .enemy-activity:not([open]) { border-color: rgba(255,115,86,.52); background: linear-gradient(105deg, rgba(91,28,28,.58), rgba(17,24,35,.96) 62%); box-shadow: 0 0 18px rgba(255,85,58,.09), inset 0 1px 0 rgba(255,190,168,.07); }
  .enemy-activity-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; min-height: 30px; margin: 0; }
  .enemy-activity-heading > span { display: inline-flex; align-items: center; gap: 6px; color: #ff9c83; white-space: nowrap; }
  .enemy-activity-heading > span::before { content: "◉"; color: #ff765e; font-size: 15px; text-shadow: 0 0 9px rgba(255,86,57,.75); animation: enemy-alert-pulse 1.8s ease-in-out infinite; }
  .enemy-activity[open] .enemy-activity-heading { margin-bottom: 8px; }
  .enemy-activity-heading small { max-width: none; color: #f2d7cf; font-size: 11px; font-weight: 800; text-align: right; text-transform: none; }
  .enemy-activity-toggle { display: block; width: 24px; color: #ff9c83; text-align: center; }
  .enemy-activity-toggle::after { content: "⌄"; font-size: 19px; line-height: 1; }
  .enemy-activity[open] .enemy-activity-toggle::after { content: "⌃"; }
  .combat-phase .own-zone {
    position: absolute;
    z-index: 2;
    top: 18px;
    right: 18px;
    width: 126px;
    padding: 7px;
    border-color: rgba(100,229,255,.3);
    border-radius: 11px;
    background: rgba(4,18,29,.92);
    box-shadow: 0 8px 24px rgba(0,0,0,.32), 0 0 16px rgba(80,214,255,.08);
  }
  .combat-phase .own-zone > summary { margin-bottom: 6px; font-size: 11px; letter-spacing: .05em; list-style: none; cursor: default; }
  .combat-phase .own-zone > summary::-webkit-details-marker { display: none; }
  .combat-phase .own-zone > summary small { display: none; }
  .combat-phase .own-zone .board { width: 110px; max-width: 110px; border-color: #3f7898; }
  .combat-phase .own-zone .coordinate-board { --coordinate-size: 10px; width: 110px; }
  .combat-phase .own-zone .coordinate-board .board { width: 100%; max-width: none; }
  .combat-phase .own-zone .column-coordinates span,
  .combat-phase .own-zone .row-coordinates span { font-size: 6px; }
  .combat-phase .own-zone .cell.hit::after { font-size: 9px; line-height: 1; }
  .combat-phase .own-zone .cell.miss::after { font-size: 10px; line-height: 1; }
  .other-group-grid { grid-template-columns: 1fr; }
  .player-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero, .section-header { align-items: flex-start; flex-direction: column; }
  .battle-header-actions { justify-content: flex-start; }
}
.role-tabs { display: flex; gap: 10px; margin-bottom: 20px; }
.role-tab { flex: 1; background: #091725; }
.role-tab.active { border-color: #50d6ff; background: #123e59; box-shadow: 0 0 0 2px rgba(80,214,255,.12); }
.hint { color: #8faabd; margin: 12px 0 0; }
.admin-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.simulation-card { width: min(680px, 100%); }
.simulation-champions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 22px 0; text-align: left; }
.simulation-champions div { display: grid; gap: 5px; padding: 14px 16px; border: 1px solid rgba(127,255,178,.28); border-radius: 12px; background: rgba(4,16,25,.55); }
.simulation-champions span { color: #8faabd; }
.simulation-champions strong { color: #8affbd; font-size: 20px; }
.simulation-progress {
  position: sticky;
  top: 12px;
  z-index: 5;
  margin: 16px 0;
  padding: 14px 18px;
  border: 1px solid rgba(255,209,122,.5);
  border-radius: 12px;
  background: rgba(46,35,13,.94);
  color: #ffe09b;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.spectate-button { width: 100%; margin-top: 10px; padding: 7px 12px; border-color: #3f8faf; color: #9deaff; }
.spectator-overlay { position: fixed; inset: 0; z-index: 1100; overflow-y: auto; padding: 24px; background: rgba(2,8,15,.96); backdrop-filter: blur(12px); }
.spectator-shell { width: min(1200px, 100%); min-height: calc(100vh - 48px); margin: 0 auto; padding: 28px; border: 1px solid rgba(99,196,255,.3); border-radius: 22px; background: #071725; }
.spectator-header { margin-bottom: 20px; }
.spectator-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; padding: 12px; border-radius: 12px; background: rgba(13,45,68,.65); }
.spectator-controls .message { margin: 0; }
.spectator-boards { align-items: start; }
.spectator-player { padding: 18px; border: 2px solid #29465d; border-radius: 16px; background: #091725; transition: border-color .2s, box-shadow .2s; }
.spectator-player.active-turn { border-color: #ffd77f; box-shadow: 0 0 25px rgba(255,209,122,.2); }
.spectator-player.active-turn h3::after { content: "｜目前回合"; color: #ffd77f; font-size: 14px; }
.spectator-player .board { width: 100%; }
.spectator-player-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.spectator-player-actions button { flex: 1; padding: 8px 10px; font-size: 13px; }

.name-field { margin-bottom: 20px; }
.room-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 12px; }
.room-heading h3 { margin-bottom: 4px; }
.room-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.room-card { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; text-align: left; background: #091725; }
.room-card span:first-child { display: grid; gap: 5px; }
.room-card strong { font-size: 18px; }
.room-card small { color: #8faabd; }
.room-card.selected { border-color: #5fe2ff; background: #123e59; box-shadow: 0 0 0 3px rgba(95,226,255,.12); }
.room-capacity { flex: 0 0 auto; padding: 6px 10px; border-radius: 999px; background: rgba(95,226,255,.1); color: #9deaff; font-weight: 800; }
.empty-state { grid-column: 1 / -1; margin: 0; padding: 24px; border: 1px dashed #35546d; border-radius: 12px; color: #8faabd; text-align: center; }
.join-selected { width: 100%; }
.result-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; background: rgba(2, 8, 15, .86); backdrop-filter: blur(10px); animation: overlay-in .25s ease-out; }
.result-card { width: min(520px, 100%); padding: 38px 28px; border: 1px solid rgba(127,255,178,.55); border-radius: 28px; background: radial-gradient(circle at top, #174f45, #091725 58%); box-shadow: 0 25px 100px rgba(0,0,0,.55), 0 0 60px rgba(127,255,178,.13); text-align: center; animation: result-pop .45s cubic-bezier(.2,.9,.2,1.15); }
.result-card h2 { margin: 4px 0 12px; font-size: clamp(38px, 10vw, 72px); color: #8affbd; }
.result-card p:not(.eyebrow) { color: #d8e8f3; font-size: 18px; line-height: 1.7; }
.result-card .primary { min-width: 180px; margin-top: 10px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.result-actions button, .result-card .result-actions .primary { min-width: 150px; margin-top: 0; }
.trophy { font-size: 72px; filter: drop-shadow(0 0 20px rgba(255,209,122,.45)); }
.result-overlay.defeat { background: rgba(2, 8, 15, .92); }
.defeat .result-card {
  border-color: rgba(124,174,207,.5);
  background: radial-gradient(circle at top, #233f52, #091725 62%);
  box-shadow: 0 25px 100px rgba(0,0,0,.65), 0 0 50px rgba(91,145,182,.12);
}
.defeat .result-card h2 { color: #b9d8eb; }
.defeat .trophy { filter: drop-shadow(0 0 20px rgba(124,174,207,.35)); }
.result-overlay.champion { padding: 0; background: radial-gradient(circle at 50% 35%, #174f45 0, #071c26 48%, #02080f 100%); }
.result-overlay.champion::before,
.result-overlay.champion::after {
  content: "✦  ·  ✧  ·  ✦  ·  ✧  ·  ✦";
  position: absolute;
  left: 50%;
  color: #ffd77f;
  font-size: clamp(18px, 3vw, 34px);
  letter-spacing: .35em;
  white-space: nowrap;
  opacity: .8;
  transform: translateX(-50%);
  animation: honor-glow 2.4s ease-in-out infinite;
}
.result-overlay.champion::before { top: 9vh; }
.result-overlay.champion::after { bottom: 9vh; animation-delay: -1.2s; }
.champion .result-card {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  padding: clamp(32px, 7vh, 80px) 24px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.champion .trophy { font-size: clamp(96px, 18vh, 180px); }
.champion .result-kicker { color: #ffd77f; font-size: clamp(14px, 2vw, 22px); }
.champion .result-card h2 { font-size: clamp(48px, 10vw, 112px); text-shadow: 0 0 35px rgba(138,255,189,.28); }
.champion .result-card p:not(.eyebrow) { font-size: clamp(20px, 3vw, 34px); color: #fff3cf; }
@keyframes overlay-in { from { opacity: 0; } }
@keyframes result-pop { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes honor-glow {
  50% { opacity: .35; transform: translateX(-50%) scale(.96); }
}
@keyframes turn-alert-in {
  from { opacity: 0; transform: translateY(-14px) scale(.96); }
}
@keyframes turn-alert-glow {
  50% { filter: brightness(1.28); transform: scale(1.015); }
}

@media (max-width: 600px) {
  .shell { width: min(100% - 20px, 1440px); padding-top: 16px; }
  .panel, .group-card { padding: 16px; border-radius: 16px; }
  .combat-phase > .section-header { min-height: 118px; padding-right: 118px; }
  .combat-phase .boards { margin-top: 6px; }
  .combat-phase .enemy-zone > h3 { margin-bottom: 10px; }
  .combat-phase .own-zone { top: 12px; right: 12px; width: 108px; padding: 6px; }
  .combat-phase .own-zone > summary { margin-bottom: 4px; font-size: 10px; }
  .combat-phase .own-zone .board { width: 94px; max-width: 94px; }
  .combat-phase .own-zone .coordinate-board { --coordinate-size: 8px; width: 94px; }
  .battle-heading-kicker { gap: 7px; }
  .battle-heading-kicker + h2 { font-size: 22px; line-height: 1.2; }
  .exit-solo-button { padding: 4px 7px; font-size: 11px; }
  .hero { gap: 12px; }
  h1 { font-size: clamp(34px, 12vw, 52px); }
  .room-heading { align-items: flex-start; }
  .room-list { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 170px; padding: 22px 16px; }
  .player-grid { grid-template-columns: 1fr; }
  .boards { gap: 22px; }
  .boards > div { min-width: 0; width: 100%; }
  .board { width: 100%; max-width: 100%; grid-template-columns: repeat(10, minmax(0, 1fr)); overflow: hidden; }
  .cell { min-width: 0; width: auto; padding: 0; border-radius: 0; touch-action: manipulation; }
  .cell.hit::after { font-size: clamp(12px, 5vw, 22px); }
  .cell.miss::after { font-size: clamp(12px, 5vw, 22px); }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .toolbar .primary { grid-column: 1 / -1; }
  .ability-grid { grid-template-columns: 1fr; }
  .ability-card { min-height: 0; grid-template-columns: auto 1fr; justify-items: start; text-align: left; }
  .ability-card-icon { grid-row: 1 / 3; }
  .ability-notice-actions { display: grid; }
  .combat-hud {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 10px;
    min-height: 0;
    padding: 9px 10px 13px;
  }
  .placement-countdown { margin: 8px 0 0; padding: 6px 8px 8px; }
  .hud-countdown { min-width: 43px; padding: 0; }
  .hud-countdown .countdown-heading strong { min-width: 43px; font-size: 13px; }
  .combat-hud .turn-alert { grid-column: 1; grid-row: 1; }
  .combat-hud .hud-countdown { grid-column: 2; grid-row: 1; }
  .combat-hud .ammo-status { grid-column: 1 / -1; grid-row: 2; }
  .turn-alert { grid-template-columns: auto minmax(0, 1fr); gap: 7px; padding: 0; }
  .turn-alert > span { font-size: 20px; }
  .turn-alert strong { font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
  .turn-alert small {
    display: block;
    max-width: none;
    overflow: visible;
    color: #a9bec9;
    line-height: 1.35;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .ammo-status {
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    gap: 10px;
    padding: 7px 0 0;
    border-top: 1px solid rgba(132,174,198,.2);
    border-left: 0;
  }
  .ammo-label { flex: 1 1 auto; font-size: 11px; line-height: 1.3; letter-spacing: .04em; white-space: normal; }
  .ammo-rack { flex: 0 0 auto; }
  .ammo-rack { gap: 5px; }
  .status-pill, .identity { white-space: normal; }
  .match-grid { grid-template-columns: 1fr; }
  .match-card.final { grid-column: auto; }
  .knockout-player { padding: 6px 4px; font-size: 12px; }
  .knockout-player.champion { font-size: 16px; }
  .simulation-champions { grid-template-columns: 1fr; }
  .spectator-overlay { padding: 0; }
  .spectator-shell { min-height: 100vh; padding: 18px 12px; border: 0; border-radius: 0; }
  .solo-finished-actions { grid-template-columns: 1fr; }
  .solo-finished-actions button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #confirmShipsButton.ready-to-submit { animation: none; }
  .action-countdown.urgent { animation: none; }
  .fuse-spark { animation: none; }
  .smoke-zone-clouds { animation: none; }
  .enemy-activity-heading > span::before { animation: none; }
}
