:root {
  color-scheme: dark;
  --bg: #050b14;
  --panel: rgba(9, 19, 34, 0.88);
  --ink: #e6f4ff;
  --muted: #8fa7ba;
  --line: rgba(120, 185, 229, 0.28);
  --accent: #f08b4f;
  --accent-2: #53d6ff;
  --danger: #ff6b6b;
  --good: #74e6a8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(5, 10, 20, 0.72), rgba(5, 10, 20, 0.88)),
    url("/image_assets/SpaceBG.png"),
    radial-gradient(circle at top left, rgba(83, 214, 255, 0.24), transparent 32%),
    radial-gradient(circle at 80% 15%, rgba(240, 139, 79, 0.16), transparent 30%),
    linear-gradient(180deg, #08182a 0%, var(--bg) 100%);
  background-attachment: fixed;
  background-size: cover;
}

button,
input,
select {
  font: inherit;
}

.shell {
  min-height: 100vh;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.topbar h1,
.panel h2 {
  margin: 0 0 6px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.version-line {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--accent-2);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line);
  background: rgba(16, 35, 58, 0.9);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

button.primary {
  background: var(--accent);
  color: #101018;
  border-color: var(--accent);
}

button.secondary {
  background: var(--accent-2);
  color: #06111c;
  border-color: var(--accent-2);
}

button.toggle-on {
  box-shadow: 0 0 0 2px rgba(47, 98, 115, 0.18);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr);
  gap: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32), inset 0 0 28px rgba(83, 214, 255, 0.035);
  backdrop-filter: blur(10px);
}

.hidden {
  display: none;
}

.rules-panel h3 {
  margin: 14px 0 8px;
  color: var(--accent-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.88rem;
}

.rules-panel p {
  color: var(--muted);
  line-height: 1.4;
  margin: 8px 0;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
  font-size: 0.95rem;
}

.help-table th,
.help-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.help-table th {
  color: #06111c;
  background: var(--accent-2);
  font-weight: 700;
}

.help-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.05);
}

.help-table.compact {
  font-size: 0.82rem;
}

.help-table.compact th,
.help-table.compact td {
  padding: 7px 8px;
}

.help-table tr:last-child td {
  border-bottom: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.status-line {
  font-size: 0.95rem;
  color: var(--muted);
}

.control-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(83, 214, 255, 0.12);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 0.94rem;
}

.map-scroll {
  overflow: auto;
  max-width: 100%;
  max-height: 78vh;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.map-scroll.panning { cursor: grabbing; user-select: none; }  /* shift + left-drag panning */

.map-panel svg {
  width: 3680px;
  height: 2210px;
  display: block;
  background:
    linear-gradient(rgba(4, 10, 18, 0.42), rgba(4, 10, 18, 0.52)),
    url("/image_assets/SpaceBG.png"),
    radial-gradient(circle at top, rgba(83,214,255,0.2), transparent 30%),
    linear-gradient(180deg, #071525 0%, #020711 100%);
  background-size: cover;
}

.ship-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 4px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(2, 10, 20, 0.82);
  color: var(--ink);
}

.log-panel {
  min-height: 220px;
}

#log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.log-entry {
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}

.muted {
  color: var(--muted);
}

.map-label {
  font-size: 12px;
  fill: rgba(255, 255, 255, 0.9);
}

.damage-label {
  font-size: 11px;
  fill: #ffd7aa;
}

.coord-label {
  font-size: 9px;
  fill: rgba(201, 219, 227, 0.45);
}

.hex {
  fill: rgba(83, 214, 255, 0.018);
  stroke: rgba(130, 219, 255, 0.24);
}

/* Only the plain circle fallback gets softened; authored shield art renders crisp. */
.shield-glow-soft {
  filter: blur(7px);
}

.terrain {
  filter: drop-shadow(0 0 9px rgba(255, 209, 140, 0.26));
}

.terrain-vector {
  stroke: rgba(255, 208, 140, 0.85);
  stroke-width: 3;
  stroke-dasharray: 8 6;
}

.terrain-label {
  font-size: 11px;
  fill: rgba(255, 232, 194, 0.95);
}

.chaff-cloud {
  opacity: 0.6;
  filter: drop-shadow(0 0 7px rgba(200, 220, 235, 0.4));
}

.chaff-puff {
  fill: rgba(216, 230, 240, 0.95);
  stroke: rgba(188, 206, 220, 0.55);
  stroke-width: 0.5;
}

.chaff-label {
  font-size: 13px;
  font-weight: 700;
  fill: #2c3c46;
}

.explosion-marker {
  fill: rgba(255, 128, 66, 0.95);
  stroke: rgba(255, 235, 199, 0.95);
  stroke-width: 2;
}

.ship-token {
  filter: drop-shadow(0 0 10px rgba(83, 214, 255, 0.42));
}

.ship-engine {
  transform-origin: center;
  animation: shipEnginePulse 0.9s ease-in-out infinite;
}

@keyframes shipEnginePulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.ship-token.active {
  filter: drop-shadow(0 0 14px rgba(255, 211, 110, 0.78));
}

.missile-token.playback {
  filter: drop-shadow(0 0 14px rgba(255, 199, 83, 0.95));
}

.preview-token {
  opacity: 0.92;
  filter: drop-shadow(0 0 7px rgba(103, 214, 255, 0.6));
}

.vector-line {
  stroke: rgba(255, 248, 222, 0.85);
  stroke-width: 3;
  stroke-dasharray: 8 6;
}

.vector-line.side-a {
  stroke: rgba(90, 209, 255, 0.92);
}

.vector-line.side-b {
  stroke: rgba(255, 120, 90, 0.92);
}

.missile-token {
  filter: drop-shadow(0 0 8px rgba(255, 211, 110, 0.8));
}


.weapon-arc-outline {
  fill: none;
  stroke: rgba(120, 215, 255, 0.85);
  stroke-width: 2.5;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  pointer-events: none;
}

.preview-line {
  stroke: rgba(103, 214, 255, 0.92);
  stroke-width: 3;
  stroke-dasharray: 10 7;
}

.preview-ring {
  fill: rgba(103, 214, 255, 0.08);
  stroke: rgba(103, 214, 255, 0.8);
  stroke-width: 2;
}

.preview-label {
  font-size: 12px;
  fill: rgba(197, 239, 255, 0.98);
}

.inline-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

/* Scale these around each element's own centre, not the map origin, so bursts stay on their hex. */
.effect-fire,
.effect-impact,
.effect-explosion,
.effect-miss,
.effect-explosion-ring,
.effect-missile-hit,
.effect-missile-hit-ring,
.effect-missile-intercept,
.effect-missile-intercept-ring {
  transform-box: fill-box;
}

.effect-fire {
  fill: rgba(255, 214, 102, 0.9);
  stroke: rgba(255, 247, 213, 0.8);
  stroke-width: 2;
  animation: effectFire 0.5s ease-out forwards;
  transform-origin: center;
}

.effect-impact {
  fill: rgba(255, 137, 76, 0.8);
  stroke: rgba(255, 233, 196, 0.9);
  stroke-width: 2;
  animation: effectImpact 0.75s ease-out forwards;
  transform-origin: center;
}

.effect-explosion {
  fill: rgba(255, 101, 63, 0.92);
  stroke: rgba(255, 237, 193, 0.95);
  stroke-width: 3;
  animation: effectExplosion 1.1s ease-out forwards;
  transform-origin: center;
}

.effect-miss {
  fill: rgba(0, 0, 0, 0);
  stroke: rgba(191, 231, 247, 0.85);
  stroke-width: 3;
  animation: effectMiss 0.65s ease-out forwards;
  transform-origin: center;
}

.effect-explosion-ring {
  fill: rgba(0,0,0,0);
  stroke: rgba(255, 181, 111, 0.95);
  stroke-width: 3;
  animation: effectExplosionRing 0.9s ease-out forwards;
  transform-origin: center;
}

.effect-beam-hit {
  stroke: rgba(255, 215, 120, 0.95);
  stroke-width: 5;
  stroke-linecap: round;
  animation: effectBeamHit 0.32s ease-out forwards;
}

.effect-beam-miss {
  stroke: rgba(173, 228, 247, 0.9);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 18 12;
  animation: effectBeamMiss 0.28s ease-out forwards;
}

.effect-projectile-hit,
.effect-projectile-miss {
  opacity: 0;
  animation: effectProjectile 0.32s linear forwards;
}

.effect-projectile-hit {
  fill: #ffd77e;
}

.effect-projectile-miss {
  fill: #b9e6f3;
}

.effect-missile-hit {
  fill: rgba(255, 95, 47, 0.88);
  stroke: rgba(255, 240, 184, 0.95);
  stroke-width: 3;
  animation: effectMissileHit 0.85s ease-out forwards;
  transform-origin: center;
}

.effect-missile-hit-ring {
  fill: rgba(0, 0, 0, 0);
  stroke: rgba(255, 186, 92, 0.95);
  stroke-width: 4;
  animation: effectMissileHitRing 0.85s ease-out forwards;
  transform-origin: center;
}

.effect-missile-intercept {
  fill: rgba(255, 218, 107, 0.9);
  stroke: rgba(194, 239, 255, 0.95);
  stroke-width: 2.5;
  animation: effectMissileIntercept 0.65s ease-out forwards;
  transform-origin: center;
}

.effect-missile-intercept-ring {
  fill: rgba(0, 0, 0, 0);
  stroke: rgba(174, 232, 255, 0.88);
  stroke-width: 3;
  stroke-dasharray: 7 5;
  animation: effectMissileInterceptRing 0.65s ease-out forwards;
  transform-origin: center;
}

@keyframes effectFire {
  0% {
    opacity: 0.95;
    transform: scale(0.35);
  }
  100% {
    opacity: 0;
    transform: scale(1.4);
  }
}

@keyframes effectImpact {
  0% {
    opacity: 0.95;
    transform: scale(0.25);
  }
  70% {
    opacity: 0.85;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes effectExplosion {
  0% {
    opacity: 1;
    transform: scale(0.3);
  }
  40% {
    opacity: 0.95;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes effectMiss {
  0% {
    opacity: 0.9;
    transform: scale(0.6);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes effectExplosionRing {
  0% {
    opacity: 0.95;
    transform: scale(0.35);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes effectBeamHit {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes effectBeamMiss {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@keyframes effectProjectile {
  0% {
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes effectMissileHit {
  0% {
    opacity: 1;
    transform: scale(0.2);
  }
  45% {
    opacity: 0.95;
    transform: scale(1.25);
  }
  100% {
    opacity: 0;
    transform: scale(1.9);
  }
}

@keyframes effectMissileHitRing {
  0% {
    opacity: 0.95;
    transform: scale(0.35);
  }
  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

@keyframes effectMissileIntercept {
  0% {
    opacity: 1;
    transform: scale(0.25);
  }
  55% {
    opacity: 0.9;
    transform: scale(1.05);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes effectMissileInterceptRing {
  0% {
    opacity: 0.95;
    transform: scale(0.3);
  }
  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ===== Power Allocation panel ===== */
.alloc-panel {
  background: linear-gradient(155deg, #56697e 0%, #25323f 38%, #1c2733 62%, #46566b 100%);
  padding: 3px;
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.alloc-inner {
  background: radial-gradient(120% 90% at 50% -15%, #12253a 0%, #0a1421 72%);
  border: 1px solid rgba(120, 165, 205, 0.14);
  border-radius: 13px;
  padding: 16px 16px 18px;
}

.alloc-header {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #eaf4ff;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(120, 170, 210, 0.18);
}

.alloc-bolt {
  filter: drop-shadow(0 0 6px rgba(94, 200, 240, 0.7));
}

.alloc-unassigned {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 15px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: rgba(20, 42, 31, 0.55);
  border: 1px solid rgba(93, 240, 138, 0.42);
  box-shadow: inset 0 0 18px rgba(93, 240, 138, 0.12), 0 0 14px rgba(93, 240, 138, 0.14);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.alloc-unassigned.over {
  background: rgba(46, 20, 20, 0.5);
  border-color: rgba(255, 107, 107, 0.55);
  box-shadow: inset 0 0 18px rgba(255, 107, 107, 0.14);
}

.alloc-unassigned-label {
  color: #cfe9d8;
  text-transform: uppercase;
}

.alloc-unassigned-value {
  margin-left: auto;
  font-size: 1.18rem;
  text-shadow: 0 0 10px rgba(93, 240, 138, 0.6);
}

.alloc-row {
  margin-bottom: 13px;
}

.alloc-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.alloc-label {
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #eaf4ff;
  font-size: 1.0rem;
}

.alloc-label em {
  font-style: normal;
  font-weight: 600;
  color: #9fc0d6;
}

.alloc-slider {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alloc-step {
  flex: none;
  width: 44px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(120, 170, 210, 0.28);
  background: linear-gradient(180deg, #1b2d3f, #11202e);
  color: #cfe6f5;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.alloc-step:hover:not(:disabled) {
  border-color: rgba(94, 200, 240, 0.6);
  color: #f0faff;
}

.alloc-step:disabled {
  opacity: 0.3;
  cursor: default;
}

.alloc-track {
  position: relative;
  flex: 1;
  display: flex;
  gap: 3px;
  height: 30px;
  padding: 4px;
  border-radius: 8px;
  background: #0a1825;
  border: 1px solid rgba(120, 170, 210, 0.2);
}

.alloc-seg {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 3px;
  background: #16293b;
  cursor: pointer;
  padding: 0;
}

.alloc-seg.on {
  background: linear-gradient(180deg, #74d4f6, #3aa9e0);
  box-shadow: 0 0 8px rgba(94, 200, 240, 0.45);
}

.alloc-seg:hover {
  outline: 1px solid rgba(94, 200, 240, 0.55);
  outline-offset: -1px;
}

.alloc-handle {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 11px;
  margin-left: -6px;
  border-radius: 4px;
  background: linear-gradient(180deg, #eaf4fc, #a6c8df);
  box-shadow: 0 0 9px rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.alloc-overboost-wrap {
  margin: 16px 0 14px;
}

select.alloc-overboost {
  width: 100%;
  height: 44px;
  border-radius: 9px;
  background: #0c1a28;
  border: 1px solid rgba(120, 170, 210, 0.28);
  color: #dcebf8;
  padding: 0 14px;
  font-weight: 600;
}

.alloc-confirm {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #f4a65d, #e07f2e);
  color: #2a1607;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(224, 127, 46, 0.35);
}

.alloc-confirm:hover {
  filter: brightness(1.06);
}

.alloc-confirm:active {
  transform: translateY(1px);
}

/* ===== Rules panel as a map overlay ===== */
.rules-panel:not(.hidden) {
  position: fixed;
  top: 84px;
  left: 20px;
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 108px);
  overflow: auto;
  z-index: 60;
  background: rgba(8, 17, 30, 0.96);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.62);
}

.rules-list {
  margin: 8px 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.5;
}

.rules-list li {
  margin: 7px 0;
}

.rules-list strong {
  color: var(--ink);
}

/* ===== Movement panel ===== */
.move-panel {
  background: linear-gradient(155deg, #56697e 0%, #25323f 38%, #1c2733 62%, #46566b 100%);
  padding: 3px;
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.move-inner {
  background: radial-gradient(120% 90% at 50% -15%, #12253a 0%, #0a1421 72%);
  border: 1px solid rgba(120, 165, 205, 0.14);
  border-radius: 13px;
  padding: 16px;
}

.move-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(120, 170, 210, 0.18);
}

.move-header-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #eaf4ff;
}

.move-rocket {
  filter: drop-shadow(0 0 6px rgba(94, 200, 240, 0.6));
}

.move-info {
  width: 26px;
  height: 26px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(120, 170, 210, 0.4);
  background: rgba(12, 26, 40, 0.8);
  color: #9fc0d6;
  font-style: italic;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer;
}

.move-info:hover {
  color: #eaf6ff;
  border-color: rgba(94, 200, 240, 0.7);
}

.move-timeline {
  border: 1px solid rgba(74, 200, 170, 0.35);
  border-radius: 11px;
  background: rgba(14, 34, 34, 0.4);
  padding: 9px 10px;
  margin-bottom: 12px;
}

.move-timeline-head {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  font-size: 0.84rem;
  color: #d4e7f2;
  margin-bottom: 7px;
}

.move-slot-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.move-slot-row:last-of-type {
  margin-bottom: 0;
}

.move-plus {
  color: #5a7488;
  font-weight: 700;
  flex: none;
}

.move-slot {
  position: relative;
  flex: 1;
  height: 38px;
  border-radius: 7px;
  background: #122738;
  border: 1px solid rgba(120, 170, 210, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bfe0f4;
}

.move-slot.empty {
  background: rgba(18, 39, 56, 0.5);
  border-style: dashed;
  opacity: 0.55;
}

.move-slot svg {
  width: 24px;
  height: 24px;
}

.move-num {
  position: absolute;
  top: 1px;
  left: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #7f9bb0;
}

.move-remaining {
  text-align: center;
  margin-bottom: 12px;
}

.move-remaining-head {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  font-weight: 700;
  color: #8fb0c6;
  margin-bottom: 2px;
}

.move-remaining-counts {
  display: flex;
  justify-content: center;
  gap: 26px;
  font-size: 0.98rem;
  font-weight: 600;
  color: #b9d4e6;
}

.move-remaining-count b {
  color: #eaf6ff;
  font-weight: 800;
}

.move-remaining-count.spent,
.move-remaining-count.spent b {
  color: #f0954a;
}

.move-pad {
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  grid-template-areas:
    "rev   rev   rev"
    "rotL  ship  rotR"
    "lblL  ship  lblR"
    "portT ship  stbdT"
    "accel accel accel";
  gap: 7px;
  align-items: stretch;
  margin: 4px 0 14px;
}

.move-ship-cell {
  grid-area: ship;
  display: flex;
  justify-content: center;
  align-items: center;
}

.move-side-label {
  align-self: center;
  text-align: center;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8fb0c6;
}

.move-side-label.lblL { grid-area: lblL; }
.move-side-label.lblR { grid-area: lblR; }

.move-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 0;
  padding: 4px 6px;
  border-radius: 9px;
  background: linear-gradient(180deg, #16283a, #0e1d2b);
  border: 1.5px solid rgba(150, 175, 200, 0.4);
  color: #cdd9e6;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
}

.move-btn svg {
  width: 30px;
  height: 30px;
}

.move-btn:hover:not(:disabled) {
  filter: brightness(1.14);
}

.move-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.move-btn.rotL { grid-area: rotL; }
.move-btn.rev { grid-area: rev; }
.move-btn.rotR { grid-area: rotR; }
.move-btn.portT { grid-area: portT; }
.move-btn.stbdT { grid-area: stbdT; }
.move-btn.accel { grid-area: accel; }

.move-btn.rev,
.move-btn.accel {
  flex-direction: row;
  gap: 9px;
}

.move-footer {
  display: flex;
  gap: 8px;
}

.move-footer button {
  flex: 1;
  height: 38px;
  border-radius: 9px;
  border: 1px solid rgba(120, 170, 210, 0.3);
  background: #0e1c2a;
  color: #dcebf8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
  cursor: pointer;
}

.move-footer button:hover {
  border-color: rgba(94, 200, 240, 0.6);
}

.move-footer .move-commit {
  flex: 1.25;
  border: none;
  background: linear-gradient(180deg, #f4a65d, #e07f2e);
  color: #2a1607;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(224, 127, 46, 0.32);
}

/* ===== Weapons / fire panel ===== */
.fire-panel {
  background: linear-gradient(155deg, #56697e 0%, #25323f 38%, #1c2733 62%, #46566b 100%);
  padding: 3px;
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.fire-inner {
  background: radial-gradient(120% 90% at 50% -15%, #12253a 0%, #0a1421 72%);
  border: 1px solid rgba(120, 165, 205, 0.14);
  border-radius: 13px;
  padding: 16px;
}

.fire-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(120, 170, 210, 0.18);
}

.fire-header-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.18rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #eaf4ff;
}

.fire-header-title svg {
  width: 22px;
  height: 22px;
  color: #5ec8f0;
  filter: drop-shadow(0 0 5px rgba(94, 200, 240, 0.5));
}

.fire-info-btn {
  width: 26px;
  height: 26px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(120, 170, 210, 0.4);
  background: rgba(12, 26, 40, 0.8);
  color: #9fc0d6;
  font-style: italic;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  cursor: pointer;
}

.fire-section {
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}

.fire-section.offense,
.fire-section.queue {
  background: rgba(240, 139, 79, 0.07);
  border: 1px solid rgba(240, 139, 79, 0.42);
}

.fire-section.pd {
  background: rgba(74, 200, 170, 0.07);
  border: 1px solid rgba(74, 200, 170, 0.38);
}

.fire-section-head {
  position: relative;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 11px;
}

.fire-section.offense > .fire-section-head,
.fire-section.queue > .fire-section-head {
  color: #f6a45f;
}

.fire-section.pd > .fire-section-head {
  color: #6fdccb;
}

.fire-section-head > svg {
  width: 20px;
  height: 20px;
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
}

.fire-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.fire-selectors label {
  font-size: 0.85rem;
  color: #b9c9d6;
  margin-bottom: 4px;
}

select.fire-weapon,
select.fire-target {
  width: 100%;
  height: 42px;
  border-radius: 9px;
  background: #0c1a26;
  border: 1px solid rgba(120, 170, 210, 0.3);
  color: #eaf4ff;
  padding: 0 10px;
  font-weight: 600;
}

.fire-info {
  text-align: center;
  color: #b9c9d6;
  font-size: 0.95rem;
  margin-bottom: 10px;
}

.fire-info b {
  color: #f6a45f;
}

.fire-info .sep {
  color: #5a7488;
  margin: 0 6px;
}

.fire-power {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b9c9d6;
  font-size: 0.82rem;
  margin-bottom: 9px;
}

.fire-power > span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  white-space: nowrap;
}

.fire-pips {
  display: flex;
  gap: 3px;
  flex: 1;
}

.fire-pip {
  flex: 1;
  max-width: 14px;
  height: 14px;
  border-radius: 2px;
  background: #13283a;
  border: 1px solid rgba(120, 170, 210, 0.2);
}

.fire-pip.on {
  background: linear-gradient(180deg, #f4a65d, #e07f2e);
  border-color: #e07f2e;
}

.fire-power.over .fire-pip.on {
  background: #ff6b6b;
  border-color: #ff6b6b;
}

.fire-power b {
  color: #eaf6ff;
}

.fire-power.over b {
  color: #ff6b6b;
}

.fire-primary,
.fire-commit {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 9px;
  background: linear-gradient(180deg, #f4a65d, #e07f2e);
  color: #2a1607;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1.05rem;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(224, 127, 46, 0.3);
}

.fire-primary:disabled {
  opacity: 0.4;
  cursor: default;
  box-shadow: none;
  filter: saturate(0.6);
}

.fire-commit {
  margin-top: 8px;
}

.shot-list {
  margin-bottom: 8px;
}

.shot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
}

.shot-icon {
  flex: none;
  display: inline-flex;
  color: #f0954a;
}

.shot-icon svg {
  width: 18px;
  height: 18px;
}

.shot-text {
  flex: 1;
  color: #e6f0f8;
  font-size: 0.92rem;
}

.shot-text em {
  color: #8fb0c6;
  font-style: normal;
}

.shot-undo {
  flex: none;
  height: 26px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid rgba(120, 170, 210, 0.35);
  background: #0e1c2a;
  color: #b9d4e6;
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
}

.shot-empty {
  color: #7f9bb0;
  text-align: center;
  padding: 8px 0;
}

.pd-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pd-title svg {
  width: 18px;
  height: 18px;
}

.pd-ammo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin-bottom: 10px;
}

.pd-ammo em {
  font-style: normal;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #7fb3a8;
  margin-right: 6px;
  letter-spacing: 0.04em;
}

.pd-pip {
  width: 6px;
  height: 13px;
  border-radius: 2px;
  background: #16323a;
}

.pd-pip.on {
  background: linear-gradient(180deg, #5fe0c8, #34b89e);
  box-shadow: 0 0 5px rgba(74, 200, 170, 0.5);
}

.pd-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  border-top: 1px solid rgba(74, 200, 170, 0.16);
}

.pd-row:first-of-type {
  border-top: none;
}

.pd-side {
  width: 56px;
  flex: none;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: #b9c9d6;
}

.pd-modes {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

.pd-mode {
  flex: none;
  width: 62px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(120, 170, 210, 0.3);
  background: #0e1f2a;
  color: #9fc0d6;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
}

.pd-mode.active {
  border-color: #f0954a;
  background: rgba(240, 139, 79, 0.16);
  color: #ffcca0;
}

.pd-mode:hover:not(:disabled) {
  border-color: rgba(94, 200, 240, 0.6);
}

.pd-mode:disabled {
  opacity: 0.3;
  cursor: default;
}

.pd-row.offline .pd-side {
  opacity: 0.4;
}

.fire-endphase {
  width: 100%;
  height: 46px;
  margin-bottom: 12px;
  border-radius: 9px;
  border: 1px solid rgba(120, 170, 210, 0.35);
  background: #0e1c2a;
  color: #dcebf8;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1rem;
  text-transform: uppercase;
  cursor: pointer;
}

.fire-endphase:hover {
  border-color: rgba(94, 200, 240, 0.6);
}

.fire-endphase.done {
  border: none;
  background: linear-gradient(180deg, #f4a65d, #e07f2e);
  color: #2a1607;
  box-shadow: 0 5px 14px rgba(224, 127, 46, 0.3);
}

/* ===== Ship status cards ===== */
.ship-status-card {
  background: radial-gradient(120% 130% at 50% -20%, #13263a 0%, #0a1421 78%);
  border: 1px solid rgba(120, 165, 205, 0.16);
  border-left-width: 4px;
  border-radius: 12px;
  padding: 11px 12px;
}

.ship-status-card.blue { border-left-color: #5ad1ff; }
.ship-status-card.red { border-left-color: #ff9b7a; }
.ship-status-card.neutral { border-left-color: #8fb0c6; }

.ship-status-card.active {
  box-shadow: 0 0 0 1px rgba(255, 211, 110, 0.5), 0 0 18px rgba(255, 211, 110, 0.15);
}

.ship-status-card.destroyed {
  opacity: 0.5;
  filter: grayscale(0.6);
}

.card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-nm {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ship-status-card.blue .card-nm { color: #9fe2ff; }
.ship-status-card.red .card-nm { color: #ffc2ab; }
.ship-status-card.neutral .card-nm { color: #dceaf4; }

.card-ship {
  width: 20px;
  height: 20px;
}

.card-ctrl {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9fc0d6;
  border: 1px solid rgba(120, 170, 210, 0.3);
  border-radius: 999px;
  padding: 2px 8px;
}

.card-sh {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-sh .card-l {
  width: 46px;
  flex: none;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8fb0c6;
}

.card-bar {
  flex: 1;
  height: 9px;
  border-radius: 5px;
  background: #10232f;
  overflow: hidden;
}

.card-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #3aa9e0, #74d4f6);
}

.card-sh.offline .card-bar i {
  background: rgba(140, 160, 175, 0.45);
}

.card-shv {
  width: 64px;
  flex: none;
  text-align: right;
  font-size: 0.78rem;
  font-weight: 800;
  color: #cfeaff;
}

.card-off {
  color: #ff9b6b;
  font-size: 0.66rem;
}

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 9px;
  font-size: 0.78rem;
}

.card-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #8fb0c6;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.card-stat b {
  color: #e6f2fb;
  font-weight: 800;
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.card-stat b.warn {
  color: #f0954a;
}

.card-pip {
  width: 5px;
  height: 11px;
  border-radius: 2px;
  background: #1a2c3c;
}

.card-pip.rc {
  background: linear-gradient(180deg, #f6c267, #dd9226);
}

.card-pip.pd {
  background: linear-gradient(180deg, #5fe0c8, #34b89e);
}

.card-sides {
  border-top: 1px solid rgba(120, 170, 210, 0.14);
}

.card-sr {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(120, 170, 210, 0.07);
}

.card-sr:last-child {
  border-bottom: none;
}

.card-sn {
  width: 40px;
  flex: none;
  font-weight: 800;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #8fb0c6;
}

.card-hv {
  width: 42px;
  flex: none;
  font-weight: 800;
  font-size: 0.78rem;
}

.card-hv small {
  opacity: 0.55;
  font-weight: 700;
}

.card-hv.g { color: #74e6a8; }
.card-hv.y { color: #f0b24a; }
.card-hv.r { color: #ff6b6b; }

.card-sw {
  flex: 1;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.card-wc {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #cdd9e6;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(120, 170, 210, 0.22);
  border-radius: 5px;
  padding: 2px 6px;
}

.card-wc b {
  color: #9fe2ff;
}

.card-wc.dead {
  text-decoration: line-through;
  opacity: 0.45;
}

.card-none {
  color: #52697b;
  font-size: 0.78rem;
}

/* ===== Map status bars (header) ===== */
.map-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.ms-side {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.ms-right {
  align-items: flex-end;
}

.ms-center {
  color: #9fc0d6;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  white-space: nowrap;
  padding-top: 4px;
  flex: none;
}

.ms-ship {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
}

.ms-right .ms-ship {
  flex-direction: row-reverse;
}

.ms-name {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.ms-ship.side-a .ms-name {
  color: #9fe2ff;
}

.ms-ship.side-b .ms-name {
  color: #ffc2ab;
}

.ms-ship.active .ms-name {
  text-shadow: 0 0 9px rgba(255, 211, 110, 0.7);
}

.ms-ship.dead {
  opacity: 0.4;
  filter: grayscale(0.6);
}

.ms-bar {
  width: 64px;
  height: 8px;
  border-radius: 4px;
  background: #0e1f2a;
  border: 1px solid rgba(120, 170, 210, 0.18);
  overflow: hidden;
  flex: none;
}

.ms-bar i {
  display: block;
  height: 100%;
}

.ms-bar.shields i {
  background: linear-gradient(90deg, #3aa9e0, #74d4f6);
}

.ms-bar.hull i {
  background: linear-gradient(90deg, #3fa86a, #74e6a8);
}

/* PD chip on ship-card side rows */
.card-pd {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #7fe0cc;
  background: rgba(95, 224, 200, 0.08);
  border: 1px solid rgba(95, 224, 200, 0.32);
  border-radius: 5px;
  padding: 2px 6px;
}

.card-pd.dead {
  color: #708595;
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(120, 150, 165, 0.3);
  text-decoration: line-through;
  opacity: 0.55;
}

/* Stack the shields/hull bars in the map status header */
.ms-gauges {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Firing side: a small grey smoke puff */
.effect-smoke {
  fill: rgba(150, 162, 173, 0.5);
  stroke: rgba(180, 190, 200, 0.35);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: effectSmoke 0.6s ease-out forwards;
}

@keyframes effectSmoke {
  0% { opacity: 0.7; transform: scale(0.45); }
  100% { opacity: 0; transform: scale(1.7); }
}

/* Hit side: a fire-colored burst with an expanding ring */
.effect-impact-ring {
  fill: none;
  stroke: rgba(255, 168, 76, 0.95);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  animation: effectExplosionRing 0.75s ease-out forwards;
}

/* Combat headline in the map status centre */
.ms-center.headline {
  color: #ffd36e;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(255, 211, 110, 0.55);
}

/* Off-map move preview warning */
.preview-line.danger {
  stroke: rgba(255, 90, 80, 0.95);
}

.preview-ring.danger {
  fill: rgba(255, 90, 80, 0.14);
  stroke: rgba(255, 90, 80, 0.95);
}

.preview-label.danger {
  fill: #ff8a7a;
  font-weight: 800;
  font-size: 16px;
}

/* ===== Wall tiles (tutorial corridor) ===== */
.wall-tile {
  fill: #2a3340;
  stroke: #46566a;
  stroke-width: 2;
}

/* ===== Tutorial overlay + spotlight ===== */
.tutorial-overlay {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 1000;
  max-width: 420px;
  pointer-events: none;
}

.tutorial-overlay.hidden { display: none; }

.tutorial-overlay .tut-card {
  pointer-events: auto;
  background: radial-gradient(120% 130% at 0% 0%, #13314a, #0a1726 80%);
  border: 1px solid rgba(94, 200, 240, 0.45);
  border-left: 4px solid #5ec8f0;
  border-radius: 12px;
  padding: 13px 15px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 24px rgba(94, 200, 240, 0.18);
  color: #e6f4ff;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
}

.tut-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.tut-speaker {
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: #6fe0ff; font-size: 0.95rem;
}
.tut-stage { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #8fb0c6; }
.tut-say { margin: 0 0 8px; line-height: 1.45; font-size: 0.95rem; }
.tut-hint { margin: 0; font-weight: 700; color: #ffd36e; font-size: 0.9rem; }
.tut-reprompt { margin: 6px 0 0; color: #ff9b6b; font-weight: 700; font-size: 0.9rem; min-height: 0; }
.tut-reprompt:empty { display: none; }
.tut-actions { margin-top: 10px; display: flex; gap: 8px; }
.tut-actions:empty { display: none; }
.tut-actions button {
  background: var(--accent-2); color: #06111c; border: none; border-radius: 8px;
  padding: 8px 12px; font-weight: 800; cursor: pointer;
}

/* Dimming backdrop so the spotlighted control stands out. */
#tutorial-dim {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 16, 0.3);
  z-index: 55;
  pointer-events: none;
}

/* Spotlight: a bold breathing ring on the control the tutorial wants you to use. */
.tutorial-highlight {
  position: relative;
  z-index: 60 !important;
  outline: 4px solid #ffe66d !important;
  outline-offset: 3px;
  border-radius: 10px;
  box-shadow: 0 0 0 4px rgba(255, 211, 110, 0.55), 0 0 28px 6px rgba(255, 230, 130, 0.9) !important;
  animation: tutPulse 0.9s ease-in-out infinite;
}

@keyframes tutPulse {
  0%, 100% { outline-offset: 3px; box-shadow: 0 0 0 4px rgba(255, 211, 110, 0.45), 0 0 18px 4px rgba(255, 230, 130, 0.55); }
  50% { outline-offset: 6px; box-shadow: 0 0 0 7px rgba(255, 211, 110, 0.7), 0 0 36px 10px rgba(255, 233, 140, 0.98); }
}

/* Mission objectives checklist */
.objectives-panel #objectives { display: flex; flex-direction: column; gap: 6px; }
.obj-row { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.obj-icon { width: 1.1em; text-align: center; flex: none; }
.obj-label { color: var(--ink); }
.obj-complete .obj-icon { color: #5df08a; }
.obj-complete .obj-label { color: var(--muted); text-decoration: line-through; }
.obj-active .obj-icon { color: var(--accent-2); }
.obj-locked { opacity: 0.55; }
.obj-failed .obj-icon, .obj-failed .obj-label { color: #ff6b6b; }
.obj-fail .obj-icon { color: #8fb0c6; }
.obj-sep { margin-top: 6px; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* Mission end screen (win/lose) — shown for any mission */
.mission-end {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 8, 16, 0.62);
}
.mission-end-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 28px 32px; max-width: 460px; text-align: center;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.5);
}
.mission-end-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 10px; letter-spacing: 0.02em; }
.mission-end.win .mission-end-title { color: #5df08a; }
.mission-end.lose .mission-end-title { color: #ff6b6b; }
.mission-end-text { color: var(--ink); line-height: 1.5; margin: 0 0 18px; }
.mission-end-actions { display: flex; gap: 10px; justify-content: center; }
.mission-end-actions button {
  background: var(--accent-2); color: #06111c; border: none; border-radius: 10px;
  padding: 10px 16px; font-weight: 800; cursor: pointer;
}

/* Objectives pop-up (opened from the topbar; shown once at level start) */
.obj-modal {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2, 8, 16, 0.55);
}
.obj-modal.hidden { display: none; }
.obj-modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px 26px; max-width: 420px; min-width: 300px;
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.5);
}
.obj-modal-card h2 { margin: 0 0 12px; }
.obj-modal-card #objectives { display: flex; flex-direction: column; gap: 6px; }
.obj-modal-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
.obj-modal-actions button {
  background: var(--accent-2); color: #06111c; border: none; border-radius: 10px;
  padding: 9px 16px; font-weight: 800; cursor: pointer;
}

/* Ambient cosmetic explosions (the Aegis breaking apart) — softer + quick fade so they read as distant */
.ambient-fx { opacity: 0.8; animation: ambientFxFade 0.8s ease-out forwards; transform-origin: center; }
@keyframes ambientFxFade {
  0% { opacity: 0; transform: scale(0.6); }
  35% { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.15); }
}

/* Topbar link to the standalone map editor (styled to match the action buttons) */
#map-editor-link {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); background: rgba(16, 35, 58, 0.9); color: var(--ink);
  border-radius: 999px; padding: 10px 14px; cursor: pointer; text-decoration: none;
}
#map-editor-link:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* Settings dropdown: tucks the less-used toggles (Mode/AI/Sound/Map Editor) behind one button */
.settings-wrap { position: relative; display: inline-flex; }
.settings-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
  display: flex; flex-direction: column; gap: 8px; min-width: 200px;
  padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(10, 24, 41, 0.98); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.settings-menu button, .settings-menu #map-editor-link { width: 100%; justify-content: flex-start; text-align: left; }
.settings-menu.hidden { display: none; }     /* beats `.settings-menu { display:flex }` so it hides by default */
#map-editor-link.hidden { display: none; }   /* ID-specificity override so the dev-only link truly hides */
