/* Main menu — Stellar Empire */

body.main-menu-open {
  overflow: hidden;
}

body.main-menu-open .toolbar,
body.main-menu-open .map-stage,
body.main-menu-open canvas,
body.main-menu-open .sim-date-bar,
body.main-menu-open .perf-hud,
body.main-menu-open .resource-hud,
body.main-menu-open .right-hud-stack,
body.main-menu-open .system-context-menu {
  visibility: hidden;
  pointer-events: none;
}

.main-menu[hidden] {
  display: none !important;
}

.main-menu {
  --menu-cyan: #3ec8ff;
  --menu-cyan-dim: rgba(62, 200, 255, 0.45);
  --menu-cyan-glow: rgba(62, 200, 255, 0.55);
  --menu-btn-bg: rgba(4, 18, 38, 0.72);
  --menu-btn-border: rgba(90, 190, 255, 0.38);
  --menu-accent-line: rgba(120, 210, 255, 0.35);

  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 4.5vh, 52px) clamp(28px, 4vw, 64px) clamp(24px, 3.5vh, 44px);
  color: #f4f9ff;
  font-family: Rajdhani, "Segoe UI", sans-serif;
  background:
    linear-gradient(
      100deg,
      rgba(2, 8, 22, 0.94) 0%,
      rgba(2, 10, 28, 0.78) 22%,
      rgba(2, 10, 28, 0.42) 40%,
      rgba(2, 8, 20, 0.08) 55%,
      transparent 68%
    ),
    url("../assets/main-menu-bg.png") center / cover no-repeat;
  user-select: none;
}

.main-menu::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(62, 200, 255, 0.12);
  box-shadow:
    inset 0 0 80px rgba(0, 40, 80, 0.35),
    inset 0 0 0 1px rgba(62, 200, 255, 0.06);
}

.main-menu__left {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(28px, 4vh, 48px);
  max-width: min(520px, 42vw);
}

.main-menu__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  padding-left: 4px;
}

.main-menu__brand-rings {
  position: absolute;
  left: -18px;
  top: 50%;
  width: 200px;
  height: 200px;
  transform: translateY(-52%);
  opacity: 0.22;
  pointer-events: none;
}

.main-menu__brand-rings circle,
.main-menu__brand-rings line {
  stroke: var(--menu-cyan);
  fill: none;
}

.main-menu__title-stellar {
  margin: 0;
  font-family: Orbitron, sans-serif;
  font-size: clamp(2.4rem, 4.8vw, 3.65rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 40px rgba(62, 200, 255, 0.35),
    0 2px 24px rgba(0, 0, 0, 0.6);
}

.main-menu__title-empire-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin-top: 6px;
}

.main-menu__title-line {
  flex: 1;
  height: 1px;
  max-width: 72px;
  background: linear-gradient(90deg, transparent, var(--menu-accent-line) 30%, var(--menu-accent-line) 70%, transparent);
}

.main-menu__title-empire {
  margin: 0;
  font-family: Orbitron, sans-serif;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 400;
  letter-spacing: 0.55em;
  text-align: center;
  padding-right: 0.55em;
  color: rgba(235, 246, 255, 0.92);
}

.main-menu__crest {
  display: block;
  margin: 14px auto 0;
  width: 36px;
  height: 36px;
  color: rgba(240, 248, 255, 0.92);
  filter: drop-shadow(0 0 8px rgba(62, 200, 255, 0.35));
}

.main-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, 100%);
}

.main-menu__btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px 0 18px;
  border: 1px solid var(--menu-btn-border);
  border-radius: 2px;
  background-color: rgba(4, 14, 32, 0.82);
  background-image:
    linear-gradient(180deg, rgba(12, 32, 58, 0.55) 0%, rgba(4, 14, 32, 0.82) 100%),
    linear-gradient(
      105deg,
      transparent 0%,
      transparent 38%,
      rgba(62, 200, 255, 0.14) 50%,
      transparent 62%,
      transparent 100%
    );
  background-size: 100% 100%, 220% 100%;
  background-position: 0 0, -120% 0;
  background-repeat: no-repeat;
  color: #eef6ff;
  font-family: Rajdhani, sans-serif;
  font-size: clamp(1.05rem, 1.35vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transform: translateX(0);
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background-position 0.55s ease,
    transform 0.22s ease,
    color 0.22s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 4px 24px rgba(0, 0, 0, 0.35);
}

.main-menu__btn::before,
.main-menu__btn::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.main-menu__btn::before {
  left: 0;
  transform: translateY(-50%);
  border-width: 7px 0 7px 8px;
  border-color: transparent transparent transparent var(--menu-cyan);
}

.main-menu__btn::after {
  right: 14px;
  transform: translateY(-50%);
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent rgba(62, 200, 255, 0.85);
}

.main-menu__btn-icon {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--menu-cyan);
  opacity: 0.92;
  transform: scale(1);
  filter: drop-shadow(0 0 0 transparent);
  transition:
    transform 0.22s ease,
    filter 0.22s ease,
    color 0.22s ease;
}

.main-menu__btn-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main-menu__btn-label {
  position: relative;
  z-index: 1;
  flex: 1;
  text-shadow: 0 0 0 transparent;
  transition: text-shadow 0.22s ease, color 0.22s ease;
}

.main-menu__btn--active,
.main-menu__btn:hover:not(:disabled),
.main-menu__btn:focus-visible {
  border-color: rgba(100, 210, 255, 0.75);
  background-image:
    linear-gradient(180deg, rgba(20, 70, 120, 0.65) 0%, rgba(8, 36, 72, 0.88) 100%),
    linear-gradient(
      105deg,
      transparent 0%,
      transparent 38%,
      rgba(120, 220, 255, 0.22) 50%,
      transparent 62%,
      transparent 100%
    );
  background-position: 0 0, 120% 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 24px rgba(62, 200, 255, 0.08),
    0 0 0 1px rgba(62, 200, 255, 0.15),
    0 0 28px rgba(62, 200, 255, 0.22),
    0 6px 32px rgba(0, 0, 0, 0.45);
  outline: none;
}

.main-menu__btn:hover:not(:disabled) {
  transform: translateX(6px);
}

.main-menu__btn--active::before,
.main-menu__btn--active::after,
.main-menu__btn:hover:not(:disabled)::before,
.main-menu__btn:hover:not(:disabled)::after,
.main-menu__btn:focus-visible::before,
.main-menu__btn:focus-visible::after {
  opacity: 1;
}

.main-menu__btn:hover:not(:disabled) .main-menu__btn-icon,
.main-menu__btn--active .main-menu__btn-icon,
.main-menu__btn:focus-visible .main-menu__btn-icon {
  transform: scale(1.08);
  filter: drop-shadow(0 0 6px rgba(62, 200, 255, 0.65));
  color: #7ee0ff;
}

.main-menu__btn:hover:not(:disabled) .main-menu__btn-label,
.main-menu__btn--active .main-menu__btn-label,
.main-menu__btn:focus-visible .main-menu__btn-label {
  color: #fff;
  text-shadow: 0 0 18px rgba(62, 200, 255, 0.35);
}

.main-menu__btn:active:not(:disabled) {
  transform: translateX(4px) translateY(1px);
  transition-duration: 0.08s;
}

.main-menu__welcome {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: min(480px, 90vw);
  padding: 14px 18px 12px 14px;
  border: 1px solid rgba(62, 200, 255, 0.2);
  border-radius: 2px;
  background: linear-gradient(135deg, rgba(4, 16, 36, 0.75) 0%, rgba(2, 10, 24, 0.55) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 8px 32px rgba(0, 0, 0, 0.35);
}

.main-menu__welcome::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 48px;
  border-left: 1px solid rgba(62, 200, 255, 0.25);
  border-bottom: 1px solid rgba(62, 200, 255, 0.25);
  pointer-events: none;
}

.main-menu__welcome-crest {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  color: rgba(240, 248, 255, 0.9);
  filter: drop-shadow(0 0 10px rgba(62, 200, 255, 0.25));
}

.main-menu__welcome-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 2px;
}

.main-menu__welcome-heading {
  margin: 0;
  font-family: Rajdhani, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
}

.main-menu__welcome-tagline {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(180, 210, 240, 0.85);
}

.main-menu__welcome-version {
  margin: 6px 0 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: rgba(120, 155, 190, 0.75);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .main-menu {
    padding: 24px 20px 20px;
  }

  .main-menu__left {
    max-width: 100%;
  }

  .main-menu__title-stellar {
    letter-spacing: 0.14em;
  }

  .main-menu__btn {
    letter-spacing: 0.18em;
    min-height: 48px;
  }

  .main-menu__btn:hover:not(:disabled) {
    transform: translateX(4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .main-menu__btn,
  .main-menu__btn-icon,
  .main-menu__btn-label {
    transition-duration: 0.01ms;
  }

  .main-menu__btn:hover:not(:disabled) {
    transform: none;
  }

  .main-menu__btn:hover:not(:disabled) .main-menu__btn-icon,
  .main-menu__btn--active .main-menu__btn-icon {
    transform: none;
  }
}
