:root{--bg:#0c171f;--surface:#12252d;--surface-deep:#0b222a;--line:#28434b;--ink:#f2f7f3;--muted:#9ab1b2;--acid:#d8f659;--red:#ff786a;--blue:#7ba5ff;--sans:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif}
*{box-sizing:border-box}
html{color-scheme:dark}
body{margin:0;min-height:100vh;background:radial-gradient(circle at 35% 0%,#1a3538 0,transparent 38%),var(--bg);color:var(--ink);font-family:var(--sans)}
button,input,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.35;cursor:not-allowed}
button:focus-visible,a:focus-visible{outline:3px solid var(--acid);outline-offset:3px}
a{text-decoration:none;color:inherit}.hidden{display:none!important}
.topbar{background:#0b171bcf;border-bottom:1px solid #284048}
.topbar-inner{min-height:61px;max-width:1600px;margin:auto;padding:0 24px;display:flex;align-items:center;gap:15px}
.brand{display:flex;align-items:center;gap:2px;font-size:21px;font-weight:780;letter-spacing:-.4px}
.brand-symbol{display:inline-grid;place-items:center;color:var(--acid);background:#263732;width:30px;height:30px;border-radius:9px;font-size:22px;margin-right:8px}
.brand-period{color:var(--acid)}
.header-divider{height:23px;width:1px;background:#385258}
.mode-name{font-size:12px;letter-spacing:.7px;color:#bcd9c3;font-weight:800}
.topbar-spacer{flex:1}
.tool-button{color:#d1e1de;background:#1b2d32;border:1px solid #365055;border-radius:9px;min-height:35px;padding:7px 11px;font-size:12px;font-weight:710;white-space:nowrap}
.tool-button:hover{background:#254047}
.back-btn{border-color:#445057}
.shell{max-width:1510px;margin:auto;padding:18px 22px 32px;position:relative}
.match-header{display:grid;grid-template-columns:minmax(0,1fr) 120px minmax(0,1fr);gap:13px;align-items:stretch;margin-bottom:14px}
.score-card{display:flex;align-items:center;gap:14px;border:1px solid #36525c;border-radius:15px;background:#162d36;padding:13px 18px;min-height:78px;min-width:0}
.score-red{border-left:4px solid var(--red)}.score-blue{border-right:4px solid var(--blue)}
.team-mark{width:10px;height:10px;flex:none;border-radius:50%}.red-mark{background:var(--red);box-shadow:0 0 18px #ff786a66}.blue-mark{background:var(--blue);box-shadow:0 0 18px #7ba5ff66}
.team-copy{display:flex;flex-direction:column;min-width:0;gap:5px}
.team-name{font-weight:780;font-size:clamp(15px,1.4vw,20px);line-height:1.2;overflow-wrap:anywhere}
.team-detail{font-size:11px;color:#9fb4ba}
.team-detail b{color:var(--ink)}
.hit-score{margin-left:auto;display:flex;align-items:center;flex-direction:column;gap:0}
.hit-score b{line-height:1;font-size:31px;color:var(--acid)}
.hit-score small{font-size:9px;color:#9cbbbb}
.match-mid{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;color:#9caeb3}
.match-mid span{font-size:9px;letter-spacing:1px;font-weight:750;text-align:center}
.match-mid strong{font-size:23px;font-weight:870;color:var(--acid)}
.question-panel{border:1px solid #48635b;border-radius:18px;padding:17px 21px 14px;background:linear-gradient(138deg,#1c3937,#18302c 52%,#1c3130);box-shadow:0 12px 45px #00000015;margin-bottom:15px}
.question-top{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px}
.eyebrow{color:#d8f38a;font-size:11px;letter-spacing:1.1px;font-weight:820}
.context{color:#bdcfc1;font-size:11px}
.question-text{font-size:clamp(20px,2.5vw,35px);font-weight:690;line-height:1.36;letter-spacing:-.3px;white-space:pre-wrap;overflow-wrap:anywhere;min-height:52px;margin:10px 0 12px}
.answer-box{display:flex;align-items:baseline;gap:10px;background:#0f302c;border:1px solid #506a52;border-radius:9px;padding:9px 12px;margin:8px 0 12px}
.answer-box span{color:#bbd586;font-size:10px;letter-spacing:.7px;font-weight:820}.answer-box strong{font-size:15px;line-height:1.5;font-weight:630;white-space:pre-wrap;overflow-wrap:anywhere}
.question-controls{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.outline-button{background:transparent;border:1px solid #658079;border-radius:9px;color:#d4e9da;min-height:42px;padding:10px 16px;font-size:12px;font-weight:750;display:inline-flex;align-items:center;justify-content:center}
.outline-button:hover{background:#36504a}
.answer-winners{display:flex;gap:10px;flex-wrap:wrap;flex:1;justify-content:flex-end}
.award{min-width:190px;min-height:43px;border-radius:10px;border:1px solid transparent;padding:10px 13px;color:#151f25;font-size:13px;font-weight:720}
.award b{font-weight:820}.red-award{background:var(--red)}.blue-award{background:var(--blue)}
.award:hover:not(:disabled){filter:brightness(1.08)}
.action-row{border-top:1px solid #4863588a;margin-top:12px;padding-top:10px;display:flex;justify-content:space-between;align-items:center;gap:13px;min-height:49px}
.status-line{font-size:12px;color:#b6d1c0;line-height:1.45;font-weight:550}
.status-line.alert{color:var(--acid);font-weight:730}
.nav-actions{display:flex;gap:12px;align-items:center;justify-content:flex-end}
.text-button{border:0;background:transparent;color:#becfc8;text-decoration:underline;text-underline-offset:4px;font-size:12px;padding:6px 0;font-weight:670;white-space:nowrap}
.text-button:hover{color:var(--ink)}
.next-button{border:0;background:var(--acid);color:#253521;border-radius:9px;padding:11px 16px;font-size:13px;font-weight:820;white-space:nowrap}
.next-button:hover{filter:brightness(1.07)}
.boards{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:stretch}
.fleet-panel{min-width:0;border-radius:17px;background:#132932;border:1px solid #36535d;padding:16px 17px 18px;transition:border-color .15s,box-shadow .15s}
.fleet-red{border-top:3px solid var(--red)}.fleet-blue{border-top:3px solid var(--blue)}
.fleet-panel.target{box-shadow:0 0 0 2px var(--acid),0 0 38px #d5f05d2c;border-color:var(--acid)}
.fleet-title-row{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-bottom:12px}
.fleet-kicker{color:#98b3b5;font-size:9px;letter-spacing:1.2px;font-weight:800}
.fleet-title-row h2{font-size:clamp(15px,1.6vw,22px);font-weight:760;margin:2px 0 0;line-height:1.2}
.fleet-meta{display:flex;flex-direction:column;text-align:right;color:#a2bcbf}
.fleet-meta b{font-size:24px;line-height:1.1;color:#e8f7eb}
.fleet-meta span{font-size:9px}
.grid-holder{display:flex;justify-content:center}
.battleship-grid{display:grid;grid-template-columns:22px repeat(8,minmax(0,1fr));grid-template-rows:18px repeat(8,minmax(0,1fr));gap:4px;width:min(100%,395px);aspect-ratio:1}
.grid-axis{display:grid;place-items:center;color:#97afb5;font-size:10px;font-weight:800;user-select:none}
.cell{min-width:0;min-height:0;border-radius:6px;border:1px solid #385b63;background:linear-gradient(145deg,#1a3c45,#21454f);color:transparent;display:grid;place-items:center;font-size:18px;font-weight:850;aspect-ratio:1;transition:background .14s,transform .14s,border-color .14s}
.cell.is-target:not(.miss):not(.hit):hover,.cell.is-target:not(.miss):not(.hit):focus-visible{background:#436f6d;border-color:var(--acid);transform:scale(1.05);color:#dcf87a}
.cell:not(.is-target){cursor:default}
.cell.miss{background:#1c3039;color:#91b0b8;font-size:25px;border-color:#39505b}
.cell.hit{color:#ffb9a5;background:#583d3a;border-color:#bb6553;text-shadow:0 0 15px #ff8c6b88}
.cell.sunk{color:#f7e4bc;background:#744b2c;border-color:#ffc05f}
.cell.is-target{cursor:crosshair}
.cell:disabled{opacity:1}
.bottom-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 1px 0;color:#79939d;font-size:11px;line-height:1.5;flex-wrap:wrap}
.legend{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.legend span{font-weight:900;font-size:19px;margin-left:9px}.legend span:first-child{margin-left:0}
.legend-miss{color:#91b0b8}.legend-hit{color:#ff9b87}.legend-sunk{color:#f4bc67}
.finish-button{border:1px solid #456066;background:transparent;color:#acbec3;border-radius:7px;padding:8px 12px;font-size:11px;font-weight:750}
.finish-button:hover{color:#fff}
.end-overlay{position:fixed;inset:0;z-index:99;display:grid;place-items:center;background:#061318ed;padding:20px}
.end-card{width:min(100%,560px);border:1px solid #81943d;border-radius:22px;padding:40px 30px 34px;background:radial-gradient(circle at top,#315044,#19332f 60%,#132d2c);text-align:center;box-shadow:0 25px 90px #0009}
.end-icon{font-size:55px}
.end-card h2{font-size:clamp(32px,5vw,50px);margin:12px 0;font-weight:790;letter-spacing:-1px}
.end-card p{color:#c3d5cb;line-height:1.65;max-width:440px;margin:0 auto 25px;font-size:15px}
.end-buttons{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap}
@media(max-width:900px){.match-header{grid-template-columns:1fr 50px 1fr}.match-mid span{display:none}.boards{gap:10px}.fleet-panel{padding:13px 10px}.battleship-grid{gap:3px;grid-template-columns:17px repeat(8,minmax(0,1fr));grid-template-rows:15px repeat(8,minmax(0,1fr))}.shell{padding:12px 14px 24px}.cell{font-size:14px}.cell.miss{font-size:20px}}
@media(max-width:650px){.topbar-inner{padding:0 12px;gap:8px;min-height:55px}.brand{font-size:17px}.brand-symbol{width:27px;height:27px;font-size:19px;margin-right:4px}.mode-name{font-size:10px}.tool-button{font-size:13px;padding:8px}.tool-button span{display:none}.header-divider{height:19px}.shell{padding:10px 11px 20px}.match-header{gap:5px;grid-template-columns:1fr 23px 1fr}.score-card{gap:6px;padding:8px 7px;min-height:61px}.team-mark{width:7px;height:7px}.team-name{font-size:12px}.team-detail{font-size:9px}.hit-score b{font-size:22px}.hit-score small{font-size:8px}.match-mid strong{font-size:11px}.question-panel{padding:13px 13px 9px}.question-text{font-size:clamp(19px,5vw,26px);min-height:56px}.question-controls{align-items:stretch}.outline-button{width:100%;min-height:37px}.answer-winners{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:7px}.award{min-width:0;padding:8px 5px;min-height:41px;font-size:11px}.action-row{align-items:flex-start;flex-wrap:wrap}.nav-actions{width:100%;justify-content:flex-end;gap:13px}.boards{grid-template-columns:1fr}.fleet-panel{padding:14px}.battleship-grid{width:min(100%,365px);grid-template-columns:20px repeat(8,minmax(0,1fr));grid-template-rows:18px repeat(8,minmax(0,1fr));gap:4px}.cell{font-size:18px}.cell.miss{font-size:24px}.bottom-bar{font-size:10px}.finish-button{margin-left:auto}}
@media(max-width:400px){.team-detail{display:none}.score-card{min-height:50px}.question-text{font-size:18px}.battleship-grid{width:100%;gap:3px}.cell{font-size:16px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition-duration:.001ms!important;animation-duration:.001ms!important}}

/* v0.2: projector-friendly Battleship. Show both complete 8x8 grids at once.
   Mobile phones retain the scrollable, vertically stacked board layout. */
@media (min-width:901px) and (min-height:650px) {
  .topbar-inner {min-height:55px}
  .shell {width:100%;padding:10px 20px 8px}
  .match-header {gap:12px;margin-bottom:9px;grid-template-columns:minmax(0,1fr) 105px minmax(0,1fr)}
  .score-card {min-height:61px;border-radius:13px;padding:8px 16px;gap:12px}
  .team-name {font-size:clamp(15px,1.3vw,19px)}
  .team-copy {gap:3px}
  .hit-score b {font-size:27px}
  .match-mid strong {font-size:21px}
  .question-panel {padding:10px 17px 9px;margin-bottom:10px;border-radius:14px}
  .question-top {gap:8px}
  .question-text {min-height:34px;max-height:min(100px,13dvh);overflow-y:auto;margin:7px 0 9px;font-size:clamp(22px,2vw,29px);line-height:1.25;scrollbar-width:thin}
  .question-controls {gap:9px}
  .outline-button {min-height:37px;padding:8px 13px}
  .award {min-height:38px;min-width:180px;padding:8px 12px}
  .answer-box {padding:6px 11px;margin:5px 0 8px}
  .answer-box strong {font-size:14px}
  .action-row {min-height:36px;margin-top:8px;padding-top:7px;gap:10px}
  .status-line {line-height:1.3}
  .next-button {padding:8px 13px}
  .boards {gap:12px;align-items:stretch}
  .fleet-panel {display:flex;flex-direction:column;align-items:stretch;min-width:0;padding:11px 14px 12px;border-radius:14px}
  .fleet-title-row {margin-bottom:7px}
  .fleet-title-row h2 {font-size:clamp(15px,1.35vw,20px)}
  .fleet-meta b {font-size:22px}
  .grid-holder {min-width:0;display:flex;justify-content:center;align-items:center}
  /* Keep a reserve for controls, score, open answer, fleet captions and footer. */
  .battleship-grid {width:min(100%,410px,max(200px,calc(100dvh - 470px)));gap:clamp(2px,.32vw,4px);grid-template-columns:20px repeat(8,minmax(0,1fr));grid-template-rows:17px repeat(8,minmax(0,1fr));aspect-ratio:1}
  .cell {font-size:clamp(12px,1.2vw,18px)}
  .cell.miss {font-size:clamp(17px,1.6vw,25px)}
  .bottom-bar {gap:8px;min-height:33px;padding:7px 1px 0;font-size:10px;flex-wrap:nowrap}
  .legend span {font-size:17px}
  .finish-button {padding:7px 11px}
}
@media (min-width:901px) and (max-height:649px) {
  .shell {padding:10px 18px 14px}
  .match-header {margin-bottom:9px}
  .score-card {min-height:58px;padding:8px 12px}
  .question-panel {padding:10px 14px;margin-bottom:9px}
  .question-text {font-size:clamp(19px,2vw,26px);min-height:32px;margin:7px 0}
  .action-row {margin-top:7px;padding-top:7px;min-height:35px}
  .fleet-panel {padding:10px 12px 11px}
  .fleet-title-row {margin-bottom:7px}
  .battleship-grid {width:min(100%,280px,42dvh)}
}
@media (min-width:651px) and (max-width:900px) {
  .score-card {min-height:61px;padding:9px}
  .match-header {margin-bottom:10px}
  .question-panel {padding:11px 13px;margin-bottom:11px}
  .question-text {font-size:clamp(19px,2.8vw,27px);margin:7px 0 9px}
  .action-row {margin-top:9px;padding-top:8px;min-height:39px}
  .fleet-title-row {margin-bottom:8px}
  .battleship-grid {width:min(100%,335px,max(180px,calc(100dvh - 460px)))}
}

/* v0.3 — Battleship owns its team settings. Matches remain projector-first. */
.sea-setup{max-width:1160px;margin:0 auto;padding:clamp(18px,3vw,38px) 22px 40px;min-width:0}
.sea-setup-header{margin:3px 0 27px}
.sea-setup-kicker,.sea-card-eyebrow{font-size:11px;font-weight:850;letter-spacing:1.5px;color:#c6f57c}
.sea-setup-header h1{font-size:clamp(38px,5vw,66px);margin:9px 0 12px;line-height:1.08;letter-spacing:-2px}
.sea-setup-header h1 span{color:var(--acid)}
.sea-setup-header p{font-size:14px;color:#bad0d1;line-height:1.7;max-width:740px;margin:0}
.sea-setup-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px;align-items:start}
.sea-setup-card,.sea-rules-card{background:#122a33;border:1px solid #385d65;border-radius:19px;padding:clamp(18px,3vw,29px);min-width:0}
.sea-setup-card h2,.sea-rules-card h2{font-size:clamp(21px,2.4vw,28px);letter-spacing:-.7px;margin:8px 0 23px}
.sea-setup-card>label:not(.sea-check){display:block;color:#b9d4cf;font-size:12px;font-weight:760;margin:16px 0 7px}
.sea-setup-card>input{width:100%;min-width:0;min-height:47px;background:#0c2029;border:1px solid #52717b;border-radius:10px;padding:11px 14px;color:#fff;font-size:16px;font-weight:740}
.sea-check{display:flex;align-items:center;gap:13px;background:#0f252d;border:1px solid #365c5d;border-radius:10px;margin-top:20px;padding:15px;cursor:pointer}
.sea-check input{width:21px;height:21px;accent-color:#d8f659;flex:none}
.sea-check span{display:flex;flex-direction:column;gap:4px}
.sea-check b{font-size:13px}
.sea-check small{font-size:11px;color:#9db6b6;line-height:1.55}
.sea-question-count{display:flex;align-items:center;justify-content:space-between;border-top:1px solid #3b535a;margin-top:20px;padding:18px 0;color:#aac3be;letter-spacing:.8px;font-size:10px;font-weight:850}
.sea-question-count strong{color:var(--acid);font-size:17px;letter-spacing:0}
.sea-start{display:flex;align-items:center;justify-content:center;width:100%;border:0;border-radius:11px;background:#d8f659;color:#203127;font-weight:860;min-height:51px;padding:14px}
.sea-start:hover{filter:brightness(1.07)}
.sea-resume{width:100%;margin-top:11px;min-height:42px;color:#e1f3de;background:transparent;border:1px solid #668780;border-radius:10px;font-weight:750}
.sea-edit-link{display:block;text-align:center;margin-top:18px;color:#a4bfb9;text-decoration:underline;text-underline-offset:3px;font-size:12px}
.sea-rule{display:flex;align-items:flex-start;gap:14px;border-top:1px solid #31515b;padding:18px 0;line-height:1.5}
.sea-rule b{color:var(--acid);font-size:18px;min-width:32px}
.sea-rule span{font-size:13px;color:#d2e2df}
.sea-setup-tip{padding:17px;background:#183a3d;border:1px solid #496b58;border-radius:11px;color:#d4e9d6;font-size:12px;line-height:1.7;margin-top:14px}
@media(max-width:700px){
  .sea-setup{padding:17px 12px 28px}
  .sea-setup-layout{grid-template-columns:minmax(0,1fr)}
  .sea-setup-header h1{letter-spacing:-1px}
  .sea-setup-card,.sea-rules-card{padding:19px}
  .sea-setup-header{margin-bottom:17px}
}

/* v0.4 — compact setup without walkthroughs or a redundant rules column. */
.sea-setup{max-width:940px;padding-top:clamp(16px,2.8vw,28px)}
.sea-setup-header{margin-bottom:14px}
.sea-setup-header h1{margin:5px 0 0}
.sea-setup-layout{grid-template-columns:minmax(0,560px);justify-content:center}
.sea-setup-card{padding:clamp(20px,3vw,28px)}
.sea-setup-card h2{margin:7px 0 16px}
.sea-setup .sea-question-count{margin-top:17px}
@media(max-width:700px){.sea-setup-layout{grid-template-columns:minmax(0,1fr)}}

/* v0.5 — align the one remaining setup card with the page heading. */
.sea-setup{max-width:680px;margin-inline:auto;padding-inline:18px}
.sea-setup-header{width:min(100%,560px);margin:0 auto 18px}
.sea-setup-header h1{font-size:clamp(32px,4.3vw,50px)}
.sea-setup-layout{width:min(100%,560px);display:grid;grid-template-columns:minmax(0,1fr);margin:0 auto}
.sea-setup-card{width:100%;padding:clamp(20px,3vw,30px)}
.sea-setup-card h2{font-size:clamp(20px,2.3vw,26px)}
@media(max-width:700px){
 .sea-setup{padding:16px 12px 25px}
 .sea-setup-header{margin-bottom:13px}
 .sea-setup-layout{width:100%}
}
