/* 라이프게임: 미녀들과의 최후의 생존 - Style */
:root {
  --bg-main: #0c0f14;
  --bg-card: rgba(22, 28, 36, 0.85);
  --bg-card-hover: rgba(30, 38, 50, 0.95);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-glow: rgba(255, 140, 0, 0.4);
  
  --primary: #ff8a00;
  --primary-glow: rgba(255, 138, 0, 0.35);
  --secondary: #00d2ff;
  --secondary-glow: rgba(0, 210, 255, 0.35);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --font-main: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --font-display: 'Orbitron', 'Black Han Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(255, 138, 0, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(0, 210, 255, 0.06) 0%, transparent 40%),
    linear-gradient(180deg, #090c10 0%, #0d1218 100%);
  background-attachment: fixed;
}

#game-app {
  max-width: 1240px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ================= 1. 최상단 서바이벌 HUD ================= */
#top-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: rgba(14, 18, 24, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.hud-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.day-badge {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.2), rgba(255, 60, 0, 0.1));
  border: 1px solid var(--primary);
  padding: 4px 10px;
  border-radius: 8px;
}

.day-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: #ffaa33;
  letter-spacing: 0.5px;
}

.day-phase {
  font-size: 0.8rem;
  color: var(--text-main);
  background: rgba(0,0,0,0.4);
  padding: 2px 6px;
  border-radius: 4px;
}

.weather-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.82rem;
}

/* HUD 자원 바 */
.hud-resources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.res-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.res-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.res-icon {
  font-size: 1rem;
}

.res-val {
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
}

/* 기지 방어 / 사기 상태 바 */
.hud-status {
  display: flex;
  gap: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
}

.pill-tag {
  color: var(--text-muted);
  white-space: nowrap;
}

.pill-bar-wrap {
  width: 50px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.pill-bar-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.defense-fill { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.morale-fill { background: linear-gradient(90deg, #10b981, #34d399); }
.danger-fill { background: linear-gradient(90deg, #ef4444, #f87171); }

.pill-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 28px;
}

/* HUD 버튼 */
.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--secondary);
}

.btn-highlight {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.2), rgba(0, 100, 255, 0.1));
  border-color: var(--secondary);
}

.badge-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  display: none;
}

/* ================= 2. 메인 네비게이션 탭 ================= */
#main-nav {
  display: flex;
  background: rgba(18, 23, 31, 0.9);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 55px;
  z-index: 90;
}

#main-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  flex: 1;
  min-width: 105px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.nav-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: linear-gradient(180deg, transparent 60%, rgba(255, 138, 0, 0.08) 100%);
}

.badge-pill {
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 700;
  animation: pulse 1.5s infinite;
}

/* ================= 3. 메인 콘텐츠 뷰 ================= */
#main-view {
  flex: 1;
  padding: 18px;
}

.game-tab {
  display: none;
}

.game-tab.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* 섹션 공통 헤더 */
.section-head {
  margin-bottom: 16px;
}

.section-head-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.section-block {
  margin-top: 24px;
}

/* ================= TAB 1: 캠프 거점 ================= */
.camp-hero-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  margin-bottom: 24px;
}

.hero-image-wrap {
  position: relative;
  width: 100%;
  min-height: 380px;
  background: #000;
}

.hero-bg-img {
  width: 100%;
  height: 100%;
  max-height: 440px;
  object-fit: cover;
  display: block;
  filter: brightness(0.9) contrast(1.05);
  transition: transform 0.5s ease;
}

.camp-hero-card:hover .hero-bg-img {
  transform: scale(1.02);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(10,14,20,0.7) 50%, rgba(10,14,20,0.96) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
}

.hero-badge {
  display: inline-block;
  align-self: flex-start;
  background: rgba(255, 138, 0, 0.2);
  border: 1px solid var(--primary);
  color: #ffaa44;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  margin-bottom: 8px;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 680px;
  margin-bottom: 18px;
}

.hero-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* 공통 버튼 */
.btn-primary, .btn-secondary, .btn-warning, .btn-upgrade, .btn-zone-start {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #ff8a00, #ff5500);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.pulse-btn {
  animation: btnPulse 2s infinite;
}

@keyframes btnPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 138, 0, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(255, 138, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 138, 0, 0); }
}

/* 거점 시설 그리드 */
.facilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.facility-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all 0.2s ease;
}

.facility-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.fac-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.fac-info {
  flex: 1;
}

.fac-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.fac-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.fac-lv {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--primary);
}

.fac-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.btn-upgrade {
  width: 100%;
  font-size: 0.8rem;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
}

.btn-upgrade:hover {
  background: rgba(255, 138, 0, 0.2);
  border-color: var(--primary);
  color: #ffaa44;
}

/* 생존 로그 창 */
.log-window {
  background: rgba(10, 14, 20, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  max-height: 160px;
  overflow-y: auto;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-line {
  color: var(--text-muted);
  line-height: 1.4;
}

.log-line.system { color: #60a5fa; }
.log-line.reward { color: #34d399; }
.log-line.danger { color: #f87171; }
.log-line.story { color: #fbbf24; }

.btn-text {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-text:hover { color: var(--text-main); }

/* ================= TAB 2: 원정 탐사 ================= */
.explore-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.explore-assigned-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.companion-selector {
  display: flex;
  gap: 8px;
}

.comp-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.comp-badge.selected {
  border-color: var(--primary);
  background: rgba(255, 138, 0, 0.15);
}

.comp-avatar-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.zone-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.zone-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.zone-img-wrap {
  position: relative;
  height: 180px;
  overflow: hidden;
}

.zone-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.zone-card:hover .zone-img-wrap img {
  transform: scale(1.05);
}

.zone-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.tag-safe { background: rgba(16, 185, 129, 0.85); color: #fff; }
.tag-medium { background: rgba(59, 130, 246, 0.85); color: #fff; }
.tag-danger { background: rgba(239, 68, 68, 0.85); color: #fff; }
.tag-hard { background: rgba(168, 85, 247, 0.85); color: #fff; }

.zone-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.zone-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
}

.zone-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
  flex: 1;
}

.zone-drops {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.drop-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.zone-rec {
  font-size: 0.8rem;
  color: #fbbf24;
  margin-bottom: 12px;
}

.btn-zone-start {
  width: 100%;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 138, 0, 0.9), rgba(255, 80, 0, 0.9));
  color: #fff;
}

.btn-zone-start:hover {
  filter: brightness(1.15);
}

/* ================= TAB 3: 생존 미녀들 ================= */
.girls-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.girl-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
}

.girl-card:hover {
  border-color: rgba(255, 138, 0, 0.4);
  transform: translateY(-2px);
}

.girl-banner {
  height: 220px;
  position: relative;
  overflow: hidden;
}

.girl-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.girl-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--primary);
  color: #ffaa44;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.girl-info {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.girl-name-wrap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.girl-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

.girl-role {
  font-size: 0.82rem;
  color: var(--secondary);
}

.affection-wrap {
  margin-bottom: 12px;
}

.aff-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.aff-bar-wrap {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.aff-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ec4899, #f43f5e);
  transition: width 0.4s ease;
}

.girl-bio {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
  flex: 1;
}

.girl-special-skill {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--primary);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  font-size: 0.8rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

.girl-actions {
  display: flex;
  gap: 8px;
}

.girl-actions button {
  flex: 1;
  padding: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.girl-actions button:hover {
  background: rgba(255, 138, 0, 0.2);
  border-color: var(--primary);
  color: #ffaa44;
}

/* ================= TAB 4: 제작 & 공방 ================= */
.crafting-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.craft-category-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.craft-category-box h3 {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipe-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}

.recipe-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.recipe-meta h4 {
  font-size: 0.92rem;
  color: #fff;
  margin-bottom: 4px;
}

.recipe-meta p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.recipe-cost {
  font-size: 0.76rem;
  color: #fbbf24;
  margin-top: 4px;
}

.btn-craft {
  padding: 6px 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-craft:hover { filter: brightness(1.15); }
.btn-craft:disabled { opacity: 0.4; cursor: not-allowed; }

/* ================= TAB 5: 밤의 모닥불 ================= */
.campfire-screen {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 138, 0, 0.3);
  box-shadow: 0 0 40px rgba(255, 100, 0, 0.15);
}

.campfire-bg-wrap {
  position: relative;
  min-height: 520px;
  background: #05070a;
}

.campfire-bg {
  width: 100%;
  height: 100%;
  max-height: 580px;
  object-fit: cover;
  display: block;
  filter: brightness(0.85) contrast(1.1);
}

.campfire-overlay-panel {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 7, 10, 0.2) 0%, rgba(5, 7, 10, 0.85) 60%, rgba(5, 7, 10, 0.98) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.campfire-header {
  max-width: 600px;
}

.night-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid #818cf8;
  color: #a5b4fc;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-family: var(--font-display);
}

.campfire-header h2 {
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 4px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.campfire-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 대화 상자 */
.campfire-dialogue-box {
  background: rgba(14, 18, 26, 0.88);
  border: 1px solid rgba(255, 138, 0, 0.35);
  border-radius: 14px;
  padding: 18px;
  backdrop-filter: blur(10px);
  margin: 18px 0;
}

.speaker-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.cf-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

.cf-speaker-info {
  display: flex;
  flex-direction: column;
}

.cf-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.cf-relation {
  font-size: 0.8rem;
  color: #f43f5e;
}

.cf-dialogue-text {
  font-size: 1.02rem;
  color: #f3f4f6;
  line-height: 1.6;
  min-height: 60px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

.cf-choices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cf-choice-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cf-choice-btn:hover {
  background: rgba(255, 138, 0, 0.2);
  border-color: var(--primary);
  transform: translateX(4px);
}

.btn-night-sleep {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
  transition: all 0.2s ease;
}

.btn-night-sleep:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

/* ================= TAB 6: 극비 일지 & CG ================= */
.archive-nav-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.arch-tab-btn {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.arch-tab-btn:hover {
  color: var(--text-main);
}

.arch-tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.2), rgba(0, 100, 255, 0.1));
  border-color: var(--secondary);
  color: #fff;
}

.archive-content-sub {
  display: none;
}

.archive-content-sub.active {
  display: block;
}

/* CG 그리드 */
.cg-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.cg-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
}

.cg-card:hover {
  border-color: var(--secondary);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 210, 255, 0.2);
}

.cg-thumb-wrap {
  height: 180px;
  position: relative;
  background: #000;
}

.cg-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cg-thumb-wrap.locked img {
  filter: blur(12px) brightness(0.4);
}

.cg-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  font-size: 0.85rem;
}

.cg-caption {
  padding: 12px;
}

.cg-caption h4 {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 4px;
}

.cg-caption p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* 극비 문서 리스트 */
.files-list-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-card:hover {
  border-color: #fbbf24;
  background: var(--bg-card-hover);
}

.file-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.file-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.file-code {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: #fbbf24;
}

.file-status {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.status-found { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.status-hidden { background: rgba(255, 255, 255, 0.08); color: var(--text-dim); }

.file-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.file-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 아티팩트 그리드 */
.relics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.relic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.relic-icon {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 10px;
}

.relic-card.locked {
  opacity: 0.5;
  filter: grayscale(1);
}

.relic-info h4 {
  font-size: 0.92rem;
  color: #fff;
  margin-bottom: 3px;
}

.relic-buff {
  font-size: 0.78rem;
  color: var(--secondary);
  font-weight: 600;
}

/* 엔딩 분기 그리드 */
.endings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.ending-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
}

.ending-card.achieved {
  border-color: #fbbf24;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.15);
}

.ending-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.ending-tag {
  font-family: var(--font-display);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-unlocked { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.tag-locked { background: rgba(255, 255, 255, 0.08); color: var(--text-dim); }

.ending-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}

.ending-req {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ================= 7. 모달 시스템 ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: #151a23;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.15rem;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
}

.event-image-banner {
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

.event-image-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-narrative {
  font-size: 0.95rem;
  color: #f3f4f6;
  line-height: 1.6;
  margin-bottom: 18px;
}

.event-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-opt-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.event-opt-btn:hover {
  background: rgba(255, 138, 0, 0.2);
  border-color: var(--primary);
  transform: translateX(4px);
}

/* CG 풀화면 모달 */
.modal-full {
  max-width: 960px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.modal-close-float {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid #fff;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.cg-full-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.cg-full-wrap img {
  width: 100%;
  max-height: 75vh;
  object-fit: contain;
  display: block;
}

.cg-full-caption {
  background: rgba(14, 18, 26, 0.95);
  padding: 16px 20px;
}

.cg-full-caption h3 {
  color: #fff;
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.cg-full-caption p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 문서 리더 모달 (양식) */
.modal-doc {
  max-width: 620px;
}

.doc-paper {
  background: #fdfbf7;
  color: #262626;
  border-radius: 8px;
  padding: 24px;
  font-family: 'Georgia', serif;
  position: relative;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.08);
}

.doc-stamp {
  position: absolute;
  top: 20px;
  right: 20px;
  border: 3px solid #dc2626;
  color: #dc2626;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  padding: 4px 10px;
  transform: rotate(-10deg);
  opacity: 0.85;
}

.doc-meta {
  font-size: 0.8rem;
  color: #737373;
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 10px;
  margin-bottom: 16px;
  font-family: var(--font-main);
}

.doc-text {
  font-size: 0.98rem;
  line-height: 1.8;
  white-space: pre-line;
}

/* ================= 8. 엔딩 오버레이 ================= */
.ending-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.95);
  backdrop-filter: blur(15px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ending-overlay.hidden { display: none; }

.ending-box {
  background: #111620;
  border: 2px solid #fbbf24;
  border-radius: 18px;
  padding: 28px;
  max-width: 680px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 60px rgba(251, 191, 36, 0.25);
  animation: zoomIn 0.5s ease;
}

.ending-badge {
  font-family: var(--font-display);
  color: #fbbf24;
  font-size: 0.85rem;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.ending-title {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 16px;
}

.ending-img-box {
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ending-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ending-story {
  color: #e5e7eb;
  font-size: 0.98rem;
  line-height: 1.7;
  margin-bottom: 20px;
  white-space: pre-line;
}

.ending-stats {
  font-size: 0.88rem;
  color: #fbbf24;
  margin-bottom: 24px;
}

/* ================= 9. 반응형 미디어 쿼리 ================= */
@media (max-width: 768px) {
  #top-hud {
    padding: 8px 12px;
  }

  .hud-status {
    width: 100%;
    justify-content: space-between;
  }

  .status-pill {
    flex: 1;
  }

  .hero-title {
    font-size: 1.4rem;
  }

  .hero-image-wrap {
    min-height: 320px;
  }

  .hero-overlay {
    padding: 16px;
  }

  .campfire-bg-wrap {
    min-height: 480px;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
