.slot-row {
  position: relative;
  z-index: 2;
  width: min(680px, 96%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 28px);
  justify-content: center;
  align-items: end;
}

.slot-wrap {
  position: relative;
  display: grid;
  grid-template-rows: 20px auto;
  gap: 2px;
  min-width: 0;
  padding-top: 0;
}

.slot-button {
  position: relative;
  grid-row: 2;
  width: 100%;
  min-width: 0;
  height: clamp(124px, 19vh, 164px);
  border: 1px solid rgba(80, 200, 255, 0.54);
  background: rgba(4, 10, 18, 0.72);
  color: var(--text);
  padding: 8px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 6px;
  cursor: pointer;
  clip-path: polygon(50% 0, 98% 22%, 98% 78%, 50% 100%, 2% 78%, 2% 22%);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.enemy-zone .slot-button {
  border-color: rgba(255, 75, 67, 0.62);
  box-shadow: inset 0 0 18px rgba(255, 75, 67, 0.1);
}

.player-zone .slot-button {
  border-color: rgba(80, 200, 255, 0.6);
  box-shadow: inset 0 0 18px rgba(80, 200, 255, 0.1);
}

.slot-button:hover,
.slot-button.is-legal {
  transform: translateY(-2px);
  border-color: #ffffff;
  box-shadow: 0 0 22px rgba(120, 220, 255, 0.42), inset 0 0 18px rgba(120, 220, 255, 0.16);
}

.enemy-zone .slot-button.is-legal {
  box-shadow: 0 0 22px rgba(255, 82, 77, 0.5), inset 0 0 18px rgba(255, 82, 77, 0.16);
}

.slot-button.is-selected-target {
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(239, 184, 77, 0.72), inset 0 0 20px rgba(239, 184, 77, 0.18);
}

.slot-button.has-focus-memory {
  border-style: solid;
  box-shadow: 0 0 18px rgba(196, 92, 255, 0.38), inset 0 0 18px rgba(196, 92, 255, 0.12);
}

.slot-button.has-target-lock {
  border-color: rgba(239, 184, 77, 0.9);
  box-shadow: 0 0 24px rgba(239, 184, 77, 0.44), inset 0 0 22px rgba(239, 184, 77, 0.16);
}

.slot-button.has-delayed-threat {
  border-color: rgba(255, 226, 138, 0.92);
  box-shadow: 0 0 24px rgba(255, 226, 138, 0.34), inset 0 0 22px rgba(255, 226, 138, 0.14);
}

.slot-button.has-cutter-threat {
  border-color: rgba(204, 126, 255, 0.94);
  background: linear-gradient(180deg, rgba(64, 20, 92, 0.34), rgba(4, 10, 18, 0.78));
}

.slot-button.has-missile-threat {
  border-color: rgba(255, 116, 82, 0.96);
  background: linear-gradient(180deg, rgba(92, 26, 14, 0.36), rgba(4, 10, 18, 0.78));
}

.slot-button.has-missile-splash {
  border-style: dashed;
  box-shadow: inset 0 0 18px rgba(255, 186, 75, 0.12);
}

.slot-button.is-breached {
  border-color: rgba(255, 181, 80, 0.88);
  box-shadow: 0 0 22px rgba(255, 118, 58, 0.34), inset 0 0 22px rgba(255, 118, 58, 0.14);
}

.slot-button.seal-armor-over-breach {
  border-color: rgba(255, 156, 65, 0.92);
  background: linear-gradient(180deg, rgba(72, 28, 8, 0.34), rgba(4, 10, 18, 0.78));
  box-shadow: 0 0 24px rgba(255, 115, 44, 0.34), inset 0 0 22px rgba(255, 115, 44, 0.16);
}

.slot-button.seal-open-breach {
  border-color: rgba(255, 77, 64, 0.94);
  background: linear-gradient(180deg, rgba(78, 14, 12, 0.44), rgba(4, 10, 18, 0.78));
  box-shadow: 0 0 28px rgba(255, 65, 55, 0.46), inset 0 0 22px rgba(255, 65, 55, 0.18);
}

.slot-button.seal-closed-empty {
  border-color: rgba(92, 151, 176, 0.44);
}

.slot-button.is-recently-sealed {
  border-color: rgba(92, 255, 204, 0.92);
  box-shadow: 0 0 24px rgba(92, 255, 204, 0.42), inset 0 0 22px rgba(92, 255, 204, 0.14);
}

.slot-status-row {
  position: relative;
  grid-row: 1;
  z-index: 9;
  min-width: 0;
  height: 20px;
  min-height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  overflow: visible;
}

.enemy-zone .slot-wrap {
  grid-template-rows: auto 20px;
}

.enemy-zone .slot-button {
  grid-row: 1;
}

.enemy-zone .slot-status-row {
  grid-row: 2;
}

.slot-status-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 1 70px;
  width: 70px;
  min-width: 0;
  max-width: 100%;
  height: 18px;
  padding: 0 4px;
  border: 1px solid currentColor;
  background: rgba(10, 6, 20, 0.92);
  color: #e8b7ff;
  font-size: 0.46rem;
  line-height: 1;
  font-weight: 900;
  border-radius: 3px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 0 14px rgba(196, 92, 255, 0.6);
}

.slot-status-badge.focus {
  border-color: rgba(210, 132, 255, 0.92);
  background: rgba(28, 12, 48, 0.94);
  color: #e8b7ff;
  box-shadow: 0 0 15px rgba(196, 92, 255, 0.6);
}

.slot-status-badge.target-lock {
  border: 1px solid rgba(239, 184, 77, 0.9);
  background: rgba(67, 43, 7, 0.94);
  color: #ffe28a;
  box-shadow: 0 0 16px rgba(239, 184, 77, 0.66);
  animation: lockPulse 1.8s ease-in-out infinite;
}

.slot-status-badge.delayed-cutter {
  border-color: rgba(210, 132, 255, 0.95);
  background: rgba(39, 12, 64, 0.96);
  color: #efd2ff;
  box-shadow: 0 0 16px rgba(196, 92, 255, 0.62);
}

.slot-status-badge.delayed-missile {
  border-color: rgba(255, 116, 82, 0.96);
  background: rgba(74, 22, 11, 0.96);
  color: #ffd4c4;
  box-shadow: 0 0 16px rgba(255, 92, 65, 0.62);
}

.slot-status-badge.missile-splash {
  border-color: rgba(255, 210, 126, 0.9);
  background: rgba(58, 38, 8, 0.92);
  color: #ffe28a;
  box-shadow: 0 0 14px rgba(255, 186, 75, 0.46);
}

.slot-status-badge.covered-breach {
  border-color: rgba(255, 168, 72, 0.94);
  background: rgba(82, 36, 8, 0.94);
  color: #ffc16e;
  box-shadow: 0 0 15px rgba(255, 139, 48, 0.58);
}

.slot-status-badge.open-breach {
  border-color: rgba(255, 92, 78, 0.95);
  background: rgba(78, 14, 12, 0.94);
  color: #ffd1cc;
  box-shadow: 0 0 16px rgba(255, 65, 55, 0.62);
}

.slot-status-badge.sealed {
  border-color: rgba(92, 255, 204, 0.95);
  background: rgba(7, 58, 50, 0.94);
  color: #baffef;
  box-shadow: 0 0 16px rgba(92, 255, 204, 0.62);
}

.slot-fx-stack {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}

.slot-fx-label {
  max-width: calc(100% - 12px);
  padding: 6px 8px;
  border: 1px solid currentColor;
  background: rgba(2, 8, 14, 0.9);
  color: var(--red-soft);
  font-size: 0.72rem;
  line-height: 1.05;
  font-weight: 900;
  text-transform: uppercase;
  text-align: center;
  border-radius: 4px;
  box-shadow: var(--shadow-red);
  overflow-wrap: anywhere;
  animation: fxFloat 2.15s ease-out both;
}

.slot-fx-label.from-human {
  color: var(--blue-soft);
  box-shadow: var(--shadow-blue);
}

.slot-button.fx-attack {
  animation: slotHit 1.25s ease-out both;
}

.slot-button.fx-place {
  animation: slotPlace 1.45s ease-out both;
}

.slot-button.fx-control {
  animation: slotControl 1.55s ease-out both;
}

.slot-button.fx-prep {
  animation: slotPrep 1.55s ease-out both;
}

.slot-button.fx-repair {
  animation: slotRepair 1.55s ease-out both;
}

.slot-button.fx-repair.fx-trap-fx {
  animation-duration: 620ms;
}

.slot-button.fx-attack::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: -8px;
  border: 2px solid currentColor;
  color: var(--red-soft);
  pointer-events: none;
  clip-path: polygon(50% 0, 98% 22%, 98% 78%, 50% 100%, 2% 78%, 2% 22%);
  box-shadow: 0 0 24px currentColor, inset 0 0 20px currentColor;
  animation: targetPulse 1.7s ease-out both;
}

.slot-button.fx-from-human.fx-attack::after {
  color: var(--blue-soft);
}

.slot-button.fx-laser-fx::before {
  content: "";
  position: absolute;
  z-index: 6;
  left: 50%;
  top: -118px;
  --laser-rotation: 12deg;
  width: 9px;
  height: 380px;
  background: linear-gradient(180deg, transparent 0 10%, rgba(255, 144, 144, 0.42), rgba(231, 128, 255, 0.98), rgba(255, 144, 144, 0.34), transparent 90% 100%);
  transform: translateX(-50%) rotate(var(--laser-rotation));
  filter: drop-shadow(0 0 14px rgba(196, 92, 255, 0.95)) drop-shadow(0 0 28px rgba(255, 75, 67, 0.44));
  pointer-events: none;
  animation: laserBeam 1.75s ease-out both;
}

.slot-button.fx-from-human.fx-laser-fx::before {
  --laser-rotation: -12deg;
  background: linear-gradient(180deg, transparent, rgba(80, 220, 255, 0.96), transparent);
  filter: drop-shadow(0 0 10px rgba(80, 200, 255, 0.95));
}

.slot-button.fx-ballistic-fx,
.slot-button.fx-piercing-shot-fx,
.slot-button.fx-double-fx,
.slot-button.fx-explosive-fx {
  box-shadow: 0 0 26px rgba(255, 75, 67, 0.68), inset 0 0 24px rgba(255, 75, 67, 0.2);
}

.slot-button.fx-from-human.fx-ballistic-fx,
.slot-button.fx-from-human.fx-piercing-shot-fx,
.slot-button.fx-from-human.fx-double-fx,
.slot-button.fx-from-human.fx-explosive-fx {
  box-shadow: 0 0 26px rgba(80, 200, 255, 0.68), inset 0 0 24px rgba(80, 200, 255, 0.2);
}

.slot-button.fx-explosive-fx .slot-layers {
  animation: blastShake 1.1s ease-out both;
}

.slot-button.fx-hull-fx {
  border-color: rgba(255, 226, 138, 0.95);
  animation: hullImpact 1.25s ease-out both;
}

.slot-button.fx-from-human.fx-hull-fx {
  border-color: rgba(157, 236, 255, 0.95);
}

.slot-button.fx-hull-fx .slot-layers::after {
  content: "";
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 50%;
  width: 72%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) scale(0.24);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 10%, rgba(255, 226, 138, 0.94) 11% 24%, rgba(255, 92, 65, 0.78) 25% 42%, rgba(255, 92, 65, 0) 64%),
    conic-gradient(from 20deg, rgba(255, 226, 138, 0), rgba(255, 226, 138, 0.9), rgba(255, 92, 65, 0), rgba(255, 255, 255, 0.85), rgba(255, 92, 65, 0));
  box-shadow: 0 0 22px rgba(255, 186, 75, 0.85), 0 0 44px rgba(255, 75, 67, 0.45);
  animation: hullBurst 1.08s ease-out both;
}

.slot-button.fx-from-human.fx-hull-fx .slot-layers::after {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 10%, rgba(157, 236, 255, 0.94) 11% 24%, rgba(80, 200, 255, 0.76) 25% 42%, rgba(80, 200, 255, 0) 64%),
    conic-gradient(from 20deg, rgba(157, 236, 255, 0), rgba(157, 236, 255, 0.9), rgba(80, 200, 255, 0), rgba(255, 255, 255, 0.85), rgba(80, 200, 255, 0));
  box-shadow: 0 0 22px rgba(157, 236, 255, 0.9), 0 0 44px rgba(80, 200, 255, 0.52);
}

.slot-layers {
  position: relative;
  display: grid;
  grid-template-rows: repeat(2, 1fr);
  place-items: center;
  align-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

.layer {
  width: min(88px, 72%);
  aspect-ratio: 1.08;
  min-width: 48px;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  grid-template-areas: "stack";
  place-items: center;
  gap: 2px;
  padding: 8px 9px;
  background: rgba(255, 255, 255, 0.06);
  color: #d6e8f5;
  clip-path: polygon(50% 0, 96% 24%, 96% 76%, 50% 100%, 4% 76%, 4% 24%);
  font-weight: 800;
  font-size: 0.82rem;
  text-align: center;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.72);
  overflow: hidden;
}

.player-zone .layer.armor {
  order: 1;
}

.player-zone .layer.shield-bay {
  order: 2;
}

.enemy-zone .layer.shield-bay {
  order: 1;
}

.enemy-zone .layer.armor {
  order: 2;
}

.layer-value {
  grid-area: stack;
  position: relative;
  z-index: 2;
  min-width: 0;
  max-width: 100%;
  padding: 3px 6px;
  overflow: visible;
  white-space: nowrap;
  background: rgba(2, 7, 13, 0.62);
  color: #f8fdff;
  clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%);
  font-size: 0.9rem;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-shadow: 0 0 9px rgba(0, 0, 0, 0.9);
}

.layer.empty {
  opacity: 0.66;
  border-style: dashed;
  filter: saturate(0.78);
}

.layer-icon {
  grid-area: stack;
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  border: 0;
  color: currentColor;
  font-size: 1.42rem;
  line-height: 1;
  font-weight: 950;
  clip-path: none;
  opacity: 0.46;
  transform: translateY(-1px) scale(1.1);
  text-shadow: 0 0 10px currentColor;
}

.layer.shield-bay {
  border-color: rgba(80, 200, 255, 0.62);
  background: rgba(14, 62, 86, 0.58);
  color: #aeeaff;
}

.layer.shield-bay .layer-value {
  padding-inline: 5px;
  font-size: 0.78rem;
}

.layer.shield-bay.normal-shield {
  border-color: rgba(80, 200, 255, 0.72);
  background: rgba(20, 95, 140, 0.6);
  color: #aeeaff;
}

.layer.shield-bay.is-regenerating {
  animation: shieldRegenLayer 0.92s ease-out both;
}

.layer.shield-bay.is-regenerating .layer-value {
  color: #f4ffff;
  animation: shieldRegenNumber 0.92s ease-out both;
}

.layer.shield-bay.military,
.layer.military {
  border-color: rgba(196, 92, 255, 0.7);
  background: rgba(73, 24, 105, 0.62);
  color: #e4b6ff;
}

@keyframes shieldRegenLayer {
  0% {
    box-shadow: 0 0 0 rgba(80, 220, 255, 0), inset 0 0 0 rgba(80, 220, 255, 0);
    filter: brightness(1);
  }
  38% {
    box-shadow: 0 0 28px rgba(80, 220, 255, 0.82), inset 0 0 18px rgba(80, 220, 255, 0.22);
    filter: brightness(1.32);
  }
  100% {
    box-shadow: 0 0 12px rgba(80, 220, 255, 0.38), inset 0 0 10px rgba(80, 220, 255, 0.1);
    filter: brightness(1.04);
  }
}

@keyframes shieldRegenNumber {
  0% {
    transform: scale(0.94);
    background: rgba(2, 7, 13, 0.62);
  }
  42% {
    transform: scale(1.12);
    background: rgba(66, 218, 255, 0.34);
    text-shadow: 0 0 12px rgba(170, 250, 255, 0.9), 0 0 9px rgba(0, 0, 0, 0.9);
  }
  100% {
    transform: scale(1);
    background: rgba(2, 7, 13, 0.62);
  }
}

.layer.is-layer-candidate {
  border-color: rgba(255, 255, 255, 0.98);
  color: #ffffff;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18), transparent 58%),
    linear-gradient(180deg, rgba(38, 122, 152, 0.74), rgba(10, 32, 48, 0.9));
  box-shadow:
    0 0 22px rgba(120, 220, 255, 0.72),
    inset 0 0 20px rgba(120, 220, 255, 0.22);
}

.layer.armor.is-layer-candidate {
  border-color: rgba(255, 226, 138, 0.98);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 226, 138, 0.2), transparent 58%),
    linear-gradient(180deg, rgba(112, 70, 14, 0.82), rgba(38, 22, 6, 0.92));
  box-shadow:
    0 0 24px rgba(255, 190, 74, 0.74),
    inset 0 0 20px rgba(255, 226, 138, 0.2);
}

.layer.shield-bay.is-layer-candidate {
  border-color: rgba(220, 170, 255, 0.98);
  background:
    radial-gradient(circle at 50% 50%, rgba(220, 170, 255, 0.22), transparent 58%),
    linear-gradient(180deg, rgba(82, 32, 122, 0.84), rgba(28, 9, 44, 0.92));
  box-shadow:
    0 0 24px rgba(196, 92, 255, 0.74),
    inset 0 0 20px rgba(220, 170, 255, 0.2);
}

.layer.shield,
.layer.shield-bay.normal-shield.is-layer-candidate {
  border-color: rgba(80, 200, 255, 0.72);
  background: rgba(20, 95, 140, 0.58);
  color: #aeeaff;
}

.layer.layer--orphan-shield {
  border-style: dashed;
  opacity: 0.58;
  filter: saturate(0.55);
  background: repeating-linear-gradient(
    135deg,
    rgba(80, 200, 255, 0.14) 0 8px,
    rgba(80, 200, 255, 0.04) 8px 16px
  );
  color: #bdd4dc;
}

.layer.layer--orphan-shield .layer-icon {
  opacity: 0.72;
}

.layer-marker {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(255, 226, 138, 0.86);
  border-radius: 50%;
  color: #ffe28a;
  font-size: 0.62rem;
  line-height: 1;
  box-shadow: 0 0 10px rgba(239, 184, 77, 0.48);
}

.layer.armor {
  border-color: rgba(239, 184, 77, 0.78);
  background: rgba(116, 72, 14, 0.66);
  color: #ffe0a1;
}
