@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&family=Libre+Caslon+Display&display=swap');

:root {
  color-scheme: light;
  --ink: oklch(27% .025 150);
  --muted: oklch(48% .018 150);
  --green: oklch(40% .065 162);
  --green-light: oklch(93% .025 155);
  --canvas: oklch(95% .012 90);
  --paper: oklch(99% .004 90);
  --line: oklch(84% .014 100);
  --orange: oklch(62% .14 42);
  font-family: 'DM Sans', 'Helvetica Neue', sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button, select, a, input { -webkit-tap-highlight-color: transparent; }
button { transition: background 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
button:disabled { opacity: .45; cursor: default; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-header { max-width: 1440px; margin: auto; height: 94px; padding: 0 5%; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.wordmark { display: flex; align-items: center; text-decoration: none; color: var(--ink); font-size: 25px; font-weight: 650; letter-spacing: -1.1px; }
.wordmark svg { width: 36px; height: 32px; margin-right: 11px; color: var(--green); stroke-width: 1.8; }
.brand-dot { color: var(--orange); }
.header-right { display: flex; gap: 32px; align-items: center; }
.header-note { color: var(--muted); font-size: 12px; }
.language-label { display: flex; gap: 9px; align-items: center; }
.language-label svg { width: 17px; }
.language-label select { border: 0; background: transparent; padding: 8px 3px; font-size: 12px; font-weight: 600; }
main { max-width: 1260px; padding: 0 40px; margin: auto; }
.intro { display: flex; align-items: center; justify-content: space-between; padding: 54px 0 43px; }
.eyebrow { font-size: 10px; font-weight: 650; letter-spacing: 1.8px; text-transform: uppercase; color: var(--green); margin: 0 0 16px; }
h1 { font-family: 'Libre Caslon Display', Georgia, serif; font-weight: 400; letter-spacing: -1.4px; font-size: 54px; line-height: 1.08; margin: 0; max-width: 820px; text-wrap: balance; }
.intro-copy { font-size: 14px; color: var(--muted); margin: 16px 0 0; line-height: 1.6; }
.intro-sketch { flex: 0 0 150px; margin: 0 15px 0 30px; transform: rotate(-7deg); }
.intro-sketch svg { width: 150px; height: 100px; stroke: var(--green); }
.sketch-grid { stroke: var(--line); stroke-width: .6; }
.sketch-ship { fill: var(--canvas); stroke-width: 2; }
.sketch-wave { stroke-width: 1.2; }
.intro-sketch circle, .intro-sketch path:last-child { stroke: var(--orange); }
.workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-items: stretch; background: oklch(97% .008 90); }
.controls { padding: 26px 23px 22px; border-right: 1px solid var(--line); }
.panel-heading { display: flex; gap: 11px; align-items: center; }
.step { color: var(--muted); font-family: monospace; font-size: 10px; border: 1px solid var(--line); border-radius: 50%; width: 23px; height: 23px; display: grid; place-items: center; }
h2 { font-size: 14px; font-weight: 650; letter-spacing: -.2px; margin: 0; }
.control-section { padding-top: 22px; }
fieldset { margin: 0 0 20px; padding: 0; border: 0; min-width: 0; }
legend, .field-label { font-size: 11px; font-weight: 550; margin-bottom: 9px; display: block; }
.segmented { display: flex; padding: 3px; background: oklch(93% .009 90); border: 1px solid var(--line); border-radius: 5px; gap: 3px; }
.segmented label { position: relative; flex: 1; min-width: 0; cursor: pointer; }
.segmented input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented label span, .segmented button { display: block; padding: 8px 3px; border-radius: 3px; text-align: center; font-size: 11px; font-weight: 500; }
.segmented input:checked + span, .segmented button[aria-pressed="true"] { background: var(--paper); color: var(--green); box-shadow: 0 1px 3px oklch(20% .01 150 / .08); }
.segmented input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 1px; }
.segmented button { background: transparent; border: 0; flex: 1; }
.segmented button:hover { background: oklch(98% .006 90); }
.layout-options { flex-wrap: wrap; }
.layout-options .eight-fields-option { flex-basis: 100%; }
.player-tabs.four-players { display: grid; grid-template-columns: 1fr 1fr; }
.player-tabs button[hidden] { display: none; }
.fleet-explanation { font-size: 10px; margin-top: -6px; }
.ship-length { display: block; font-size: 9px; color: var(--muted); margin-top: 3px; font-weight: 400; }
#fleet-type { width: 100%; padding: 9px 10px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); font-size: 11px; }
#grid-size { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); font-size: 12px; }
.fleet-heading { border-top: 1px solid var(--line); padding-top: 25px; margin-top: 26px; }
.fleet-controls { padding-top: 16px; }
.help { font-size: 11px; line-height: 1.65; color: var(--muted); margin: 13px 0 16px; }
.fleet-list { display: grid; gap: 3px; margin: 0 -5px; }
.fleet-item { display: flex; align-items: center; gap: 7px; padding: 10px 7px; border: 1px solid transparent; border-radius: 4px; background: transparent; font-size: 11px; text-align: left; }
.fleet-item > span:first-child { flex: 1; }
.fleet-item:hover { background: oklch(92% .012 150); }
.fleet-item.selected { background: var(--green-light); border-color: oklch(78% .045 155); }
.ship-blocks { display: inline-flex; gap: 2px; }
.ship-blocks i { width: 8px; height: 8px; background: var(--green); border: 1px solid var(--green); display: block; }
.fleet-item.placed .ship-blocks { opacity: .45; }
.fleet-check { width: 12px; font-size: 10px; color: var(--muted); text-align: right; }
.fleet-item.placed .fleet-check { color: var(--green); }
.rotate-button { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin: 12px 0 17px; padding: 8px; border: 1px dashed var(--line); border-radius: 4px; background: transparent; font-size: 11px; }
.rotate-button:hover { border-color: var(--green); background: var(--green-light); }
.rotate-button > span { font-size: 18px; line-height: 15px; }
kbd { font-family: inherit; color: var(--muted); border: 1px solid var(--line); padding: 0 4px; font-size: 9px; border-radius: 2px; }
.button-pair { display: flex; align-items: center; gap: 13px; }
.secondary { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px; background: transparent; font-size: 11px; flex: 1; }
.secondary svg { width: 14px; height: 14px; }
.secondary:hover { border-color: var(--green); background: var(--green-light); }
.text-button { background: none; border: 0; padding: 9px 0; font-size: 11px; color: var(--muted); }
.text-button:hover { color: var(--ink); text-decoration: underline; }
.checkbox-label { display: flex; gap: 8px; align-items: flex-start; font-size: 10px; line-height: 1.5; margin: 23px 0 0; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--green); width: 13px; height: 13px; margin: 1px 0 0; flex-shrink: 0; }
.status { min-height: 29px; font-size: 10px; line-height: 1.5; margin: 9px 0 13px; color: var(--green); }
.status.error { color: oklch(45% .15 30); }
.primary { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--paper); border: 1px solid var(--green); background: var(--green); padding: 13px 10px; border-radius: 4px; font-size: 12px; font-weight: 550; }
.primary:hover { background: oklch(32% .06 162); }
.primary svg { width: 17px; height: 17px; }
.print-tip { color: var(--muted); font-size: 9px; line-height: 1.6; text-align: center; margin: 10px 0 0; }
.preview-area { min-width: 0; background: oklch(91.5% .01 100); padding: 0 32px 22px; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; height: 57px; font-size: 10px; color: var(--muted); }
.preview-toolbar > div { display: flex; align-items: center; gap: 7px; }
.preview-dot { width: 5px; height: 5px; background: var(--green); border-radius: 50%; }
.paper-container { max-width: 650px; margin: auto; }
.paper { --sheet-ink: #242824; --sheet-line: #a5aaa4; color: var(--sheet-ink); background: var(--paper); width: 100%; aspect-ratio: 210/297; padding: 5.25%; box-shadow: 0 3px 5px oklch(20% .01 100 / .06), 0 12px 25px oklch(20% .01 100 / .05); display: flex; flex-direction: column; container-type: inline-size; font-family: 'DM Sans', 'Helvetica Neue', sans-serif; }
.paper.letter { aspect-ratio: 8.5/11; }
.player-sheet { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sheet-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet-brand { display: flex; align-items: center; gap: 8px; }
.sheet-brand svg { width: 5cqw; height: 4cqw; stroke-width: 1.6; }
.sheet-brand h2 { font-size: 3.2cqw; letter-spacing: .18em; line-height: 1.2; font-weight: 700; }
.sheet-brand p { font-size: 1.3cqw; color: #62675f; margin: .3cqw 0 0; }
.player-badge { border: 1px solid var(--sheet-line); border-radius: 3px; padding: .7cqw 1.2cqw; font-size: 1.6cqw; white-space: nowrap; }
.write-in { display: flex; gap: 6cqw; padding: 1.4cqw 0 1.2cqw; font-size: 1.6cqw; }
.write-in > span { display: flex; gap: 6px; align-items: baseline; flex: 1; }
.write-in > span:last-child { flex: .6; }
.write-in i { flex: 1; border-bottom: 1px solid var(--sheet-line); height: 1em; }
.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 5.5%; width: 94%; margin: 0 auto; }
.letter:not(.single-sheet) .boards { width: 85%; }
.board-heading { display: flex; align-items: center; justify-content: space-between; }
.board-heading h3 { font-size: 2.2cqw; font-weight: 600; margin: 0; }
.board-heading > span { font-size: 1.5cqw; color: #757a73; }
.board-help { font-size: 1.4cqw; color: #62675f; margin: .3cqw 0 1cqw; }
.board { display: grid; grid-template-columns: 6% repeat(var(--size), 1fr); grid-template-rows: 6% repeat(var(--size), 1fr); aspect-ratio: 1; }
.coordinate { font-size: 1.6cqw; font-weight: 500; display: grid; place-items: center; line-height: 1; }
.coordinate.corner { color: #858a82; font-size: 1.5cqw; }
.cell { min-width: 0; padding: 0; background: transparent; border: 0; border-right: 1px solid var(--sheet-line); border-bottom: 1px solid var(--sheet-line); border-radius: 0; position: relative; }
.board .cell.first-row { border-top: 1px solid var(--sheet-line); }
.board .cell.first-col { border-left: 1px solid var(--sheet-line); }
.cell.occupied::after { content: ''; position: absolute; inset: 12%; background: #677c70; border: 1px solid #344d3d; border-radius: 1px; }
.cell.ghost { background: #c5d8cb; }
.cell.ghost-invalid { background: #edc6b7; }
.ocean .cell:hover { background: #c5d8cb; }
.ocean .cell:focus-visible { z-index: 1; outline: 2px solid var(--orange); outline-offset: -2px; }
.sheet-fleet { display: flex; gap: 2.2cqw; align-items: center; padding: 1.4cqw 0 1.2cqw; font-size: 1.4cqw; }
.sheet-fleet > span:first-child { font-weight: 600; }
.sheet-fleet .ship-blocks { gap: .35cqw; }
.sheet-fleet .ship-blocks i { width: 1.3cqw; height: 1.3cqw; background: transparent; border: 1px solid #6e776d; }
.shot-legend { margin-left: auto; display: flex; gap: 1.5cqw; white-space: nowrap; }
.sheet-rule { font-size: 1.4cqw; line-height: 1.5; margin: 0; padding: .9cqw 0; border-top: 1px solid #d3d5cf; }
.sheet-footer { margin-top: auto; display: flex; justify-content: space-between; padding-top: .7cqw; font-size: 1.1cqw; letter-spacing: .15em; color: #73796e; }
.cut-line { border-top: 1px dashed #a5aaa4; margin: 2.5cqw -5.85% 2.5cqw; position: relative; height: 0; }
.letter .cut-line { margin-top: 1.5cqw; margin-bottom: 1.5cqw; }
.cut-line > span { position: absolute; left: 50%; transform: translate(-50%, -50%); background: var(--paper); color: #73796e; font-size: 1.3cqw; padding: 0 2cqw; white-space: nowrap; }
.single-sheet .player-sheet { justify-content: flex-start; }
.single-sheet .sheet-header { margin-top: 5cqw; }
.single-sheet .write-in { margin: 5cqw 0 4cqw; }
.single-sheet .boards { margin-top: 5cqw; }
.single-sheet .sheet-fleet { margin-top: 4cqw; }
.single-sheet .sheet-rule { margin-top: 3cqw; }
.paper.eight-fields { aspect-ratio: 297 / 210; padding: 3.37%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 5% 5%; position: relative; }
.eight-fields::before, .eight-fields::after { content: ''; position: absolute; pointer-events: none; }
.eight-fields::before { top: 50%; left: 0; right: 0; border-top: 1px dashed var(--sheet-line); }
.eight-fields::after { left: 50%; top: 0; bottom: 0; border-left: 1px dashed var(--sheet-line); }
.eight-fields .player-sheet { container-type: inline-size; }
.eight-fields .sheet-brand p, .eight-fields .board-help, .eight-fields .sheet-footer { display: none; }
.eight-fields .sheet-brand { gap: 1cqw; }
.eight-fields .sheet-brand h2 { font-size: 3cqw; letter-spacing: .1em; }
.eight-fields .boards { width: 92%; }
.eight-fields .board-heading { margin-bottom: 1cqw; }
.eight-fields .coordinate { font-size: 1.9cqw; }
.eight-fields .sheet-fleet { gap: 1.5cqw; font-size: 1.7cqw; }
.eight-fields .sheet-rule { font-size: 1.6cqw; padding: .7cqw 0 0; }
.preview-caption { margin: 18px 0 0; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 10px; color: var(--muted); }
.preview-caption svg { width: 14px; height: 14px; }
.how-to { padding: 38px 0 37px; }
.how-to .eyebrow { font-size: 9px; margin-bottom: 18px; }
.how-to-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 35px; }
.how-to-steps p { margin: 0; display: flex; align-items: flex-start; gap: 12px; font-size: 11px; color: var(--muted); line-height: 1.7; }
.how-to-steps p > span:first-child { font-family: monospace; color: var(--orange); font-size: 10px; padding-top: 1px; }
footer { max-width: 1180px; margin: 0 auto; border-top: 1px solid var(--line); padding: 23px 0 28px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 10px; }
footer > span:last-child { font-size: 8px; letter-spacing: 1px; }
@media (min-width: 1300px) { .workspace { grid-template-columns: 280px minmax(0, 1fr); } .controls { padding: 29px; } }
@media (max-width: 1000px) {
  main { padding: 0 25px; } .workspace { grid-template-columns: 235px minmax(0, 1fr); } .controls { padding: 22px 18px; } .preview-area { padding: 0 18px 20px; } h1 { font-size: 45px; } .intro-sketch { flex-basis: 100px; } .intro-sketch svg { width: 100px; } footer { margin: 0 25px; } .sheet-fleet { gap: 1.7cqw; }
}
@media (max-width: 760px) {
  .app-header { height: 73px; padding: 0 22px; } .header-note { display: none; } main { padding: 0 20px; } .intro { padding: 34px 0 29px; } h1 { font-size: 42px; } .intro-sketch { display: none; } .intro-copy { font-size: 13px; } .eyebrow { font-size: 9px; }
  .workspace { grid-template-columns: 1fr; } .controls { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 0 25px; padding: 23px; }
  .panel-heading:first-child { grid-column: 1; grid-row: 1; } .control-section:not(.fleet-controls) { grid-column: 1; grid-row: 2; } .fleet-heading { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; } .fleet-controls { grid-column: 2; grid-row: 2 / span 3; } .primary { grid-column: 1; align-self: end; margin-top: 25px; } .print-tip { grid-column: 1; } .help { font-size: 10px; } .fleet-item { font-size: 10px; padding: 8px 5px; } .ship-blocks i { width: 6px; height: 6px; } .fleet-check { width: 8px; } .preview-area { padding: 0 22px 20px; } .preview-toolbar { height: 48px; } .how-to-steps { gap: 20px; } .how-to { padding: 30px 0; } .sheet-fleet { gap: 2.2cqw; } footer { margin: 0 20px; }
}
@media (max-width: 440px) {
  .controls { display: block; padding: 24px; } .control-section:not(.fleet-controls) { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; } .control-section > fieldset { margin-bottom: 16px; } .field-label { grid-column: 1; align-self: center; margin: 0; } #grid-size { grid-column: 2; } .fleet-heading { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 23px; } .fleet-item { font-size: 12px; padding: 9px; } .ship-blocks i { width: 9px; height: 9px; } .fleet-check { width: 20px; } .help { font-size: 12px; } .status { min-height: 16px; } .primary { margin-top: 14px; } .preview-area { padding: 0 12px 15px; } .preview-caption { font-size: 9px; line-height: 1.5; } .how-to-steps { grid-template-columns: 1fr; gap: 14px; } footer { flex-direction: column; gap: 15px; } h1 { font-size: 39px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

@page { size: A4 portrait; margin: 10mm; }
@media print {
  :root { background: white; color: black; }
  html, body { width: auto; margin: 0 !important; padding: 0 !important; background: white !important; }
  .no-print, noscript { display: none !important; }
  main, .workspace, .preview-area, .paper-container { display: block; margin: 0; padding: 0; max-width: none; width: 100%; border: 0; border-radius: 0; background: white; overflow: visible; }
  .paper { --paper: white; --sheet-line: #777; --sheet-ink: black; width: 190mm; height: 276mm; aspect-ratio: auto; margin: 0; padding: 0; box-shadow: none; background: white; break-inside: avoid; color: black; }
  .paper.letter { width: 195.9mm; height: 258.4mm; aspect-ratio: auto; }
  .paper.eight-fields { width: 277mm; height: 189mm; aspect-ratio: auto; padding: 0; }
  .player-sheet { break-inside: avoid; }
  .sheet-brand p, .board-help, .sheet-footer { color: #444; }
  .cut-line > span { color: #444; background: white; }
  .coordinate { color: black; }
  .cell { background: transparent !important; box-shadow: none; }
  .cell.occupied::after { background: transparent; border: 1.5pt solid black; border-radius: 0; inset: 12%; }
  .hide-ships .cell.occupied::after { display: none; }
  .cell:focus-visible { outline: none !important; }
  .ship-blocks i { border-color: #444 !important; background: transparent !important; }
  .single-sheet .sheet-header { margin-top: 8mm; }
  a { color: inherit; text-decoration: none; }
}
