:root {
  color-scheme: dark;
  /* r4box: deep ink violet, with the curve's colours: teal (calm), gold (golden), hot (a peak), violet (the window) */
  --bg: #0B0918; --paper: #171331; --paper-2: #1F1A3F; --ink: #F3F1FF; --muted: #ACA5D6; --line: #2F2957;
  --water: #1A1640; --water-2: #262058; --ship: #8C9BB0;
  --hit: #FF5A4A; --hit-soft: #4A2230; --miss: #B8C8DA; --flag: #F5C542; --flag-ink: #2A2100;
  --accent: #3DD6C6; --accent-ink: #062A26; --teal: #3DD6C6; --gold: #F5C542; --hot: #FF5A4A; --violet: #B9A6FF; --mint: #C9FFF8;
  --display: "Unbounded", "Arial Black", Impact, sans-serif;
  --body: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { background: var(--bg); margin: 0; }
body { background: radial-gradient(900px 420px at 15% -10%, #2A1F5E55, transparent 60%), radial-gradient(700px 380px at 100% 0%, #0E4A4655, transparent 60%), var(--bg); background-attachment: fixed; }
body {
  color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5;
  padding: 0 16px; padding-block: calc(20px + env(safe-area-inset-top, 0px)) calc(96px + env(safe-area-inset-bottom, 0px));
}
[hidden] { display: none !important; }
.wrap { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.narrow { max-width: 560px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: -.01em; line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 7vw, 40px); }
h2 { font-size: 19px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: 14px; }
input[type=text], input[type=password] {
  font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%;
}
input:focus-visible, button:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label, .chip {
  display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; font-size: 14px; background: var(--paper); color: var(--ink); font-weight: 700;
}
.choice input { accent-color: var(--accent); }
.choice label:has(input:checked), .chip[aria-pressed=true] { border-color: var(--accent); background: var(--water); }
button { font: inherit; cursor: pointer; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); padding: 10px 16px; font-weight: 700; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.fire { background: var(--hit); border-color: var(--hit); color: #fff; font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: .04em; }
button.danger { color: var(--hit); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; }

.status { border-radius: 12px; padding: 12px 14px; background: var(--water); font-weight: 700; }
.status.bad { background: var(--hit-soft); }
.status.good { background: var(--flag); color: var(--flag-ink); }
.error { color: var(--hit); font-weight: 700; }

.players { display: flex; flex-wrap: wrap; gap: 8px; }
.player { display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 14px; }
.player.turn { border-color: var(--flag); background: var(--flag); color: var(--flag-ink); }
.player.out { text-decoration: line-through; color: var(--muted); }

.pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.pill.turn { background: var(--flag); color: var(--flag-ink); }
.pill.wait { background: var(--water); color: var(--ink); }
.pill.done { background: var(--line); color: var(--ink); }
.pill.out { background: var(--hit-soft); color: var(--ink); }

.games { display: flex; flex-direction: column; gap: 8px; list-style: none; margin: 0; padding: 0; }
.games button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; font-weight: 400; }

.boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.board { display: grid; gap: 2px; width: 100%; max-width: 440px; margin: 0 auto; font-variant-numeric: tabular-nums; }
.board .lbl { font-size: 11px; font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.cell { aspect-ratio: 1; border: 0; padding: 0; border-radius: 4px; background: var(--water); position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; }
button.cell { cursor: crosshair; }
button.cell:hover { background: var(--water-2); }
.cell.ship { background: var(--ship); }
.cell.miss::after { content: ""; width: 28%; height: 28%; border-radius: 50%; background: var(--miss); box-shadow: 0 0 0 1.5px var(--line); }
.cell.hit { background: var(--hit-soft); }
/* a shell of yours that has landed, while the server says what it hit */
.board .cell.landing { box-shadow: inset 0 0 0 3px #FFE08A !important; animation: landing .5s ease-in-out infinite alternate !important; }
@keyframes landing { from { background-color: #FFE08A22; } to { background-color: #FFE08A66; } }
.board .cell.fog { background: radial-gradient(circle at 50% 55%, #F4F7FAEE 35%, #DCE4EBAA 75%) !important; }
.cell.fog::after { content: "?"; font-weight: 800; font-size: 11px; color: #5A6B7B; }
.cell.ship.hit { background: var(--ship); }
.cell.hit::after { content: ""; width: 60%; height: 60%; border-radius: 50%; background: var(--hit); }
.cell.sunk { background: var(--hit) !important; }
.cell.sunk::after { content: "✕"; color: #fff; font-weight: 700; font-size: clamp(10px, 2.6vw, 16px); }
.cell.aim { background: var(--flag) !important; }
.cell.aim::after { content: ""; width: 40%; height: 40%; border: 2px solid var(--flag-ink); border-radius: 50%; }
.cell.new { box-shadow: 0 0 0 2px var(--flag); z-index: 1; animation: land .6s ease-out; }
@keyframes land { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .cell.new { animation: none; } }
.fleet-list { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.fleet-list span { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.fleet-list span.gone { text-decoration: line-through; color: var(--muted); }
/* Battleship: each player's colour (by seat) on their ships, hits and name */
.pdot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 1.5px #fff9; margin-right: 5px; vertical-align: middle; }
/* Each fleet told apart by a thick outline in its player's colour (no dot on the ship) */
.board.seaview .vessel.pc { position: relative; filter: drop-shadow(0 0 1.5px var(--pc)) drop-shadow(0 0 1.5px var(--pc)) drop-shadow(0 0 1.5px var(--pc)) drop-shadow(0 0 4px var(--pc)) drop-shadow(0 3px 3px #0006); }
.board.seaview .vessel.pc.wreck { filter: grayscale(.75) brightness(.6) drop-shadow(0 0 1px var(--pc)) drop-shadow(0 0 1.5px var(--pc)); }
.board .cell.owned { box-shadow: inset 0 0 0 2.5px var(--pc) !important; }
.boardtabs button[role=tab][style*="--pc"] { border-bottom: 3px solid var(--pc); }
/* Live Battleship: the burst's shots left (037) */
.ammo { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 4px; }
.ammo i { width: 9px; height: 16px; border-radius: 3px 3px 2px 2px; background: #ffffff33; }
.ammo i.on { background: linear-gradient(#FFD27A, #E0892E); box-shadow: 0 0 6px #FFB14E88; }
/* Battleship: the fleet theme picker on the placement screen */
.themepick { display: grid; gap: 8px; margin-top: 4px; }
.themepick .row { flex-wrap: wrap; gap: 4px 10px; }
/* Shared Ocean: who's still afloat, under the one big board */
.oceanroll { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.oceanroll li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.oceanroll li .fleet-list { flex-basis: 100%; }
.oceanroll li.out { opacity: .55; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.card.target-active { border-color: var(--flag); box-shadow: 0 0 0 2px var(--flag); }
.card.eliminated { opacity: .7; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.feed li { border-left: 3px solid var(--line); padding-left: 10px; }
.feed li.hit { border-color: var(--hit); }

.firebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #2FA36B; }
.live.off::before { background: var(--muted); }

/* ---------------------------------------------------------------- battle effects */
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 40; }
.board .cell:not(.ship):not(.hit):not(.sunk):not(.aim) {
  background: linear-gradient(115deg, var(--water) 0%, var(--water-2) 45%, var(--water) 55%, var(--water) 100%);
  background-size: 300% 100%; animation: shimmer 7s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
.cell.ship { background: linear-gradient(160deg, #7C8BA0, var(--ship) 55%, #3E4A5A); box-shadow: inset 0 1px 0 #ffffff33; }
.cell.hit::after { animation: burn .9s ease-in-out infinite alternate; box-shadow: 0 0 10px #FF7A30; }
@keyframes burn { from { transform: scale(.9); filter: brightness(1); } to { transform: scale(1.08); filter: brightness(1.35); } }
.cell.sunk { background: radial-gradient(circle at 50% 60%, #FF8A3D, var(--hit) 55%, #5A1410) !important; animation: embers 1.6s ease-in-out infinite alternate; }
@keyframes embers { from { filter: brightness(.9); } to { filter: brightness(1.25); } }
.cell.aim { animation: lockon .8s ease-in-out infinite alternate; }
@keyframes lockon { from { box-shadow: 0 0 0 0 var(--flag); } to { box-shadow: 0 0 0 4px #F2C23055; } }
.cell.land { animation: land .5s cubic-bezier(.2, 1.8, .4, 1); z-index: 2; }
.cell.pending::after { content: none !important; }
.cell.peek-ship { box-shadow: inset 0 0 0 2px #B37BFF, 0 0 10px #B37BFF; }
.cell.peek-ship::before { content: "👁"; font-size: clamp(9px, 2.2vw, 13px); position: absolute; }
.cell.peek-empty { box-shadow: inset 0 0 0 1.5px #B37BFF88; }
button.fire:not(:disabled) { animation: ready 1s ease-in-out infinite alternate; }
@keyframes ready { from { box-shadow: 0 0 0 0 #D8403A88; } to { box-shadow: 0 0 0 10px #D8403A00; transform: scale(1.04); } }
body.quake { animation: quake .45s linear 1; }
@keyframes quake { 0%,100% { transform: none; } 20% { transform: translate(-7px, 3px); } 40% { transform: translate(6px, -4px); } 60% { transform: translate(-5px, -2px); } 80% { transform: translate(4px, 3px); } }
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 39; box-shadow: inset 0 0 120px 40px #D8403Acc; animation: vig .7s ease-out forwards; }
@keyframes vig { from { opacity: 1; } to { opacity: 0; } }
.stamp { position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 16px; text-align: center; }
.stamp span {
  font-family: var(--display); font-size: clamp(38px, 11vw, 88px); line-height: .95; color: #FFE08A;
  -webkit-text-stroke: 3px #3A1D00; paint-order: stroke fill; text-shadow: 0 6px 0 #3A1D00, 0 0 40px #F2C230;
  animation: stampin 2.4s cubic-bezier(.2, 1.6, .4, 1) both;
}
.stamp.red span { color: #FF6B5E; -webkit-text-stroke-color: #2A0000; text-shadow: 0 6px 0 #2A0000, 0 0 40px #FF5A4E; }
.stamp.blue span { color: #BDE7FF; -webkit-text-stroke-color: #0A2238; text-shadow: 0 6px 0 #0A2238, 0 0 40px #5AB8FF; }
.stamp.purple span { color: #E3CCFF; -webkit-text-stroke-color: #22103A; text-shadow: 0 6px 0 #22103A, 0 0 40px #B37BFF; }
@keyframes stampin { 0% { transform: scale(2.4) rotate(-8deg); opacity: 0; } 14% { transform: scale(.92) rotate(2deg); opacity: 1; } 24% { transform: scale(1.04) rotate(-1deg); }
  34%, 78% { transform: scale(1) rotate(0); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
.banner { position: fixed; left: 0; right: 0; top: 30%; z-index: 44; pointer-events: none; display: flex; justify-content: center; }
.banner span { font-family: var(--display); font-size: clamp(30px, 9vw, 60px); color: #fff; background: linear-gradient(90deg, transparent, #1E5A96ee 18%, #1E5A96ee 82%, transparent);
  padding: 10px 18vw; letter-spacing: .06em; animation: sweep 1.9s cubic-bezier(.3, .8, .3, 1) both; text-shadow: 0 3px 0 #0A2238; }
@keyframes sweep { 0% { transform: translateX(-110%); } 22%, 72% { transform: translateX(0); } 100% { transform: translateX(110%); } }
@media (prefers-reduced-motion: reduce) {
  .board .cell, .cell.hit::after, .cell.sunk, .cell.aim, button.fire, body.quake, .cell.land { animation: none !important; }
  .stamp span, .banner span { animation: vig 2.4s linear both; }
}

/* ---------------------------------------------------------------- cheating */
.cheatbar { border: 1.5px dashed #D8403A99; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: color-mix(in srgb, var(--hit-soft) 45%, var(--paper)); }
.cheatbar h2 { color: var(--hit); }
.cheatbar .row button[aria-pressed=true] { border-color: #B37BFF; box-shadow: 0 0 0 2px #B37BFF55; }
.callout { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border-radius: 14px; padding: 12px 14px; background: #D8403A1f; border: 1.5px solid #D8403A66; }
.feed li.accuse { border-color: #B37BFF; }
.skipnote { font-size: 12px; }

/* game list rows are links now (they can open other pages) */
.games a.gamebtn { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 16px; background: var(--paper); }
.games a.gamebtn:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }

/* ---------------------------------------------------------------- lobby: game cards and chaos */
.lobby { max-width: 980px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 158px), 1fr)); gap: 12px; }
@media (max-width: 380px) { .cards { grid-template-columns: 1fr; } }
.gcard { display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--paper); border: 1.5px solid var(--line);
  color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.gcard:hover { transform: translateY(-3px); box-shadow: 0 10px 24px #0003; }
.gcard:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
.gcard.mine { border-color: var(--flag); box-shadow: 0 0 0 2px var(--flag); }
.gcard .preview { display: block; width: 100%; aspect-ratio: 16 / 10; height: auto; background: #0E0A24; }
.gcard .gbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.pill.gt { background: #FF8A3D; color: #2a1200; }
.lobby-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; align-items: start; }
.pack, .chaosfeed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pack li, .chaosfeed li { display: flex; gap: 10px; align-items: flex-start; }
.pack .big, .chaosfeed .big { font-size: 26px; line-height: 1; }
.chaosfeed li.new { font-weight: 700; }
.chaosfeed li.new .big { filter: drop-shadow(0 0 6px #F2C230); }
.backpack button { font-size: 14px; padding: 6px 12px; }

/* ---------------------------------------------------------------- lobby: games as a list, new games as preview cards */
.glist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.grow { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 12px 8px 8px;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; color: var(--ink); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.grow:hover { transform: translateX(3px); box-shadow: 0 6px 16px #0002; }
.grow:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
.grow.mine { border-color: var(--flag); box-shadow: inset 4px 0 0 var(--flag); }
.grow.over { opacity: .75; }
.grow .thumb { display: block; width: 80px; height: 50px; border-radius: 8px; background: #0E0A24; }
/* A finished Gauntlet: one row, its rounds folded inside. */
.gbundle > details > summary { list-style: none; cursor: pointer; }
.gbundle > details > summary::-webkit-details-marker { display: none; }
.grow .gthumb { display: grid; place-items: center; font-size: 26px; background: linear-gradient(160deg, #5A3718, #2A1808); }
.gbundle details[open] > summary .pill { background: var(--flag); color: var(--flag-ink); }
.gbrounds { margin: 8px 0 4px 18px; padding-left: 10px; border-left: 3px solid var(--flag); }
.grow .gmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.grow .gtitle, .grow .gmain > .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow .gstate { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.prog { display: block; height: 4px; border-radius: 99px; background: var(--water); overflow: hidden; max-width: 220px; margin-top: 2px; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
@media (max-width: 480px) {
  .grow { grid-template-columns: 56px minmax(0, 1fr); padding-right: 10px; }
  .grow .thumb { width: 56px; height: 35px; }
  .grow .gstate { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
}
.ncards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.ncard { display: flex; flex-direction: column; padding: 0; text-align: left; border-radius: 16px; overflow: hidden; background: var(--paper);
  border: 2px solid var(--line); color: var(--ink); font-weight: 400; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ncard:hover { transform: translateY(-3px); box-shadow: 0 10px 24px #0003; }
.ncard[aria-checked=true] { border-color: var(--flag); box-shadow: 0 0 0 3px var(--flag), 0 10px 24px #0003; }
.ncard .preview { display: block; width: 100%; aspect-ratio: 16 / 10; height: auto; background: #0E0A24; }
.ncard .nbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 440px) { .ncard .nbody .muted { display: none; } }
@media (prefers-reduced-motion: reduce) { .grow, .ncard { transition: none; } .grow:hover, .ncard:hover { transform: none; } }

/* ---------------------------------------------------------------- lobby: Your move strip, compact New game on phones */
.upcount { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; padding: 0 .4em; border-radius: 99px; background: var(--flag); color: var(--flag-ink); font: 700 .7em/1 var(--body); vertical-align: middle; }
.upnav { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 24px; line-height: 1; }
.upstrip { display: grid; grid-auto-flow: column; grid-auto-columns: min(78%, 280px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 2px;
  padding: 4px 2px 10px; overscroll-behavior-x: contain; scrollbar-width: thin; }
.upcard { scroll-snap-align: start; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--paper);
  border: 2px solid var(--flag); box-shadow: 0 0 0 2px var(--flag); color: var(--ink); text-decoration: none; }
.upcard:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.upcard .upbody > .uplive { align-self: flex-start; max-width: 100%; display: inline-flex; align-items: center; gap: 6px; margin: 1px 0 2px;
  padding: 3px 10px 3px 8px; border-radius: 99px; background: #3DDC8426; color: #157A45; font-size: 12px; font-weight: 800; }
.upcard .upbody > .uplive[hidden] { display: none; }
@media (prefers-color-scheme: dark) { .upcard .upbody > .uplive { color: #3DDC84; } }
.uplive i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #3DDC84; box-shadow: 0 0 0 3px #3DDC8433; }
@media (prefers-reduced-motion: no-preference) { .uplive i { animation: hnPulse 1.8s ease-in-out infinite; } }
.upcard.attable { box-shadow: 0 0 0 2.5px #3DDC84, 0 8px 22px #3DDC8433; }
.upcard.attable .upbody > .uplive { background: #1E9E5A; color: #fff; }
.upcard .preview { display: block; width: 100%; aspect-ratio: 16 / 10; height: auto; background: #0E0A24; }
.upcard .upbody { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.upcard .upbody > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chaosic { position: relative; margin-right: 6px; }
.chaosic .mini { position: absolute; right: -11px; bottom: -8px; width: 19px; height: 19px; font-size: 11px; vertical-align: 0; box-shadow: 0 0 0 2px var(--paper); }
.chaosic .mini.emo { font-size: 11px; }
.upcard .upvs .mini { width: 22px; height: 22px; margin-right: 5px; vertical-align: -6px; box-shadow: 0 0 0 1.5px var(--paper); }
.upcard .upvs .mini + .mini { margin-left: -11px; }
.upcard .upgo { margin-top: 6px; align-self: flex-start; background: var(--flag); color: var(--flag-ink); font-weight: 700; border-radius: 99px; padding: 4px 14px; }
.nshort { display: none; }
@media (max-width: 520px) {
  .ncards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .ncard { border-radius: 12px; }
  .ncard .preview { aspect-ratio: 1 / 1; }
  .ncard .nbody { padding: 6px 4px 8px; text-align: center; }
  .ncard .nbody .muted, .ncard .nbody .eyebrow { display: none; }
  .ncard .nbody strong { font-size: 12px; line-height: 1.2; }
  .nfull { display: none; } .nshort { display: inline; }
  #newgame.card { padding: 14px; }
}

/* ---------------------------------------------------------------- Battleship on phones */
.boardtabs { display: none; }
@media (max-width: 640px) {
  .boardtabs { display: flex; gap: 6px; overflow-x: auto; position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 6px 0; margin: -6px 0; }
  .boardtabs button { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 6px 8px; border-radius: 12px; font-weight: 700; font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .boardtabs button small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin: 0; }
  .boardtabs button[aria-selected=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .boardtabs button[aria-selected=true] small { color: inherit; opacity: .85; }
  /* 4+ boards (Battleship for up to 6, 034): each tab keeps a readable name and the row scrolls */
  .boardtabs.many { scrollbar-width: none; } .boardtabs.many::-webkit-scrollbar { display: none; }
  .boardtabs.many button { flex: 0 0 auto; min-width: 96px; max-width: 150px; }
  .boards .bsec:not(.tab-on) { display: none; }
  .boards .bsec { padding: 12px; }
  .boards .bsec h2 { font-size: 16px; }
}
.firebar { gap: 10px; flex-wrap: nowrap; justify-content: space-between; }
.firebar .aimwrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.firebar #aimtext { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.firebar #clearAim { flex: none; }
.firebar .error { position: absolute; left: 16px; right: 16px; bottom: 100%; background: var(--paper); padding: 6px 10px; }
.firebar .aimdots { display: flex; gap: 5px; }
.firebar .aimdots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--hit); }
.firebar .aimdots i.on { background: var(--hit); }
.firebar #aimtext { font-weight: 700; }
.firebar .fire { min-height: 52px; min-width: 110px; font-size: 18px; }
.firebar .fire.ready { animation: readyPulse 1.2s ease-in-out infinite; }
@keyframes readyPulse { 50% { transform: scale(1.06); box-shadow: 0 0 0 6px #D8403A33; } }
@media (prefers-reduced-motion: reduce) { .firebar .fire.ready { animation: none; } }
body.has-firebar #nextUp { bottom: calc(var(--fbh, 80px) + 10px) !important; }
body.has-firebar { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
/* Phones and tablets: the backpack as a row of icons along the top of the fire bar */
.firebar.withmini { flex-wrap: wrap; row-gap: 4px; padding-top: 4px; }
.firebar .fbmini { flex: 1 0 100%; min-width: 0; }
body.has-firebar.fb-mini { padding-bottom: calc(210px + env(safe-area-inset-bottom, 0px)); }
.botlive { display: flex; }
.botlive .chip[aria-pressed=true] { background: var(--hit); border-color: var(--hit); color: #fff; }
/* Desktop: the fire bar is a compact panel centered under the boards, and the boards grow with
   the window but always fit it top to bottom. */
@media (min-width: 1000px) and (min-height: 560px) {
  #app:not(.fs-on) .firebar { left: 50%; right: auto; transform: translateX(-50%); width: min(900px, calc(100vw - 48px)); bottom: 16px;
    border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 14px 34px #0003; padding: 12px 18px; }
  #app:not(.fs-on) .board { max-width: min(560px, max(320px, calc(100dvh - 480px))); }
  .firebar .fbpack { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
  .firebar .fbpack .backpack { border: 0 !important; padding: 0 !important; flex-wrap: nowrap !important; overflow-x: auto; }
  .firebar .fbpack .backpack > span:first-child { font-size: 0 !important; }
  .firebar .fbpack .backpack > span:first-child::before { content: '🎒'; font-size: 18px; }
  .firebar .fbpack .backpack button { flex: none; white-space: nowrap; font-size: 14px; padding: 6px 10px; }
  body.has-firebar { padding-bottom: 120px; }
}

/* ---------------------------------------------------------------- phones and full screen: the game first */
@media (max-width: 640px) {
  #app h1 { font-size: 24px; }
  #app header.stack { gap: 6px; }
  #app .gsub, #app .players, .boards ~ .legend, .legend, .bsec .fleet-list, .bsec > p.muted.small, #fireerr { display: none !important; }
  .cheatbar, #app .backpack { padding: 8px 10px !important; }
  .cheatbar h2 { font-size: 13px; }
  .cheatbar { gap: 6px !important; }
  .cheatbar > p, .cheatbar .muted { display: none; }
  .cheatbar > .row:not(.between), #app .backpack { flex-wrap: nowrap !important; overflow-x: auto; }
  .cheatbar button, #app .backpack button { flex: none; white-space: nowrap; padding: 6px 10px; font-size: 14px; }
  #app .backpack > span:first-child { font-size: 0 !important; } #app .backpack > span:first-child::before { content: '🎒'; font-size: 18px; }
}
#app.fs-on header .gtop, #app.fs-on header h1, #app.fs-on .gsub, #app.fs-on .players, #app.fs-on .legend, #app.fs-on #feedFold, #app.fs-on #del,
#app.fs-on .fleet-list, #app.fs-on .bsec > p.muted.small, #app.fs-on .cheatlog { display: none !important; }
/* Full screen puts ⚙️ Settings top-right: keep the header's Live dot and ✕ clear of it. */
#app.fs-on > header > .row:first-child { padding-right: 56px; }

/* ---------------------------------------------------------------- lobby on phones: compact */
.lobtoggles { display: none; }
@media (max-width: 640px) {
  .lobby { gap: 14px; }
  .lobby .lobhead { gap: 0; }
  .lobby .lobhead h1 { font-size: 22px; }
  .lobby h2 { font-size: 18px; }
  .lobby-cols { display: flex; flex-direction: column; gap: 10px; }
  .lobtoggles { display: flex; gap: 8px; overflow-x: auto; }
  .lobtoggles button { flex: none; min-height: 40px; padding: 6px 12px; border-radius: 99px; font-weight: 700; font-size: 14px; white-space: nowrap; }
  .lobtoggles button b { background: var(--flag); color: var(--flag-ink); border-radius: 99px; padding: 0 7px; font-size: 12px; }
  .lobtoggles button b:empty { display: none; }
  .lobtoggles button[aria-expanded=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  #packCard:not(.show), #chaosCard:not(.show) { display: none !important; }
  /* Your move: slim horizontal cards, picture on the left */
  .upstrip { grid-auto-columns: 86%; gap: 10px; padding-bottom: 6px; }
  .upcard { flex-direction: row; align-items: stretch; }
  .upcard .preview { width: 40%; aspect-ratio: 16 / 10; height: auto; flex: none; align-self: center; }
  .upcard .upbody { padding: 8px 10px; gap: 1px; font-size: 14px; }
  .upcard .upgo { margin-top: 4px; padding: 2px 12px; }
  .upnav { width: 34px; height: 34px; font-size: 20px; }
  .ncard .preview { aspect-ratio: 4 / 3; }
  .grow { padding: 6px 10px 6px 6px; gap: 10px; }
  .glist { gap: 6px; }
}

/* ---------------------------------------------------------------- lobby: the Gauntlet up front */
.gthero { border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 14px; color: #FFF3D6;
  background: radial-gradient(600px 220px at 85% -20%, #FFB44A55, transparent 70%), linear-gradient(160deg, #3A1D00, #5C2E00 55%, #2A1400); border: 2px solid #FFC85788; }
.gthead { display: flex; gap: 12px; align-items: center; }
.gthead h2 { color: #FFD77A; font-size: 24px; }
.gthead p { color: #F3D9A6; margin: 2px 0 0; }
.gtcup { font-size: 44px; line-height: 1; filter: drop-shadow(0 4px 10px #FFB44A88); }
.gtfold { border-radius: 14px; background: #0000002e; }
.gtfold > summary { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
.gtfold > summary::-webkit-details-marker { display: none; }
.gtfold > summary::after { content: '›'; font-size: 20px; line-height: 1; transition: transform .2s; }
.gtfold[open] > summary::after { transform: rotate(90deg); }
.gtstart { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.gtlabel { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; color: #FFD77A; }
.gtstart .chip { background: #ffffff14; color: #FFF3D6; border-color: #FFC85766; }
.gtstart .chip[aria-pressed=true] { background: #FFC857; color: #2A1600; border-color: #FFC857; }
.gtrow { gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border-radius: 99px; overflow: hidden; border: 1.5px solid #FFC85766; }
.seg label { padding: 8px 12px; cursor: pointer; font-weight: 700; font-size: 14px; color: #FFF3D6; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: #FFC857; color: #2A1600; }
.seg label:has(input:focus-visible) { outline: 3px solid #fff; outline-offset: -3px; }
.gtbtn { margin-left: auto; min-height: 46px; padding: 0 22px; border-radius: 99px; border: 0; background: linear-gradient(180deg, #FFD77A, #FFB12E); color: #2A1600; font-family: var(--display); font-size: 16px; box-shadow: 0 6px 16px #0006; }
.gtbtn:disabled { opacity: .5; }
.gthero .error { color: #FFB3A8; }
@media (max-width: 640px) {
  .gthero { padding: 12px; gap: 10px; border-radius: 16px; }
  .gthead h2 { font-size: 20px; }
  .gtcup { font-size: 34px; }
  .gthead p { font-size: 13px; }
  .ncards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gtbtn { flex: 1 1 100%; margin-left: 0; }
}


.fin { display: flex; align-items: center; gap: 6px; transition: opacity .25s, transform .25s; }
.fin > a, .fin > details { flex: 1; min-width: 0; }
.fin[hidden] { display: none; }
.gbundle.fin { align-items: flex-start; }
.gbundle.fin > .gdel { margin-top: 13px; }
.gdel { position: relative; flex: none; width: 40px; height: 40px; padding: 0; border-radius: 12px; border: 1px solid var(--line); background: transparent;
  color: inherit; font-size: 17px; line-height: 1; cursor: pointer; opacity: .55; transition: opacity .15s, background .15s; }
.gdel:hover, .gdel:focus-visible { opacity: 1; }
.gdel.armed { opacity: 1; background: #C0392B; border-color: #C0392B; }
/* "Delete?" pops out beside the button, so nothing in the row moves */
.gdel.armed::before { content: 'Delete?'; position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%); z-index: 3;
  padding: 7px 11px; border-radius: 10px; background: #C0392B; color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 4px 14px #0004; pointer-events: none; }
/* With a mouse: a small corner badge that shows on hover, so rows keep their full width */
@media (hover: hover) and (pointer: fine) {
  .fin { position: relative; display: block; }
  .fin > .gdel { position: absolute; top: 5px; right: 5px; width: 30px; height: 30px; margin: 0 !important; border-radius: 50%; font-size: 14px;
    background: var(--paper); opacity: 0; z-index: 2; box-shadow: 0 2px 8px #0003; }
  .fin:hover > .gdel, .fin > .gdel:focus-visible, .fin > .gdel.armed { opacity: 1; }
  .fin > .gdel.armed { background: #C0392B; }
  .gbundle.fin > .gdel { top: 5px; }
}
.gclear.armed { color: #FF6B5B; font-weight: 800; }
.fin.gone { opacity: 0; transform: translateX(24px); }
@media (prefers-reduced-motion: reduce) { .fin { transition: none; } }

/* ---------------------------------------------------------------- Quick play: one layer down (#quick) */
.lobby:not(.quickmode) #newSec, .lobby:not(.quickmode) .quickhead { display: none; }
.lobby.quickmode > :not(.quickhead):not(.lobmain), .lobby.quickmode .lobmain > :not(#newSec) { display: none !important; }
/* The lobby's two groups only matter on desktop; elsewhere they vanish and the sections stack. */
.lobmain, .lobside { display: contents; }
/* The scoreboard's too; on phones "Every stat" stays last, as before. */
#statsBody .smain, #statsBody .sside { display: contents; }
#statsBody .sall { order: 5; }
@media (min-width: 1000px) and (min-height: 560px) {
  .lobby.lobhome { max-width: 1320px; display: grid; grid-template-columns: minmax(0, 1fr) 380px; column-gap: 28px; row-gap: 20px; align-items: start; }
  .lobby.lobhome > header { grid-column: 1 / -1; }
  .lobby.lobhome .lobmain, .lobby.lobhome .lobside { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
  .lobby.lobhome .lobside .lobby-cols { display: flex; flex-direction: column; gap: 12px; }
  .lobby.lobhome .upstrip { grid-auto-columns: min(46%, 300px); }
  .lobby.statsview { max-width: 1320px; }
  #statsBody { display: grid !important; grid-template-columns: minmax(0, 1fr) 400px; column-gap: 24px; align-items: start; }
  #statsBody .smain, #statsBody .sside { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
  #statsBody .sall { order: 0; }
}
.quickhead { display: flex; flex-direction: column; gap: 4px; }
.quickhead a { font-weight: 700; align-self: flex-start; }
.quickentry { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; }
.quickentry:hover { border-color: var(--accent); }
.quickentry:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
.quickentry > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.quickentry .qicons { font-size: 20px; letter-spacing: 2px; }
.quickentry .qgo { font-size: 26px; color: var(--muted); }
.lobby.quickmode .ncards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
@media (max-width: 640px) { .lobby.quickmode .ncards { grid-template-columns: 1fr; } .lobby.quickmode .ncard { flex-direction: row; } .lobby.quickmode .ncard .preview { width: 42%; aspect-ratio: 16 / 10; flex: none; } .lobby.quickmode .ncard .nbody { text-align: left; padding: 10px 12px; } .lobby.quickmode .ncard .nbody .muted, .lobby.quickmode .ncard .nbody .eyebrow { display: block; } .lobby.quickmode .ncard .nfull { display: inline; } .lobby.quickmode .ncard .nshort { display: none; } .lobby.quickmode .ncard .nbody strong { font-size: 16px; } }

/* Hidden cheats use press-and-hold: no callout menus or text selection on those spots */
.cell, #app > header h1 { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

.clk { color: #C0392B; font-weight: 700; }
@media (prefers-color-scheme: dark) { .clk { color: #FF8A7A; } }
.gtclk { color: #FFB3A8; font-weight: 700; }

/* ---------------------------------------------------------------- family scoreboard (#stats) */
.statshead { display: flex; flex-direction: column; gap: 4px; }
.statshead a { font-weight: 700; align-self: flex-start; }
.scards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.scard { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.scard.me { border-color: var(--flag); box-shadow: 0 0 0 2px var(--flag); }
.scard .sname { font-size: 18px; }
.scard .sbig { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; }
.scard .sbig b { font-family: var(--display); font-weight: 400; font-size: 30px; }
.scard .sbig small { color: var(--muted); font-weight: 700; }
.scard .skinds { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted); font-weight: 700; }
.streak { background: #FF8A3D; color: #2a1200; font-weight: 800; font-size: 12px; border-radius: 99px; padding: 2px 10px; }
.h2h { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.h2h li { display: grid; grid-template-columns: 1fr auto auto auto 1fr; gap: 8px; align-items: center; }
.h2h li > span:first-child { text-align: right; }
.h2h b { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--muted); min-width: 1.2em; text-align: center; }
.h2h b.lead { color: var(--ink); }
.h2h .dash { color: var(--muted); }
.stable-wrap { overflow-x: auto; margin: 0 -4px; }
.stable { border-collapse: collapse; width: 100%; font-size: 14px; white-space: nowrap; }
.stable th, .stable td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.stable thead th { font-size: 13px; }
.stable tbody th { text-align: left; font-weight: 600; color: var(--muted); position: sticky; left: 0; background: var(--paper); }
.stable td { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------------------------------------------------------------- trophy case (#player=<id>) */
.scard { color: var(--ink); text-decoration: none; }
.scard:hover { border-color: var(--accent); }
.scard .sgo { margin-left: auto; color: var(--accent); }
.phead { display: flex; gap: 14px; align-items: center; }
.phead h1 { font-size: 26px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 30px; flex: none;
  background: linear-gradient(160deg, var(--flag), #E0892F); color: var(--flag-ink); box-shadow: 0 6px 16px #0003; }
.avatar.pic, .mini.pic { object-fit: cover; background: #000; padding: 0; }
.avatar.emo { font-family: inherit; font-size: 40px; }
.mini.emo { font-size: 16px; }
.avatar.pic { box-shadow: 0 0 0 2px #E8B84A, 0 6px 16px #0003; }
.mini { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; vertical-align: -6px; font-size: 13px;
  background: linear-gradient(160deg, var(--flag), #E0892F); color: var(--flag-ink); }
.shelf { display: flex; gap: 12px; overflow-x: auto; padding: 14px 12px 20px; border-radius: 14px;
  background: linear-gradient(180deg, #3A2410, #5A3718 70%); box-shadow: inset 0 -12px 0 #2A1808, inset 0 2px 8px #0006; scroll-snap-type: x proximity; }
.trophy { flex: none; width: 118px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border: 0; border-radius: 12px;
  background: #ffffff10; color: #FFE7B0; font: inherit; cursor: pointer; text-align: center; }
.trophy .cup { font-size: 48px; line-height: 1.1; filter: drop-shadow(0 4px 8px #FFC85788); }
.trophy.perfect .cup { filter: drop-shadow(0 0 10px #9BE7FF) drop-shadow(0 4px 8px #FFC85788); }
.trophy .tvs { font-weight: 700; font-size: 13px; }
.trophy .tscore { font-family: var(--display); font-size: 16px; color: #FFC857; }
.trophy .tdate { font-size: 12px; color: #D9B97F; }
.trophy.empty { width: 100%; cursor: default; background: none; }
.trophy.empty .cup { opacity: .25; filter: grayscale(1); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 12px 8px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line); }
.badge .bicon { font-size: 34px; line-height: 1.1; }
.badge strong { font-size: 14px; }
.badge .bhow { font-size: 12px; color: var(--muted); }
.badge:not(.got) .bicon { filter: grayscale(1); opacity: .35; }
.badge:not(.got) strong { color: var(--muted); }
.badge.got { border-color: var(--flag); background: linear-gradient(180deg, #FFF6D6, var(--paper) 70%); }
.badge .bprog { width: 80%; height: 6px; border-radius: 99px; background: var(--water); overflow: hidden; margin-top: 4px; }
.badge .bprog i { display: block; height: 100%; background: var(--accent); }
.badge .bnum { font-size: 11px; color: var(--muted); font-weight: 700; }
@media (prefers-color-scheme: dark) { .badge.got { background: linear-gradient(180deg, #3A2E10, var(--paper) 70%); } }
@media (max-width: 440px) { .badges { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#profBody { display: flex; flex-direction: column; gap: 20px; }

/* Who's here (lobby header): the family's avatars, live ones first, with a green ring (common.js paints it) */
.lobby > header { flex-wrap: wrap; gap: 10px; }
.herenow { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.hnlabel { align-self: center; font-size: 12px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.hndot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3DDC84; margin-right: 6px; box-shadow: 0 0 0 3px #3DDC8433; vertical-align: 1px; }
@media (prefers-reduced-motion: no-preference) { .hndot { animation: hnPulse 1.8s ease-in-out infinite; } }
@keyframes hnPulse { 50% { box-shadow: 0 0 0 6px #3DDC8400; } }
.hn { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 46px; }
.hn small { font-size: 11px; line-height: 1.1; color: var(--muted); white-space: nowrap; }
.hn.on small { color: #1E9E5A; font-weight: 800; }
@media (prefers-color-scheme: dark) { .hn.on small { color: #3DDC84; } }
.hnav { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; font-family: var(--display); font-size: 16px;
  background: linear-gradient(160deg, #F2C230, #E0892F); color: #2A2100; transition: filter .3s, opacity .3s; }
.hnav.emo { font-family: inherit; font-size: 20px; background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
img.hnav { object-fit: cover; background: #000; }
.hn:not(.on) .hnav { filter: grayscale(.8); opacity: .55; }
@media (max-width: 560px) { .herenow { width: 100%; justify-content: flex-start; } .hnav { width: 30px; height: 30px; } }

/* Battleship ready check: who has placed their fleet */
.readyroll .rlist { list-style: none; margin: 10px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.readyroll .rlist li { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 12px; border: 1px solid var(--line); }
.readyroll .rlist li.ok { border-color: #3DDC8499; background: #3DDC8414; }
.readyroll .rav { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; font-family: var(--display); font-size: 17px;
  background: linear-gradient(160deg, #F2C230, #E0892F); color: #2A2100; }
.readyroll .rav.emo { font-family: inherit; font-size: 21px; background: var(--paper); box-shadow: 0 0 0 1px var(--line); }
.readyroll img.rav { object-fit: cover; background: #000; }
.readyroll .rname { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readyroll .rstate { font-size: 13px; font-weight: 800; white-space: nowrap; }
.readyroll li:not(.ok) .rstate { color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .readyroll .rdots { animation: rBlink 1.6s ease-in-out infinite; } }
@keyframes rBlink { 50% { opacity: .45; } }

/* Full screen on a landscape phone (047): no page header, every board as tall as the screen in a
   row (sideways scroll with several rivals), and the fire bar a column down the right, under the
   toolbar. */
@media (orientation: landscape) and (max-height: 520px) {
  body.fs-lock #app.fs-on { padding: 6px 216px 6px calc(8px + env(safe-area-inset-left, 0px)) !important; }
  #app.fs-on > header, #app.fs-on .tabs, #app.fs-on .bstabs { display: none !important; }
  #app.fs-on .boards { display: grid; grid-auto-flow: column; grid-auto-columns: calc(100dvh - 44px); grid-template-columns: none; gap: 10px;
    overflow-x: auto; scroll-snap-type: x mandatory; align-items: start; }
  #app.fs-on .boards .bsec { display: block !important; padding: 0; scroll-snap-align: start; border: 0; background: none; box-shadow: none; }
  #app.fs-on .bsec h2 { font-size: 13px; margin: 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #app.fs-on .board { max-width: none; width: 100%; }
  #app.fs-on .firebar { left: auto; right: 6px; top: calc(54px + env(safe-area-inset-top, 0px)); bottom: 6px; width: 204px; transform: none;
    flex-direction: column; flex-wrap: nowrap; justify-content: flex-end; align-items: stretch; border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
  #app.fs-on .firebar .aimwrap { flex: 1; justify-content: flex-end; }
  #app.fs-on .firebar #aimtext { white-space: normal; }
  #app.fs-on .firebar .fire { width: 100%; }
  #app.fs-on .firebar .backpack { overflow-x: auto; }
  #app.fs-on .firebar .fbmini { flex: 0 0 auto; overflow-x: auto; }
}

/* 🐙🌪️ the kraken rising / the tornado spinning over a square it hits (053) */
.seabeast { position: fixed; z-index: 45; pointer-events: none; font-size: 40px; line-height: 1; transform: translate(-50%, -50%); filter: drop-shadow(0 4px 8px #0008); }
.seabeast.kraken { animation: krakenRise 1.3s ease-out forwards; }
.seabeast.tornado { animation: tornadoSpin 1.3s ease-in-out forwards; }
@keyframes krakenRise { 0% { transform: translate(-50%, 10%) scale(.4); opacity: 0; } 30% { transform: translate(-50%, -60%) scale(1.25); opacity: 1; } 70% { transform: translate(-50%, -50%) scale(1.1) rotate(-8deg); opacity: 1; } 100% { transform: translate(-50%, 20%) scale(.5); opacity: 0; } }
@keyframes tornadoSpin { 0% { transform: translate(-150%, -50%) scale(.6); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(60%, -50%) scale(1.2) rotate(40deg); opacity: 0; } }

/* 🔍 board zoom (053): the board grows inside a box that scrolls sideways */
.bzoom { max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; touch-action: pan-x pan-y; }   /* two fingers: our pinch (app.js), not the page's */
.bz-on .bzoom > .board { width: calc(100% * var(--bz, 1)) !important; max-width: none !important; }   /* zoomed: past every layout's usual cap */
.bzbar { display: inline-flex; align-items: center; gap: 4px; margin: 0 0 6px auto; padding: 3px 6px; border-radius: 99px; background: var(--card, #ffffff10); border: 1px solid var(--line); font-size: 14px; }
.bzbar button { width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 50%; font-size: 17px; line-height: 1; }
.bzbar button:disabled { opacity: .35; }
.bzbar b { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }

/* Full screen, upright: the board tabs sit up top beside the toolbar */
/* ...the tabs keep their width: the 🔍 zoom moves up into the strip left of the toolbar, and on the shared
   ocean the board's heading row leaves room for the toolbar. */
@media (orientation: portrait) {
  body.fs-lock #app.fs-on > .bzbar, body.fs-lock #app.fs-on .boards ~ .bzbar, body.fs-lock #app.fs-on .bzbar:not(.bsec .bzbar) { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; margin: 0; z-index: 5; }
  body.fs-lock #app.fs-on .boardtabs { margin-top: 26px; }
  body.fs-lock #app.fs-on .bsec[data-owner="ocean"] > .row.between:first-child { padding-right: var(--gtw, 56px); }
}
/* 🏝️ Islands on the shared ocean (060): the fractal shore under the squares; their squares can't be aimed at */
.board .isles { position: relative; z-index: 1; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 2px 3px #0006); }
.board .cell.isle { background: transparent !important; box-shadow: none !important; cursor: default; }
/* 🐙 the kraken's fractal arms (060): each branch draws itself out, then the tangle sinks away */
.krakenarms { position: fixed; z-index: 44; pointer-events: none; transform: translate(-50%, -50%); animation: armsSink 1.5s ease-in forwards; filter: drop-shadow(0 2px 4px #0008); }
.krakenarms path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: armGrow .45s ease-out forwards; }
@keyframes armGrow { to { stroke-dashoffset: 0; } }
@keyframes armsSink { 0%, 70% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }
/* 🤖 how many robots (new game, Route to Chaos): one counter instead of a chip each */
.botstep { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 12px; border-radius: 999px; border: 1.5px dashed #ffffff44; font-weight: 800; }
.botstep.on { border-style: solid; border-color: var(--gold, #F2C14E); background: #F2C14E22; }
.botstep button { width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; font: 800 18px/1 system-ui, sans-serif; }
.botstep b { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.botstep[hidden] { display: none; }


/* 🌀 The Box on the wall: the lobby's hero (boxHero in app.js) and the Practice fold. */
.boxhero { display: flex; flex-direction: column; gap: 10px; }
.boxhero canvas { width: 100%; height: auto; aspect-ratio: 12 / 5; border-radius: 14px; background: #0B0918; display: block; box-shadow: inset 0 0 0 1px #ffffff14; }
.boxwords h2 { color: #FFD77A; font-size: 26px; margin: 4px 0 0; }
.boxwords p { color: #F3D9A6; margin: 4px 0 10px; }
.enter { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 14px; background: #FFC857; color: #2A1600; font-weight: 900; font-size: 18px; text-decoration: none; box-shadow: 0 6px 18px #0006; }
.enter.alt { background: #0000004d; color: #FFE7B0; border: 1.5px solid #FFC85799; font-size: 16px; }
.enter:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.practice > summary { list-style: none; cursor: pointer; }
.practice > summary::-webkit-details-marker { display: none; }
.practice[open] > summary .qgo { transform: rotate(90deg); }
.practice .quickentry + .quickentry, .practice > summary + .quickentry { margin-top: 8px; }
.practice[open] > .quickentry { margin-left: 14px; }
@media (min-width: 1000px) { .lobby.lobhome .boxhero canvas { max-height: 320px; } }


/* ================================================================ r4box: the redesign (2026-09-30)
   Dark only, one deep ink-violet, the curve's four colours for meaning: teal calm, gold golden,
   hot a peak, violet the window. Unbounded for display, Sora for reading. These override the older
   lobby rules above; the games' boards keep their rules. */
.lobby > header.gtop { align-items: flex-start; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.lobhead h1 { font-size: clamp(22px, 5.5vw, 34px); }
.r4mark { font-size: 22px; }
.eyebrow { color: var(--violet); letter-spacing: .14em; }
/* the box on the wall */
.gthero { background: linear-gradient(160deg, #15102F, #0B0918 70%); border: 1px solid var(--line); border-radius: 24px; color: var(--ink); position: relative; overflow: hidden;
  box-shadow: 0 0 0 1px #3DD6C61a inset, 0 30px 60px #00000080; }
.gthero::before { content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: linear-gradient(120deg, #3DD6C6aa, #B9A6FF66 40%, #F5C54288 70%, #FF5A4A66); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.boxhero canvas { border-radius: 16px; box-shadow: 0 0 0 1px #ffffff12, 0 10px 30px #0008; }
.boxwords h2 { color: var(--ink); font-size: clamp(22px, 5vw, 30px); }
.boxwords p { color: var(--muted); }
.enter { background: var(--teal); color: #062A26; font-family: var(--display); font-weight: 700; font-size: 17px; border-radius: 14px; box-shadow: 0 8px 24px #3DD6C633; }
.enter.alt { background: #ffffff0e; color: var(--ink); border: 1px solid #ffffff22; box-shadow: none; }
.enter:hover { filter: brightness(1.08); }
.meet { display: inline-flex; align-items: center; gap: 10px; margin-top: 12px; padding: 6px 14px 6px 6px; border-radius: 99px; background: #ffffff0a; border: 1px solid #ffffff18; color: var(--ink); text-decoration: none; max-width: 100%; }
.meet:hover { background: #ffffff14; }
.meet canvas { width: 44px; height: 44px; flex: none; }
.meet span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.meet b { font-family: var(--display); font-size: 14px; }
.meet small { font-size: 12px; color: var(--muted); }
.gtfold { background: #ffffff08; border: 1px solid #ffffff10; }
.gtlabel { color: var(--violet); }
.gtstart .chip { background: #ffffff0c; color: var(--ink); border-color: #ffffff22; }
.gtstart .chip[aria-pressed=true] { background: var(--gold); color: var(--flag-ink); border-color: var(--gold); }
.seg { border-color: #ffffff22; }
.seg label { color: var(--ink); }
.seg label:has(input:checked) { background: var(--gold); color: var(--flag-ink); }
.gtbtn { background: linear-gradient(180deg, #FFD77A, #F5C542); color: var(--flag-ink); box-shadow: 0 8px 22px #F5C54233; }
.gthero .error { color: #FFB3A8; }
.gtclk { color: #FFB3A8; }
.botstep { border-color: #ffffff33; }
/* rows, cards, entries */
.quickentry { border-radius: 16px; gap: 14px; }
.quickentry .qicons { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #ffffff0c; font-size: 20px; letter-spacing: 0; }
.quickentry:hover { border-color: var(--teal); }
.grow { border-radius: 16px; }
.grow.mine { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold); }
.ncard { border-radius: 18px; }
.ncard[aria-checked=true] { border-color: var(--teal); box-shadow: 0 0 0 3px #3DD6C655, 0 10px 24px #0006; }
.upcard { border-color: var(--gold); }
.status { background: var(--paper-2); }
.status.good { background: var(--gold); }
.pill.wait { background: var(--paper-2); }
.pill.gt { background: var(--violet); color: #150F33; }
.streak { background: var(--hot); color: #fff; }
.hnav, .mini, .avatar, .readyroll .rav { background: linear-gradient(160deg, #3DD6C6, #B9A6FF); color: #0B0918; }
.hn.on .hnav { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #3DDC84; }
.scard.me { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.badge.got { border-color: var(--gold); background: linear-gradient(180deg, #3A2E10, var(--paper) 70%); }
.shelf { background: linear-gradient(180deg, #1B1538, #12102A 70%); box-shadow: inset 0 -12px 0 #0B0918, inset 0 2px 8px #0006; }
.trophy { color: var(--ink); } .trophy .tscore { color: var(--gold); } .trophy .tdate { color: var(--muted); }
.gbundle > details > summary .gthumb, .grow .gthumb { background: linear-gradient(160deg, #2A1F5E, #15102F); }
.prog { background: var(--paper-2); } .prog i { background: var(--teal); }
.lobtoggles button[aria-expanded=true] { background: var(--teal); color: var(--accent-ink); border-color: var(--teal); }
.banner span { background: linear-gradient(90deg, transparent, #2A1F5Eee 18%, #2A1F5Eee 82%, transparent); text-shadow: 0 3px 0 #0B0918; }
/* sign in */
.login header { align-items: flex-start; }
.login .hello { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: center; }
.login .hello canvas { width: 120px; height: 120px; }
.login .bubble { position: relative; padding: 12px 16px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); font-weight: 600; }
.login .bubble::before { content: ''; position: absolute; left: -8px; top: 50%; width: 14px; height: 14px; background: var(--paper); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.login form .primary { background: var(--teal); border-color: var(--teal); color: var(--accent-ink); font-family: var(--display); min-height: 46px; padding: 0 22px; }
