/* ==========================================================================
   Project Stella - HUD Styling & Visual Design System (Vanilla CSS)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Roboto+Mono:wght@400;700&display=swap');

/* -------------------------------------------------- */
/* 0. CSS 테마 변수 및 글로벌 리셋                      */
/* -------------------------------------------------- */
:root {
  --stella-black: #0B0E14;
  --stella-grey: #242B35;
  --stella-white: #F0F4F8;
  --stella-orange: #FFAA73;
  --stella-blue: #82AAFF;
  --stella-emerald: #78E3CD;

  /* 글꼴 패밀리 */
  --font-sans: 'Inter', 'Pretendard', sans-serif;
  --font-mono: 'Roboto Mono', 'JetBrains Mono', monospace;
}

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

body,
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--stella-black);
  color: var(--stella-white);
}

/* 전역 스크롤바 커스텀 스타일 (HUD 테마 통합) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(11, 14, 20, 0.35);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(130, 170, 255, 0.25);
  border-radius: 3px;
  border: 1px solid rgba(130, 170, 255, 0.1);
  transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(130, 170, 255, 0.5);
  border-color: rgba(130, 170, 255, 0.3);
}

/* Firefox 전용 스크롤바 속성 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(130, 170, 255, 0.25) rgba(11, 14, 20, 0.35);
}

/* -------------------------------------------------- */
/* 1. 레이아웃 그리드 아키텍처                          */
/* -------------------------------------------------- */
.stella-body {
  background-image: url('images/space_bg.png');
  background-size: cover;
  background-position: center;
  position: relative;
}

.hud-main-grid {
  display: grid;
  grid-template-areas:
    "header header header"
    "nav    main   aside"
    "footer footer footer";
  grid-template-columns: 80px 1fr 240px;
  grid-template-rows: 80px 1fr 60px;
  width: 100vw;
  height: 100vh;
  position: relative;
  z-index: 10;
}

/* -------------------------------------------------- */
/* 2. 공통 HUD 데코레이터 및 클래스                      */
/* -------------------------------------------------- */
.hud-panel {
  background-color: rgba(11, 14, 20, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(36, 43, 53, 0.6);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.hud-brackets {
  position: relative;
}

.hud-brackets::before,
.hud-brackets::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--stella-grey);
  border-style: solid;
  pointer-events: none;
  transition: border-color 0.3s ease;
}

.hud-brackets::before {
  top: -1px;
  left: -1px;
  border-width: 1.5px 0 0 1.5px;
}

.hud-brackets::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 1.5px 1.5px 0;
}

.hud-brackets:hover::before,
.hud-brackets:hover::after {
  border-color: var(--stella-blue);
}

/* 유틸리티 컬러 클래스 */
.text-stella-white {
  color: var(--stella-white);
}

.text-stella-grey {
  color: var(--stella-grey);
}

.text-stella-orange {
  color: var(--stella-orange);
}

.text-stella-blue {
  color: var(--stella-blue);
}

.text-stella-emerald {
  color: var(--stella-emerald);
}

.border-stella-orange {
  border-color: var(--stella-orange);
}

.border-stella-blue {
  border-color: var(--stella-blue);
}

.border-stella-grey {
  border-color: var(--stella-grey);
}

.font-stellaMono {
  font-family: var(--font-mono);
}

.font-stellaSans {
  font-family: var(--font-sans);
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gap-2 {
  gap: 8px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

.mb-2 {
  margin-bottom: 8px;
}

.text-center {
  text-align: center;
}

.text-sm {
  font-size: 0.85rem;
}

.text-xs {
  font-size: 0.75rem;
}

.uppercase {
  text-transform: uppercase;
}

.tracking-wider {
  letter-spacing: 0.05em;
}

.tracking-widest {
  letter-spacing: 0.15em;
}

.scroll-y {
  overflow-y: auto;
}

/* -------------------------------------------------- */
/* 3. 상단 자원 바 (Top Resource Bar)                  */
/* -------------------------------------------------- */
.top-resource-bar {
  grid-area: header;
  display: grid;
  grid-template-columns: 240px 1fr auto;
  align-items: center;
  padding: 0 20px;
  border-bottom: 0.5px solid rgba(36, 43, 53, 0.8);
}

.top-resource-bar .logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--stella-white);
  text-shadow: 0 0 6px rgba(240, 244, 248, 0.4);
}

.logo-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.user-id-label {
  font-size: 0.65rem;
  color: var(--stella-blue);
  margin-top: 4px;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.resources-wrapper {
  display: grid;
  grid-template-columns: 320px 320px;
  gap: 4px 40px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.res-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  width: 320px;
}

.res-label {
  font-weight: 600;
  font-size: 0.75rem;
  width: 90px;
  flex-shrink: 0;
  white-space: nowrap;
}

.res-value {
  font-weight: 700;
  width: 75px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.res-cap {
  font-size: 0.75rem;
  width: 65px;
  color: rgba(240, 244, 248, 0.4);
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: 2px;
}

.res-rate {
  font-size: 0.75rem;
  width: 70px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.feed-btn {
  background: transparent;
  border: 0.5px solid rgba(130, 170, 255, 0.6);
  color: var(--stella-blue);
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.feed-btn:hover {
  background: rgba(130, 170, 255, 0.15);
  border-color: var(--stella-blue);
  box-shadow: 0 0 8px rgba(130, 170, 255, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.ml-4 {
  margin-left: 16px;
}

/* -------------------------------------------------- */
/* 4. 좌측 내비게이션 바                                */
/* -------------------------------------------------- */
.left-nav-bar {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  gap: 16px;
  border-right: 0.5px solid rgba(36, 43, 53, 0.8);
}

.nav-button {
  background: transparent;
  border: 0.5px solid transparent;
  color: var(--stella-grey);
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  outline: none;
}

.nav-button .nav-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
  filter: grayscale(100%) brightness(0.6);
}

.nav-button .nav-label {
  font-size: 0.65rem;
  font-weight: 600;
}

.nav-button:hover {
  background: rgba(130, 170, 255, 0.08);
  border-color: rgba(130, 170, 255, 0.6);
  color: var(--stella-white);
  box-shadow: 0 0 8px rgba(130, 170, 255, 0.3);
  cursor: pointer;
}

.nav-button:hover .nav-icon {
  filter: none;
}

.nav-button.active {
  background: rgba(120, 227, 205, 0.08);
  border-color: var(--stella-emerald);
  color: var(--stella-white);
  box-shadow: 0 0 10px rgba(120, 227, 205, 0.25);
}

.nav-button.active .nav-icon {
  filter: none;
}

/* -------------------------------------------------- */
/* 5. 우측 상태 및 스케줄러 대기열 패널                  */
/* -------------------------------------------------- */
.right-status-bar {
  grid-area: aside;
  border-left: 0.5px solid rgba(36, 43, 53, 0.8);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}


.sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-left: 2px solid var(--stella-blue);
  padding-left: 6px;
  margin-bottom: 12px;
}

.military-snapshot {
  padding-bottom: 16px;
  border-bottom: 0.5px solid rgba(36, 43, 53, 0.6);
}

.snapshot-category {
  display: flex;
  flex-direction: column;
}

.category-label {
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.snapshot-list {
  list-style: none;
  font-size: 0.75rem;
  padding-left: 8px;
}

.snapshot-list li {
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  border-bottom: 0.5px solid rgba(36, 43, 53, 0.25);
  padding-bottom: 4px;
}

.snapshot-list li .unit-label {
  font-weight: 400;
  color: rgba(240, 244, 248, 0.7);
}

.snapshot-list li .unit-qty {
  font-weight: 700;
  color: var(--stella-white);
  text-align: right;
}

.queue-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-card {
  border: 0.5px solid var(--stella-grey);
  border-radius: 4px;
  padding: 8px;
  background: rgba(11, 14, 20, 0.5);
  font-size: 0.75rem;
  transition: all 0.3s ease;
}

.queue-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: 700;
}

.queue-card-status {
  text-align: right;
  font-size: 0.7rem;
}

/* 활성화 생산 대기열 클래스 */
.queue-card.active {
  border-color: var(--stella-orange);
  color: var(--stella-orange);
  background: rgba(255, 170, 115, 0.03);
}

/* 큐 내의 progress bar */
.queue-progress-container {
  background: rgba(36, 43, 53, 0.5);
  height: 3px;
  width: 100%;
  margin-top: 4px;
  border-radius: 2px;
  overflow: hidden;
}

.queue-progress-bar {
  background: var(--stella-orange);
  height: 100%;
  width: 0%;
  transition: width 1s linear;
}

.queue-complete-btn {
  background: rgba(120, 227, 205, 0.1);
  border: 0.5px solid var(--stella-emerald);
  color: var(--stella-emerald);
  border-radius: 2px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.queue-complete-btn:hover {
  background: var(--stella-emerald);
  color: var(--stella-black);
}

/* -------------------------------------------------- */
/* 6. 중앙 가변 콘텐츠 워크스페이스                    */
/* -------------------------------------------------- */
.center-workspace {
  grid-area: main;
  position: relative;
  overflow: hidden;
  padding: 10px;
}

.central-view {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.workspace-content {
  width: 100%;
  height: 100%;
  padding: 20px;
  background: rgba(11, 14, 20, 0.6);
  backdrop-filter: blur(8px);
  border: 0.5px solid rgba(36, 43, 53, 0.3);
  border-radius: 6px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 20px;
  border-bottom: 0.5px solid rgba(240, 244, 248, 0.2);
  padding-bottom: 8px;
}

/* -------------------------------------------------- */
/* [A] 기지 홈 뷰포트                                   */
/* -------------------------------------------------- */
.base-viewport-container {
  position: relative;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  border: 0.5px solid rgba(36, 43, 53, 0.5);
  margin: auto;
}

.base-bg-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.hud-hotspot-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
}

.hotspot-polygon {
  fill: rgba(36, 43, 53, 0.0);
  stroke: rgba(240, 244, 248, 0.0);
  stroke-width: 0.5px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.hotspot-polygon:hover {
  fill: rgba(130, 170, 255, 0.07);
  stroke: rgba(130, 170, 255, 0.85);
  filter: drop-shadow(0 0 6px rgba(130, 170, 255, 0.6));
}

/* 창고 만재 95% 초과 주황색 글로우 아우라 */
.storage-warning-aura {
  position: absolute;
  left: 14%;
  top: 52%;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 25;
}

.storage-overload-glow {
  background: rgba(255, 170, 115, 0.05);
  box-shadow: 0 0 20px var(--stella-orange);
  border: 1px solid rgba(255, 170, 115, 0.6);
  animation: storage-pulse 0.8s infinite alternate;
}

@keyframes storage-pulse {
  0% {
    opacity: 0.3;
    transform: scale(0.9);
  }

  100% {
    opacity: 1.0;
    transform: scale(1.1);
  }
}

/* 기지 구역 정보 상세 슬라이더 서브 패널 */
.hotspot-drawer-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 320px;
  height: calc(100% - 20px);
  z-index: 30;
  border-radius: 4px;
  padding: 20px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.7);
  animation: slide-in 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes slide-in {
  from {
    transform: translateX(110%);
  }

  to {
    transform: translateX(0);
  }
}

.drawer-close-btn {
  background: transparent;
  border: none;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: block;
  margin-bottom: 12px;
}

.drawer-details {
  border-top: 0.5px solid rgba(36, 43, 53, 0.6);
  padding-top: 12px;
  font-size: 0.8rem;
  line-height: 1.5;
}

/* -------------------------------------------------- */
/* [B] 월드 맵 뷰포트                                   */
/* -------------------------------------------------- */
.map-viewport-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #06080b;
  border-radius: 6px;
  overflow: hidden;
  border: 0.5px solid rgba(36, 43, 53, 0.5);
}

.map-canvas-layer {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.map-canvas-layer:active {
  cursor: grabbing;
}

.map-hud-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(11, 14, 20, 0.8);
  padding: 8px 12px;
  border-radius: 4px;
  border: 0.5px solid var(--stella-grey);
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.75rem;
  pointer-events: auto;
  z-index: 22;
}

.zoom-btn-group {
  display: flex;
  gap: 4px;
}

.map-ctrl-btn {
  background: var(--stella-grey);
  border: 0.5px solid var(--stella-white);
  color: var(--stella-white);
  width: 20px;
  height: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  border-radius: 2px;
}

.map-ctrl-btn:hover {
  background: var(--stella-blue);
  border-color: var(--stella-blue);
  color: var(--stella-black);
}

.map-tile-detail-card {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 260px;
  padding: 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 22;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* -------------------------------------------------- */
/* [C] 시설 증축 및 대기열 카드                       */
/* -------------------------------------------------- */
.buildings-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding-right: 6px;
}

.building-card {
  padding: 16px;
  border-radius: 4px;
  background: rgba(36, 43, 53, 0.15);
  border: 0.5px solid var(--stella-grey);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
}

.building-card:hover {
  border-color: var(--stella-blue);
  background: rgba(130, 170, 255, 0.02);
}

.building-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
}

.building-level {
  font-size: 0.8rem;
}

.building-costs {
  font-size: 0.75rem;
  margin-top: 12px;
  line-height: 1.4;
}

.upgrade-btn {
  background: rgba(120, 227, 205, 0.08);
  border: 0.5px solid var(--stella-emerald);
  color: var(--stella-emerald);
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 3px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  margin-top: 12px;
  transition: all 0.2s ease;
}

.upgrade-btn:hover {
  background: var(--stella-emerald);
  color: var(--stella-black);
}

.upgrade-btn:disabled {
  border-color: var(--stella-grey);
  color: var(--stella-grey);
  background: transparent;
  cursor: not-allowed;
}

/* -------------------------------------------------- */
/* [D] 연구 패널 락아웃                                 */
/* -------------------------------------------------- */
.tech-lock-box {
  border: 0.5px solid var(--stella-grey);
  background: rgba(11, 14, 20, 0.85);
  border-radius: 6px;
  padding: 30px;
  max-width: 450px;
}

.tech-lock-box .lock-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

/* -------------------------------------------------- */
/* [E] 군사 탭 및 스펙 슬라이더                         */
/* -------------------------------------------------- */
#view-MENU_MILITARY .workspace-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mil-tab-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mil-tabs {
  margin-bottom: 16px;
  border-bottom: 0.5px solid rgba(36, 43, 53, 0.6);
  gap: 4px;
}

.mil-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--stella-grey);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mil-tab-btn:hover {
  color: var(--stella-white);
}

.mil-tab-btn.active {
  color: var(--stella-emerald);
  border-bottom-color: var(--stella-emerald);
}

.template-selector-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  height: 100%;
}

.template-list-side {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.template-list-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
}

.template-item {
  background: rgba(36, 43, 53, 0.2);
  border: 0.5px solid var(--stella-grey);
  padding: 8px 10px;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  text-align: left;
  color: rgba(240, 244, 248, 0.85);
  transition: all 0.2s ease;
}

.template-item:hover {
  border-color: var(--stella-blue);
  color: var(--stella-white);
}

.template-item.active {
  border-color: var(--stella-emerald);
  color: var(--stella-emerald);
  background: rgba(120, 227, 205, 0.05);
}

.template-spec-details {
  border-radius: 4px;
  padding: 20px;
  overflow: hidden;
  height: 100%;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  border-bottom: 0.5px solid rgba(36, 43, 53, 0.6);
  padding-bottom: 16px;
}

.spec-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}

.spec-line label {
  color: rgba(130, 170, 255, 0.85);
}

.qty-btn-group {
  display: flex;
  gap: 8px;
}

.qty-btn {
  background: rgba(36, 43, 53, 0.3);
  border: 0.5px solid var(--stella-grey);
  color: rgba(240, 244, 248, 0.7);
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
  outline: none;
}

.qty-btn:hover {
  border-color: var(--stella-blue);
  color: var(--stella-white);
  background: rgba(130, 170, 255, 0.1);
}

.qty-btn.active {
  border-color: var(--stella-emerald);
  color: var(--stella-emerald);
  background: rgba(120, 227, 205, 0.1);
  box-shadow: 0 0 8px rgba(120, 227, 205, 0.25);
}

.build-slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-input {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--stella-grey);
  outline: none;
  border-radius: 2px;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--stella-emerald);
  border-radius: 50%;
  cursor: pointer;
}

.slider-qty-text {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: right;
}

.required-resources-box {
  background: rgba(11, 14, 20, 0.4);
  padding: 8px;
  border-radius: 3px;
  font-size: 0.75rem;
  border: 0.5px solid rgba(36, 43, 53, 0.4);
}

.mil-action-btn {
  background: rgba(120, 227, 205, 0.08);
  border: 0.5px solid var(--stella-emerald);
  color: var(--stella-emerald);
  padding: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mil-action-btn:hover {
  background: var(--stella-emerald);
  color: var(--stella-black);
}

.mil-action-btn:disabled {
  background: transparent;
  border-color: var(--stella-grey) !important;
  color: var(--stella-grey) !important;
  cursor: not-allowed;
}

.warning-overload-alert {
  background: rgba(255, 170, 115, 0.08);
  border: 0.5px solid var(--stella-orange);
  color: var(--stella-orange);
  padding: 8px;
  font-size: 0.75rem;
  border-radius: 3px;
  text-align: center;
  margin-top: 8px;
}

/* -------------------------------------------------- */
/* [F] 연합 오버뷰 및 에센스 기부                        */
/* -------------------------------------------------- */
.alliance-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.alliance-status-card,
.alliance-relations-card {
  border-radius: 4px;
  padding: 20px;
}

.alliance-status-card h3,
.alliance-relations-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
  border-bottom: 0.5px solid rgba(240, 244, 248, 0.1);
  padding-bottom: 6px;
}

.alliance-donate-btn {
  background: rgba(130, 170, 255, 0.1);
  border: 0.5px solid var(--stella-blue);
  color: var(--stella-blue);
  padding: 6px 12px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.alliance-donate-btn:hover {
  background: var(--stella-blue);
  color: var(--stella-black);
}

.war-btn {
  border: none;
  padding: 10px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 2px;
  transition: opacity 0.2s ease;
}

.war-btn:hover {
  opacity: 0.9;
}

.peace-btn {
  background: transparent;
  padding: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.peace-btn:hover {
  background: rgba(130, 170, 255, 0.1);
}

/* -------------------------------------------------- */
/* 7. 오버레이 알림 패널 및 애니메이션 효과               */
/* -------------------------------------------------- */

/* [A] 승급 락아웃 스캔라인 */
.hq-scanline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  background: rgba(11, 14, 20, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

.scanline-hud-box {
  width: 480px;
  padding: 24px;
  border-radius: 4px;
  text-align: center;
}

.scan-title {
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.scan-desc {
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.progress-bar-container {
  background: rgba(36, 43, 53, 0.8);
  height: 4px;
  width: 100%;
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  background: var(--stella-emerald);
  height: 100%;
  width: 0%;
  animation: load-bar 2s cubic-bezier(0.1, 0.8, 0.1, 1) forwards;
}

.progress-bar-fill.bg-stella-blue {
  background: var(--stella-blue);
}

@keyframes load-bar {
  to {
    width: 100%;
  }
}

/* 스캔라인 애니메이션 라인 오버레이 */
.hq-scanline-overlay::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(120, 227, 205, 0.4);
  box-shadow: 0 0 10px var(--stella-emerald);
  animation: scan-loop 2s linear infinite;
}

@keyframes scan-loop {
  0% {
    top: 0%;
  }

  100% {
    top: 100%;
  }
}

/* [B] 오프라인 브리핑 로그 */
.offline-briefing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 110;
  background: rgba(11, 14, 20, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.briefing-box {
  width: 500px;
  border-radius: 4px;
  padding: 24px;
}

.briefing-header {
  border-bottom: 0.5px solid rgba(240, 244, 248, 0.2);
  padding-bottom: 8px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 0.9rem;
}

.briefing-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 6px;
}

.briefing-timeline li {
  font-size: 0.8rem;
  line-height: 1.4;
  padding-left: 8px;
  border-left: 1.5px solid var(--stella-grey);
}

.timeline-time {
  font-weight: 700;
  margin-right: 8px;
  color: var(--stella-grey);
}

.briefing-close-btn {
  background: rgba(240, 244, 248, 0.05);
  border: 0.5px solid var(--stella-white);
  color: var(--stella-white);
  width: 100%;
  padding: 10px;
  margin-top: 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.briefing-close-btn:hover {
  background: var(--stella-white);
  color: var(--stella-black);
}

/* [C] Tier 1 최상위 침공 위협 알림 */
.critical-alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 120;
  background: rgba(11, 14, 20, 0.7);
  backdrop-filter: blur(16px) brightness(0.25);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 주황색 스트라이프 블링킹 탑/바텀 경고바 */
.critical-alert-overlay::before,
.critical-alert-overlay::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 12px;
  background: repeating-linear-gradient(-45deg,
      var(--stella-orange),
      var(--stella-orange) 10px,
      var(--stella-black) 10px,
      var(--stella-black) 20px);
  animation: warning-pulse 1s infinite alternate;
}

.critical-alert-overlay::before {
  top: 0;
}

.critical-alert-overlay::after {
  bottom: 0;
}

.critical-alert-box {
  width: 480px;
  padding: 24px;
  text-align: center;
  border-radius: 4px;
  animation: lock-shake 0.4s ease-in-out;
}

.alert-title {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.alert-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.alert-actions {
  display: flex;
  justify-content: center;
}

.alert-btn {
  background: rgba(255, 170, 115, 0.05);
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 2px;
  font-weight: 700;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.alert-btn:hover {
  background: var(--stella-orange);
  color: var(--stella-black);
}

@keyframes lock-shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-6px);
  }

  75% {
    transform: translateX(6px);
  }
}

@keyframes warning-pulse {
  0% {
    opacity: 0.4;
    box-shadow: 0 0 4px rgba(255, 170, 115, 0.1);
  }

  100% {
    opacity: 1.0;
    box-shadow: 0 0 16px rgba(255, 170, 115, 0.4);
  }
}

/* -------------------------------------------------- */
/* 8. 개발자 시뮬레이션 제어 바                          */
/* -------------------------------------------------- */
.simulation-control-hud {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  border-radius: 4px;
  padding: 10px 16px;
  width: 780px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  border-color: var(--stella-emerald);
}

.control-header {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.sim-btn {
  background: rgba(36, 43, 53, 0.5);
  border: 0.5px solid var(--stella-emerald);
  color: var(--stella-white);
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.sim-btn:hover {
  background: rgba(120, 227, 205, 0.15);
  border-color: var(--stella-emerald);
  box-shadow: 0 0 6px rgba(120, 227, 205, 0.3);
}

/* ==========================================================================
   0. 로그인 및 인증 시스템 스타일 (Auth & Gateway Styling)
   ========================================================================== */

.auth-game-title {
  position: absolute;
  top: 60px;
  left: 60px;
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--stella-white);
  text-shadow: 0 0 15px rgba(130, 170, 255, 0.5), 0 0 30px rgba(130, 170, 255, 0.2);
  user-select: none;
  animation: auth-title-pulse 4s ease-in-out infinite alternate;
}

@keyframes auth-title-pulse {
  0% {
    text-shadow: 0 0 10px rgba(130, 170, 255, 0.4);
    opacity: 0.95;
  }

  100% {
    text-shadow: 0 0 25px rgba(130, 170, 255, 0.8), 0 0 40px rgba(130, 170, 255, 0.4);
    opacity: 1;
  }
}

.auth-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  background-color: var(--stella-black);
  background-image: radial-gradient(circle at center, rgba(130, 170, 255, 0.05) 0%, rgba(11, 14, 20, 0.95) 100%), url('images/space_bg.png');
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 80px;
}

.auth-card {
  width: 440px;
  padding: 30px;
  background-color: rgba(11, 14, 20, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 0.5px solid rgba(130, 170, 255, 0.3);
  box-shadow: 0 0 30px rgba(11, 14, 20, 0.95), 0 0 15px rgba(130, 170, 255, 0.1);
  border-radius: 4px;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(240, 244, 248, 0.4);
}

.auth-subtitle {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

.auth-tabs {
  display: flex;
  border-bottom: 0.5px solid rgba(36, 43, 53, 0.8);
  margin-bottom: 24px;
  gap: 8px;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--stella-grey);
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
}

.auth-tab:hover {
  color: var(--stella-white);
}

.auth-tab.active {
  color: var(--stella-emerald);
  border-bottom-color: var(--stella-emerald);
  text-shadow: 0 0 8px rgba(120, 227, 205, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group.mt-4 {
  margin-top: 16px;
}

.hud-input {
  background-color: rgba(11, 14, 20, 0.8);
  border: 0.5px solid var(--stella-grey);
  color: var(--stella-white);
  padding: 10px 12px;
  font-size: 0.85rem;
  border-radius: 3px;
  outline: none;
  transition: all 0.3s ease;
}

.hud-input::placeholder {
  color: rgba(112, 128, 144, 0.5);
}

.hud-input:focus {
  border-color: var(--stella-emerald);
  box-shadow: 0 0 10px rgba(120, 227, 205, 0.25);
}

.auth-error-msg {
  border: 0.5px solid rgba(255, 170, 115, 0.3);
  background: rgba(255, 170, 115, 0.05);
  padding: 8px;
  border-radius: 2px;
  margin-top: 8px;
  border-left: 2px solid var(--stella-orange);
}

.auth-action-btn {
  border: none;
  padding: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.auth-action-btn.bg-stella-emerald {
  background-color: var(--stella-emerald);
}

.auth-action-btn.bg-stella-emerald:hover {
  background-color: #5ed6be;
  box-shadow: 0 0 15px rgba(120, 227, 205, 0.4);
}

.auth-action-btn.bg-stella-orange {
  background-color: var(--stella-orange);
}

.auth-action-btn.bg-stella-orange:hover {
  background-color: #ff9a59;
  box-shadow: 0 0 15px rgba(255, 170, 115, 0.4);
}

/* 마이그레이션 안내 팝업 스타일 */
.migration-notify-overlay,
.session-invalidated-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
}

.migration-notify-box,
.session-invalidated-box {
  width: 460px;
  padding: 24px;
  border-radius: 4px;
  text-align: center;
  background-color: rgba(11, 14, 20, 0.95);
  border: 0.5px solid rgba(120, 227, 205, 0.4);
  box-shadow: 0 0 25px rgba(120, 227, 205, 0.2);
}

.session-invalidated-box {
  border-color: rgba(255, 170, 115, 0.4);
  box-shadow: 0 0 25px rgba(255, 170, 115, 0.2);
}

.war-warning-blink {
  animation: border-blink 1.5s infinite alternate;
}

@keyframes border-blink {
  0% {
    border-color: rgba(255, 170, 115, 0.2);
  }

  100% {
    border-color: rgba(255, 170, 115, 0.8);
  }
}

/* 로그아웃 버튼 */
.logout-btn {
  background: transparent;
  border: 0.5px solid rgba(255, 170, 115, 0.6);
  color: var(--stella-orange);
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255, 170, 115, 0.15);
  border-color: var(--stella-orange);
  box-shadow: 0 0 8px rgba(255, 170, 115, 0.3);
}

.block {
  display: block;
}

.mb-1 {
  margin-bottom: 4px;
}

.w-full {
  width: 100%;
}

/* 하단 전술 통신 로그 바 */
.bottom-hud-bar {
  grid-area: footer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-top: 0.5px solid rgba(36, 43, 53, 0.6);
  z-index: 100;
  height: 60px;
}

.bottom-log-feed {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  font-size: 0.8rem;
  color: var(--stella-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-log-prefix {
  font-weight: 700;
  color: var(--stella-emerald);
  border: 0.5px solid var(--stella-emerald);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.bottom-log-message {
  font-family: var(--stellaMono);
  animation: feed-fade 0.5s ease;
}

@keyframes feed-fade {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bottom-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bottom-btn {
  background: rgba(11, 14, 20, 0.6);
  border: 0.5px solid var(--stella-grey);
  color: var(--stella-white);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.bottom-btn:hover {
  border-color: var(--stella-emerald);
  color: var(--stella-emerald);
  box-shadow: 0 0 10px rgba(120, 227, 205, 0.2);
}

/* 실시간 통합 전술 피드 드롭다운 패널 */
.feed-dropdown-panel {
  position: absolute;
  top: 60px;
  right: 20px;
  width: 500px;
  background-color: rgba(11, 14, 20, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 0.5px solid var(--stella-blue);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.85), 0 0 15px rgba(130, 170, 255, 0.25);
  z-index: 1000;
  padding: 16px;
  border-radius: 4px;
  animation: dropdown-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 피드 종류 구분 색상 원 */
.feed-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* -------------------------------------------------- */
/* 9. 군사 수량 선택 및 자원 안내판 스타일                */
/* -------------------------------------------------- */
.qty-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.qty-btn {
  background: rgba(36, 43, 53, 0.4);
  border: 0.5px solid var(--stella-grey);
  color: rgba(240, 244, 248, 0.6);
  padding: 5px 10px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 48px;
  text-align: center;
}

.qty-btn:hover {
  border-color: var(--stella-blue);
  color: var(--stella-white);
  background: rgba(130, 170, 255, 0.1);
}

.qty-btn.active {
  background: rgba(130, 170, 255, 0.2);
  border-color: var(--stella-blue);
  color: var(--stella-blue);
  box-shadow: 0 0 8px rgba(130, 170, 255, 0.3);
  font-weight: 700;
}

.required-resources-box {
  color: rgba(240, 244, 248, 0.85);
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 10px;
  background: rgba(11, 14, 20, 0.4);
  border-radius: 4px;
  border-left: 2px solid var(--stella-blue);
}

.required-resources-box span {
  color: var(--stella-white) !important;
  font-weight: 700;
}

.required-resources-box span.text-stella-orange {
  color: var(--stella-orange) !important;
}

/* -------------------------------------------------- */
/* 10. 함선/지상군 스펙 메타데이터 정렬 및 좁은 간격 스타일 */
/* -------------------------------------------------- */
.spec-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 0.8rem;
}

.spec-line label {
  width: 170px;
  color: var(--stella-white);
  opacity: 0.8;
  flex-shrink: 0;
}

.spec-line span {
  color: var(--stella-blue);
  font-weight: 700;
}

/* -------------------------------------------------- */
/* 11. 월드맵 선택 셀 상세 정보 카드 시인성 향상 스타일       */
/* -------------------------------------------------- */
.map-tile-detail-card {
  background-color: rgba(11, 14, 20, 0.95) !important;
  border: 1px solid var(--stella-blue) !important;
  box-shadow: 0 0 15px rgba(130, 170, 255, 0.35) !important;
}

.map-tile-detail-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.tile-header-pirate {
  color: #B22222 !important; /* 약간 검붉은 색 */
}

.tile-header-unexplored {
  color: #CCCCCC !important; /* 밝은 회색 */
}

.map-tile-detail-card p {
  font-size: 0.82rem;
  color: var(--stella-white) !important;
  line-height: 1.4;
  opacity: 0.95;
  margin-top: 4px;
}