/* ── VALHALLA HQ — 16-Bit Pixel-Art Heads-Up Display Styling ──
 * Palette:
 *  - Background: #0b1320 (Deep slate / midnight navy)
 *  - HUD Cards: #131e31 (Translucent dark HUD with 1px solid rgba(255,255,255,0.08))
 *  - Timber Gold: #d4a373 / #e5ac56
 *  - Emerald Green: #22c55e
 *  - Portal Purple: #a855f7
 *  - Frost Blue: #38bdf8
 * Typography:
 *  - Headings/Badges: 'Press Start 2P', 'Silkscreen', monospace
 *  - Body/Logs: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Press+Start+2P&family=Silkscreen:wght@400;700&display=swap');

:root {
  --bg-dark: #0b1320;
  --bg-card: rgba(19, 30, 49, 0.88);
  --bg-card-hover: rgba(24, 38, 62, 0.95);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-card-hover: rgba(212, 163, 115, 0.35);
  --timber-gold: #d4a373;
  --timber-gold-light: #e5ac56;
  --timber-dark: #2c1a0e;
  --emerald-green: #22c55e;
  --portal-purple: #a855f7;
  --frost-blue: #38bdf8;
  --blood-red: #ef4444;
  --amber-gold: #f59e0b;
  --text-primary: #f1f5f9;
  --text-muted: #94a3b8;
}

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

html, body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 10% 30%, rgba(168, 85, 247, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 70%, rgba(212, 163, 115, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

/* ── Typography Classes ──────────────────────────────────────────────── */
.font-pixel {
  font-family: 'Press Start 2P', 'Silkscreen', monospace;
  letter-spacing: -0.05em;
}
.font-silkscreen {
  font-family: 'Silkscreen', monospace;
}
.font-sans {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* ── Retro Pixel Borders & Cards ─────────────────────────────────────── */
.hud-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.hud-card:hover {
  border-color: var(--border-card-hover);
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.6), 0 0 16px rgba(212, 163, 115, 0.08);
}

.pixel-plaque {
  background: linear-gradient(180deg, #3d2516 0%, #24140b 100%);
  border: 2px solid #8c5b30;
  box-shadow: inset 0 1px 0 #b37d46, 0 4px 12px rgba(0,0,0,0.6);
}

.pixel-pill {
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ── Global Header (Test Selector: header.global-header) ─────────────── */
header.global-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 19, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ── Segmented Nav Pills ─────────────────────────────────────────────── */
.nav-pill {
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  border: 1px solid transparent;
}
.nav-pill:hover {
  color: var(--timber-gold);
  background: rgba(255, 255, 255, 0.05);
}
.nav-pill.active {
  background: rgba(212, 163, 115, 0.15);
  color: var(--timber-gold-light);
  border-color: rgba(212, 163, 115, 0.4);
  box-shadow: 0 0 12px rgba(212, 163, 115, 0.2);
}

/* ── Hero Zone: Isometric Mead Hall (Test Selector: section#hall) ───── */
section#hall {
  position: relative;
  background: #0f1826;
  border: 1px solid var(--border-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

/* Longhouse Timber Floor Grid */
.longhouse-floor {
  background-color: #121c2d;
  background-image: 
    linear-gradient(45deg, #0e1624 25%, transparent 25%), 
    linear-gradient(-45deg, #0e1624 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #0e1624 75%), 
    linear-gradient(-45deg, transparent 75%, #0e1624 75%);
  background-size: 32px 32px;
  background-position: 0 0, 0 16px, 16px -16px, -16px 0px;
}

/* Timber Rafters / Beams */
.timber-rafter-top {
  height: 14px;
  background: linear-gradient(180deg, #51331c 0%, #2f1c0f 100%);
  border-bottom: 2px solid #1a0f08;
  box-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

/* Fire Pit & Embers */
.fire-pit-base {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, #2b1810 0%, #150c08 70%);
  border: 4px solid #4a3427;
  box-shadow: 
    0 0 40px rgba(245, 158, 11, 0.35),
    0 0 70px rgba(239, 68, 68, 0.2),
    inset 0 0 20px rgba(0,0,0,0.8);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flame-core {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.8));
  animation: hearthFlame 1.8s infinite alternate ease-in-out;
  transform-origin: bottom center;
}

@keyframes hearthFlame {
  0% {
    transform: scale(1) translateY(0) rotate(-1deg);
    filter: drop-shadow(0 0 14px rgba(245, 158, 11, 0.7));
  }
  50% {
    transform: scale(1.08) translateY(-4px) rotate(1deg);
    filter: drop-shadow(0 0 24px rgba(239, 68, 68, 0.85));
  }
  100% {
    transform: scale(1.02) translateY(-2px) rotate(0deg);
    filter: drop-shadow(0 0 18px rgba(245, 158, 11, 0.75));
  }
}

.ember-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #f59e0b;
  border-radius: 50%;
  box-shadow: 0 0 6px #f59e0b;
  animation: floatEmber 2.5s infinite linear;
}
.ember-1 { left: 35%; animation-delay: 0.2s; }
.ember-2 { left: 50%; animation-delay: 0.8s; }
.ember-3 { left: 65%; animation-delay: 1.4s; }

@keyframes floatEmber {
  0% { transform: translateY(0) scale(1); opacity: 0.9; }
  50% { transform: translateY(-30px) translateX(6px) scale(0.8); opacity: 0.6; }
  100% { transform: translateY(-60px) translateX(-4px) scale(0.2); opacity: 0; }
}

/* ── Dynamic Workstation Status Pins ─────────────────────────────────── */
.workstation-pin {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  transition: all 0.2s ease;
  user-select: none;
}
.workstation-pin:hover {
  transform: translateY(-2px);
  border-color: var(--timber-gold);
  box-shadow: 0 6px 18px rgba(0,0,0,0.6), 0 0 12px rgba(212, 163, 115, 0.2);
}

/* Skald Interactive Speech Bubble */
.skald-bubble {
  position: relative;
  background: linear-gradient(135deg, rgba(26, 18, 48, 0.92) 0%, rgba(18, 13, 34, 0.95) 100%);
  border: 1px solid rgba(168, 85, 247, 0.4);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6), 0 0 14px rgba(168, 85, 247, 0.18);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.skald-bubble:hover {
  border-color: rgba(168, 85, 247, 0.8);
  box-shadow: 0 8px 24px rgba(0,0,0,0.7), 0 0 20px rgba(168, 85, 247, 0.3);
  transform: translateY(-2px) scale(1.01);
}
.skald-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 24px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(168, 85, 247, 0.5);
}

/* ── Live Activity Floating Drawer (Test Selector: aside.sidebar) ────── */
aside.sidebar {
  background: rgba(19, 30, 49, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}

/* Event Feed (Test Selector: #event-feed) */
#event-feed {
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 163, 115, 0.3) transparent;
}
#event-feed::-webkit-scrollbar {
  width: 5px;
}
#event-feed::-webkit-scrollbar-track {
  background: transparent;
}
#event-feed::-webkit-scrollbar-thumb {
  background: rgba(212, 163, 115, 0.3);
  border-radius: 4px;
}
#event-feed li {
  animation: feedItemSlide 0.25s ease-out;
}
@keyframes feedItemSlide {
  from { opacity: 0; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Event Feed Badge Colors ─────────────────────────────────────────── */
.badge-join {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.badge-leave {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-boss {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}
.badge-raid {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-save {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ── Real-Time Telemetry Progress Bars ────────────────────────────────── */
.meter-track {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.meter-fill {
  height: 100%;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 4px;
}

/* ── Biome Tracker Status Dots ───────────────────────────────────────── */
.biome-dot-conquered {
  background-color: var(--emerald-green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}
.biome-dot-active {
  background-color: var(--amber-gold);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
  animation: pulseAmber 1.8s infinite;
}
.biome-dot-locked {
  background-color: #64748b;
  box-shadow: none;
}

@keyframes pulseAmber {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.75; }
  100% { transform: scale(1); opacity: 1; }
}

/* ── Portal Connection Ley-Line Canvas & Network ─────────────────────── */
.portal-network-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 260px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, #1a0e2e 0%, #0c0818 65%, #05030a 100%);
  border: 2px solid rgba(168, 85, 247, 0.4);
  box-shadow: inset 0 0 24px rgba(0,0,0,0.8), 0 0 20px rgba(168, 85, 247, 0.15);
  overflow: hidden;
}
.portal-orbit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(168, 85, 247, 0.25);
  pointer-events: none;
}
.portal-ring-1 { width: 32%; height: 32%; }
.portal-ring-2 { width: 62%; height: 62%; }
.portal-ring-3 { width: 92%; height: 92%; }

.portal-pulse-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  background: #a855f7;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px #a855f7;
  animation: pulsePortalCenter 2s infinite ease-in-out;
}
@keyframes pulsePortalCenter {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.35); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.portal-leyline-beam {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48%;
  height: 2px;
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.85) 0%, rgba(56, 189, 248, 0.3) 100%);
  transform-origin: left center;
  pointer-events: none;
}

.portal-node-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.8));
  transition: transform 0.15s ease;
}
.portal-node-pin:hover {
  transform: translate(-50%, -50%) scale(1.4);
  z-index: 10;
}

/* ── Modals / Overlays for Nav Pills ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(7, 12, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-dialog {
  background: #111b2b;
  border: 1px solid rgba(212, 163, 115, 0.3);
  box-shadow: 0 20px 48px -8px rgba(0,0,0,0.8), 0 0 24px rgba(212, 163, 115, 0.12);
  border-radius: 16px;
  max-width: 860px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

/* ── Footer (Test Selector: footer.footer) ───────────────────────────── */
footer.footer {
  background: #09111c;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
}

/* ── Responsive Mobile Utilities ─────────────────────────────────────── */
@media (max-width: 768px) {
  .fire-pit-base {
    width: 110px;
    height: 110px;
  }
  .flame-core {
    font-size: 2.75rem;
  }
  .portal-network-container {
    max-width: 220px;
  }
}
