/* Sea Battle — the "Night Sonar" console, sitting on the Arcade kit's paper page.
   Hits and misses differ by shape as well as colour: a glowing X for a hit, a small ring for a miss. */
.sb-page { --sb-bg: #070d18; --sb-panel: #0b1626; --sb-line: rgba(92,242,176,.22); --sb-acc: #5cf2b0; --sb-txt: #d8f7ea;
  --sb-dim: #8fb9a8; --sb-hit: #ff4d4d; --sb-miss: #7fd8ff; --sb-mono: 'IBM Plex Mono', ui-monospace, monospace; --sb-sans: 'Space Grotesk', system-ui, sans-serif; }
.sb-hero { margin-bottom: 10px; }

.sb-console {
  position: relative; border-radius: 24px; padding: 14px; color: var(--sb-txt); font-family: var(--sb-sans);
  background: radial-gradient(520px 360px at 50% 34%, rgba(20,90,80,.32), transparent 70%), var(--sb-bg);
  box-shadow: inset 0 0 0 1px rgba(92,242,176,.12), 0 2px 0 #02060c, 0 18px 40px rgba(7,13,24,.4);
  min-width: 0; overflow-x: clip;
}
.sb-console [hidden] { display: none !important; }

/* ---- status strip with Bumpy in his headset ---- */
.sb-status { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; border: 1px solid var(--sb-line); border-radius: 14px; background: rgba(92,242,176,.06); margin-bottom: 12px; }
.sb-bumpy { width: 46px; height: 46px; flex: none; }
.sb-bumpy svg { width: 100%; height: 100%; display: block; overflow: visible; }
.sb-bumpy.cheer svg { animation: sb-hop .6s cubic-bezier(.3,1.6,.5,1); }
.sb-bumpy.ouch svg { animation: sb-wobble .5s; }
.sb-bumpy.ouch .eyes { transform: scaleY(.35); transform-origin: 32px 33px; transition: transform .1s; }
.sb-bumpy.listen svg { animation: sb-listen 1.6s ease-in-out infinite; }
@keyframes sb-hop { 40% { transform: translateY(-10px) scale(1.06, .94); } }
@keyframes sb-wobble { 25% { transform: rotate(-9deg); } 50% { transform: rotate(7deg); } 75% { transform: rotate(-4deg); } }
@keyframes sb-listen { 50% { transform: rotate(-5deg); } }
.sb-status-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sb-status-txt b { font-size: 16px; font-weight: 700; line-height: 1.2; }
.sb-status-txt span { font-size: 13px; color: var(--sb-dim); line-height: 1.3; }
.sb-score { flex: none; font: 600 13px var(--sb-mono); color: var(--sb-acc); padding: 5px 9px; border-radius: 9px; border: 1px solid var(--sb-line); white-space: nowrap; }

/* ---- buttons and fields ---- */
.sb-console .sb-btn, .sb-console .sb-leave, .sb-console .sb-seg button, .sb-console .sb-level { font-family: var(--sb-sans); }   /* over the kit's button font */
.sb-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px; padding: 10px 16px; border: 0; border-radius: 14px;
  background: var(--sb-acc); color: #03281b; font: 700 17px var(--sb-sans); letter-spacing: .02em; cursor: pointer; box-shadow: 0 0 22px rgba(92,242,176,.35); }
.sb-btn:active { transform: translateY(1px); }
.sb-btn:disabled { background: #1c2a3a; color: #6f8a80; box-shadow: none; cursor: default; }
.sb-btn.ghost { background: transparent; color: var(--sb-txt); border: 1px solid rgba(92,242,176,.35); box-shadow: none; }
.sb-btn.alt { background: #1d3550; color: #e6f3ff; box-shadow: none; border: 1px solid rgba(127,216,255,.35); }
.sb-btn.fire { background: var(--sb-hit); color: #fff; box-shadow: 0 0 24px rgba(255,77,77,.45); font-size: 19px; }
.sb-btn.fire:disabled { background: #2a1d24; color: #8a6a72; box-shadow: none; }
.sb-help { margin: 8px 2px 12px; font-size: 13px; line-height: 1.45; color: var(--sb-dim); }
.sb-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.sb-field span { font: 600 11px var(--sb-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sb-dim); }
.sb-field input, .sb-joinrow input { min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(92,242,176,.3); background: #06111c; color: var(--sb-txt); font: 600 17px var(--sb-sans); }
.sb-field input:focus, .sb-joinrow input:focus { outline: 2px solid var(--sb-acc); outline-offset: 1px; }
.sb-console :focus-visible { outline: 3px solid var(--sb-acc); outline-offset: 2px; }

/* ---- home ---- */
.sb-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.sb-seg button, .sb-level { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 56px; padding: 9px 12px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(92,242,176,.2); background: rgba(255,255,255,.03); color: var(--sb-txt); font-family: var(--sb-sans); }
.sb-seg button b, .sb-level b { font-size: 16px; font-weight: 700; }
.sb-seg button small, .sb-level small { font-size: 12.5px; color: var(--sb-dim); }
.sb-seg button[aria-checked="true"], .sb-level[aria-checked="true"] { border-color: var(--sb-acc); background: rgba(92,242,176,.12); box-shadow: inset 0 0 0 1px var(--sb-acc); }
.sb-joinrow { display: flex; gap: 8px; margin: 4px 0 6px; }
.sb-joinrow input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .2em; font-family: var(--sb-mono); }
.sb-joinrow .sb-btn { width: auto; flex: none; padding: 0 22px; }
.sb-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; font: 600 11px var(--sb-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sb-dim); }
.sb-or::before, .sb-or::after { content: ''; flex: 1; height: 1px; background: var(--sb-line); }
.sb-levels { display: grid; gap: 8px; margin-bottom: 12px; }
.sb-level { width: 100%; flex-direction: row; align-items: center; gap: 12px; }
.sb-level > span:not(.lv):not(.rec) { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sb-level .lv { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font: 700 15px var(--sb-mono); background: rgba(92,242,176,.12); color: var(--sb-acc); }
.sb-level .rec { margin-left: auto; font: 600 12px var(--sb-mono); color: var(--sb-dim); white-space: nowrap; }
.sb-mygames { margin-top: 18px; }
.sb-mygames h3 { margin: 0 0 8px; font: 600 11px var(--sb-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sb-dim); }
.sb-mygames ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sb-mygames a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--sb-line); color: var(--sb-txt); text-decoration: none; font-weight: 700; }
.sb-mygames a small { color: var(--sb-dim); font: 500 12px var(--sb-mono); }
.sb-invited { margin: 4px 0 14px; font-size: 20px; font-weight: 700; line-height: 1.3; }

/* ---- invite ---- */
.sb-invite { border: 1px dashed rgba(92,242,176,.45); border-radius: 14px; padding: 12px; margin-bottom: 12px; background: rgba(92,242,176,.05); }
.sb-invite p { margin: 0 0 10px; font-size: 13.5px; color: var(--sb-dim); line-height: 1.4; }
.sb-invite p b { display: block; color: var(--sb-txt); font-size: 16px; margin-bottom: 2px; }
.sb-code { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; font-family: var(--sb-mono); }
.sb-code span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sb-dim); }
.sb-code b { font-size: 26px; letter-spacing: .3em; color: var(--sb-acc); }

/* ---- the board ---- */
.sb-boardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 2px 6px; }
.sb-boardhead b { font-size: 15px; font-weight: 700; }
.sb-boardhead span { font: 500 12px var(--sb-mono); color: var(--sb-dim); text-align: right; }
.sb-board { --n: 10; position: relative; display: grid; grid-template-columns: 16px minmax(0, 1fr); grid-template-rows: 16px auto; gap: 3px; max-width: 520px; margin: 0 auto; }
.sb-cols { grid-column: 2; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); font: 500 10px var(--sb-mono); color: #6fa592; text-align: center; align-items: end; }
.sb-rows { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(var(--n), minmax(0, 1fr)); font: 500 10px var(--sb-mono); color: #6fa592; text-align: center; align-items: center; }
.sb-water { grid-column: 2; grid-row: 2; position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #04121a; box-shadow: 0 0 0 1px rgba(92,242,176,.3), 0 0 30px rgba(20,90,80,.25); touch-action: none; }
.sb-ocean { position: absolute; inset: 0; }
.sb-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); grid-template-rows: repeat(var(--n), minmax(0, 1fr)); }
.sb-cell { position: relative; border: 0; padding: 0; margin: 0; background: transparent; box-shadow: inset 0 0 0 .5px rgba(92,242,176,.16); cursor: default; font: inherit; color: inherit; }
.sb-board.aim .sb-cell.open { cursor: crosshair; }
.sb-board.aim .sb-cell.open:hover { background: rgba(92,242,176,.12); }
.sb-cell.miss::after { content: ''; position: absolute; inset: 34%; border-radius: 50%; border: 2px solid var(--sb-miss); box-shadow: 0 0 8px rgba(127,216,255,.7); }
.sb-cell.hit::before, .sb-cell.hit::after { content: ''; position: absolute; left: 22%; right: 22%; top: calc(50% - 2px); height: 4px; border-radius: 2px; background: #ffe1d6; box-shadow: 0 0 8px var(--sb-hit), 0 0 16px var(--sb-hit); }
.sb-cell.hit::before { transform: rotate(45deg); } .sb-cell.hit::after { transform: rotate(-45deg); }
.sb-cell.sunk::before, .sb-cell.sunk::after { background: #ff9b9b; box-shadow: 0 0 6px rgba(255,77,77,.6); opacity: .75; }
.sb-cell.target { box-shadow: inset 0 0 0 2px var(--sb-acc), 0 0 16px rgba(92,242,176,.75); z-index: 2; animation: sb-lock 1s ease-in-out infinite; }
@keyframes sb-lock { 50% { box-shadow: inset 0 0 0 2px var(--sb-acc), 0 0 6px rgba(92,242,176,.4); } }
.sb-cell.new::before, .sb-cell.new::after { animation: sb-pop .35s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes sb-pop { from { opacity: 0; scale: .2; } }

/* ships: placed (my fleet), sunk outlines and the reveal at the end */
.sb-ships { position: absolute; inset: 0; z-index: 3; pointer-events: none; }   /* above the grid, so ships can be dragged */
.sb-ship { position: absolute; pointer-events: auto; touch-action: none; }
.sb-ship i { position: absolute; inset: 4px; display: block; border-radius: 999px; background: linear-gradient(180deg, #6d7c92, #44526a); box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.4); }
.sb-ship.v i { background: linear-gradient(90deg, #6d7c92, #44526a); }
.sb-ship i::after { content: ''; position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; max-width: 16px; border-radius: 50%; transform: translate(-50%, -50%); background: #2b3447; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.sb-ship.mine { cursor: grab; }
.sb-ship.sel i { box-shadow: 0 0 0 3px var(--sb-acc), 0 0 18px rgba(92,242,176,.7); }
.sb-ship.drag { z-index: 5; cursor: grabbing; }
.sb-ship.bad i { box-shadow: 0 0 0 3px var(--sb-hit), 0 0 16px rgba(255,77,77,.6); }
.sb-ship.wreck { pointer-events: none; }
.sb-ship.wreck i { background: transparent; border: 2px dashed rgba(255,120,120,.65); box-shadow: none; }
.sb-ship.wreck i::after { display: none; }
.sb-ship.ghost { pointer-events: none; }
.sb-ship.ghost i { background: rgba(127,216,255,.18); border: 2px solid rgba(127,216,255,.6); box-shadow: none; }
.sb-ship.ghost i::after { display: none; }
.sb-shake { animation: sb-wobble .4s; }

/* the radar sweep while you wait */
.sb-sweep { position: absolute; left: 50%; top: 50%; width: 150%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .4s;
  background: conic-gradient(from 0deg, rgba(92,242,176,.26), rgba(92,242,176,.08) 30deg, rgba(92,242,176,0) 70deg, transparent 360deg); filter: blur(3px); }
.sb-board.sweeping .sb-sweep { opacity: 1; animation: sb-spin 3.2s linear infinite; }
@keyframes sb-spin { to { rotate: 360deg; } }

.sb-toast { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 6; pointer-events: none; padding: 10px 18px; border-radius: 12px; white-space: nowrap;
  font: 700 22px var(--sb-sans); letter-spacing: .04em; background: rgba(4,12,20,.82); border: 1px solid var(--sb-line); opacity: 0; scale: .8; transition: opacity .2s, scale .25s cubic-bezier(.2,1.6,.4,1); }
.sb-toast.on { opacity: 1; scale: 1; }
.sb-toast.hit { color: #ffd0c4; border-color: rgba(255,77,77,.6); text-shadow: 0 0 12px rgba(255,77,77,.8); }
.sb-toast.miss { color: #c9efff; }
.sb-toast.sunk { color: #fff; background: rgba(120,16,16,.85); border-color: #ff6b6b; }

/* ---- placing ---- */
.sb-placebar { margin-top: 10px; }
.sb-placebtns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }

/* ---- battle ---- */
.sb-battlebar { margin-top: 12px; }
.sb-panels { display: flex; gap: 10px; }
.sb-panel { padding: 10px; border: 1px solid var(--sb-line); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; width: 132px; flex: none; }
.sb-panel.grow { flex: 1; width: auto; min-width: 0; }
.sb-label { font: 600 10px var(--sb-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--sb-dim); }
.sb-mini { display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 1px; }
.sb-mini i { aspect-ratio: 1; background: rgba(92,242,176,.07); border-radius: 1px; }
.sb-mini i.ship { background: rgba(160,180,205,.55); }
.sb-mini i.hit { background: var(--sb-hit); box-shadow: 0 0 4px var(--sb-hit); }
.sb-mini i.miss { background: rgba(127,216,255,.35); }
.sb-mini i.new { animation: sb-flash .9s ease-out 2; }
@keyframes sb-flash { 50% { background: #fff; box-shadow: 0 0 10px #fff; } }
.sb-roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sb-roster li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.sb-roster li span { width: 76px; flex: none; color: #c6e9db; }
.sb-roster li i { display: flex; gap: 2px; flex: 1; }
.sb-roster li i u { flex: 1; max-width: 14px; height: 7px; border-radius: 2px; background: var(--sb-acc); box-shadow: 0 0 6px rgba(92,242,176,.5); }
.sb-roster li.down span { color: #8a7078; text-decoration: line-through; }
.sb-roster li.down i u { background: rgba(255,77,77,.55); box-shadow: none; }
.sb-firerow { display: flex; gap: 10px; margin-top: 12px; }
.sb-target { display: flex; flex-direction: column; justify-content: center; padding: 0 14px; border: 1px solid rgba(92,242,176,.3); border-radius: 12px; font-family: var(--sb-mono); min-width: 82px; }
.sb-target span { font-size: 10px; color: var(--sb-dim); letter-spacing: .12em; text-transform: uppercase; }
.sb-target b { font-size: 22px; font-weight: 600; color: var(--sb-acc); }
.sb-firerow .sb-btn { flex: 1; }

.sb-leave { display: block; margin: 14px auto 2px; min-height: 40px; padding: 0 14px; border: 0; background: none; color: var(--sb-dim); font: 600 13px var(--sb-sans); cursor: pointer; }
.sb-leave:hover { color: var(--sb-txt); }

/* ---- result ---- */
.sb-result { margin-top: 12px; text-align: center; padding: 14px 6px 4px; border-top: 1px solid var(--sb-line); }
.sb-res-big { margin: 0; font: 700 34px/1.1 var(--sb-sans); }
.sb-res-big.win { color: var(--sb-acc); text-shadow: 0 0 22px rgba(92,242,176,.55); }
.sb-res-sub { margin: 6px 0 14px; color: var(--sb-dim); font-size: 14.5px; line-height: 1.45; }
.sb-res-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sb-res-actions .sb-btn:first-child { grid-column: 1 / -1; }

@media (min-width: 640px) {
  .sb-console { padding: 18px; }
  .sb-panel { width: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-board.sweeping .sb-sweep, .sb-cell.target, .sb-bumpy svg, .sb-mini i.new { animation: none !important; }
}
