/* Sink Your Anemone styles: the original Fleet Four stylesheet, scoped under .ff so it cannot affect the hub or other games. */
.ff {
  --bg: #07111f;
  --bg2: #0b1a2e;
  --card: rgba(16, 33, 56, 0.82);
  --line: rgba(148, 197, 255, 0.14);
  --text: #e6eef8;
  --muted: #8ea3bd;
  --accent: #38bdf8;
  --accent2: #0ea5e9;
  --water: #0d2c4c;
  --water2: #10365c;
  --hit: #ff5a36;
  --miss: #bcd3ea;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ff, .ff * { box-sizing: border-box; }
.ff,.ff { margin: 0; }
.ff {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(59, 130, 246, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.ff button { font: inherit; color: inherit; }
.ff input {
  font: inherit; color: var(--text); background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; width: 100%;
}
.ff input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2); }
.ff h1,.ff h2,.ff h3 { margin: 0 0 10px; }
.ff h2 { font-size: 1.15rem; }
.ff h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.ff kbd { font-family: var(--mono); background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.ff .muted { color: var(--muted); }
.ff .small { font-size: 0.85rem; }
.ff .hidden { display: none !important; }
.ff .center { text-align: center; }
.ff .topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 31, 0.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.ff .logo { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-size: 1.2rem; letter-spacing: 0.02em; }
.ff .logo svg { width: 28px; height: 28px; }
.ff .logo b { color: var(--accent); }
.ff .topbar-right { display: flex; align-items: center; gap: 10px; }
.ff .chip { font-family: var(--mono); font-size: 0.85rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.04); }
.ff .conn { width: 10px; height: 10px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.ff .conn.ok { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.ff .icon-btn { background: none; border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; cursor: pointer; font-size: 1rem; }
.ff main { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 18px; }
.ff .foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 14px; }
.ff .card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.ff .card.narrow { max-width: 440px; margin: 0 auto; }
.ff .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 14px; cursor: pointer; transition: transform 0.08s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ff .btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); border-color: rgba(148, 197, 255, 0.35); }
.ff .btn:active:not(:disabled) { transform: translateY(1px); }
.ff .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ff .btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); border-color: transparent; color: #04223a; font-weight: 700; }
.ff .btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #5cc8fa, var(--accent)); }
.ff .btn.ghost { background: transparent; }
.ff .btn.big { padding: 12px 18px; font-size: 1.05rem; width: 100%; }
.ff .btn.tiny { padding: 4px 9px; font-size: 0.8rem; border-radius: 8px; }
.ff .btn.small { font-size: 0.85rem; }
.ff .badge { font-size: 0.7rem; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid var(--line); white-space: nowrap; }
.ff .badge.you { background: rgba(56, 189, 248, 0.18); border-color: rgba(56, 189, 248, 0.5); }
.ff .badge.bot { background: rgba(167, 139, 250, 0.16); border-color: rgba(167, 139, 250, 0.45); }
.ff .badge.off { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.45); }
.ff .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.ff .team-tag { font-size: 0.7rem; padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.ff .team-tag.t0 { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.ff .team-tag.t1 { background: rgba(59, 130, 246, 0.15); color: #93c5fd; }
.ff .hero { text-align: center; margin: 24px 0 22px; }
.ff .hero h1 { font-size: clamp(2.4rem, 7vw, 4rem); letter-spacing: -0.02em; margin: 0; }
.ff .hero h1 span { background: linear-gradient(90deg, #ef4444, #3b82f6, #22c55e, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ff .tagline { color: var(--muted); max-width: 520px; margin: 8px auto 0; }
.ff .home-card { display: flex; flex-direction: column; gap: 14px; }
.ff .field span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.ff .divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; }
.ff .divider::before,.ff .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ff .join-row { display: flex; gap: 8px; }
.ff .code-input { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-size: 1.2rem; }
.ff .mode-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; max-width: 980px; margin: 22px auto 0; }
.ff .mode-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.ff .mode-card span { color: var(--muted); font-size: 0.85rem; line-height: 1.35; }
.ff button.mode-card { cursor: pointer; }
.ff button.mode-card:disabled { cursor: default; }
.ff button.mode-card:hover:not(:disabled) { border-color: rgba(56, 189, 248, 0.5); }
.ff .mode-card.selected { border-color: var(--accent); background: rgba(56, 189, 248, 0.1); box-shadow: inset 0 0 0 1px var(--accent); }
.ff .lobby { display: grid; gap: 16px; grid-template-columns: 300px 1fr; max-width: 1150px; margin: 0 auto; align-items: start; }
.ff .lobby-left,.ff .lobby-main { display: flex; flex-direction: column; gap: 16px; }
.ff .lobby-left { position: sticky; top: 70px; }
.ff .room-card { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ff .big-code { font-family: var(--mono); font-size: 2.6rem; letter-spacing: 0.25em; font-weight: 800; padding-left: 0.25em; color: #fff; text-shadow: 0 0 24px rgba(56, 189, 248, 0.55); }
.ff .share-url { font-family: var(--mono); font-size: 1rem; padding: 6px 10px; border-radius: 8px; background: rgba(0,0,0,0.3); border: 1px solid var(--line); user-select: all; word-break: break-all; }
.ff .mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ff .seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.ff .crew-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.ff .crew-head h2 { margin: 0; }
.ff .seat-count { display: flex; align-items: center; gap: 8px; }
.ff .seat-count span { color: var(--muted); font-size: 0.85rem; }
.ff .seat-count b { font-family: var(--mono); font-size: 1.1rem; min-width: 1.2em; text-align: center; }
.ff .seat-count .btn { width: 30px; height: 30px; padding: 0; font-size: 1.1rem; }
.ff .seat {
  border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 12px; padding: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 12%, transparent), transparent 70%);
  display: flex; flex-direction: column; gap: 8px; min-height: 140px;
}
.ff .seat.empty { border-style: dashed; border-top-style: solid; opacity: 0.85; background: none; }
.ff .seat.mine { box-shadow: 0 0 0 1px var(--c), 0 0 20px color-mix(in srgb, var(--c) 30%, transparent); }
.ff .seat-head { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.ff .seat-name { font-size: 1.1rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.ff .badges,.ff .seat-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.ff .seat-actions { margin-top: auto; }
.ff .lobby-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin-top: 14px; }
.ff .hint { color: #fbbf24; font-size: 0.9rem; text-align: center; }
.ff .chat-log,.ff .log { max-height: 190px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; padding-right: 4px; }
.ff .chat-line { word-wrap: break-word; }
.ff .chat-row { display: flex; gap: 6px; margin-top: 8px; }
.ff .chat-row input { padding: 7px 10px; }
.ff .log-line { color: var(--muted); line-height: 1.3; }
.ff .log-line.hit { color: #fdba74; }
.ff .log-line.sunk { color: #fca5a5; font-weight: 600; }
.ff .log-line.big { color: var(--text); font-weight: 700; }
.ff .board {
  --axis: 18px;
  display: grid;
  grid-template-columns: var(--axis) repeat(var(--n), 1fr);
  gap: 2px;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.ff .axis { display: flex; align-items: center; justify-content: center; font-size: 0.62rem; color: var(--muted); font-family: var(--mono); }
.ff .cell {
  position: relative; aspect-ratio: 1; border-radius: 3px;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(160deg, var(--water2), var(--water));
  box-shadow: inset 0 0 0 1px rgba(125, 180, 255, 0.07);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.ff .large .axis { font-size: 0.55rem; }
.ff .cell.ship {
  background: linear-gradient(180deg, #94a3b8, #64748b);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25), inset 0 0 0 3px color-mix(in srgb, var(--sc, #94a3b8) 55%, transparent);
}
.ff .cell.ship.h.start { border-radius: 50% 3px 3px 50%; }
.ff .cell.ship.h.end { border-radius: 3px 50% 50% 3px; }
.ff .cell.ship.v.start { border-radius: 50% 50% 3px 3px; }
.ff .cell.ship.v.end { border-radius: 3px 3px 50% 50%; }
.ff .cell.ship.sunk { background: linear-gradient(180deg, #3f2a2a, #261616); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--sc, #ef4444) 80%, transparent); }
.ff .cell.ship.own { outline: 2px solid rgba(255,255,255,0.65); outline-offset: -2px; }
.ff .cell.miss::after {
  content: ""; position: absolute; inset: 34%; border-radius: 50%;
  background: var(--miss); opacity: 0.75; box-shadow: 0 0 6px rgba(188, 211, 234, 0.6);
}
.ff .cell.hit::after {
  content: ""; position: absolute; inset: 14%; border-radius: 50%;
  background: radial-gradient(circle, #fff7c2 0%, #ffb02e 35%, var(--hc, var(--hit)) 70%, transparent 72%);
  box-shadow: 0 0 10px var(--hc, var(--hit));
  animation: ff-burn 1.6s ease-in-out infinite alternate;
}
.ff .cell.hit:not(.ship) { background: linear-gradient(160deg, #3a2030, #2a1622); }
.ff .cell.hit.sunk::after { animation: none; opacity: 0.85; background: radial-gradient(circle, #ffd7c2 0%, var(--hc, #b91c1c) 60%, transparent 72%); box-shadow: none; }
.ff .cell.multi::before { content: "×2"; position: absolute; right: 1px; top: 0; font-size: 0.5rem; font-weight: 800; z-index: 2; color: #fff; }
.ff .cell.last { box-shadow: 0 0 0 2px var(--by, #fff), 0 0 10px var(--by, #fff); z-index: 1; }
@keyframes ff-burn { from { transform: scale(0.9); filter: brightness(0.95); } to { transform: scale(1.05); filter: brightness(1.2); } }
.ff .board.armed .cell.target { cursor: crosshair; }
.ff .board.armed .cell.target:hover {
  background: rgba(56, 189, 248, 0.35);
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 12px rgba(56, 189, 248, 0.6);
  transform: scale(1.08); z-index: 2;
}
.ff .board.armed .cell.target.own:hover { background: rgba(245, 158, 11, 0.4); box-shadow: inset 0 0 0 2px #f59e0b; }
.ff .board.placing:not(.locked) .cell { cursor: pointer; }
.ff .cell.preview { background: #1f7fb3 !important; box-shadow: inset 0 0 0 2px var(--accent), 0 0 10px rgba(56, 189, 248, 0.5) !important; }
.ff .cell.preview.bad { background: #8f2424 !important; box-shadow: inset 0 0 0 2px #ef4444 !important; }
.ff .cell.incoming::before {
  content: ""; position: absolute; inset: -6px; border: 2px solid #fff; border-radius: 50%;
  animation: ff-lockon 0.38s ease-in forwards; z-index: 3;
}
@keyframes ff-lockon { from { transform: scale(2.2); opacity: 0; } to { transform: scale(0.6); opacity: 1; } }
.ff .cell.fresh.hit { animation: ff-boom 0.7s ease-out; z-index: 3; }
@keyframes ff-boom {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 176, 46, 0.9); background: #fff3c4; }
  30% { transform: scale(1.5); box-shadow: 0 0 30px 12px rgba(255, 90, 54, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 90, 54, 0); }
}
.ff .cell.fresh.miss::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(188, 211, 234, 0.9); animation: ff-ripple 0.9s ease-out forwards; z-index: 3;
}
@keyframes ff-ripple { from { transform: scale(0.3); opacity: 1; } to { transform: scale(2.4); opacity: 0; } }
.ff .cell.fresh-sunk { animation: ff-sink 0.9s ease-out both; }
@keyframes ff-sink {
  0% { filter: brightness(2.5) saturate(2); transform: scale(1.2); }
  100% { filter: none; transform: scale(1); }
}
.ff .board.shake { animation: ff-shake 0.45s; }
@keyframes ff-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, -1px); }
  80% { transform: translate(2px, 1px); }
}
@media (prefers-reduced-motion: reduce) {
.ff .cell,.ff .board,.ff .cell::after,.ff .cell::before { animation: none !important; transition: none !important; }

}
.ff .place-layout { display: grid; grid-template-columns: minmax(0, 560px) 320px; gap: 16px; justify-content: center; align-items: start; }
.ff .place-board .board { max-width: 520px; margin: 0 auto; }
.ff .place-board .board.large { max-width: 640px; }
.ff .place-board .board.huge { max-width: 760px; }
.ff .large.huge .axis { font-size: 0.5rem; }
.ff .place-layout:has(.board.large) { grid-template-columns: minmax(0, 680px) 320px; }
.ff .note { font-size: 0.85rem; color: #bae6fd; background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.25); padding: 8px 10px; border-radius: 10px; }
.ff .dock { display: flex; flex-direction: column; gap: 10px; }
.ff .dock-list { display: flex; flex-direction: column; gap: 6px; }
.ff .dock-ship {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); text-align: left;
}
.ff .dock-ship:hover:not(:disabled) { border-color: rgba(56, 189, 248, 0.5); }
.ff .dock-ship.selected { border-color: var(--accent); background: rgba(56, 189, 248, 0.14); }
.ff .dock-ship.placed { opacity: 0.5; }
.ff .dock-ship.placed span:last-child::after { content: " ✓"; color: #22c55e; }
.ff .hull { display: inline-flex; gap: 2px; min-width: 92px; }
.ff .hull i { width: 16px; height: 12px; background: linear-gradient(180deg, #94a3b8, #64748b); border-radius: 2px; }
.ff .hull i:first-child { border-radius: 6px 2px 2px 6px; }
.ff .hull i:last-child { border-radius: 2px 6px 6px 2px; }
.ff .dock-tools { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.ff .dock-tools .btn { padding: 8px 6px; font-size: 0.85rem; }
.ff .ready-list,.ff .players,.ff .ranking { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ff .ready-list li,.ff .players li { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.ff .ready-list li span:last-child { margin-left: auto; font-size: 0.8rem; }
.ff .ok { color: #4ade80; }
.ff .waiting { color: var(--muted); font-size: 0.9rem; }
.ff .banner {
  position: sticky; top: 58px; z-index: 10; backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--accent));
}
.ff .banner b { font-size: 1.15rem; }
.ff .banner.mine { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, transparent), var(--card) 70%); animation: ff-glow 1.8s ease-in-out infinite alternate; }
@keyframes ff-glow { from { box-shadow: 0 0 0 rgba(56,189,248,0); } to { box-shadow: 0 0 24px color-mix(in srgb, var(--c) 45%, transparent); } }
.ff .banner.over { border-left-color: #a78bfa; }
.ff .banner.over.won { border-left-color: #facc15; background: linear-gradient(90deg, rgba(250, 204, 21, 0.18), var(--card) 70%); }
.ff .timer { margin-left: auto; font-family: var(--mono); font-size: 1rem; color: var(--muted); }
.ff .timer.low { color: #f87171; font-weight: 700; }
.ff .battle { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.ff .boards { display: grid; gap: 14px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.ff .battle.shared .boards { grid-template-columns: minmax(0, 1fr); }
.ff .panel {
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--radius);
  padding: 10px 12px 12px; transition: box-shadow 0.2s, opacity 0.2s;
}
.ff .panel header { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; flex-wrap: wrap; min-height: 24px; }
.ff .panel.active { box-shadow: 0 0 0 1px var(--c), 0 0 22px color-mix(in srgb, var(--c) 35%, transparent); }
.ff .panel.clickable header b::after { content: "  🎯"; }
.ff .panel.dead { opacity: 0.55; }
.ff .panel.dead .board { filter: grayscale(0.6); }
.ff .panel .board { max-width: min(440px, calc((100vh - 220px) / var(--rows, 1) - 50px)); min-width: 200px; margin: 0 auto; }
.ff .panel.ocean .board { max-width: min(760px, calc(100vh - 230px)); min-width: 280px; }
.ff .pips { margin-left: auto; display: inline-flex; gap: 3px; align-items: center; }
.ff .pips i { display: inline-block; height: 8px; width: calc(var(--w) * 5px); border-radius: 3px; background: color-mix(in srgb, var(--c) 75%, #fff 10%); }
.ff .pips i.gone { background: rgba(255, 255, 255, 0.12); }
.ff .side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 70px; }
.ff .players li { padding: 4px 6px; border-radius: 8px; }
.ff .players li.turn { background: color-mix(in srgb, var(--c) 18%, transparent); }
.ff .players li.dead .pname { text-decoration: line-through; color: var(--muted); }
.ff .ranking { counter-reset: r; }
.ff .ranking li { counter-increment: r; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ff .ranking li::before { content: counter(r) "."; width: 18px; color: var(--muted); }
.ff .ranking li:first-child::after { content: "🏆"; }
.ff .flash {
  position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%) scale(0.8);
  pointer-events: none; z-index: 50; opacity: 0; text-align: center;
  padding: 16px 30px; border-radius: 16px; background: rgba(7, 17, 31, 0.85); border: 1px solid var(--line);
  backdrop-filter: blur(6px); transition: opacity 0.2s, transform 0.25s;
}
.ff .flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ff .flash b { display: block; font-size: clamp(1.4rem, 4vw, 2.2rem); letter-spacing: 0.02em; max-width: 80vw; }
.ff .flash small { display: block; text-transform: uppercase; letter-spacing: 0.25em; color: #fca5a5; }
.ff .flash.sunk b,.ff .flash.hit b { color: #ff7a52; text-shadow: 0 0 20px rgba(255, 90, 54, 0.7); }
.ff .flash.win b { color: #facc15; text-shadow: 0 0 24px rgba(250, 204, 21, 0.7); }
.ff .flash.turn b { color: var(--accent); }
.ff .toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: #13273f; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; z-index: 60;
  transition: opacity 0.2s, transform 0.2s; max-width: 90vw; text-align: center;
}
.ff .toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1100px) {
.ff .battle { grid-template-columns: 1fr; }
.ff .side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

}
@media (max-width: 900px) {
.ff .lobby { grid-template-columns: 1fr; }
.ff .lobby-left { position: static; }
.ff .mode-grid { grid-template-columns: 1fr; }
.ff .place-layout,.ff .place-layout:has(.board.large) { grid-template-columns: 1fr; }
.ff .boards { grid-template-columns: repeat(2, minmax(0, 1fr)); }

}
@media (max-width: 640px) {
.ff main { padding: 10px; }
.ff .boards { grid-template-columns: 1fr; }
.ff .boards .panel.me { order: 9; }
.ff .boards .panel .board { max-width: 100%; min-width: 0; }
.ff .banner { top: 50px; }
.ff .board { --axis: 14px; gap: 1px; }
.ff .seats { grid-template-columns: 1fr 1fr; }
.ff .seat { min-height: 0; }
.ff .big-code { font-size: 2rem; }
.ff .card { padding: 12px; }

}
.ff .settings h3.extras-title { margin-top: 14px; }
.ff .set-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ff .set-label { width: 92px; color: var(--muted); font-size: 0.88rem; }
.ff .seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ff .seg-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 0.85rem; }
.ff .seg-btn.on { background: rgba(56, 189, 248, 0.2); border-color: var(--accent); color: #fff; font-weight: 600; }
.ff .seg-btn:disabled { cursor: default; }
.ff .seg-btn:disabled:not(.on) { opacity: 0.5; }
.ff .fleet-preview { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 0 2px; }
.ff .fleet-preview > .muted { width: 100%; }
.ff .fp-ship { display: inline-flex; flex-direction: column; gap: 3px; }
.ff .fp-ship small { color: var(--muted); font-size: 0.7rem; }
.ff .toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.ff .toggle {
  display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px;
}
.ff .toggle:disabled { cursor: default; }
.ff .toggle.on { border-color: rgba(56, 189, 248, 0.6); background: rgba(56, 189, 248, 0.09); }
.ff .tg-icon { font-size: 1.3rem; width: 28px; text-align: center; }
.ff .tg-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.ff .tg-text small { color: var(--muted); font-size: 0.75rem; line-height: 1.25; }
.ff .switch { width: 34px; height: 20px; border-radius: 999px; background: rgba(255,255,255,0.15); position: relative; flex: none; transition: background 0.15s; }
.ff .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #cbd5e1; transition: left 0.15s; }
.ff .toggle.on .switch { background: var(--accent2); }
.ff .toggle.on .switch::after { left: 16px; background: #fff; }
.ff .action-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 8px; }
.ff .act-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; cursor: pointer;
  background: rgba(16, 33, 56, 0.95); border: 1px solid var(--line);
}
.ff .act-btn span { font-size: 1.05rem; }
.ff .act-btn small { color: var(--muted); font-size: 0.72rem; }
.ff .act-btn.on { border-color: var(--accent); background: rgba(14, 116, 160, 0.55); box-shadow: 0 0 12px rgba(56, 189, 248, 0.4); }
.ff .act-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ff .action-help { background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.3); border-radius: 10px; padding: 7px 12px; margin-bottom: 10px; font-size: 0.9rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ff .shots-left { font-family: var(--mono); background: rgba(250, 204, 21, 0.15); color: #fde68a; border: 1px solid rgba(250, 204, 21, 0.4); border-radius: 8px; padding: 2px 8px; font-size: 0.85rem; }
.ff .event-chip { background: rgba(167, 139, 250, 0.18); border: 1px solid rgba(167, 139, 250, 0.5); border-radius: 999px; padding: 3px 10px; font-size: 0.85rem; }
.ff .board.armed .cell { cursor: crosshair; }
.ff .board.movable .cell.ship { cursor: pointer; }
.ff .board.movable .cell.ship:hover { filter: brightness(1.3); }
.ff .cell.ship.moving { box-shadow: inset 0 0 0 3px #facc15, 0 0 12px rgba(250, 204, 21, 0.7); }
.ff .cell.aim { background: rgba(250, 204, 21, 0.35) !important; box-shadow: inset 0 0 0 2px #facc15 !important; }
.ff .cell .ic { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--cellfs, 0.75rem)); line-height: 1; z-index: 2; pointer-events: none; font-weight: 800; }
.ff .board { --cellfs: 0.8rem; }
.ff .board.large { --cellfs: 0.65rem; }
.ff .board.huge { --cellfs: 0.55rem; }
.ff .cell.ship.sunk {
  background: repeating-linear-gradient(135deg, #3b0d0d 0 4px, #5a1414 4px 8px);
  box-shadow: inset 0 0 0 2px var(--sc, #ef4444), 0 0 8px color-mix(in srgb, var(--sc, #ef4444) 70%, transparent);
}
.ff .cell.ship.sunk::after { display: none; }
.ff .cell.ship.sunk .ic { color: #fecaca; text-shadow: 0 0 6px #000; }
.ff .cell.damaged { background: linear-gradient(180deg, #a16207, #78350f); }
.ff .roster { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ff .rs { font-size: 0.72rem; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); }
.ff .rs small { color: var(--muted); }
.ff .rs.sunk { background: rgba(185, 28, 28, 0.35); border-color: #ef4444; color: #fecaca; text-decoration: line-through; text-decoration-thickness: 2px; }
.ff .panel { position: relative; overflow: hidden; }
.ff .dead-stamp {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-14deg);
  border: 4px solid #ef4444; color: #ef4444; font-weight: 900; letter-spacing: 0.12em; font-size: clamp(1.4rem, 4vw, 2.4rem);
  padding: 4px 16px; border-radius: 8px; background: rgba(7, 17, 31, 0.6); pointer-events: none; z-index: 5; opacity: 0.85;
}
.ff .stamp {
  position: absolute; left: 50%; top: 45%; z-index: 6; pointer-events: none; text-align: center;
  transform: translate(-50%, -50%) rotate(-10deg) scale(2.2); opacity: 0;
  border: 5px solid #ef4444; border-radius: 10px; padding: 6px 18px; background: rgba(40, 6, 6, 0.85);
  color: #fecaca; animation: ff-stampIn 3.2s ease-out forwards; box-shadow: 0 0 40px rgba(239, 68, 68, 0.6);
}
.ff .stamp b { display: block; font-size: clamp(1.8rem, 5vw, 3rem); letter-spacing: 0.15em; color: #ef4444; }
.ff .stamp span { font-size: 0.9rem; }
@keyframes ff-stampIn {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(2.2); }
  12% { opacity: 1; transform: translate(-50%, -50%) rotate(-10deg) scale(0.95); }
  18% { transform: translate(-50%, -50%) rotate(-10deg) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-10deg) scale(1); }
}
.ff .flash .sub { display: block; color: var(--muted); font-size: 0.85rem; text-transform: none; letter-spacing: 0; margin-top: 4px; }
.ff .cell.trap-mine .ic { color: #fca5a5; }
.ff .cell.trap-decoy .ic { color: #a5f3fc; }
.ff .cell.trap-mine,.ff .cell.trap-decoy { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35); }
.ff .cell.boom { background: radial-gradient(circle, #fde047, #ea580c 55%, #431407) !important; }
.ff .cell.boom::after,.ff .cell.crate::after,.ff .cell.decoy-hit::after { display: none; }
.ff .cell.crate { background: linear-gradient(160deg, #3f3a1c, #2a2611) !important; }
.ff .cell.decoy-hit { background: linear-gradient(160deg, #164e63, #0c2a36) !important; }
.ff .cell.stealth { outline: 2px dashed #a78bfa; outline-offset: -3px; }
.ff .cell.repaired .ic { opacity: 0.7; }
.ff .cell.spot { box-shadow: inset 0 0 0 2px #facc15; animation: ff-spotPulse 1.4s ease-in-out infinite; }
.ff .cell.spot-mine { box-shadow: inset 0 0 0 2px #f97316; }
@keyframes ff-spotPulse { 50% { box-shadow: inset 0 0 0 2px #facc15, 0 0 10px #facc15; } }
.ff .cell.ping-area { box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.55); }
.ff .cell.ping { background: rgba(20, 184, 166, 0.35); }
.ff .cell.ping .ic { color: #5eead4; font-size: 1em; }
.ff .pts { font-family: var(--mono); font-size: 0.8rem; color: #fde68a; margin-left: 4px; }
.ff .bounty { font-size: 1rem; filter: drop-shadow(0 0 4px #facc15); }
.ff .players .score,.ff .ranking .score { margin-left: auto; font-family: var(--mono); color: #fde68a; }
.ff .ranking li .score { font-weight: 600; }
.ff .team-totals { display: flex; gap: 8px; margin-bottom: 8px; }
.ff .how-points { margin-top: 8px; }
.ff .how-points summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.ff .how-points ul { padding-left: 18px; margin: 6px 0 0; }
.ff .stats .table-wrap { overflow-x: auto; }
.ff .stats table { border-collapse: collapse; width: 100%; font-size: 0.8rem; font-family: var(--mono); }
.ff .stats th,.ff .stats td { padding: 4px 5px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ff .stats tbody th { text-align: left; }
.ff .stats td small { color: #fca5a5; }
.ff .stats td.self { color: var(--muted); }
.ff .stats td.zero { color: rgba(255,255,255,0.25); }
.ff .stats td.fired { color: #fde68a; font-weight: 700; }
.ff .ship-guide h3 { margin-top: 4px; }
.ff .sg-row { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; font-size: 0.88rem; }
.ff .sg-row .hull { min-width: 92px; margin-top: 3px; }
.ff .sg-row small { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.3; }
.ff .dock .ship-guide { border-top: 1px solid var(--line); padding-top: 8px; }
.ff .trap-ic { min-width: 92px; text-align: center; font-size: 1.1rem; }
.ff .log-line.points { color: #fde68a; font-size: 0.8rem; }
.ff .log-line.good { color: #86efac; }
@media (max-width: 640px) {
.ff .set-label { width: 100%; }

}
.ff .under-fire { font-size: 0.75rem; font-family: var(--mono); padding: 1px 6px; border-radius: 6px; background: rgba(239, 68, 68, 0.18); border: 1px solid rgba(239, 68, 68, 0.5); color: #fecaca; }
.ff .board-note { padding-top: 8px; }
.ff .board.huge .axis { font-size: 0.48rem; }
.ff .board.huge { gap: 1px; --axis: 14px; }
.ff .set-row.dim { opacity: 0.45; }
.ff .set-label small { display: block; font-size: 0.68rem; color: var(--muted); }
.ff .set-label { width: 120px; }
.ff .shop-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(250, 204, 21, 0.08); border: 1px solid rgba(250, 204, 21, 0.35); }
.ff .shop-row > span { width: 100%; }
.ff .shop-item { background: rgba(16, 33, 56, 0.95); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; cursor: pointer; }
.ff .shop-item b { color: #fde68a; font-family: var(--mono); margin-left: 4px; }
.ff .shop-item:disabled { opacity: 0.4; cursor: not-allowed; }
.ff .shop-item:hover:not(:disabled) { border-color: #facc15; }


/* hub integration */
.ff { background: transparent; min-height: 0; display: block; color: var(--text); font-family: var(--font); }
.ff .flash { position: fixed; }
.ff .chatlog { max-height: 160px; overflow: auto; font-size: .85rem; margin-bottom: 6px; }

/* steady layout: the action bar and help line stay put between turns */
.ff .action-bar.waiting .act-btn { opacity: .5; }
.ff .action-help { min-height: 2.4em; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
