* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(80, 160, 255, 0.14), transparent 45%),
    radial-gradient(ellipse at 90% 30%, rgba(255, 190, 70, 0.1), transparent 40%),
    #07080c;
  color: #eee;
  font-family: "Exo 2", "Trebuchet MS", sans-serif;
}

body.game-off #lobby {
  display: none;
}

body.in-arena {
  overflow: hidden;
}

#lobby {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.lobby-card {
  width: min(420px, 100%);
  padding: 22px 20px 18px;
  border: 1px solid rgba(140, 190, 255, 0.22);
  background: linear-gradient(180deg, rgba(20, 28, 40, 0.96), rgba(10, 12, 16, 0.97));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(160, 210, 255, 0.65);
  text-align: center;
  margin-bottom: 6px;
}

.brand {
  text-align: center;
  font-size: clamp(28px, 6vw, 36px);
  font-weight: 900;
  color: #9fd0ff;
  text-shadow: 0 0 24px rgba(100, 180, 255, 0.3);
  margin: 0 0 6px;
}

.tagline {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: rgba(220, 235, 255, 0.7);
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  font-size: 16px;
  outline: none;
}

.field input:focus {
  border-color: rgba(140, 200, 255, 0.55);
}

.cta {
  width: 100%;
  padding: 14px;
  border: 2px solid rgba(140, 200, 255, 0.55);
  background: linear-gradient(180deg, rgba(80, 150, 255, 0.28), rgba(30, 70, 140, 0.35));
  color: #e8f4ff;
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.cta:disabled {
  opacity: 0.45;
  cursor: default;
}

.cta:hover:not(:disabled) {
  border-color: rgba(180, 220, 255, 0.8);
}

.btn-ghost {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(230, 240, 255, 0.8);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-ghost[hidden] {
  display: none !important;
}

.status {
  min-height: 1.3em;
  margin-top: 12px;
  font-size: 13px;
  color: rgba(180, 255, 210, 0.85);
  text-align: center;
}

.counts {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}

.counts strong {
  color: rgba(200, 230, 255, 0.9);
  font-weight: 800;
}

.made-by {
  margin-top: 14px;
  text-align: center;
  font-size: 11px;
  color: rgba(200, 220, 255, 0.35);
}

/* ——— Arena / placing ——— */

#arena {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  padding:
    max(10px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 50% 0%, rgba(40, 110, 200, 0.18), transparent 50%),
    linear-gradient(180deg, #081018 0%, #07080c 100%);
  overflow: auto;
}

#arena[hidden] {
  display: none !important;
}

.arena-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 100%;
}

.arena-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 4px 2px;
}

.arena-eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(160, 210, 255, 0.65);
  margin-bottom: 4px;
}

#arena-title {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 900;
  color: #9fd0ff;
  line-height: 1.1;
}

.arena-vs {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 800;
  color: rgba(255, 236, 210, 0.85);
}

.arena-top-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.place-status {
  font-size: 13px;
  font-weight: 700;
  color: rgba(180, 255, 210, 0.9);
  text-align: right;
  max-width: 320px;
}

.arena-leave {
  width: auto;
  margin: 0;
  min-width: 120px;
}

.board-panel {
  display: grid;
  gap: 12px;
  justify-items: center;
  min-width: 0;
}

.board-frame {
  width: min(100%, 560px);
  padding: 14px;
  border: 1px solid rgba(140, 190, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(12, 28, 44, 0.9), rgba(8, 14, 22, 0.95)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 11px,
      rgba(80, 140, 200, 0.03) 11px,
      rgba(80, 140, 200, 0.03) 12px
    );
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    inset 0 0 40px rgba(40, 120, 200, 0.08);
}

.board-tools {
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
}

.tool-btn {
  height: 44px;
  padding: 0 10px;
  border: 1px solid rgba(140, 200, 255, 0.35);
  background: rgba(40, 100, 180, 0.22);
  color: #d8ecff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tool-btn:hover:not(:disabled) {
  border-color: rgba(180, 220, 255, 0.7);
}

.tool-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.tool-muted {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(230, 240, 255, 0.7);
}

.tool-ready {
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-color: rgba(120, 220, 160, 0.55);
  background: linear-gradient(180deg, rgba(40, 160, 100, 0.35), rgba(20, 80, 50, 0.4));
  color: #d8ffe8;
}

.tool-ready:disabled {
  opacity: 0.35;
}

.tool-cancel {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-color: rgba(255, 160, 100, 0.55);
  background: linear-gradient(180deg, rgba(160, 90, 40, 0.4), rgba(80, 40, 20, 0.45));
  color: #ffe0c8;
}

.ready-peers {
  font-size: 12px;
  font-weight: 800;
  color: rgba(180, 220, 255, 0.65);
  text-align: center;
}

.fx-banner {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 80;
  pointer-events: none;
  padding: 18px 36px;
  border: 2px solid rgba(180, 220, 255, 0.45);
  background: rgba(6, 12, 22, 0.88);
  box-shadow: 0 0 40px rgba(80, 160, 255, 0.35);
  opacity: 0;
}

.fx-banner[hidden] {
  display: none !important;
}

.fx-banner.is-pop {
  animation: banner-pop 0.55s cubic-bezier(0.2, 1.3, 0.4, 1) forwards;
}

.fx-banner span {
  font-size: clamp(36px, 10vw, 72px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #e8f4ff;
  text-shadow: 0 0 24px rgba(120, 200, 255, 0.55);
}

.fx-banner.fx-count span {
  color: #9fd0ff;
}

.fx-banner.fx-hit span,
.fx-banner.fx-sunk span {
  color: #ff8a5c;
  text-shadow: 0 0 28px rgba(255, 100, 60, 0.7);
}

.fx-banner.fx-sunk {
  border-color: rgba(255, 120, 80, 0.7);
  box-shadow: 0 0 50px rgba(255, 80, 40, 0.45);
}

.fx-banner.fx-miss span {
  color: rgba(180, 210, 255, 0.75);
  font-size: clamp(28px, 7vw, 48px);
}

.fx-banner.fx-turn-me {
  border-color: rgba(120, 230, 160, 0.7);
  box-shadow: 0 0 48px rgba(60, 200, 120, 0.4);
}

.fx-banner.fx-turn-me span {
  color: #b8ffd0;
}

.fx-banner.fx-win span {
  color: #ffe566;
  text-shadow: 0 0 30px rgba(255, 210, 80, 0.7);
}

.fx-banner.fx-lose span {
  color: #ffb0b0;
}

@keyframes banner-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.battle-panel {
  width: 100%;
  display: grid;
  gap: 12px;
}

.battle-panel[hidden] {
  display: none !important;
}

body.in-battle #placing-panel {
  display: none !important;
}

.battle-boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
}

/* Wide: own left, enemy right (DOM order) */

.battle-col {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.board-caption {
  font-size: 13px;
  font-weight: 900;
  color: rgba(180, 220, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.turn-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(220, 230, 255, 0.55);
  background: rgba(0, 0, 0, 0.35);
}

.turn-pill.is-mine {
  border-color: rgba(120, 230, 160, 0.65);
  color: #c8ffe0;
  background: rgba(40, 140, 90, 0.35);
  box-shadow: 0 0 12px rgba(80, 200, 140, 0.3);
}

.board-frame-sm,
.board-frame-enemy {
  width: 100%;
  padding: 10px;
}

.board-frame-enemy {
  border-color: rgba(255, 140, 100, 0.35);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    inset 0 0 40px rgba(200, 80, 40, 0.08);
}

.cell-fog {
  background: linear-gradient(160deg, rgba(20, 40, 70, 0.55), rgba(8, 14, 24, 0.75));
}

.cell.can-shoot {
  cursor: crosshair;
}

.cell.can-shoot:hover {
  border-color: rgba(255, 180, 120, 0.85);
  background: linear-gradient(160deg, rgba(120, 60, 40, 0.45), rgba(40, 20, 16, 0.7));
  box-shadow: inset 0 0 12px rgba(255, 140, 80, 0.25);
}

.cell.is-aimed {
  z-index: 3;
  border-color: rgba(255, 70, 70, 0.95) !important;
  background: linear-gradient(160deg, rgba(180, 30, 30, 0.65), rgba(80, 10, 10, 0.75)) !important;
  box-shadow: inset 0 0 14px rgba(255, 60, 60, 0.4) !important;
}

/* Cheap opacity blink on a single overlay — not box-shadow/filter */
.cell.is-aimed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 60, 60, 0.28);
  pointer-events: none;
  animation: aim-blink 0.75s ease-in-out infinite;
}

@keyframes aim-blink {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.aim-toast {
  margin: 0 auto;
  padding: 8px 14px;
  max-width: 360px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 220, 210, 0.88);
  border: 1px solid rgba(255, 120, 100, 0.35);
  background: rgba(40, 12, 12, 0.55);
  letter-spacing: 0.02em;
}

.aim-toast[hidden] {
  display: none !important;
}

/* —— Loadout —— */
.loadout-panel {
  width: 100%;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.loadout-panel[hidden] {
  display: none !important;
}

.loadout-roster {
  width: 100%;
}

/* —— Horizontal team builds (Клякса-style) —— */
.team-build {
  width: 100%;
  display: grid;
  gap: 16px;
}

.build-section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(220, 230, 245, 0.75);
}

.build-title-killer {
  color: rgba(255, 120, 120, 0.9);
}

.build-killer {
  padding: 12px 14px 14px;
  border: 1px solid rgba(220, 80, 80, 0.28);
  background: linear-gradient(165deg, rgba(50, 18, 22, 0.55), rgba(10, 12, 18, 0.7));
}

.build-killer-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
}

.build-addons {
  display: grid;
  gap: 8px;
}

.build-survivors {
  padding: 12px 14px 14px;
  border: 1px solid rgba(140, 190, 255, 0.18);
  background: linear-gradient(165deg, rgba(20, 32, 52, 0.55), rgba(8, 12, 20, 0.72));
}

.build-surv-list {
  display: grid;
  gap: 10px;
}

.build-surv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.build-surv-row:last-child {
  border-bottom: 0;
}

.build-gear {
  display: flex;
  align-items: center;
  gap: 6px;
}

.build-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: flex-start;
}

.build-perks-2x2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 90px));
  gap: 10px 12px;
}

.build-perks-row {
  flex: 1;
  min-width: 0;
}

.build-portrait {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 88px;
  cursor: pointer;
  flex-shrink: 0;
}

button.build-portrait:disabled {
  cursor: default;
  opacity: 0.85;
}

div.build-portrait {
  cursor: default;
}

.build-portrait-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle at 40% 30%, rgba(80, 90, 110, 0.5), rgba(10, 12, 18, 0.95));
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.45);
}

.build-portrait.is-picked .build-portrait-ring {
  border-color: rgba(180, 210, 255, 0.55);
  box-shadow: 0 0 18px rgba(80, 140, 220, 0.25);
}

.build-killer .build-portrait.is-picked .build-portrait-ring {
  border-color: rgba(255, 120, 120, 0.65);
  box-shadow: 0 0 18px rgba(200, 60, 60, 0.3);
}

.build-portrait-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.build-portrait-ph {
  font-size: 28px;
  font-weight: 900;
  color: rgba(200, 210, 230, 0.35);
}

.build-portrait-name {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  color: rgba(230, 238, 255, 0.88);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  max-width: 96px;
  word-break: break-word;
}

.build-slot {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  width: 78px;
  display: grid;
  justify-items: center;
  gap: 4px;
  cursor: pointer;
}

button.build-slot:disabled {
  cursor: default;
  opacity: 0.85;
}

div.build-slot {
  cursor: default;
}

.build-slot-frame {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  position: relative;
}

.build-slot-perk .build-slot-frame {
  width: 58px;
  height: 58px;
  transform: rotate(45deg);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, rgba(40, 50, 70, 0.85), rgba(12, 16, 24, 0.95));
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
}

.build-slot-perk.is-filled.t3 .build-slot-frame {
  border-color: rgba(210, 140, 255, 0.85);
  box-shadow: 0 0 16px rgba(180, 80, 255, 0.35);
  background: linear-gradient(135deg, rgba(90, 40, 130, 0.75), rgba(30, 12, 50, 0.95));
}

.build-slot-perk.is-filled.t2 .build-slot-frame {
  border-color: rgba(120, 190, 255, 0.8);
  box-shadow: 0 0 14px rgba(60, 140, 230, 0.3);
  background: linear-gradient(135deg, rgba(30, 70, 130, 0.75), rgba(12, 28, 55, 0.95));
}

.build-slot-perk.is-filled.t1 .build-slot-frame {
  border-color: rgba(210, 180, 90, 0.75);
  box-shadow: 0 0 12px rgba(180, 140, 40, 0.25);
  background: linear-gradient(135deg, rgba(90, 70, 30, 0.7), rgba(35, 28, 12, 0.95));
}

.build-slot-perk .build-slot-frame img,
.build-slot-perk .build-slot-frame .build-slot-ph {
  transform: rotate(-45deg);
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.build-slot-item .build-slot-frame,
.build-slot-addon .build-slot-frame {
  width: 48px;
  height: 48px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
}

.build-slot-item.is-filled .build-slot-frame,
.build-slot-addon.is-filled .build-slot-frame {
  border-color: rgba(140, 200, 255, 0.55);
}

.build-slot-item .build-slot-frame img,
.build-slot-addon .build-slot-frame img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.build-slot-ph {
  display: block;
  width: 40%;
  height: 40%;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

.build-slot-label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  color: rgba(220, 230, 245, 0.85);
  max-width: 78px;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.build-slot-label.is-placeholder {
  color: rgba(160, 180, 200, 0.45);
}

.build-slot.is-destroyed {
  opacity: 0.38;
  filter: grayscale(0.85);
}

.build-slot.is-destroyed .build-slot-label {
  text-decoration: line-through;
}

.loadout-ready-btn {
  min-width: 180px;
}

@media (max-width: 720px) {
  .build-killer-body {
    justify-content: center;
  }
  .build-surv-row {
    justify-content: center;
  }
  .build-perks-2x2 {
    grid-template-columns: repeat(2, minmax(64px, 80px));
  }
}

.loadout-picker {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  background: rgba(4, 8, 14, 0.97);
}

.loadout-picker[hidden] {
  display: none !important;
}

body.picker-open {
  overflow: hidden;
}

.loadout-picker-panel {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: none;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 16px 18px 18px;
  border: 0;
  background: linear-gradient(180deg, #121c2c 0%, #0a1018 40%, #070b12 100%);
  z-index: 1;
}

.loadout-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.loadout-picker-titles {
  display: grid;
  gap: 4px;
}

.loadout-picker-head h3 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
}

.picker-meta {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(180, 210, 240, 0.55);
}

.picker-search {
  width: 100%;
  border: 1px solid rgba(140, 200, 255, 0.35);
  background: rgba(0, 0, 0, 0.45);
  color: #eef6ff;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 14px 16px;
  outline: none;
}

.picker-search:focus {
  border-color: rgba(160, 220, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(80, 160, 255, 0.15);
}

.picker-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  min-height: 0;
  align-content: start;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.picker-list.picker-chars {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

.picker-list.picker-perks {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.picker-opt {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: #e8f2ff;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.picker-opt-char,
.picker-opt-perk {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  min-height: 110px;
  justify-content: flex-start;
  padding: 10px 8px;
}

.picker-opt-img,
.picker-opt-ph {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.picker-opt-perk .picker-opt-img {
  object-fit: contain;
  width: 56px;
  height: 56px;
  background: transparent;
  border: 0;
}

.picker-opt-name {
  line-height: 1.2;
  word-break: break-word;
}

.picker-opt:hover:not(:disabled) {
  border-color: rgba(140, 200, 255, 0.55);
}

.picker-opt.is-disabled,
.picker-opt:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.picker-opt-tier {
  font-size: 11px;
  color: rgba(180, 210, 240, 0.65);
}

.picker-empty {
  margin: 0;
  padding: 20px;
  text-align: center;
  color: rgba(180, 200, 220, 0.5);
}

.results-roster {
  width: 100%;
  text-align: left;
}

@media (max-width: 720px) {
  .lo-surv-grid {
    grid-template-columns: 1fr;
  }
  .lo-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.results-panel {
  width: min(980px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
  padding: 8px 0 24px;
  animation: results-in 0.45s ease-out both;
}

.results-panel[hidden] {
  display: none !important;
}

@keyframes results-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(180, 210, 240, 0.55);
}

.results-title {
  margin: 0;
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #eef6ff;
  text-shadow: 0 0 24px rgba(120, 200, 255, 0.25);
}

.results-title.is-win {
  color: #c8ffe0;
  text-shadow: 0 0 28px rgba(80, 220, 140, 0.35);
}

.results-title.is-lose {
  color: #ffc8b8;
  text-shadow: 0 0 24px rgba(255, 100, 80, 0.3);
}

.results-sub {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: rgba(200, 220, 245, 0.72);
}

.results-stacks {
  display: grid;
  gap: 18px;
  width: 100%;
  margin-top: 8px;
}

.results-stack {
  display: grid;
  gap: 10px;
  justify-items: stretch;
  min-width: 0;
  padding: 14px 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, rgba(24, 40, 64, 0.65), rgba(10, 16, 28, 0.75));
  text-align: left;
}

.results-stack.is-mine {
  border-color: rgba(120, 210, 255, 0.55);
  background: linear-gradient(165deg, rgba(36, 70, 110, 0.75), rgba(12, 24, 44, 0.85));
  box-shadow: 0 0 28px rgba(70, 160, 230, 0.28);
}

.results-stack.is-mine .results-label {
  color: rgba(180, 230, 255, 0.92);
}

.results-label {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: rgba(180, 210, 240, 0.62);
  word-break: break-word;
}

.results-consolation {
  margin: 0;
  max-width: 36em;
  font-size: 15px;
  font-weight: 800;
  color: rgba(255, 210, 160, 0.9);
}

.results-consolation[hidden] {
  display: none !important;
}

.results-tip {
  margin: 4px 0 0;
  max-width: 28em;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: rgba(200, 220, 245, 0.72);
}

.results-loot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  min-height: 56px;
  width: 100%;
}

.results-loot .perk {
  width: 44px;
}

.results-loot .results-perk-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(8px) scale(0.85);
}

.results-loot .results-perk-line.is-in {
  animation: loot-line-in 0.4s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

@keyframes loot-line-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.results-loot .results-perk-cap {
  font-size: 13px;
  font-weight: 800;
  color: rgba(230, 240, 255, 0.88);
  white-space: nowrap;
}

.results-empty {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: rgba(180, 200, 220, 0.45);
  font-style: italic;
}

.results-lobby-btn {
  margin-top: 6px;
  min-width: 160px;
}


.cell.enemy-reveal {
  z-index: 2;
}

.fx-banner.fx-perk span {
  font-size: clamp(28px, 7vw, 52px);
}

.fx-banner.fx-perk-t1 {
  border-color: rgba(180, 120, 70, 0.55);
}

.fx-banner.fx-perk-t1 span {
  color: #e8c8a0;
  text-shadow: none;
}

.fx-banner.fx-perk-t2 {
  border-color: rgba(120, 190, 255, 0.65);
  box-shadow: 0 0 40px rgba(60, 140, 255, 0.4);
}

.fx-banner.fx-perk-t2 span {
  color: #b8e0ff;
}

.fx-banner.fx-perk-t3 {
  border-color: rgba(220, 140, 255, 0.85);
  box-shadow: 0 0 50px rgba(180, 80, 255, 0.55);
}

.fx-banner.fx-perk-t3 span {
  color: #f0c8ff;
  text-shadow: 0 0 28px rgba(220, 120, 255, 0.8);
}

.cell.is-firing {
  animation: cell-fire 0.35s ease-out;
}

@keyframes cell-fire {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  40% {
    transform: scale(1.08);
    filter: brightness(1.6);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.shot {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}

.shot-miss {
  background: radial-gradient(circle, rgba(220, 235, 255, 0.85), rgba(120, 160, 200, 0.2) 70%, transparent);
  box-shadow: 0 0 8px rgba(180, 210, 255, 0.4);
}

.shot-hit,
.shot-sunk {
  border-radius: 2px;
  background: radial-gradient(circle, #ffb080 0%, #ff4a2a 45%, rgba(120, 20, 10, 0.2) 75%);
  box-shadow: 0 0 14px rgba(255, 80, 40, 0.75);
}

.shot-sunk {
  box-shadow:
    0 0 16px rgba(255, 60, 30, 0.9),
    0 0 28px rgba(255, 120, 40, 0.45);
}

/* Only the newest shot pops — prevents replaying FX on older hits */
.shot-pop {
  animation: hit-burst 0.45s ease-out;
}

.cell.shot-sunk-soft {
  outline: 1px solid rgba(255, 160, 120, 0.35);
}

.cell.shot-miss {
  background: linear-gradient(160deg, rgba(40, 70, 110, 0.5), rgba(12, 20, 36, 0.7));
}

.cell.shot-hit,
.cell.shot-sunk {
  outline: 1px solid rgba(255, 120, 80, 0.55);
}

.cell.revealed-hit.has-ship {
  filter: brightness(1.05);
}

@keyframes hit-burst {
  0% {
    transform: scale(0.3);
    opacity: 0.2;
  }
  60% {
    transform: scale(1.25);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.board {
  --n: 10;
  --label: 28px;
  display: grid;
  grid-template-columns: var(--label) repeat(var(--n), minmax(0, 1fr));
  grid-template-rows: var(--label) repeat(var(--n), minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  aspect-ratio: 1;
  user-select: none;
  touch-action: none;
  contain: layout style;
}

.board-corner {
  grid-column: 1;
  grid-row: 1;
}

.board-label {
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: rgba(180, 220, 255, 0.65);
  letter-spacing: 0.04em;
}

.board-label-col {
  grid-row: 1;
}

.board-label-row {
  grid-column: 1;
}

.cell {
  position: relative;
  border: 1px solid rgba(100, 160, 220, 0.22);
  background:
    linear-gradient(160deg, rgba(30, 70, 110, 0.35), rgba(10, 24, 40, 0.55));
  cursor: pointer;
  padding: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  contain: layout style;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.cell:hover:not(.has-ship) {
  border-color: rgba(160, 220, 255, 0.55);
  background: linear-gradient(160deg, rgba(50, 110, 170, 0.45), rgba(16, 40, 70, 0.6));
}

.cell.has-ship {
  z-index: 1;
}

/* Tier 1 — brown, plain */
.cell.tier-cell-1 {
  border-color: rgba(160, 110, 60, 0.55);
  background: linear-gradient(160deg, #5a3a22, #2e1c10);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.35);
}

/* Tier 2 — blue, medium */
.cell.tier-cell-2 {
  border-color: rgba(120, 190, 255, 0.7);
  background: linear-gradient(160deg, #2a6cb8, #12365f);
  box-shadow:
    inset 0 0 12px rgba(140, 210, 255, 0.25),
    0 0 10px rgba(60, 140, 255, 0.25);
}

/* Tier 3 — purple, static glow (no infinite animation — GPU friendly) */
.cell.tier-cell-3 {
  border-color: rgba(220, 140, 255, 0.85);
  background: linear-gradient(145deg, #7a2fd0, #3a1070 55%, #1a0838);
  box-shadow:
    inset 0 0 14px rgba(255, 180, 255, 0.28),
    0 0 14px rgba(180, 80, 255, 0.35);
}

.cell.is-selected-ship {
  outline: 2px solid rgba(255, 220, 120, 0.9);
  outline-offset: -2px;
  z-index: 2;
}

.cell.preview-ok {
  border-color: rgba(100, 230, 160, 0.8) !important;
  box-shadow: inset 0 0 14px rgba(120, 255, 180, 0.25) !important;
  animation: none;
}

.cell.preview-bad {
  border-color: rgba(255, 110, 110, 0.85) !important;
  filter: saturate(0.7) brightness(0.85);
  animation: none;
}

.cell.is-dragging {
  transform: scale(0.96);
}

/* Perk diamonds / icons */
.perk {
  position: relative;
  width: 72%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.perk.perk-icon {
  width: 86%;
}

.perk-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
}

.perk-glow {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

.perk-diamond {
  position: relative;
  width: 78%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transform: rotate(45deg);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.25);
}

.perk-diamond b {
  transform: rotate(-45deg);
  font-size: clamp(10px, 2.6vw, 14px);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Tier 1 perk — dull brown */
.perk-t1 .perk-diamond {
  border-color: rgba(210, 160, 100, 0.45);
  background: linear-gradient(135deg, rgba(140, 90, 45, 0.85), rgba(70, 42, 20, 0.9));
  box-shadow: none;
}

.perk-t1 .perk-diamond b {
  color: #f0e0c8;
  text-shadow: none;
}

/* Tier 2 perk — blue, static */
.perk-t2 .perk-glow {
  opacity: 0.45;
  background: radial-gradient(circle, rgba(120, 200, 255, 0.45), transparent 70%);
}

.perk-t2 .perk-diamond {
  border-color: rgba(180, 230, 255, 0.75);
  background: linear-gradient(135deg, rgba(100, 190, 255, 0.95), rgba(30, 90, 180, 0.95));
  box-shadow: 0 0 8px rgba(80, 170, 255, 0.4);
}

.perk-t2 .perk-diamond b {
  color: #f2f9ff;
  text-shadow: 0 0 6px rgba(160, 220, 255, 0.55);
}

/* Tier 3 perk — purple, static (spawn anim only on appear) */
.perk-t3 .perk-glow {
  opacity: 0.7;
  background: radial-gradient(circle, rgba(230, 140, 255, 0.55), transparent 68%);
}

.perk-t3 .perk-diamond {
  border-color: rgba(255, 200, 255, 0.95);
  background:
    linear-gradient(135deg, rgba(220, 140, 255, 0.98), rgba(120, 40, 220, 0.98) 55%, rgba(70, 20, 140, 0.98));
  box-shadow: 0 0 12px rgba(210, 120, 255, 0.65);
}

.perk-t3 .perk-diamond::before {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 55%);
  pointer-events: none;
}

.perk-t3 .perk-diamond b {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 200, 255, 0.75);
}

/* Spawn pop */
.perk.is-spawning {
  animation: perk-spawn 0.42s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.perk-t1.is-spawning {
  animation-duration: 0.28s;
  animation-timing-function: ease-out;
}

.perk-t2.is-spawning {
  animation-duration: 0.38s;
}

.perk-t3.is-spawning {
  animation-duration: 0.55s;
  animation-name: perk-spawn-t3;
}

@keyframes perk-spawn {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-20deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.12) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes perk-spawn-t3 {
  0% {
    opacity: 0;
    transform: scale(0.05) rotate(-40deg);
    filter: brightness(2);
  }
  55% {
    opacity: 1;
    transform: scale(1.28) rotate(8deg);
    filter: brightness(1.6);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
    filter: brightness(1);
  }
}

.place-hint {
  font-size: 12px;
  font-weight: 700;
  color: rgba(180, 210, 255, 0.55);
  text-align: center;
  max-width: 560px;
  line-height: 1.35;
}

#game-disabled {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: #07080c;
}

#game-disabled[hidden] {
  display: none !important;
}

.disabled-card {
  text-align: center;
  padding: 24px;
}

.disabled-card .brand {
  margin-bottom: 10px;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 22px 20px;
  border: 1px solid rgba(140, 190, 255, 0.28);
  background: #101820;
}

.modal-panel h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.modal-lead {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 16px;
  line-height: 1.4;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}

@media (max-width: 860px) {
  .place-status {
    text-align: left;
    max-width: none;
  }

  .arena-top-actions {
    justify-items: stretch;
    width: 100%;
  }

  .arena-leave {
    width: 100%;
  }

  .board {
    --label: 22px;
    gap: 2px;
  }

  .board-label {
    font-size: 10px;
  }

  .board-frame {
    padding: 10px;
  }

  .board-tools {
    grid-template-columns: 1fr 1fr;
  }

  .tool-ready,
  .tool-cancel {
    grid-column: 1 / -1;
  }

  .battle-boards {
    grid-template-columns: 1fr;
  }
}
