/* Lodě — noční moře. Mobil → tablet → PC. */
:root {
  --bg0: #050b16;
  --bg1: #0a1830;
  --panel: rgb(16 30 54 / .72);
  --panel-solid: #0f1d34;
  --line: rgb(140 180 230 / .14);
  --ink: #eaf2ff;
  --muted: #8ea3c2;
  --sea0: #0d2a4d;
  --sea1: #0a2140;
  --cell-line: rgb(120 190 255 / .10);
  --hull0: #e9eef6;
  --hull1: #9fb0c8;
  --hull-edge: #5f7291;
  --hit: #ff5a3c;
  --hit-glow: #ffb347;
  --miss: #9cc9ff;
  --accent: #46c2ff;
  --accent-2: #2f7bff;
  --ok: #3ee0a0;
  --radius: 18px;
  --board: min(calc(100vw - 32px), 460px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  color: var(--ink);
  font: 16px/1.4 "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgb(70 194 255 / .16), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgb(47 123 255 / .14), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 70%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }

/* ---------- tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgb(255 255 255 / .05); cursor: pointer;
  font-weight: 600; text-decoration: none; letter-spacing: .01em;
  touch-action: manipulation;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s, box-shadow .15s;
}
.btn:hover { background: rgb(255 255 255 / .09); border-color: rgb(140 180 230 / .28); }
.btn:active { transform: scale(.97); }
.btn.primary {
  border: 0; color: #04162b;
  background: linear-gradient(180deg, #7fd8ff, var(--accent) 55%, #1fa3e6);
  box-shadow: 0 6px 20px rgb(70 194 255 / .35), inset 0 1px 0 rgb(255 255 255 / .5);
}
.btn.primary:hover { box-shadow: 0 8px 28px rgb(70 194 255 / .5), inset 0 1px 0 rgb(255 255 255 / .5); }
.btn.ghost { background: transparent; }
.btn.big { min-height: 56px; font-size: 18px; width: 100%; font-weight: 700; }
.btn:disabled { opacity: .35; cursor: default; transform: none; box-shadow: none; }
.ico { font-size: 18px; line-height: 1; }

.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); text-align: left; }
.field input, .link-row input, .own-code input {
  min-height: 48px; padding: 0 14px; border-radius: 14px;
  border: 1px solid var(--line); background: rgb(0 0 0 / .25); color: var(--ink);
  font-size: 16px; outline: none;
}
.field input:focus, .link-row input:focus, .own-code input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(70 194 255 / .2); }
.field.inline { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; justify-content: center; gap: 14px; font-size: 52px; font-weight: 800; letter-spacing: -.03em; }
.logo-ship {
  width: 54px; height: 16px; border-radius: 99px; position: relative;
  background: linear-gradient(180deg, var(--hull0), var(--hull1));
  box-shadow: 0 4px 14px rgb(70 194 255 / .35);
}
.logo-ship::after { content: ""; position: absolute; right: 8px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--hit); box-shadow: 0 0 10px var(--hit-glow); }
.logo.small { font-size: 22px; gap: 9px; color: inherit; text-decoration: none; }
.logo.small .logo-ship { width: 26px; height: 9px; }
.logo.small .logo-ship::after { width: 4px; height: 4px; top: 2.5px; right: 4px; }

/* ---------- úvod ---------- */
.home { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.home-in { width: 100%; max-width: 380px; display: grid; gap: 18px; text-align: center; position: relative; z-index: 1; }
.home-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 20px; display: grid; gap: 14px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgb(0 0 0 / .35);
}
.lead { margin: 0; color: var(--muted); font-size: 17px; }
.rules { list-style: none; margin: 0; padding: 0; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rules li { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: rgb(255 255 255 / .03); }
.waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 34vh; min-height: 180px; pointer-events: none; }
.hero-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; width: 180px; margin: 0 auto 4px;
  padding: 8px; border-radius: 14px; background: linear-gradient(180deg, var(--sea0), var(--sea1));
  box-shadow: inset 0 0 0 1px var(--cell-line), 0 12px 40px rgb(0 0 0 / .4);
}
.hero-grid i { aspect-ratio: 1; border-radius: 4px; background: rgb(255 255 255 / .04); position: relative; }

/* ---------- herní rozvržení ---------- */
.game {
  max-width: 1180px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.score {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; letter-spacing: .04em;
  padding: 5px 14px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line);
}
.opp {
  display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); max-width: 45%;
  padding: 6px 12px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line);
}
.opp span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #56637a; flex: none; }
.opp.on .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.status { text-align: center; }
.status h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.status p { margin: 6px 0 0; color: var(--muted); font-size: 16px; min-height: 1.4em; }
.status.turn h1 { background: linear-gradient(90deg, #9be6ff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 0 30px rgb(70 194 255 / .25); }
.status.win h1 { color: var(--ok); text-shadow: 0 0 30px rgb(62 224 160 / .35); }
.ready-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rd {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 99px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted); max-width: 100%;
}
.rd b { color: var(--text, #fff); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 10em; }
.rd::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #56637a; flex: none; }
.rd.ok { border-color: rgb(62 224 160 / .5); color: var(--ok); }
.rd.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.rd.busy::before { background: #ffc94a; animation: rdPulse 1.2s ease-in-out infinite; }
@keyframes rdPulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rd.busy::before { animation: none; } }
.cell.ship.one { border-radius: 99px; }
.status.lose h1 { color: var(--hit); text-shadow: 0 0 30px rgb(255 90 60 / .3); }

.invite, .setup {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 12px;
  width: 100%; max-width: 460px; margin: 0 auto;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 16px 50px rgb(0 0 0 / .3);
}
.invite { border-color: rgb(70 194 255 / .35); }
.invite p { margin: 0; font-size: 15px; color: var(--ink); font-weight: 600; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; font-size: 15px; color: var(--accent); }
.over { display: grid; gap: 8px; width: 100%; max-width: 460px; margin: 0 auto; }
.over p { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }

.boards { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.wrap { width: var(--board); }
.cap {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); margin: 0 0 8px 2px;
}
.cap::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; opacity: .7; }

/* ---------- moře ---------- */
.board {
  display: grid; grid-template-columns: 6.5% repeat(10, 1fr);
  gap: 3px; width: 100%; padding: 8px 10px 10px 4px;
  border-radius: var(--radius);
  background:
    repeating-radial-gradient(circle at 30% 20%, rgb(255 255 255 / .025) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #123a66, var(--sea0) 45%, var(--sea1));
  box-shadow: inset 0 0 0 1px rgb(120 190 255 / .16), inset 0 -30px 60px rgb(0 0 0 / .25), 0 18px 50px rgb(0 0 0 / .4);
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: box-shadow .25s;
}
.lbl { display: grid; place-items: center; font-size: 11px; font-weight: 600; color: rgb(170 205 245 / .55); font-variant-numeric: tabular-nums; aspect-ratio: 1; }
.lbl.col { aspect-ratio: auto; padding-bottom: 2px; }
.cell {
  aspect-ratio: 1; border: 0; padding: 0; margin: 0;
  border-radius: 5px; position: relative; cursor: default;
  background: rgb(255 255 255 / .035);
  box-shadow: inset 0 0 0 1px var(--cell-line);
  transition: background .12s;
}
.cell:disabled { color: inherit; }
.cell::after { content: ""; position: absolute; inset: 0; margin: auto; border-radius: 50%; pointer-events: none; }

/* loď: světlý trup s lesklou horní hranou */
.cell.ship {
  background: linear-gradient(180deg, var(--hull0), var(--hull1));
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / .18), 0 3px 8px rgb(0 0 0 / .35);
}
.cell.ship.v { background: linear-gradient(90deg, var(--hull1), var(--hull0) 45%, var(--hull1)); }
.cell.ship.h.s { border-radius: 99px 5px 5px 99px; }
.cell.ship.h.e { border-radius: 5px 99px 99px 5px; }
.cell.ship.v.s { border-radius: 99px 99px 5px 5px; }
.cell.ship.v.e { border-radius: 5px 5px 99px 99px; }
/* obecné rohy lodí (rovné i tvary T / tank) */
.cell.ship.tl { border-top-left-radius: 99px; }
.cell.ship.tr { border-top-right-radius: 99px; }
.cell.ship.bl { border-bottom-left-radius: 99px; }
.cell.ship.br { border-bottom-right-radius: 99px; }
/* okénko uprostřed trupu */
.cell.ship:not(.hit):not(.sunk)::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 22%; height: 22%;
  border-radius: 50%; background: var(--hull-edge); opacity: .55;
}
.cell.ghost { background: transparent; box-shadow: inset 0 0 0 2px rgb(233 238 246 / .55); }
.cell.ghost::before { display: none; }

/* minutí = šplouchnutí */
.cell.miss::after {
  width: 26%; height: 26%; background: var(--miss); opacity: .85;
  box-shadow: 0 0 0 4px rgb(156 201 255 / .14), 0 0 0 8px rgb(156 201 255 / .06);
}
.cell.halo::after { width: 14%; height: 14%; background: var(--miss); opacity: .45; }

/* zásah = žhnoucí výbuch */
.cell.hit::after {
  width: 54%; height: 54%;
  background: radial-gradient(circle, #fff3c4 0 18%, var(--hit-glow) 35%, var(--hit) 65%, rgb(255 90 60 / 0) 72%);
  box-shadow: 0 0 14px 2px rgb(255 120 60 / .55);
}
.cell.hit:not(.ship) { background: rgb(255 90 60 / .16); box-shadow: inset 0 0 0 1px rgb(255 90 60 / .4); }
.cell.ship.hit { background: linear-gradient(180deg, #c9b3ad, #7f6a6a); }

/* potopená loď = tmavý vrak */
.cell.sunk { background: linear-gradient(180deg, #4a2a2f, #2a1a20) !important; box-shadow: inset 0 0 0 1px rgb(255 90 60 / .45), 0 0 12px rgb(255 90 60 / .2); }
.cell.sunk.hit::after { width: 40%; height: 40%; box-shadow: 0 0 8px rgb(255 120 60 / .45); }

.cell.last { outline: 2px solid #fff; outline-offset: 1px; z-index: 1; }
.cell.last::after { animation: pop .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.1); opacity: 0; } }

/* náhled při pokládání */
.cell.pv { background: rgb(70 194 255 / .45); box-shadow: inset 0 0 0 1px rgb(150 225 255 / .8), 0 0 12px rgb(70 194 255 / .35); }
.cell.pv.bad { background: rgb(255 90 60 / .4); box-shadow: inset 0 0 0 1px rgb(255 140 110 / .8); }
.own.editing .cell { cursor: pointer; }

/* střelba */
.enemy.armed .cell.free { cursor: crosshair; }
.enemy.armed .cell.free:hover { background: rgb(70 194 255 / .22); box-shadow: inset 0 0 0 1px rgb(150 225 255 / .7); }
.enemy.armed .cell.free:active { background: rgb(70 194 255 / .4); }
.enemy-wrap.armed .board { box-shadow: inset 0 0 0 2px rgb(70 194 255 / .75), 0 0 0 4px rgb(70 194 255 / .12), 0 0 50px rgb(70 194 255 / .28), 0 18px 50px rgb(0 0 0 / .4); }
.enemy-wrap.armed .cap { color: var(--accent); }
.enemy-wrap.waiting .board { filter: saturate(.7) brightness(.85); }

/* zbývající lodě soupeře */
.fleet-left { display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: center; margin-top: 12px; }
.mini, .shape { display: grid; gap: 2px; align-content: center; }
.mini i { width: 11px; height: 11px; border-radius: 2px; background: linear-gradient(180deg, var(--hull0), var(--hull1)); }
.mini i.tl, .pick i.tl, .hold-ship i.tl { border-top-left-radius: 99px; }
.mini i.tr, .pick i.tr, .hold-ship i.tr { border-top-right-radius: 99px; }
.mini i.bl, .pick i.bl, .hold-ship i.bl { border-bottom-left-radius: 99px; }
.mini i.br, .pick i.br, .hold-ship i.br { border-bottom-right-radius: 99px; }
.mini.gone i { background: var(--hit); opacity: .35; }

/* výběr lodí */
.picker { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pick {
  display: flex; gap: 2px; padding: 10px 10px; border-radius: 12px; align-items: center;
  border: 1px solid var(--line); background: rgb(0 0 0 / .2); cursor: pointer;
  min-height: 42px; touch-action: manipulation; transition: border-color .15s, box-shadow .15s;
}
.pick i { width: 12px; height: 13px; border-radius: 2px; background: linear-gradient(180deg, var(--hull0), var(--hull1)); }
.pick.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(70 194 255 / .22), 0 0 18px rgb(70 194 255 / .25); }
.pick.done i { background: rgb(255 255 255 / .12); }
.hint { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.tools { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tools .btn { padding: 0 8px; }
#setupEdit { display: grid; gap: 12px; }
#setupWait { display: grid; }

.toast {
  position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgb(10 24 48 / .92); color: var(--ink); border: 1px solid rgb(70 194 255 / .4);
  padding: 11px 18px; border-radius: 14px; font-size: 15px; font-weight: 600;
  max-width: calc(100% - 32px); z-index: 10; box-shadow: 0 10px 30px rgb(0 0 0 / .45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ===== MOBIL (výchozí): moře pod sebou, při hře vlastní menší ===== */
.game.playing .own-wrap { width: min(calc(100vw - 96px), 300px); }
.game.playing .own-wrap .board { gap: 2px; padding: 6px 7px 7px 3px; border-radius: 14px; }
.game.playing .own-wrap .lbl { font-size: 9px; }
.game.playing .own-wrap .cell:not(.ship) { border-radius: 3px; }

@media (max-width: 380px) {
  .board { gap: 2px; }
  .pick { padding: 8px 7px; } .pick i { width: 9px; height: 11px; }
  .status h1 { font-size: 26px; }
}

/* ===== TABLET na výšku ===== */
@media (min-width: 600px) {
  :root { --board: min(calc(100vw - 64px), 540px); }
  .game { padding-left: 24px; padding-right: 24px; gap: 18px; }
  .status h1 { font-size: 36px; }
  .lbl { font-size: 12px; }
  .game.playing .own-wrap { width: min(60vw, 400px); }
  .game.playing .own-wrap .lbl { font-size: 10px; }
  .invite, .setup, .over { max-width: 540px; }
}

/* ===== TABLET na šířku a PC: vedle sebe ===== */
@media (min-width: 900px) {
  /* mřížka se vejde i na výšku obrazovky */
  :root { --board: min(calc((100vw - 120px) / 2), calc(100dvh - 250px), 520px); }
  .game { padding-top: 18px; }
  .status h1 { font-size: 40px; }
  .boards { flex-direction: row-reverse; justify-content: center; align-items: flex-start; gap: 48px; }
  .game.playing .own-wrap { width: var(--board); }
  .game.playing .own-wrap .board { gap: 3px; padding: 8px 10px 10px 4px; border-radius: var(--radius); }
  .game.playing .own-wrap .lbl { font-size: 11px; }
  .game.playing .own-wrap .cell:not(.ship) { border-radius: 5px; }

  /* rozmisťování: mřížka vlevo, panel (a pozvánka) vpravo */
  .game.placing {
    display: grid; justify-content: center; align-content: start;
    grid-template-columns: var(--board) minmax(320px, 380px);
    grid-template-areas: "top top" "status status" "boards invite" "boards setup" "boards reacts" "boards .";
    grid-template-rows: auto auto auto auto auto 1fr;
    column-gap: 40px; row-gap: 16px;
  }
  .game.placing { --board: min(calc(100vw - 500px), calc(100dvh - 190px), 560px); }
  .game.placing .top { grid-area: top; }
  .game.placing .status { grid-area: status; }
  .game.placing .invite { grid-area: invite; margin: 0; max-width: none; }
  .game.placing .setup { grid-area: setup; margin: 0; max-width: none; align-self: start; }
  .game.placing .boards { grid-area: boards; }
  .game.placing .over { display: none; }
}

@media (min-width: 900px) and (max-height: 640px) {
  .status h1 { font-size: 30px; }
  .game { gap: 10px; }
}

/* ---------- zvuk, reakce, statistiky ---------- */
.top-r { display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-r .opp { max-width: none; min-width: 0; }
.icon-btn {
  width: 40px; height: 40px; flex: none; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); font-size: 17px; line-height: 1;
  display: grid; place-items: center; touch-action: manipulation;
}
.icon-btn:hover { border-color: rgb(140 180 230 / .3); }
.game.pc .opp .dot { display: none; }

.reacts { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* 10 nejpoužívanějších + „＋" = dvě úhledné řady 6 + 5 */
.react-row { display: grid; grid-template-columns: repeat(6, auto); justify-content: center; gap: 6px; }
.react {
  width: 46px; height: 46px; border-radius: 14px; font-size: 24px; line-height: 1; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); touch-action: manipulation; color: var(--ink);
  transition: transform .12s, border-color .15s, opacity .2s;
}
.react:hover { border-color: rgb(140 180 230 / .35); transform: translateY(-3px) scale(1.08); }
.react:active { transform: scale(.85); }
.react.more { font-size: 22px; color: var(--muted); background: transparent; border-style: dashed; }
.reacts.open .react.more { border-color: var(--accent); color: var(--accent); border-style: solid; }
.reacts.cool .react:not(.more) { opacity: .45; }
.emo-panel {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 10px; width: min(100%, 400px);
  border-radius: 16px; background: var(--panel-solid); border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgb(0 0 0 / .45); animation: pop .15s ease-out;
}
.emo-panel[hidden] { display: none; }
.emo {
  aspect-ratio: 1; font-size: 24px; line-height: 1; border: 0; border-radius: 10px; background: transparent;
  cursor: pointer; touch-action: manipulation; transition: transform .1s, background .15s; padding: 0;
}
.emo:hover { background: rgb(255 255 255 / .08); transform: scale(1.18); }
.emo:active { transform: scale(.85); }

.fly { position: fixed; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }
.fly-one {
  position: absolute; left: 50%; top: 22%; display: grid; justify-items: center; gap: 4px;
  transform: translateX(-50%); animation: flyup 2.6s ease-out forwards;
}
.fly-one.mine { top: auto; bottom: 14%; left: calc(50% + var(--dx)); animation-name: flyme; animation-duration: 2.2s; }
.fly-one .fe { font-size: 110px; line-height: 1; filter: drop-shadow(0 10px 30px rgb(0 0 0 / .5)); }
.fly-one.mine .fe { font-size: 60px; }
.fly-one .fn { font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 99px; background: rgb(10 24 48 / .85); border: 1px solid var(--line); }
.fly-one.calm { animation: fadeonly 2.6s ease-out forwards; }
.fp {
  position: absolute; bottom: -60px; line-height: 1; opacity: 0;
  animation: rise var(--d, 2s) cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes flyup {
  0% { opacity: 0; transform: translate(-50%, 30px) scale(.3) rotate(-20deg); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.2) rotate(8deg); }
  24% { transform: translate(-50%, 0) scale(1) rotate(0); }
  34% { transform: translate(-50%, -6px) scale(1.04); }
  44% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50px) scale(.95); }
}
@keyframes flyme {
  0% { opacity: 0; transform: translate(-50%, 40px) scale(.4); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  25% { transform: translate(-50%, -10px) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -38vh) scale(.8); }
}
@keyframes rise {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  12% { opacity: 1; }
  50% { transform: translate(var(--w), -50vh) scale(1) rotate(10deg); }
  85% { opacity: .9; }
  100% { opacity: 0; transform: translate(calc(var(--w) * -1), -95vh) scale(1.1) rotate(-10deg); }
}
@keyframes fadeonly { 0% { opacity: 0; } 10%, 80% { opacity: 1; } 100% { opacity: 0; } }

.stats {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; display: grid; gap: 2px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.st-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr; padding: 6px 0; font-variant-numeric: tabular-nums; }
.st-row + .st-row { border-top: 1px solid var(--line); }
.st-row span { text-align: center; font-weight: 700; font-size: 17px; }
.st-row span:first-child { text-align: left; font-weight: 500; color: var(--muted); font-size: 15px; }
.st-row.head span { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-note { margin: 8px 0 0; text-align: center; font-size: 14px; color: var(--ink); }

/* přetahování myší */
@media (pointer: fine) {
  .own.editing .cell.ship { cursor: grab; }
  .game.dragging, .game.dragging * { cursor: grabbing !important; }
  .pick { cursor: grab; }
}
.game.dragging .own .cell.pv { box-shadow: inset 0 0 0 1px rgb(150 225 255 / .9), 0 0 18px rgb(70 194 255 / .5); }
@media (min-width: 900px) {
  .game.placing .reacts { grid-area: reacts; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fly-one { opacity: 1; }
}

/* ===== výběr režimu na úvodu ===== */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: rgb(0 0 0 / .25); border: 1px solid var(--line); }
.seg button {
  font: inherit; font-weight: 700; font-size: 15px; color: var(--muted); background: transparent;
  border: 0; border-radius: 10px; padding: 9px 6px; cursor: pointer; display: grid; gap: 1px; line-height: 1.15;
}
.seg button small { font-size: 11px; font-weight: 600; opacity: .75; }
.seg button[aria-pressed="true"] { background: rgb(70 194 255 / .18); color: var(--ink); box-shadow: inset 0 0 0 1px rgb(70 194 255 / .55); }
.seg button[data-m="hard"][aria-pressed="true"] { background: rgb(255 90 60 / .18); box-shadow: inset 0 0 0 1px rgb(255 90 60 / .6); }
.badge {
  margin-left: 8px; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: #fff; background: var(--hit); padding: 3px 7px; border-radius: 99px; vertical-align: middle;
  box-shadow: 0 0 14px rgb(255 90 60 / .4);
}

/* ===== hardcore: 15 × 15, hustší mřížka ===== */
.game.hard .board { gap: 2px; padding: 6px 7px 8px 2px; }
.game.hard .lbl { font-size: 9px; }
.game.hard .cell:not(.ship) { border-radius: 3px; }
.game.hard .cell.ship { border-radius: 3px; }
.game.hard .cell.ship.tl { border-top-left-radius: 99px; }
.game.hard .cell.ship.tr { border-top-right-radius: 99px; }
.game.hard .cell.ship.bl { border-bottom-left-radius: 99px; }
.game.hard .cell.ship.br { border-bottom-right-radius: 99px; }
.game.hard .picker { gap: 6px; }
.game.hard .pick { padding: 7px 8px; min-height: 36px; }
.game.hard .pick i { width: 10px; height: 10px; }
.game.hard .fleet-left { gap: 8px 10px; }
.game.hard .mini i { width: 9px; height: 9px; }
.game.hard.playing .own-wrap { width: min(calc(100vw - 48px), 340px); }
.game.hard.playing .own-wrap .board { gap: 1px; }
@media (min-width: 600px) {
  .game.hard .lbl { font-size: 10px; }
}

/* ===== rozmisťování obrázky: loď v ruce + prst do moře ===== */
.hold { display: flex; align-items: center; justify-content: center; gap: 18px; }
.hold-ship {
  position: relative; width: 150px; height: 150px; border-radius: 22px; padding: 0;
  border: 2px dashed rgb(70 194 255 / .55); background: rgb(0 0 0 / .25);
  display: grid; place-items: center; cursor: pointer; touch-action: manipulation;
}
.hold-ship:disabled { cursor: default; border-color: rgb(62 224 160 / .6); }
.hold-ship .shape { gap: 3px; }
.hold-ship .shape i { width: 24px; height: 24px; border-radius: 4px; background: linear-gradient(180deg, var(--hull0), var(--hull1)); box-shadow: 0 3px 8px rgb(0 0 0 / .35); }
.rot-badge {
  position: absolute; right: -12px; bottom: -12px; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px; font-weight: 800; line-height: 1;
  background: var(--accent); color: #04203a; box-shadow: 0 6px 18px rgb(70 194 255 / .45);
}
.hold.done .rot-badge, .hold.done .hold-go { display: none; }
.ok-big { font-size: 64px; line-height: 1; }
.hold-go { display: grid; justify-items: center; gap: 2px; }
.finger { font-size: 44px; line-height: 1; animation: poke 1.1s ease-in-out infinite; }
.finger.left { display: none; }
.mini-sea {
  width: 46px; height: 46px; border-radius: 8px;
  background: repeating-linear-gradient(0deg, transparent 0 10px, rgb(120 190 255 / .3) 10px 11px),
              repeating-linear-gradient(90deg, transparent 0 10px, rgb(120 190 255 / .3) 10px 11px), var(--sea0);
}
@keyframes poke { 50% { transform: translateY(-8px); } }
@keyframes pokeL { 50% { transform: translateX(-8px); } }
.spin { animation: spin .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes spin { from { transform: rotate(-90deg) scale(.8); } }
#ready.glow { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgb(70 194 255 / .35), 0 0 40px rgb(70 194 255 / .6); } }
@media (min-width: 900px) {
  .finger.up { display: none; }
  .finger.left { display: block; animation-name: pokeL; }
  /* na PC je moře vlevo: [moře 👈] [loď] */
  .hold-go { order: -1; grid-auto-flow: column; align-items: center; gap: 6px; }
  .hold-go .mini-sea { order: -1; }
}

/* ===== čas na tah ===== */
.timer { display: flex; align-items: center; gap: 10px; width: min(100%, 360px); margin: 10px auto 0; }
.t-ico { font-size: 20px; }
.t-bar { flex: 1; height: 10px; border-radius: 99px; background: rgb(255 255 255 / .08); overflow: hidden; }
.t-bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--muted); transition: width .2s linear, background .3s; }
.timer b { min-width: 2ch; font-size: 18px; font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.timer.mine .t-bar i { background: var(--accent); }
.timer.mine b { color: var(--ink); }
.timer.hurry.mine .t-bar i { background: var(--hit); }
.timer.hurry.mine b { color: var(--hit); }
.timer.hurry.mine .t-ico { animation: poke .5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .finger, .spin, #ready.glow, .timer .t-ico { animation: none !important; }
}

/* ===== síla počítače na úvodu ===== */
.seg.small button { font-size: 14px; padding: 7px 6px; }

/* ===== zaměřovač (hardcore na dotyku) ===== */
.enemy .cell.aim {
  background: rgb(255 90 60 / .3) !important; z-index: 2;
  box-shadow: inset 0 0 0 2px var(--hit), 0 0 0 3px rgb(255 90 60 / .35), 0 0 18px rgb(255 90 60 / .6) !important;
  animation: aimPulse 1s ease-in-out infinite;
}
.enemy .cell.aim::before {
  content: "🎯"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 15px; line-height: 1;
}
@keyframes aimPulse { 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .enemy .cell.aim { animation: none; } }
.seg button[data-a="hard"][aria-pressed="true"] { background: rgb(255 90 60 / .18); box-shadow: inset 0 0 0 1px rgb(255 90 60 / .6); }

/* připojení kódem */
.own-code { text-align: left; font-size: 13px; color: var(--muted); margin-top: -4px; }
.own-code summary { cursor: pointer; padding: 4px 2px; list-style: none; }
.own-code summary::-webkit-details-marker { display: none; }
.own-code[open] summary { color: var(--ink); }
.own-code input, .join input {
  width: 100%; margin-top: 6px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700;
}
.join { display: grid; gap: 6px; text-align: left; font-size: 13px; color: var(--muted);
  padding-top: 12px; border-top: 1px solid rgb(255 255 255 / .08); }
.join input { margin-top: 0; font-size: 18px; text-align: center; }
.join input::placeholder { letter-spacing: .12em; }
.code-box { display: grid; justify-items: center; gap: 2px; text-align: center; }
.code-box span { font-size: 13px; color: var(--muted); }
.code-box b { font-size: 34px; letter-spacing: .18em; color: var(--accent); line-height: 1.15; padding-left: .18em; }
.code-box small { font-size: 13px; color: var(--muted); }

/* ===== ve třech (1 v 1 v 1) ===== */
#modeSeg { grid-template-columns: 1fr 1fr 1fr; }
.seg button[data-m="trio"][aria-pressed="true"] { background: rgb(180 120 255 / .2); box-shadow: inset 0 0 0 1px rgb(180 120 255 / .65); }
.pc-part { display: contents; }
.pc-part[hidden] { display: none; }
.game.trio .badge { background: #8a5cf6; box-shadow: 0 0 14px rgb(138 92 246 / .45); }
/* výběr, na koho střílím */
.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.tgt {
  font: inherit; color: var(--muted); background: rgb(255 255 255 / .04); cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; min-height: 52px;
  display: grid; gap: 2px; text-align: left; touch-action: manipulation;
}
.tgt b { color: var(--ink); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgt small { font-size: 12px; font-weight: 600; }
.tgt[aria-pressed="true"] { background: rgb(70 194 255 / .14); box-shadow: inset 0 0 0 2px rgb(70 194 255 / .7); color: var(--ink); }
.tgt.onturn small::before { content: "🎯 "; }
.tgt.dead { opacity: .45; cursor: default; }
.tgt.dead b { text-decoration: line-through; }
/* výstřely ostatních do stejného moře jsou slabší */
.cell.other::after { opacity: .5; }
.stats.trio .st-row { grid-template-columns: 1.1fr 1fr 1fr 1fr; }
.stats.trio .st-row span { font-size: 15px; }

/* ===== zrušení hry ===== */
.cancel-row { display: flex; justify-content: center; margin: 4px 0 8px; }
.btn.small { min-height: 38px; font-size: 14px; color: var(--muted); }
.btn.small.sure { color: #fff; border-color: rgb(255 90 60 / .7); background: rgb(255 90 60 / .2); }
@media (min-width: 900px) {
  .game.placing .cancel-row { grid-column: 2; grid-row: 6; align-self: start; margin: 0; }
}
