:root {
  color-scheme: light;
  --ink: #173f42;
  --muted: #597273;
  --paper: #fcfdf8;
  --line: #d2ded6;
  --teal: #216965;
  --teal-dark: #154e4c;
  --sand: #e9dcb9;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: #edf4ef; color: var(--ink); font-size: 14px; line-height: 1.55; }
body::before { content: ""; position: fixed; z-index: -1; inset: 0; background: radial-gradient(ellipse at 10% 0, #fffdf2 0, transparent 52%), radial-gradient(ellipse at 100% 90%, #dbeae5 0, transparent 48%); pointer-events: none; }
button, input, a { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button, .home-link { min-width: 44px; min-height: 44px; }
button { border: 1px solid #b8ccc3; border-radius: 9px; color: var(--ink); background: var(--paper); padding: 9px 12px; cursor: pointer; font-weight: 650; line-height: 1.35; }
button:hover:enabled { background: #e8f0e9; border-color: #6c9990; }
button:disabled { cursor: default; color: #728481; background: #edf0e9; border-color: #d5dfd6; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #215fa3; outline-offset: 3px; }
button.primary { color: white; background: var(--teal); border-color: var(--teal); }
button.primary:hover:enabled { background: var(--teal-dark); }
button.primary:disabled { background: #dce6df; color: #6b8178; border-color: #cbd9cf; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.shell { width: min(1080px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 20px; }
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 76px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid #b9cec0; border-radius: 50%; font-size: 29px; line-height: 1; color: var(--teal); }
.home-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); text-underline-offset: 4px; font-size: 13px; white-space: nowrap; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 0; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .12em; color: var(--muted); }
.intro .eyebrow { font-size: 12px; letter-spacing: .2em; }
h1 { font-size: clamp(28px, 4.4vw, 43px); letter-spacing: .08em; line-height: 1.3; font-weight: 750; }
h1 span { color: #7ca89a; }
.intro > p { color: var(--muted); font-size: 15px; }
.intro strong { color: var(--ink); }
.game-controls { margin: 0; padding: 0; min-width: 0; border: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.bay-panel, .side-card { border: 1px solid var(--line); background: var(--paper); border-radius: 17px; box-shadow: 0 5px 16px #173f4205; }
.bay-panel { padding: 23px; }
.bay-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.bay-heading h2 { margin-top: 3px; font-size: 25px; line-height: 1.3; letter-spacing: .06em; }
.board-size { border: 1px solid #c6d6ca; border-radius: 999px; padding: 5px 11px; color: #60776b; font-size: 12px; white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 15px 0 12px; margin-top: 7px; }
.stats > div { padding-left: 18px; border-left: 1px solid var(--line); }
.stats > div:first-child { padding-left: 0; border-left: 0; }
.stats span { display: block; font-size: 12px; color: var(--muted); }
.stats strong { display: block; font-size: 27px; font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1.3; }
.stats small { font-size: 12px; color: var(--muted); font-weight: 500; }
.mode-row { display: flex; gap: 6px; align-items: center; margin-bottom: 13px; }
.mode-row button { flex-shrink: 0; min-width: 83px; }
.mode-row button[aria-pressed="true"] { color: white; background: var(--teal); border-color: var(--teal); }
.mode-row button:disabled { color: #728481; background: #edf0e9; border-color: #d5dfd6; }
.mode-row > span { margin-left: auto; padding-left: 5px; color: var(--muted); font-size: 12px; text-align: right; }
.board { display: grid; grid-template-columns: repeat(6, minmax(44px, 1fr)); gap: 4px; width: min(100%, 366px); margin-inline: auto; }
.cell { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; aspect-ratio: 1; border-radius: 7px; border: 1px solid #c0d3c7; font-size: 12px; letter-spacing: .02em; }
.cell.is-covered { background: #dce9de; color: #46685a; box-shadow: inset 0 -3px 0 #c3d8c8; }
.cell.is-covered:hover:enabled { background: #c8dfce; }
.cell.is-open { background: #f3f4e9; border-color: #e0e4d6; color: #59745f; box-shadow: none; font-size: 25px; font-weight: 650; }
.cell.number-0 { color: #63775d; font-size: 22px; font-weight: 500; }
.cell.number-1 { color: #2c7377; }
.cell.number-2 { color: #416e35; }
.cell.number-3 { color: #9c6043; }
.cell.number-4, .cell.number-5, .cell.number-6, .cell.number-7, .cell.number-8 { color: #805778; }
.cell.is-flagged { background: #f3e6c5; color: #765c2c; border-color: #d6bf8d; font-size: 14px; }
.cell.is-reef { color: #5a6567; background: #dfe5e2; border-color: #bbc9c2; font-size: 14px; }
.cell.is-hit { color: #893e2e; background: #f2d8c9; border-color: #ce9b81; font-size: 15px; }
.cell.is-wrong { color: #8a4931; background: #f3e4cf; border-color: #d7b392; font-size: 13px; }
.game-controls:disabled .board { opacity: .68; }
.feedback { min-height: 47px; padding: 10px 0 8px; color: #42635b; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.outcome { margin: 0 0 12px; padding: 10px 12px; border-radius: 9px; background: #e3eee1; border-left: 3px solid #6b9265; }
.outcome h3 { font-size: 15px; }
.outcome p { margin-top: 2px; font-size: 12px; color: var(--muted); }
.outcome.is-lost { background: #f5e9d8; border-left-color: #b48450; }
.action-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 7px; }
.action-row button { padding-inline: 5px; font-size: 13px; }
.side-column { display: grid; gap: 14px; }
.side-card { padding: 19px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { font-size: 16px; letter-spacing: .04em; }
.section-heading > span { color: var(--muted); font-size: 12px; }
.map-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.map-picker button { padding-inline: 4px; font-size: 13px; }
.map-picker button span { font-size: 12px; opacity: .75; }
.map-picker button[aria-pressed="true"] { border-color: #427b65; background: #e1ece0; color: #23583f; }
.share-button { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 12px; border-style: dashed; font-size: 13px; }
.invitation { margin-top: 12px; }
.invitation label { display: block; font-size: 12px; font-weight: 650; margin-bottom: 5px; }
.invitation input { display: block; width: 100%; min-width: 0; min-height: 44px; border: 1px solid #aabfb4; border-radius: 7px; padding: 10px; background: white; color: var(--ink); font-size: 13px; }
.invitation p { margin-top: 5px; font-size: 12px; color: var(--muted); }
.rules-card p { margin-top: 10px; color: #4d6964; font-size: 13px; }
.rules-card strong { color: var(--ink); font-weight: 650; }
.quiet, .rules-card .quiet { color: var(--muted); font-size: 12px; }
.initial-note { font-size: 12px; color: var(--muted); padding-bottom: 10px; }
.action-log { max-height: 230px; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding-left: 25px; scrollbar-color: #adc2b3 transparent; }
.action-log li { padding: 8px 0 8px 3px; border-top: 1px solid #e4e9df; font-size: 12px; color: #46645b; overflow-wrap: anywhere; }
.action-log li::marker { color: #6d8b7d; font-variant-numeric: tabular-nums; }
.confirmation { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; margin: 0 0 16px; border: 1px solid #bd9d6b; border-radius: 13px; background: #fff5df; }
.confirmation h2 { font-size: 18px; margin: 3px 0; }
.confirmation p:not(.eyebrow) { font-size: 13px; color: #715d3e; }
.confirmation-actions { display: flex; gap: 8px; flex-shrink: 0; }
.address-notice { padding: 10px 13px; margin-bottom: 13px; color: #6c593d; background: #f8edd6; border-radius: 8px; font-size: 13px; }
.page-footer { padding-top: 22px; text-align: center; font-size: 12px; color: #6d8276; }

@media (max-width: 760px) {
  .shell { width: min(520px, calc(100% - 32px)); }
  .page-header { min-height: 61px; }
  .brand { font-size: 12px; gap: 7px; }
  .brand-mark { width: 28px; height: 28px; font-size: 24px; }
  .home-link { font-size: 12px; gap: 4px; }
  .intro { padding: 16px 0; gap: 12px; }
  .intro .eyebrow { font-size: 12px; letter-spacing: .12em; }
  .intro > p { font-size: 12px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .bay-panel { padding: 15px; }
  .bay-heading h2 { font-size: 22px; }
  .bay-heading .eyebrow { font-size: 12px; letter-spacing: .05em; }
  .stats { padding: 10px 0; margin-top: 5px; }
  .stats > div { padding-left: 13px; }
  .stats strong { font-size: 24px; }
  .mode-row { margin-bottom: 10px; }
  .mode-row button { min-width: 76px; padding-inline: 8px; }
  .mode-row > span { font-size: 12px; max-width: 124px; }
  .feedback { min-height: 47px; }
  .side-card { padding: 16px; }
  .confirmation { align-items: stretch; flex-direction: column; gap: 12px; padding: 16px; }
  .confirmation-actions button { flex: 1; }
}

@media (max-width: 380px) {
  .shell { width: calc(100% - 24px); }
  .brand > span:last-child { max-width: 110px; font-size: 12px; }
  .intro { padding: 12px 0; }
  h1 { font-size: 28px; }
  .bay-panel { padding: 12px; }
  .board-size { padding-inline: 8px; }
  .mode-row { gap: 5px; }
  .mode-row button { min-width: 73px; }
  .stats > div { padding-left: 10px; }
  .action-row { gap: 5px; }
}
