/* 2317 MOON_BATTLESHIP — 레이아웃·컴포넌트 (Blueprint · 해군 설계도/해도)
 * 다크 네이비 기본 + 라이트(화이트 청사진) 토글. 시안 라인워크·모노스페이스·코너틱·각진 모서리.
 * 그라디언트/글래스/글로우/다색/과장식 없음. 함선/명중=시안, 격침만 앰버(기능색).
 */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.mono, .timer, .coord, .status-line, .board-title, .diff-label,
.bs-label, .tray-ship .name, .stat-row, .card .tag, .breadcrumb { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 18px; }
.sr-title, .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 헤더 ---------- */
.site-header { border-bottom: 1px solid var(--line-strong); background: var(--surface); position: sticky; top: 0; z-index: 30; }
.header-in { display: flex; align-items: center; gap: 16px; height: 58px; }
.brand {
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px;
  letter-spacing: 0.14em; text-transform: uppercase; font-family: 'JetBrains Mono', ui-monospace, monospace; color: var(--ink);
}
.brand .mark {
  display: grid; grid-template-columns: repeat(2, 8px); grid-template-rows: repeat(2, 8px);
  gap: 2px; padding: 4px; border: 1px solid var(--accent-line); border-radius: 2px; position: relative;
}
.brand .mark i { display: block; width: 8px; height: 8px; background: transparent; border: 1px solid var(--line-strong); }
.brand .mark i.on { background: var(--accent); border-color: var(--accent); }
.header-nav { display: flex; gap: 2px; margin-left: 10px; flex: 1; }
.header-nav a {
  padding: 7px 11px; font-size: 13px; color: var(--ink-2); border-radius: 2px; font-weight: 600;
  font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.02em;
}
.header-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.header-tools { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 2px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.lang-select {
  height: 36px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 2px; padding: 0 8px; font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace; cursor: pointer; max-width: 130px;
}

/* ---------- 게임 메인 ---------- */
.play-main { padding: 16px 0 30px; }
.play-area { max-width: 940px; margin: 0 auto; }
.status-line {
  text-align: center; font-size: 13px; color: var(--ink); font-weight: 600;
  min-height: 22px; margin: 2px 0 12px; letter-spacing: 0.03em; text-transform: uppercase;
}
.status-line .accent { color: var(--accent); }
.status-line .sunk { color: var(--danger); }

.setup-top { max-width: 460px; margin: 0 auto 16px; }
.setup-hint { text-align: center; font-size: 12px; color: var(--ink-2); margin: 10px 0 0; font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* ---------- 보드 (해도) ---------- */
.boards { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px 34px; }
.board-panel { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.board-title {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-2);
}
.board-title::before { content: '⌖'; color: var(--accent); font-size: 13px; }
.board-title.enemy { color: var(--ink); }
.fleet-pips { display: flex; gap: 6px; min-height: 12px; }
.fleet-pips .ship-row { display: flex; gap: 2px; }
.fleet-pips .pip { width: 7px; height: 7px; border-radius: 1px; background: var(--accent); }
.fleet-pips .pip.gone { background: var(--danger); }
.fleet-pips .ship-row.sunk .pip { background: var(--danger); opacity: .55; }

.board-outer { position: relative; max-width: 100%; overflow-x: auto; padding: 7px; }
/* 코너틱 (설계도 모서리 마크) */
.board-outer::before, .board-outer::after {
  content: ''; position: absolute; width: 11px; height: 11px; pointer-events: none;
  border-color: var(--accent-line); border-style: solid; z-index: 2;
}
.board-outer::before { top: 0; left: 0; border-width: 1px 0 0 1px; }
.board-outer::after { bottom: 0; right: 0; border-width: 0 1px 1px 0; }
.bs-board {
  --cell: 30px;
  display: grid; gap: 0; background: var(--grid-tint);
  border: 1px solid var(--accent-line);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.bs-label {
  display: grid; place-items: center; width: var(--cell); height: var(--cell);
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: calc(var(--cell) * 0.36);
  color: var(--accent); font-weight: 600; opacity: .85;
}
.bs-corner { width: var(--cell); height: var(--cell); }
.bs-cell {
  width: var(--cell); height: var(--cell); padding: 0; margin: 0; cursor: default;
  background: var(--water); position: relative;
  box-shadow: inset -1px -1px 0 var(--line), inset 1px 1px 0 var(--line);
  border: 0;
}
.bs-cell.bl { box-shadow: inset -1px -1px 0 var(--line), inset 2px 1px 0 var(--line-strong); }
.bs-cell.bt { box-shadow: inset -1px -1px 0 var(--line), inset 1px 2px 0 var(--line-strong); }
.bs-cell.bl.bt { box-shadow: inset -1px -1px 0 var(--line), inset 2px 2px 0 var(--line-strong); }

/* 내 함선 — 시안 아웃라인(설계도 실루엣) */
.bs-cell.ship { background: var(--ship-soft); }
.bs-cell.ship.seg-edge::before {
  content: ''; position: absolute; inset: 2px; border: 1px solid var(--ship); border-radius: 1px;
}
/* 빗나감 — 페이드 점 */
.bs-cell.miss::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 20%; height: 20%; border-radius: 50%; background: var(--miss);
}
/* 명중 — 시안 마커(각진 다이아) */
.bs-cell.hit::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(45deg);
  width: 42%; height: 42%; background: var(--hit);
}
/* 격침 — 앰버 */
.bs-cell.sunk { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }
.bs-cell.sunk::after { background: var(--danger); }
.bs-cell.flash { animation: bsflash .5s ease; }
@keyframes bsflash { 0% { transform: scale(0.55); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.bs-board.enemy .bs-cell.aimable { cursor: crosshair; }
.bs-board.enemy .bs-cell.aimable:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }

.bs-cell.pv-ok { background: var(--ship-soft); box-shadow: inset 0 0 0 1px var(--ship); }
.bs-cell.pv-bad { background: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger); }
.bs-board.place .bs-cell { cursor: pointer; }
.bs-board.place .bs-cell.ship { cursor: grab; }

.board-cover {
  position: absolute; inset: 7px; display: grid; place-items: center;
  background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px;
  border: 1px solid var(--accent-line); cursor: pointer; z-index: 5; font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.board-panel.idle .bs-board { opacity: .78; }

/* ---------- 함선 트레이 ---------- */
.ship-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 580px; margin: 6px auto 0; }
.tray-ship {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 11px;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 2px; cursor: pointer; min-width: 64px;
}
.tray-ship:hover { border-color: var(--accent-line); }
.tray-ship.active { border-color: var(--accent); background: var(--accent-soft); }
.tray-ship.placed { opacity: .4; }
.tray-ship .cells { display: flex; gap: 2px; }
.tray-ship .cells i { display: block; width: 10px; height: 10px; border-radius: 1px; background: transparent; border: 1px solid var(--ship); }
.tray-ship.active .cells i { background: var(--ship); }
.tray-ship.placed .cells i { border-color: var(--ink-3); background: transparent; }
.tray-ship .name { font-size: 10px; color: var(--ink-2); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- 컨트롤 버튼 ---------- */
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 20px auto 0; max-width: 620px; }
.ctrl-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 15px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 2px;
  cursor: pointer; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
}
.ctrl-btn svg { width: 17px; height: 17px; }
.ctrl-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.ctrl-btn.primary { border-color: var(--accent); background: var(--accent); color: var(--bg); }
.ctrl-btn.primary:hover { color: var(--bg); }
.ctrl-btn.primary:disabled { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }

/* ---------- 광고 (애드핏 규정: 래퍼 border-radius/overflow 금지) ---------- */
.ad-wrap { margin: 26px auto 4px; display: flex; justify-content: center; }
.ad-grid { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 672px; margin: 0 auto; }
.ad-grid[data-ad-layout="mixed"] { max-width: 760px; }
.ad-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: 100%; }
.ad-cell { min-height: 50px; }

/* ---------- FAB · 패널 ---------- */
.fab-stack { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 40; }
.fab {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px;
  border: 1px solid var(--accent-line); background: var(--surface); color: var(--accent);
  border-radius: 2px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600;
}
.fab svg { width: 18px; height: 18px; }
.fab:hover { border-color: var(--accent); background: var(--accent-soft); }
.fab-txt { display: none; }

.side-panel {
  position: fixed; right: 18px; bottom: 84px; width: 300px; max-width: calc(100vw - 36px);
  background: var(--surface); border: 1px solid var(--accent-line); border-radius: 2px; z-index: 45; overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--line-strong); }
.panel-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.panel-close { border: 0; background: none; color: var(--ink-3); font-size: 16px; cursor: pointer; }
.panel-body { padding: 15px; }
.set-block { margin-bottom: 16px; }
.set-label { font-size: 11px; color: var(--ink-3); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg .tab {
  padding: 9px 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 2px; cursor: pointer; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; font-weight: 600; text-align: center; letter-spacing: 0.03em;
}
.seg .tab.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; gap: 10px; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 2px; border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer; flex: none; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 1px; background: var(--ink-3); transition: .18s; }
.switch.on { background: var(--accent-soft); border-color: var(--accent); }
.switch.on .knob { left: 20px; background: var(--accent); }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.ghost-btn { padding: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 2px; cursor: pointer; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.ghost-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.panel-backdrop { position: fixed; inset: 0; background: rgba(4, 12, 20, 0.5); z-index: 42; }
.stats { display: flex; flex-direction: column; gap: 2px; }
.stat-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row .d { color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-row .n { text-align: right; font-variant-numeric: tabular-nums; }
.stat-row .n b { color: var(--accent); }

/* ---------- 완료 오버레이 ---------- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(4, 12, 20, 0.62); z-index: 60; padding: 20px; }
.overlay-card { background: var(--surface); border: 1px solid var(--accent-line); border-radius: 2px; padding: 26px; width: 340px; max-width: 100%; text-align: center; position: relative; }
.overlay-card::before, .overlay-card::after {
  content: ''; position: absolute; width: 12px; height: 12px; border-color: var(--accent); border-style: solid;
}
.overlay-card::before { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.overlay-card::after { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }
.badge { display: inline-grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 2px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.badge.lose { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.badge svg { width: 26px; height: 26px; }
.overlay-card h2 { margin: 0 0 4px; font-size: 20px; text-transform: uppercase; letter-spacing: 0.08em; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.ov-meta { color: var(--ink-2); font-size: 12px; margin: 6px 0 16px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.btn-primary { display: inline-block; padding: 12px 20px; border: 1px solid var(--accent); border-radius: 2px; background: var(--accent); color: var(--bg); font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; }
.ov-actions { display: flex; gap: 10px; justify-content: center; margin-top: 2px; }
.ov-actions .ghost-btn, .ov-actions .btn-primary { flex: 1; }

/* ---------- 문서 페이지 ---------- */
main.doc-main { padding: 26px 0 40px; }
.doc { max-width: 760px; margin: 0 auto; }
.doc h1 { font-size: 29px; margin: 4px 0 10px; letter-spacing: -0.01em; }
.doc h2 { font-size: 19px; margin: 30px 0 12px; padding-top: 10px; border-top: 1px solid var(--line-strong); }
.doc p { margin: 0 0 14px; color: var(--ink); }
.doc ul, .doc ol { margin: 0 0 16px; padding-left: 20px; }
.doc li { margin: 6px 0; }
.lead { font-size: 16px; color: var(--ink-2); }
.muted { color: var(--ink-3); font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.breadcrumb { font-size: 12px; color: var(--ink-3); margin-bottom: 10px; letter-spacing: 0.02em; }
.breadcrumb a { color: var(--ink-2); }
.breadcrumb a:hover { color: var(--accent); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 6px 0 18px; }
.card { display: block; padding: 15px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--surface); position: relative; }
.card:hover { border-color: var(--accent-line); }
.card:hover::before { content: ''; position: absolute; top: 5px; left: 5px; width: 9px; height: 9px; border: solid var(--accent); border-width: 1px 0 0 1px; }
.card .tag { display: inline-block; font-size: 10px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.card h3 { margin: 0 0 5px; font-size: 15px; }
.card p { margin: 0; font-size: 13px; color: var(--ink-2); }
.ship-spec { display: flex; gap: 14px; align-items: center; margin: 2px 0 16px; }
.ship-spec .fig { display: flex; gap: 3px; }
.ship-spec .fig i { display: block; width: 16px; height: 16px; border-radius: 1px; background: transparent; border: 1px solid var(--ship); }
.ship-spec .len { font-family: 'JetBrains Mono', ui-monospace, monospace; color: var(--accent); font-size: 13px; letter-spacing: 0.04em; }
.faq details { border: 1px solid var(--line-strong); border-radius: 2px; padding: 4px 14px; margin-bottom: 8px; background: var(--surface); }
.faq summary { padding: 11px 0; font-weight: 600; cursor: pointer; }
.faq .a { padding: 0 0 12px; color: var(--ink-2); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 22px 0; font-size: 13px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.pager a { color: var(--accent); font-weight: 600; }
.start-link { display: inline-block; margin-top: 6px; padding: 10px 18px; border-radius: 2px; background: var(--accent); color: var(--bg); font-weight: 700; font-family: 'JetBrains Mono', ui-monospace, monospace; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- 푸터 ---------- */
.site-footer { border-top: 1px solid var(--line-strong); background: var(--surface); margin-top: 20px; }
.site-footer.mini { position: static; }
.footer-in { padding: 26px 0 20px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 620px; }
.footer-cols h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); font-family: 'JetBrains Mono', ui-monospace, monospace; }
.footer-cols a { display: block; padding: 3px 0; font-size: 13px; color: var(--ink-2); }
.footer-cols a:hover { color: var(--accent); }
.copyright { margin-top: 18px; padding: 14px 0 0; font-size: 11px; color: var(--ink-3); font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.02em; }
.site-footer.mini .copyright { margin: 0; padding: 14px 0; text-align: center; }

/* ---------- 반응형 ---------- */
@media (max-width: 720px) {
  .header-nav { display: none; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .fab { padding: 12px; }
  .side-panel { right: 12px; left: 12px; width: auto; bottom: 78px; }
  .doc h1 { font-size: 24px; }
  .boards { gap: 20px; }
  .brand { font-size: 15px; letter-spacing: 0.1em; }
}
@media (max-width: 420px) {
  .footer-cols { grid-template-columns: 1fr; }
}
