/* 基础样式：CSS 变量、reset、排版与深空主题（Astrix） */

:root {
  --bg: #05070f;
  --bg-2: #0a0f1c;
  --panel: rgba(20, 28, 46, 0.55);
  --panel-solid: #0e1524;
  --border: rgba(124, 215, 255, 0.18);
  --border-strong: rgba(124, 215, 255, 0.4);
  --cyan: #7cd7ff;
  --purple: #b39cff;
  --text: #dce6f5;
  --muted: #8aa0c0;
  --danger: #ff6b81;
  --ok: #6be3a0;
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1200px;
  --tap: 44px;
}

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

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input, select {
  font-family: inherit;
  color: var(--text);
  background: rgba(5, 9, 18, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
}
input:focus, select:focus { border-color: var(--border-strong); }

h1, h2, h3 { font-weight: 600; letter-spacing: 0.02em; }
p { color: var(--text); }
a { color: var(--cyan); }

.screen { min-height: 100vh; min-height: 100dvh; }

/* 通用玻璃质感卡片 */
.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* 文本辅助色 */
.muted { color: var(--muted); }
.cyan { color: var(--cyan); }
.purple { color: var(--purple); }
.danger { color: var(--danger); }

/* ===== 全局模态层（main.js 控制挂载） ===== */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 12, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: auto;
}
.modal-overlay.open { opacity: 1; }

.modal-panel {
  width: min(560px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.18s ease;
  overflow: hidden;
}
.modal-overlay.open .modal-panel { transform: none; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.05rem; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 1.3rem;
  color: var(--muted);
  line-height: 1;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-body p { margin-bottom: 10px; }
.modal-tip { color: var(--muted); }

/* 移动端：sheet 从底部滑出 */
@media (max-width: 899px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-panel {
    width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .modal-overlay.open .modal-panel { transform: translateY(0); }
}

/* 通用按钮基类 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(124, 215, 255, 0.06);
  color: var(--text);
  font-size: 0.95rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: rgba(124, 215, 255, 0.14); border-color: var(--border-strong); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, rgba(124, 215, 255, 0.22), rgba(179, 156, 255, 0.22));
  border-color: var(--border-strong);
}
.btn-danger { border-color: rgba(255, 107, 129, 0.4); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 107, 129, 0.12); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== 太空战术交战动画与视觉特效 ===== */

@keyframes pulse-target {
  0% { transform: scale(1); box-shadow: 0 0 4px rgba(250, 204, 21, 0.4); border-color: rgba(250, 204, 21, 0.8); }
  50% { transform: scale(1.02); box-shadow: 0 0 16px rgba(250, 204, 21, 0.85); border-color: #facc15; }
  100% { transform: scale(1); box-shadow: 0 0 4px rgba(250, 204, 21, 0.4); border-color: rgba(250, 204, 21, 0.8); }
}

@keyframes laser-shoot-p2e {
  0% { transform: scaleX(0); opacity: 1; transform-origin: left center; }
  50% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; transform-origin: right center; }
}

@keyframes laser-shoot-e2p {
  0% { transform: scaleX(0); opacity: 1; transform-origin: right center; }
  50% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; transform-origin: left center; }
}

@keyframes torpedo-travel {
  0% { left: 10%; opacity: 0; transform: translateY(-50%) scale(0.6); }
  20% { opacity: 1; transform: translateY(-50%) scale(1.2); }
  80% { opacity: 1; transform: translateY(-50%) scale(1); }
  100% { left: 90%; opacity: 0; transform: translateY(-50%) scale(1.5); }
}

@keyframes shield-hit-pulse {
  0% { box-shadow: inset 0 0 20px rgba(56, 189, 248, 0.8), 0 0 15px rgba(56, 189, 248, 0.6); }
  100% { box-shadow: inset 0 0 0px transparent, 0 0 0px transparent; }
}

@keyframes hull-explosion-spark {
  0% { filter: brightness(2.2); transform: scale(1.04); }
  50% { filter: drop-shadow(0 0 10px #f43f5e) brightness(1.5); transform: scale(0.98); }
  100% { filter: none; transform: scale(1); }
}

@keyframes float-up-fade {
  0% { opacity: 1; transform: translateY(0) scale(1.2); }
  40% { opacity: 1; transform: translateY(-16px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-36px) scale(0.9); }
}

@keyframes emp-screen-flash {
  0% { background: rgba(96, 165, 250, 0.45); }
  100% { background: transparent; }
}

@keyframes radar-scan {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes warning-red-pulse {
  0%, 100% { border-color: rgba(239, 68, 68, 0.4); }
  50% { border-color: rgba(239, 68, 68, 1); box-shadow: 0 0 12px rgba(239, 68, 68, 0.6); }
}

.ship-targeted {
  animation: pulse-target 1.2s infinite ease-in-out !important;
}

.ship-shield-hit {
  animation: shield-hit-pulse 0.4s ease-out;
}

.ship-hull-hit {
  animation: hull-explosion-spark 0.35s ease-out;
}

.ship-low-hp {
  animation: warning-red-pulse 1.4s infinite ease-in-out;
}

.floating-text-item {
  position: absolute;
  pointer-events: none;
  font-weight: 800;
  font-family: monospace;
  font-size: 13px;
  z-index: 10;
  animation: float-up-fade 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 3px) rotate(-0.5deg); }
  40% { transform: translate(5px, -3px) rotate(0.5deg); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}

.screen-shake {
  animation: screen-shake 0.35s ease-in-out !important;
}

@keyframes radar-sweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes star-drift {
  0% { background-position: 0 0; }
  100% { background-position: -500px 0; }
}

@keyframes drone-flight {
  0% { left: 10%; top: 45%; opacity: 0; transform: scale(0.4) rotate(15deg); }
  25% { opacity: 1; transform: scale(1.1) rotate(-10deg); }
  75% { opacity: 1; transform: scale(1.1) rotate(10deg); }
  100% { left: 88%; top: 52%; opacity: 0; transform: scale(0.5) rotate(-15deg); }
}

@keyframes anomaly-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(251, 191, 36, 0.4); border-color: rgba(251, 191, 36, 0.5); }
  50% { box-shadow: 0 0 24px rgba(251, 191, 36, 0.9); border-color: rgba(251, 191, 36, 1); }
}

.anomaly-alert {
  animation: anomaly-pulse 1.8s infinite ease-in-out;
}

@keyframes gantry-spark {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.3); filter: drop-shadow(0 0 8px #38bdf8); }
}

.assembly-spark {
  animation: gantry-spark 0.6s infinite ease-in-out;
}

@keyframes circuit-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.quantum-circuit {
  background: linear-gradient(90deg, #38bdf830, #818cf850, #34d39940, #38bdf830);
  background-size: 300% 300%;
  animation: circuit-flow 4s ease infinite;
}

@keyframes seismic-pulse {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1.2); opacity: 1; filter: drop-shadow(0 0 6px #38bdf8); }
}

.seismic-wave-bar {
  animation: seismic-pulse 1.2s infinite ease-in-out;
}

@keyframes stratum-active-glow {
  0%, 100% { border-color: rgba(56, 189, 248, 0.4); box-shadow: 0 0 10px rgba(56, 189, 248, 0.2); }
  50% { border-color: rgba(56, 189, 248, 0.9); box-shadow: 0 0 20px rgba(56, 189, 248, 0.45); }
}

.stratum-card-active {
  animation: stratum-active-glow 1.8s infinite ease-in-out !important;
}

@keyframes warp-tunnel-flash {
  0% { opacity: 0; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.05); filter: drop-shadow(0 0 24px #38bdf8); }
  100% { opacity: 0; transform: scale(1.15); }
}

.warp-jump-fx {
  animation: warp-tunnel-flash 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes crop-sprout-sway {
  0%, 100% { transform: rotate(-3deg) scale(1); }
  50% { transform: rotate(3deg) scale(1.05); filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.5)); }
}

.agri-crop-sway {
  animation: crop-sprout-sway 2.4s infinite ease-in-out;
}

@keyframes bio-dome-pulse {
  0%, 100% { border-color: rgba(52, 211, 153, 0.35); box-shadow: 0 0 10px rgba(52, 211, 153, 0.15); }
  50% { border-color: rgba(52, 211, 153, 0.85); box-shadow: 0 0 22px rgba(52, 211, 153, 0.35); }
}

.bio-dome-active {
  animation: bio-dome-pulse 2.2s infinite ease-in-out;
}


