:root {
  color-scheme: light dark;
  --paper: #f4f3ef;
  --surface: #fffef9;
  --ink: #181817;
  --muted: #696963;
  --line: #c8c7c0;
  --line-strong: #292927;
  --water: #deddd6;
  --water-hover: #cbc9c0;
  --player: #496f83;
  --on-player: #fffef9;
  --player-two: #e9a526;
  --hit: #e5533d;
  --sunk: #7b45a8;
  --miss: #92968f;
  --success: #21805a;
  --danger: #bd382a;
  --cell-gap: 4px;
  --radius: 0;
  --max-width: 1180px;
}

html[data-theme="dark"] {
  --paper: #161715;
  --surface: #20211f;
  --ink: #f0efe9;
  --muted: #aaa9a1;
  --line: #41423e;
  --line-strong: #deddd6;
  --water: #30312e;
  --water-hover: #444640;
  --player: #8eb5c8;
  --on-player: #161715;
  --player-two: #eab24d;
  --hit: #f06450;
  --sunk: #ad72d4;
  --miss: #6d736d;
  --success: #52aa80;
  --danger: #ff7968;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --paper: #161715;
    --surface: #20211f;
    --ink: #f0efe9;
    --muted: #aaa9a1;
    --line: #41423e;
    --line-strong: #deddd6;
    --water: #30312e;
    --water-hover: #444640;
    --player: #8eb5c8;
    --on-player: #161715;
    --player-two: #eab24d;
    --hit: #f06450;
    --sunk: #ad72d4;
    --miss: #6d736d;
    --success: #52aa80;
    --danger: #ff7968;
  }
}

html[data-style="colourful"] {
  --paper: #fff4dc;
  --surface: #fffdf7;
  --ink: #241335;
  --muted: #66536f;
  --line: #dfb9d6;
  --line-strong: #4b245c;
  --water: #bfe3ed;
  --water-hover: #9bd1df;
  --player: #006d77;
  --on-player: #fffdf7;
  --player-two: #a94f00;
  --hit: #c92f56;
  --sunk: #6f42c1;
  --miss: #66758a;
  --success: #087f5b;
  --danger: #b42336;
}

html[data-style="colourful"][data-theme="dark"] {
  --paper: #171126;
  --surface: #231936;
  --ink: #fff5dc;
  --muted: #c9b7d5;
  --line: #513c69;
  --line-strong: #f3c4e2;
  --water: #28485a;
  --water-hover: #37677e;
  --player: #55d6be;
  --on-player: #171126;
  --player-two: #ffb84d;
  --hit: #ff6685;
  --sunk: #c084fc;
  --miss: #768390;
  --success: #69dbb1;
  --danger: #ff7a8f;
}

@media (prefers-color-scheme: dark) {
  html[data-style="colourful"][data-theme="system"] {
    --paper: #171126;
    --surface: #231936;
    --ink: #fff5dc;
    --muted: #c9b7d5;
    --line: #513c69;
    --line-strong: #f3c4e2;
    --water: #28485a;
    --water-hover: #37677e;
    --player: #55d6be;
    --on-player: #171126;
    --player-two: #ffb84d;
    --hit: #ff6685;
    --sunk: #c084fc;
    --miss: #768390;
    --success: #69dbb1;
    --danger: #ff7a8f;
  }
}

* { box-sizing: border-box; }

html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--paper); color: var(--ink); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link { position: fixed; left: 1rem; top: -5rem; padding: .75rem 1rem; background: var(--ink); color: var(--paper); z-index: 100; }
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header, .site-footer, .site-main { width: min(calc(100% - 32px), var(--max-width)); margin-inline: auto; }
.site-header { min-height: 78px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); }
.site-header nav { display: flex; gap: clamp(1rem, 3vw, 2.5rem); }
.site-header nav a { color: var(--muted); font-size: .82rem; font-weight: 700; text-decoration: none; text-transform: uppercase; letter-spacing: .08em; }
.site-header nav a:hover, .site-header nav a:focus-visible { color: var(--ink); }
.wordmark { justify-self: start; display: inline-flex; align-items: center; gap: .65rem; font-size: .92rem; font-weight: 900; letter-spacing: .18em; text-decoration: none; }
.wordmark-grid { display: grid; grid-template-columns: repeat(3, 6px); gap: 2px; transform: rotate(-8deg); }
.wordmark-grid i { display: block; width: 6px; height: 6px; background: var(--player); }
.wordmark-grid i:nth-child(2) { background: var(--hit); }
.icon-button { justify-self: end; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; }
.icon-button:hover { background: var(--water); }
.appearance-controls { justify-self: end; display: flex; gap: .4rem; }
.style-button { width: auto; min-width: 86px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding-inline: .65rem; }
.style-button [data-style-label] { font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }

.site-main { flex: 1; padding-block: clamp(3.5rem, 8vw, 7.5rem); }
.site-footer { min-height: 76px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem 2rem; padding-block: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.site-footer a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: .2em; }
.site-footer__copy { display: grid; gap: .4rem; }
.site-footer__privacy { max-width: 68ch; font-size: .68rem; text-transform: none; letter-spacing: .03em; }

.eyebrow { margin: 0 0 1rem; color: var(--player); font-size: .74rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero { max-width: 880px; }
.hero h1, .page-heading h1, .game-heading h1 { margin: 0; font-size: clamp(2.7rem, 8vw, 6.7rem); line-height: .93; letter-spacing: -.065em; }
.hero .lede { max-width: 540px; margin: 2rem 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.55; }

.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: clamp(4rem, 10vw, 8rem); border: 1px solid var(--line-strong); background: var(--line-strong); }
.mode-card { min-height: 220px; padding: clamp(1.5rem, 4vw, 2.5rem); display: grid; grid-template-columns: auto 1fr auto; gap: 1.5rem; align-items: end; background: var(--surface); text-decoration: none; transition: background .15s ease, color .15s ease; }
.mode-card:hover, .mode-card:focus-visible { background: var(--ink); color: var(--paper); outline: none; }
.mode-card__number { align-self: start; color: var(--muted); font: 700 .7rem ui-monospace, monospace; }
.mode-card__body { display: grid; gap: .5rem; }
.mode-card__body strong { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.04em; }
.mode-card__body span { max-width: 300px; color: var(--muted); line-height: 1.4; }
.mode-card__arrow { font-size: 2rem; }
.mode-card:hover .mode-card__number, .mode-card:hover .mode-card__body span, .mode-card:focus-visible .mode-card__number, .mode-card:focus-visible .mode-card__body span { color: var(--paper); }
.legend-strip { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; margin-top: 2rem; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; }
.legend-strip span { display: inline-flex; align-items: center; gap: .5rem; }
.cell-swatch { width: 12px; height: 12px; background: var(--water); }
.cell-swatch--ship { background: var(--player); }
.cell-swatch--miss { background: var(--miss); }
.cell-swatch--hit { background: var(--hit); }
.cell-swatch--sunk { background: var(--sunk); }

.page-heading { max-width: 800px; }
.page-heading h1 { font-size: clamp(2.5rem, 7vw, 5.5rem); }
.page-heading > p:last-child { max-width: 600px; margin: 1.5rem 0 0; color: var(--muted); font-size: 1.1rem; line-height: 1.6; }
.rules-overview { margin-top: 5rem; }
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 1.5rem; border-block: 1px solid var(--line); }
.rule-block { padding: 2.25rem; border-right: 1px solid var(--line); }
.rule-block:last-child { border: 0; }
.rule-number { font: 700 .7rem ui-monospace, monospace; color: var(--player); }
.rule-block h3 { margin: 3rem 0 1rem; font-size: 1.5rem; }
.rule-block p { margin: 0; color: var(--muted); line-height: 1.6; }
.rules-section { max-width: 900px; margin-top: 5rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.rules-section > h2 { margin: 0; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.04em; }
.rules-section__lede { max-width: 700px; margin: 1rem 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
.placement-steps { margin: 2.5rem 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.placement-steps li { display: grid; grid-template-columns: 3rem 1fr; gap: 1rem; padding: 1.25rem 0; border-top: 1px solid var(--line); }
.placement-steps li > span { color: var(--player); font: 700 .7rem ui-monospace, monospace; }
.placement-steps strong { display: block; margin-bottom: .3rem; }
.placement-steps p, .rules-details p { margin: 0; color: var(--muted); line-height: 1.6; }
.rules-note { margin: 1.25rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.rules-note strong { color: var(--ink); }
.rules-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 2.5rem; border: 1px solid var(--line); background: var(--line); }
.rules-details article { padding: 1.5rem; background: var(--surface); }
.rules-details h3 { margin: 0 0 .75rem; font-size: 1rem; }
.rules-details--modes { grid-template-columns: repeat(2, 1fr); }
.rules-details--modes h3 { margin-top: 1.5rem; font-size: 1.35rem; }
.fleet-table { max-width: 720px; margin-top: 5rem; }
.fleet-table h2 { margin-bottom: 1.5rem; }
.fleet-table > div { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.fleet-table span { color: var(--muted); }

.game-shell { max-width: 1040px; margin-inline: auto; }
.game-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.game-heading h1 { overflow-wrap: anywhere; font-size: clamp(2.5rem, 6vw, 5rem); }
.connection-pill { display: inline-flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border: 1px solid var(--line); color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.connection-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.connection-pill.is-online i { background: var(--success); }
.connection-pill.is-error i { background: var(--danger); }
.game-status { display: grid; gap: .35rem; margin: 2.5rem 0; padding: 1.2rem 1.4rem; border-left: 4px solid var(--player); background: var(--surface); }
.game-status span { color: var(--muted); line-height: 1.45; }
.invite-resend { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: -1.25rem 0 2.5rem; padding: .75rem 1rem; border: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.invite-resend .button { flex: none; }

.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.name-field { display: grid; gap: .55rem; max-width: 520px; margin-bottom: 1.25rem; }
.name-field > span { font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.name-field input { width: 100%; min-height: 50px; padding: .8rem 1rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.name-field input:focus { border-color: var(--line-strong); outline: 2px solid var(--player); outline-offset: 1px; }
.name-field small { color: var(--muted); }
.choice-card { min-height: 230px; display: grid; align-content: end; justify-items: start; gap: .5rem; padding: 1.5rem; border: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.choice-card:hover { border-color: var(--line-strong); }
.choice-card.is-selected { border: 2px solid var(--player); background: var(--surface); }
.choice-card strong { font-size: 1.4rem; }
.choice-card > span:last-child { color: var(--muted); }
.choice-card__grid { align-self: start; width: 70px; aspect-ratio: 1; margin-bottom: 2rem; opacity: .7; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 10px 10px; }
.button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: .8rem 1.25rem; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); font-weight: 800; text-decoration: none; cursor: pointer; }
.button:hover:not(:disabled), .button:focus-visible { transform: translateY(-1px); }
.button--primary { background: var(--ink); color: var(--paper); }
.button--quiet { min-height: 40px; padding: .55rem .8rem; font-size: .78rem; }
.button--danger { border-color: var(--danger); color: var(--danger); }
.button--danger:hover:not(:disabled), .button--danger:focus-visible { background: var(--danger); color: var(--surface); }
.button:disabled { opacity: .35; cursor: not-allowed; }
.lobby-panel > .button { width: 100%; margin-top: 1rem; }
.fine-print { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.waiting-panel { padding: clamp(2rem, 6vw, 4rem); border: 1px solid var(--line); background: var(--surface); text-align: center; }
.room-code-block { display: grid; gap: .5rem; }
.room-code-block span, .share-field > span:first-child { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.room-code-block strong { font: 800 clamp(2.5rem, 8vw, 5rem) ui-monospace, monospace; letter-spacing: .15em; }
.share-field { max-width: 620px; display: grid; gap: .6rem; margin: 2rem auto; text-align: left; }
.share-field__input { display: grid; grid-template-columns: 1fr auto; }
.share-field input { min-width: 0; padding: .8rem; border: 1px solid var(--line); border-right: 0; background: var(--paper); color: var(--muted); }
.share-field button { padding-inline: 1.2rem; border: 1px solid var(--line-strong); background: var(--ink); color: var(--paper); cursor: pointer; }
.waiting-animation { display: flex; justify-content: center; gap: 5px; margin: 2rem; }
.waiting-animation i { width: 14px; height: 14px; background: var(--water); animation: waiting 1.2s infinite ease-in-out; }
.waiting-animation i:nth-child(2) { animation-delay: .12s; }
.waiting-animation i:nth-child(3) { animation-delay: .24s; }
.waiting-animation i:nth-child(4) { animation-delay: .36s; }
@keyframes waiting { 0%, 60%, 100% { background: var(--water); } 30% { background: var(--player); } }

.placement-layout, .daily-layout { display: grid; grid-template-columns: minmax(300px, 680px) minmax(220px, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.board-wrap { width: 100%; }
.board-wrap--small { max-width: 360px; }
.board { --board-size: 10; display: grid; grid-template-columns: repeat(var(--board-size), 1fr); gap: var(--cell-gap); width: 100%; aspect-ratio: 1; }
.board-row { display: contents; }
.board-cell { position: relative; aspect-ratio: 1; min-width: 0; padding: 0; border: 0; background: var(--water); color: transparent; cursor: default; }
button.board-cell { cursor: pointer; }
button.board-cell:disabled { cursor: default; }
button.board-cell:hover:not(:disabled), button.board-cell:focus-visible { background: var(--water-hover); outline: 2px solid var(--ink); outline-offset: 1px; z-index: 1; }
.board-cell.is-ship { background: var(--player); }
.board-cell.is-ship[data-drag-ship], .fleet-item button[data-drag-ship] { touch-action: none; }
.board-cell.is-drag-source { opacity: .4; }
.board-cell.is-preview { background: color-mix(in srgb, var(--player) 58%, var(--water)); }
.board-cell.is-invalid { background: color-mix(in srgb, var(--hit) 70%, var(--water)); }
.board-cell.is-miss { background: var(--miss); }
.board-cell.is-miss::after { content: ""; position: absolute; inset: 42%; border-radius: 50%; background: var(--surface); }
.board-cell.is-hit { background: var(--hit); }
.board-cell.is-hit::before, .board-cell.is-hit::after { content: ""; position: absolute; left: 18%; right: 18%; top: 47%; height: 2px; background: var(--surface); transform: rotate(45deg); }
.board-cell.is-hit::after { transform: rotate(-45deg); }
.board-cell.is-sunk { background: var(--sunk); }
.board-cell.is-sunk::after { content: "×"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--surface); font-size: clamp(.7rem, 2.3vw, 1.3rem); font-weight: 800; }
.fleet-controls h2, .daily-sidebar h2, .battle-layout h2 { margin: 0 0 1rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; }
.fleet-controls > .button--primary { width: 100%; margin-top: 1.5rem; }
.fleet-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .85rem 0; border-top: 1px solid var(--line); }
.fleet-item button { display: flex; gap: 4px; align-items: center; padding: .35rem; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.fleet-item button:focus-visible { outline: 2px solid var(--ink); }
.fleet-item button:disabled { opacity: .55; cursor: not-allowed; }
.fleet-item button i { width: 18px; height: 18px; background: var(--water); }
.fleet-item.is-placed button i { background: var(--player); }
.fleet-item.is-selected button { box-shadow: 0 0 0 2px var(--player); }
.fleet-item.is-placed { color: var(--muted); }
.fleet-item span { font: .72rem ui-monospace, monospace; color: var(--muted); text-transform: uppercase; }
[data-fleet-list] { transition: background-color .12s ease, outline-color .12s ease; }
[data-fleet-list].is-drag-over { background: color-mix(in srgb, var(--player) 12%, transparent); outline: 2px dashed var(--player); outline-offset: 4px; }
.ship-drag-ghost { position: fixed; z-index: 200; display: grid; gap: 4px; width: max-content; pointer-events: none; transform: translate(-50%, -50%); filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--ink) 28%, transparent)); }
.ship-drag-ghost.is-h { grid-template-columns: repeat(var(--ship-length), 18px); }
.ship-drag-ghost.is-v { grid-template-rows: repeat(var(--ship-length), 18px); }
.ship-drag-ghost i { width: 18px; height: 18px; background: var(--player); }
.fleet-progress-ship { display: flex; gap: 4px; align-items: center; padding: .35rem; }
.fleet-progress-ship i { width: 18px; aspect-ratio: 1; background: var(--water); }
.fleet-progress-ship i.is-sunk { background: var(--hit); }
.attack-progress { margin-top: 1.5rem; }
.attack-progress h3 { margin: 0 0 .35rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.game-progress-total { display: block; margin-bottom: .45rem; color: var(--muted); font: .68rem ui-monospace, monospace; text-transform: uppercase; }
.hit-queue { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: .8rem; }
.hit-queue i { width: 11px; aspect-ratio: 1; background: var(--water); }
.hit-queue i.is-hit { background: var(--hit); }
.progress-fleet-list { border-top: 1px solid var(--line); }

.turn-banner { margin-bottom: 2rem; padding: 1rem; border: 1px solid var(--line-strong); font-weight: 800; text-align: center; text-transform: uppercase; letter-spacing: .1em; }
.turn-banner.is-your-turn { background: var(--player); color: var(--on-player); border-color: var(--player); }
.opponent-move-time { display: block; margin: -1rem 0 2rem; color: var(--muted); font-size: .78rem; text-align: center; }
.battle-layout { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(220px, .56fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.battle-actions { display: flex; justify-content: flex-end; margin-top: 1.5rem; }
.result-panel, .error-panel { max-width: 680px; padding: clamp(2rem, 6vw, 4rem); border: 1px solid var(--line); background: var(--surface); }
.battle-panel .result-panel { margin-top: clamp(2.5rem, 6vw, 5rem); }
.result-panel h2, .error-panel h2 { margin: 0 0 1rem; font-size: clamp(2rem, 5vw, 4rem); line-height: 1; letter-spacing: -.05em; }
.result-panel p:not(.eyebrow), .error-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.result-dialog { width: min(calc(100% - 2rem), 580px); max-height: min(86vh, 640px); padding: 0; border: 0; background: transparent; color: var(--ink); }
.result-dialog::backdrop { background: rgb(15 16 14 / .78); backdrop-filter: blur(3px); }
.result-dialog__surface { padding: clamp(2rem, 7vw, 4rem); border: 1px solid var(--line-strong); background: var(--surface); }
.result-dialog h2 { margin: 0 0 1rem; font-size: clamp(2.5rem, 9vw, 5rem); line-height: .95; letter-spacing: -.06em; }
.result-dialog p:not(.eyebrow) { margin: 0 0 2rem; color: var(--muted); font-size: 1.05rem; line-height: 1.55; }
.result-dialog .button { width: 100%; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.daily-date { color: var(--muted); font: .8rem ui-monospace, monospace; text-transform: uppercase; }
.stat-pair { display: grid; grid-template-columns: repeat(2, 1fr); margin-bottom: 2rem; border: 1px solid var(--line); }
.stat-pair div { display: grid; gap: .25rem; padding: 1.2rem; border-right: 1px solid var(--line); }
.stat-pair div:last-child { border: 0; }
.stat-pair strong { font-size: 1.8rem; }
.stat-pair span { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; }
.daily-sidebar > .button { width: 100%; margin-top: 1.5rem; }

.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; display: grid; gap: .5rem; }
.toast { max-width: 340px; padding: .9rem 1rem; background: var(--ink); color: var(--paper); font-size: .85rem; box-shadow: 0 6px 30px rgb(0 0 0 / .2); }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .site-header { grid-template-columns: 1fr auto; }
  .site-header nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; padding: .9rem 0; border-top: 1px solid var(--line); }
  .site-main { padding-top: 3.5rem; }
  .mode-grid, .choice-grid, .rules-grid, .placement-layout, .rules-details { grid-template-columns: 1fr; }
  .mode-card { min-height: 175px; }
  .rule-block { border-right: 0; border-bottom: 1px solid var(--line); }
  .game-heading { align-items: start; flex-direction: column; }
  .connection-pill { align-self: flex-start; }
  .fleet-controls { order: -1; }
  .daily-layout { grid-template-columns: minmax(0, 1fr) minmax(88px, 28vw); gap: clamp(.75rem, 3vw, 1.25rem); }
  .daily-layout > * { min-width: 0; }
  .fleet-progress-ship i { width: clamp(9px, 2.5vw, 14px); }
  .battle-layout { grid-template-columns: minmax(0, 1fr) minmax(88px, 28vw); gap: clamp(.75rem, 3vw, 1.25rem); align-items: start; }
  .battle-layout > section { min-width: 0; }
  .battle-layout .board-wrap--small { max-width: 100%; }
  .battle-layout > section:last-child h2 { font-size: .64rem; letter-spacing: .06em; }
}

@media (max-width: 960px) and (orientation: landscape) {
  .site-main { padding-top: 2rem; }
  .daily-layout { grid-template-columns: minmax(0, 1fr) minmax(130px, .44fr); gap: clamp(1rem, 4vw, 2.5rem); }
  .daily-layout > .board-wrap { max-width: min(62vw, 65vh); }
  .fleet-progress-ship i { width: 12px; }
  .battle-layout { grid-template-columns: minmax(0, 1fr) minmax(130px, .44fr); gap: clamp(1rem, 4vw, 2.5rem); align-items: start; }
  .battle-layout > section { min-width: 0; }
  .battle-layout > section:first-child .board-wrap { max-width: min(62vw, 65vh); }
  .battle-layout .board-wrap--small { max-width: min(30vw, 44vh); }
}

@media (max-width: 760px), (max-width: 960px) and (orientation: landscape) {
  .daily-sidebar .stat-pair { margin-bottom: .75rem; }
  .daily-sidebar .stat-pair div { padding: .45rem .25rem; }
  .daily-sidebar .stat-pair strong { font-size: 1rem; }
  .daily-sidebar .stat-pair span { font-size: .58rem; letter-spacing: .05em; }
  .daily-sidebar h2 { margin-bottom: .35rem; font-size: .64rem; letter-spacing: .06em; }
  .fleet-progress-item { grid-template-columns: 1fr; gap: .15rem; padding: .45rem 0; }
  .fleet-progress-ship { gap: 2px; padding: 0; }
  .fleet-progress-item span { font-size: .58rem; }
  .daily-sidebar > .button { min-height: 40px; padding: .55rem .4rem; font-size: .7rem; }
  .daily-sidebar .fine-print { font-size: .65rem; }
}

@media (max-width: 440px) {
  :root { --cell-gap: 3px; }
  .dialog-actions { grid-template-columns: 1fr; }
  .site-header, .site-footer, .site-main { width: min(calc(100% - 20px), var(--max-width)); }
  .site-header nav { gap: .5rem; }
  .site-header nav a { font-size: .68rem; }
  .fleet-table > div { grid-template-columns: 1fr 1fr; }
  .fleet-table > div span:last-child { grid-column: 2; }
  .share-field__input { grid-template-columns: 1fr; }
  .share-field input { border-right: 1px solid var(--line); border-bottom: 0; }
  .invite-resend { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
