/* ==========================================================================
   PROJECT CARMINITE — MILITARY TACTICAL TERMINAL OS (GDC-OS v4.9.12)
   High-Tech Cyber-Terminal Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;800;900&family=Rajdhani:wght@400;500;600;700&family=JetBrains+Mono:wght@300;400;500;700;800&display=swap');

:root {
  --term-bg-deep: #050608;
  --term-bg-screen: #0a0c10;
  --term-bg-panel: rgba(13, 16, 22, 0.92);
  --term-bg-card: rgba(18, 22, 30, 0.85);

  --bone-white: #e9e5dc;
  --bone-gray: #a8a49c;
  --bone-dark: #4b4843;

  --ruby-bright: #ff1e46;
  --ruby-core: #d80027;
  --ruby-deep: #7a0016;
  --ruby-glow: rgba(255, 30, 70, 0.4);
  --ruby-glow-intense: rgba(255, 30, 70, 0.85);

  --cyan-term: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.35);
  --amber-warn: #ffb703;
  --green-ok: #00ff88;

  --border-dim: rgba(233, 229, 220, 0.12);
  --border-bright: rgba(255, 30, 70, 0.4);
  --border-cyan: rgba(0, 240, 255, 0.4);

  --font-display: 'Orbitron', monospace, sans-serif;
  --font-body: 'Rajdhani', sans-serif;
  --font-term: 'JetBrains Mono', monospace;

  --terminal-clip: polygon(
    0 0, 
    calc(100% - 14px) 0, 100% 14px, 
    100% calc(100% - 14px), calc(100% - 14px) 100%, 
    14px 100%, 0 calc(100% - 14px)
  );
  --terminal-clip-sm: polygon(
    0 0, 
    calc(100% - 8px) 0, 100% 8px, 
    100% calc(100% - 8px), calc(100% - 8px) 100%, 
    8px 100%, 0 calc(100% - 8px)
  );
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--term-bg-deep);
  color: #dcd8d0;
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(216, 0, 39, 0.1) 0%, transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

/* CRT Scanline & Phosphor Overlay */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.35) 50%);
  background-size: 100% 3px;
  opacity: 0.45;
}

#shard-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* Terminal Outer Housing Frame */
.terminal-outer-frame {
  position: relative;
  z-index: 10;
  max-width: 1600px;
  margin: 0 auto;
  border-left: 2px solid var(--border-bright);
  border-right: 2px solid var(--border-bright);
  min-height: 100vh;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.95), inset 0 0 30px rgba(255, 30, 70, 0.05);
}

/* Top Terminal Diagnostic Bar */
.terminal-sys-bar {
  background: #080a0f;
  border-bottom: 2px solid var(--ruby-bright);
  padding: 6px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-term);
  font-size: 0.76rem;
  color: var(--bone-gray);
  box-shadow: 0 0 15px var(--ruby-glow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.terminal-status-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.term-tag-badge {
  background: rgba(255, 30, 70, 0.15);
  border: 1px solid var(--ruby-bright);
  color: var(--ruby-bright);
  padding: 2px 8px;
  font-weight: 700;
  letter-spacing: 1px;
}

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

.term-ui-btn {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-bone);
  color: var(--bone-white);
  padding: 3px 12px;
  font-family: var(--font-term);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
  clip-path: var(--terminal-clip-sm);
}

.term-ui-btn.admin {
  border-color: var(--cyan-term);
  color: var(--cyan-term);
}

.term-ui-btn:hover {
  background: var(--ruby-bright);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 12px var(--ruby-glow);
}

.term-ui-btn.admin.active {
  background: var(--cyan-term);
  color: #000;
  box-shadow: 0 0 15px var(--cyan-glow);
}

.term-ui-btn.audio-playing {
  background: rgba(255, 30, 70, 0.25);
  border-color: var(--ruby-bright);
  box-shadow: 0 0 14px var(--ruby-glow);
  color: #fff;
}

.term-ui-btn.sfx-active {
  background: rgba(0, 240, 255, 0.18);
  border-color: var(--cyan-term);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
  color: var(--cyan-term);
}

.term-ui-btn.sfx-muted {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
  color: #888;
  opacity: 0.65;
}

/* Cyber Audio Controls & Volume Slider */
.audio-vol-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-dim);
  padding: 3px 10px;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.25s ease;
}

.audio-vol-container:hover {
  border-color: var(--ruby-bright);
}

.vol-icon {
  font-size: 0.85rem;
  color: var(--ruby-bright);
}

.audio-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 75px;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.audio-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ruby-bright);
  box-shadow: 0 0 8px var(--ruby-glow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.audio-vol-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.audio-vol-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ruby-bright);
  box-shadow: 0 0 8px var(--ruby-glow);
  border: none;
  cursor: pointer;
}

.vol-percentage {
  font-family: var(--font-term);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ruby-bright);
  min-width: 32px;
  text-align: right;
}

.audio-track-ticker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-term);
  font-size: 0.7rem;
  color: var(--cyan-term);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.25);
  padding: 2px 8px;
  clip-path: var(--terminal-clip-sm);
  max-width: 280px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ticker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ruby-bright);
  box-shadow: 0 0 8px var(--ruby-glow);
  animation: pulse-ring 1.5s infinite;
}

/* Terminal Header */
.terminal-header {
  background: linear-gradient(180deg, #0d1017 0%, #080a0e 100%);
  border-bottom: 1px solid var(--border-dim);
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  gap: 20px;
}

.term-logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.term-crystal-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #fff, var(--ruby-bright), #500);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: 0 0 20px var(--ruby-glow-intense);
  animation: float-crystal 4s infinite ease-in-out;
}

.term-title h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--bone-white);
  text-transform: uppercase;
}

.term-title h1 span {
  color: var(--ruby-bright);
  text-shadow: 0 0 12px var(--ruby-glow);
}

.term-title .sub {
  font-family: var(--font-term);
  font-size: 0.72rem;
  color: var(--bone-gray);
  letter-spacing: 1.5px;
}

/* Terminal Nav Tabs */
.term-nav {
  display: flex;
  gap: 8px;
}

.term-tab-btn {
  background: rgba(14, 18, 24, 0.7);
  border: 1px solid var(--border-dim);
  border-top: 2px solid transparent;
  color: var(--bone-gray);
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.25s ease;
  clip-path: var(--terminal-clip-sm);
  position: relative;
}

.term-tab-btn:hover {
  color: #fff;
  background: rgba(255, 30, 70, 0.15);
  border-color: var(--ruby-bright);
}

.term-tab-btn.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(216, 0, 39, 0.35) 0%, rgba(15, 18, 26, 0.95) 100%);
  border-color: var(--ruby-bright);
  border-top: 2px solid var(--ruby-bright);
  box-shadow: 0 0 18px var(--ruby-glow);
}

/* Main Content Terminal Viewport */
.terminal-main-content {
  padding: 35px 30px 100px;
  min-height: 450px;
}

.tab-pane {
  display: none !important;
}

.tab-pane.active {
  display: block !important;
  animation: terminalFade 0.25s ease forwards;
}

/* Terminal Section Header */
.terminal-section-head {
  margin-bottom: 25px;
  border-left: 3px solid var(--ruby-bright);
  padding-left: 16px;
}

.terminal-section-head .tag {
  font-family: var(--font-term);
  font-size: 0.78rem;
  color: var(--ruby-bright);
  letter-spacing: 2px;
}

.terminal-section-head h2 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--bone-white);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.terminal-section-head p {
  color: var(--bone-gray);
  font-size: 1rem;
  max-width: 900px;
  margin-top: 4px;
}

/* Terminal Glass Box / Panels */
.terminal-card {
  background: var(--term-bg-panel);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--ruby-bright);
  padding: 24px;
  clip-path: var(--terminal-clip);
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

.terminal-card::before {
  content: '┌──┐';
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: var(--font-term);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.15);
}

.terminal-card:hover {
  border-color: var(--ruby-bright);
  box-shadow: 0 10px 35px rgba(0,0,0,0.8), 0 0 20px var(--ruby-glow);
  transform: translateY(-2px);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--ruby-bright), var(--ruby-deep));
  color: #fff;
  border: none;
  padding: 13px 26px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px var(--ruby-glow-intense);
  background: linear-gradient(135deg, #ff385c, #a1001c);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.7);
  color: var(--bone-white);
  border: 1px solid var(--bone-gray);
  padding: 13px 26px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--ruby-bright);
  color: #fff;
}

/* ==========================================================================
   TAB 1: HERO & TIMELINE
   ========================================================================== */
.hero-banner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 30px;
  background: linear-gradient(135deg, rgba(20, 24, 32, 0.95), rgba(10, 12, 16, 0.98));
  border: 1px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  overflow: hidden;
  margin-bottom: 50px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 30, 70, 0.2);
}

.hero-content {
  padding: 45px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 30, 70, 0.15);
  border: 1px solid var(--ruby-bright);
  color: var(--ruby-bright);
  padding: 4px 14px;
  font-family: var(--font-term);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 20px;
  clip-path: var(--terminal-clip-sm);
  width: fit-content;
}

.hero-heading {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 18px;
  color: var(--bone-white);
  text-transform: uppercase;
}

.hero-heading span {
  color: var(--ruby-bright);
  text-shadow: 0 0 20px var(--ruby-glow-intense);
}

.hero-lead {
  font-size: 1.1rem;
  color: var(--bone-gray);
  margin-bottom: 25px;
  line-height: 1.6;
}

.hero-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

.stat-box {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--ruby-bright);
  padding: 12px 16px;
  clip-path: var(--terminal-clip-sm);
}

.stat-val {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--ruby-bright);
  text-shadow: 0 0 10px var(--ruby-glow);
}

.stat-lbl {
  font-family: var(--font-term);
  font-size: 0.72rem;
  color: var(--bone-gray);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-actions {
  display: flex;
  gap: 16px;
}

.hero-image-wrap {
  position: relative;
  min-height: 400px;
  overflow: hidden;
  border-left: 1px solid var(--border-bright);
}

.hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.15) brightness(0.9);
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.timeline-card {
  background: var(--term-bg-panel);
  border: 1px solid var(--border-dim);
  border-top: 2px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 26px;
  position: relative;
  transition: all 0.3s ease;
}

.timeline-card:hover {
  border-color: var(--ruby-bright);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--ruby-glow);
}

.timeline-epoch {
  font-family: var(--font-term);
  font-size: 0.8rem;
  color: var(--ruby-bright);
  font-weight: 700;
  margin-bottom: 8px;
}

.timeline-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--bone-white);
  margin-bottom: 12px;
}

.timeline-card p {
  color: var(--bone-gray);
  font-size: 0.96rem;
  line-height: 1.55;
}

/* ==========================================================================
   TAB 2: ANATOMICAL SCANNER (SPECIMEN CATALOG & 3-COLUMN MASTER LAYOUT)
   ========================================================================== */
.scanner-master-layout {
  display: grid;
  grid-template-columns: 290px 1.05fr 1.15fr;
  gap: 24px;
  align-items: start;
}

.specimen-catalog-sidebar {
  background: var(--term-bg-panel);
  border: 1px solid var(--border-dim);
  border-top: 3px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.catalog-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 30, 70, 0.25);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.catalog-count-badge {
  background: rgba(255, 30, 70, 0.15);
  border: 1px solid var(--ruby-bright);
  color: var(--ruby-bright);
  font-family: var(--font-term);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  clip-path: var(--terminal-clip-sm);
}

.specimen-list-scrollable {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 580px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--ruby-bright) #080a0f;
}

.specimen-list-scrollable::-webkit-scrollbar {
  width: 5px;
}
.specimen-list-scrollable::-webkit-scrollbar-track {
  background: #080a0f;
}
.specimen-list-scrollable::-webkit-scrollbar-thumb {
  background: var(--ruby-bright);
  border-radius: 2px;
}

.specimen-item-btn {
  background: rgba(14, 18, 25, 0.9);
  border: 1px solid var(--border-dim);
  border-left: 3px solid transparent;
  padding: 10px 12px;
  clip-path: var(--terminal-clip-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  text-align: left;
}

.specimen-item-btn:hover {
  border-color: var(--ruby-bright);
  background: rgba(255, 30, 70, 0.1);
  transform: translateX(3px);
}

.specimen-item-btn.active {
  border-color: var(--ruby-bright);
  border-left: 3px solid var(--ruby-bright);
  background: linear-gradient(90deg, rgba(255, 30, 70, 0.25), rgba(14, 18, 25, 0.95));
  box-shadow: 0 0 15px rgba(255, 30, 70, 0.3);
}

.specimen-thumb-box {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border-dim);
  border-radius: 3px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}

.specimen-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.specimen-meta-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.specimen-meta-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.specimen-meta-tag {
  font-family: var(--font-term);
  font-size: 0.68rem;
  color: var(--cyan-term);
  margin-top: 2px;
}

.scanner-stage-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scanner-viewport-clean {
  position: relative;
  background: radial-gradient(circle at center, #151922 0%, #080a0e 100%);
  border: 1px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 30, 70, 0.2);
}

.scanner-hud-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-term);
  font-size: 0.78rem;
  color: var(--ruby-bright);
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255, 30, 70, 0.3);
  margin-bottom: 12px;
}

.specimen-stage-clean {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.specimen-stage-clean img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  filter: contrast(1.1) drop-shadow(0 0 25px rgba(255, 30, 70, 0.3));
}

.anatomy-list-clean {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.anatomy-item-btn {
  background: rgba(14, 18, 24, 0.85);
  border: 1px solid var(--border-dim);
  border-left: 4px solid var(--bone-dark);
  color: var(--bone-white);
  padding: 14px 18px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.25s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.anatomy-item-btn span.tag-code {
  font-family: var(--font-term);
  font-size: 0.75rem;
  color: var(--ruby-bright);
  font-weight: 600;
}

.anatomy-item-btn:hover {
  background: rgba(255, 30, 70, 0.15);
  border-color: var(--ruby-bright);
  transform: translateX(4px);
}

.anatomy-item-btn.active {
  background: linear-gradient(90deg, rgba(216, 0, 39, 0.4), rgba(30, 10, 16, 0.8));
  border-color: var(--ruby-bright);
  border-left: 4px solid var(--ruby-bright);
  box-shadow: 0 0 15px var(--ruby-glow);
  color: #fff;
}

.scanner-info-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hazard-level-banner {
  background: linear-gradient(90deg, #570010, #1c0206);
  border: 1px solid var(--ruby-bright);
  clip-path: var(--terminal-clip-sm);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hazard-level-banner .code {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
}

.threat-rating {
  font-family: var(--font-term);
  font-size: 0.85rem;
  color: var(--ruby-bright);
  font-weight: 700;
}

.bio-card {
  background: var(--term-bg-panel);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 24px;
}

.bio-card h4 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--bone-white);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bio-card p {
  color: var(--bone-gray);
  font-size: 0.98rem;
  line-height: 1.6;
}

.tactical-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 15px;
}

.tactical-item {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 14px;
  border-left: 2px solid var(--ruby-bright);
  font-family: var(--font-term);
  font-size: 0.82rem;
}

.tactical-item span {
  display: block;
  color: var(--bone-gray);
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.morph-switcher {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.morph-btn {
  flex: 1;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-dim);
  color: var(--bone-gray);
  padding: 10px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.2s ease;
}

.morph-btn:hover,
.morph-btn.active {
  background: var(--ruby-core);
  color: #fff;
  border-color: var(--ruby-bright);
  box-shadow: 0 0 12px var(--ruby-glow);
}

/* ==========================================================================
   TAB 3: ULTRA-DETAILED PLANETARY COMMAND MAP (BIGGER & REALISTIC)
   ========================================================================== */
.map-command-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  background: rgba(14, 18, 24, 0.95);
  border: 1px solid var(--border-dim);
  border-top: 2px solid var(--ruby-bright);
  padding: 12px 20px;
  clip-path: var(--terminal-clip-sm);
}

.map-filter-group {
  display: flex;
  gap: 10px;
}

.map-filter-btn {
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border-dim);
  color: var(--bone-gray);
  padding: 8px 16px;
  font-family: var(--font-term);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  clip-path: var(--terminal-clip-sm);
}

.map-filter-btn:hover, .map-filter-btn.active {
  background: var(--ruby-bright);
  color: #fff;
  border-color: var(--ruby-bright);
  box-shadow: 0 0 12px var(--ruby-glow);
}

.map-telemetry-hud {
  font-family: var(--font-term);
  font-size: 0.8rem;
  color: var(--cyan-term);
  display: flex;
  gap: 20px;
}

.world-map-svg-wrap {
  position: relative;
  background: radial-gradient(circle at 50% 50%, #151824 0%, #06070a 100%);
  border: 2px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 16px;
  overflow: hidden;
  box-shadow: inset 0 0 80px rgba(0,0,0,0.95), 0 0 35px var(--ruby-glow);
}

.map-svg {
  width: 100%;
  height: auto;
  min-height: 520px;
  display: block;
}

.landmass {
  fill: #1a1e2a;
  stroke: #454f68;
  stroke-width: 1.2;
  stroke-linejoin: round;
  transition: all 0.3s ease;
  cursor: pointer;
}

.landmass:hover {
  fill: #272e40;
  stroke: var(--cyan-term);
  stroke-width: 2.2;
  filter: drop-shadow(0 0 12px var(--cyan-glow));
}

.landmass.active {
  fill: #34121a;
  stroke: var(--ruby-bright);
  stroke-width: 2.8;
  filter: drop-shadow(0 0 18px var(--ruby-glow-intense));
}

.heat-epicenter {
  fill: rgba(255, 30, 70, 0.45);
  stroke: var(--ruby-bright);
  stroke-width: 2.5;
  animation: pulse-ring 2.5s infinite;
}

.heat-level-4 {
  fill: rgba(255, 56, 92, 0.35);
  stroke: #ff385c;
  stroke-width: 1.8;
}

.heat-level-3 {
  fill: rgba(255, 183, 3, 0.25);
  stroke: #ffb703;
  stroke-width: 1.5;
}

.tactical-poi {
  cursor: pointer;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.tactical-poi:hover {
  filter: drop-shadow(0 0 12px #00f0ff);
}

.poi-pulse {
  animation: poi-ring 2.5s infinite;
}

.poi-label {
  font-family: var(--font-term);
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}

/* --- Clean Live Dynamic World Map Events --- */
.live-event-marker {
  cursor: pointer;
  transition: filter 0.2s ease, opacity 0.2s ease;
}

.live-event-marker:hover {
  filter: drop-shadow(0 0 14px var(--ruby-bright));
}

.event-static-tag {
  font-family: var(--font-term);
  font-size: 9.5px;
  font-weight: 700;
  pointer-events: none;
}

.map-live-ticker-container {
  display: flex;
  align-items: center;
  background: rgba(255, 30, 70, 0.1);
  border: 1px solid var(--ruby-bright);
  padding: 0;
  margin-bottom: 14px;
  clip-path: var(--terminal-clip-sm);
  font-family: var(--font-term);
  font-size: 0.78rem;
  box-shadow: 0 0 15px rgba(255, 30, 70, 0.15);
  overflow: hidden;
  height: 38px;
}

.ticker-badge-live {
  background: var(--ruby-bright);
  color: #fff;
  font-weight: 800;
  padding: 8px 14px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  z-index: 2;
  box-shadow: 4px 0 12px rgba(0,0,0,0.8);
  flex-shrink: 0;
}

.ticker-marquee-track {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  position: relative;
  mask-image: linear-gradient(to right, transparent, black 20px, black 95%, transparent);
}

.ticker-marquee-txt {
  display: inline-block;
  white-space: nowrap;
  color: var(--bone-white);
  font-weight: 600;
  padding-left: 20%;
  animation: news-ticker-left 65s linear infinite;
}

.ticker-marquee-txt:hover {
  animation-play-state: paused;
}

@keyframes news-ticker-left {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}

/* --- 5 Structured Threat Level Badges (1 = lowest, 5 = highest) --- */
.threat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 0.72rem;
  font-family: var(--font-term);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.threat-badge.lvl-1 {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid #10b981;
}

.threat-badge.lvl-2 {
  background: rgba(0, 240, 255, 0.2);
  color: var(--cyan-term);
  border: 1px solid var(--cyan-term);
}

.threat-badge.lvl-3 {
  background: rgba(255, 183, 3, 0.2);
  color: #ffb703;
  border: 1px solid #ffb703;
}

.threat-badge.lvl-4 {
  background: rgba(255, 56, 92, 0.2);
  color: #ff385c;
  border: 1px solid #ff385c;
}

.threat-badge.lvl-5 {
  background: rgba(255, 0, 85, 0.25);
  color: #ff0055;
  border: 1px solid #ff0055;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.3);
}

.event-quick-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 0.72rem;
  font-family: var(--font-term);
  font-weight: 700;
}
.event-quick-badge.storm { background: rgba(255, 183, 3, 0.2); color: #ffb703; border: 1px solid #ffb703; }
.event-quick-badge.rain { background: rgba(255, 30, 70, 0.2); color: #ff1e46; border: 1px solid #ff1e46; }
.event-quick-badge.swarm { background: rgba(255, 0, 128, 0.2); color: #ff0080; border: 1px solid #ff0080; }
.event-quick-badge.rift { background: rgba(0, 240, 255, 0.2); color: var(--cyan-term); border: 1px solid var(--cyan-term); }
.event-quick-badge.blackout { background: rgba(180, 100, 255, 0.2); color: #c084fc; border: 1px solid #c084fc; }
.event-quick-badge.impact { background: rgba(255, 220, 0, 0.2); color: #fde047; border: 1px solid #fde047; }

/* --- Tactical Map Sub-tabs Navigation --- */
.map-subtabs-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  flex-wrap: wrap;
}

.map-subtab-btn {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--border-bone);
  color: var(--bone-gray);
  padding: 8px 16px;
  font-family: var(--font-term);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  clip-path: var(--terminal-clip-sm);
}

.map-subtab-btn:hover {
  border-color: var(--ruby-bright);
  color: #fff;
}

.map-subtab-btn.active {
  background: rgba(255, 30, 70, 0.18);
  border-color: var(--ruby-bright);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 30, 70, 0.25);
}

.hourly-cycle-timer {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-dim);
  padding: 6px 14px;
  font-family: var(--font-term);
  font-size: 0.78rem;
  color: var(--bone-gray);
  clip-path: var(--terminal-clip-sm);
}

.hourly-cycle-timer strong {
  color: var(--cyan-term);
  letter-spacing: 1px;
}

/* Dynamic Live Event Cards Grid */
.map-events-feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.event-feed-card {
  background: var(--term-bg-panel);
  border: 1px solid var(--border-dim);
  border-left: 4px solid var(--ruby-bright);
  padding: 16px;
  clip-path: var(--terminal-clip-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.event-feed-card:hover {
  border-color: var(--ruby-bright);
  box-shadow: 0 0 15px rgba(255, 30, 70, 0.2);
}

.event-feed-card.active-focus {
  border-color: var(--cyan-term);
  border-left-color: var(--cyan-term);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.event-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.event-card-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
}

.event-card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 10px;
  font-family: var(--font-term);
  font-size: 0.74rem;
  color: var(--bone-gray);
}

.event-card-desc {
  font-size: 0.88rem;
  color: var(--bone-gray);
  line-height: 1.5;
  margin-bottom: 12px;
}

.event-card-vector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-term);
  font-size: 0.76rem;
  color: var(--cyan-term);
  background: rgba(0, 240, 255, 0.08);
  padding: 4px 8px;
  border-radius: 2px;
  margin-bottom: 10px;
}

.event-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.map-bottom-details-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 20px;
}

.zone-legend-bar {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  font-family: var(--font-term);
  font-size: 0.76rem;
  padding: 10px 16px;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--border-dim);
  flex-wrap: wrap;
  clip-path: var(--terminal-clip-sm);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.zone-header-card {
  background: var(--term-bg-panel);
  border-left: 4px solid var(--ruby-bright);
  padding: 22px;
  clip-path: var(--terminal-clip);
}

.zone-name {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--bone-white);
  margin-bottom: 6px;
}

.zone-tier {
  font-family: var(--font-term);
  font-size: 0.84rem;
  color: var(--ruby-bright);
  letter-spacing: 2px;
}

.zone-stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zone-stat-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-term);
  font-size: 0.85rem;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.zone-stat-row .val {
  color: var(--ruby-bright);
  font-weight: 700;
}

/* ==========================================================================
   TAB 4: FACTIONS
   ========================================================================== */
.factions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 25px;
}

.faction-card {
  background: var(--term-bg-panel);
  border: 1px solid var(--border-dim);
  border-left: 4px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.faction-card:hover {
  transform: translateY(-5px);
  border-color: var(--ruby-bright);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7), 0 0 20px var(--ruby-glow);
}

.faction-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 30, 70, 0.15);
  border: 1px solid var(--ruby-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  color: var(--ruby-bright);
  font-size: 1.2rem;
}

.faction-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--bone-white);
  margin-bottom: 8px;
}

.faction-motto {
  font-family: var(--font-term);
  font-size: 0.78rem;
  color: var(--ruby-bright);
  margin-bottom: 14px;
  font-style: italic;
}

.faction-desc {
  color: var(--bone-gray);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.faction-perks {
  list-style: none;
  font-family: var(--font-term);
  font-size: 0.8rem;
  color: var(--bone-gray);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.faction-perks li::before {
  content: '▶ ';
  color: var(--ruby-bright);
}

/* ==========================================================================
   TAB 5: RP DOSSIER GENERATOR
   ========================================================================== */
.dossier-builder-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 35px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-family: var(--font-term);
  font-size: 0.82rem;
  color: var(--ruby-bright);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-dim);
  color: var(--bone-white);
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.25s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--ruby-bright);
  box-shadow: 0 0 15px var(--ruby-glow);
  background: rgba(20, 0, 5, 0.5);
}

select.form-control {
  cursor: pointer;
}

select.form-control option {
  background: #101218;
  color: #fff;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.slider-input {
  flex: 1;
  accent-color: var(--ruby-bright);
}

.slider-val {
  font-family: var(--font-term);
  font-weight: 700;
  color: var(--ruby-bright);
  width: 50px;
}

.dossier-card {
  background: linear-gradient(145deg, #13161f 0%, #090a0e 100%);
  border: 2px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 30px;
  position: relative;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 25px var(--ruby-glow);
}

.dossier-top {
  display: flex;
  gap: 20px;
  align-items: center;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.dossier-avatar {
  width: 90px;
  height: 90px;
  border: 2px solid var(--ruby-bright);
  clip-path: var(--terminal-clip-sm);
  overflow: hidden;
}

.dossier-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dossier-meta h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--bone-white);
}

.dossier-meta .faction-tag {
  font-family: var(--font-term);
  font-size: 0.82rem;
  color: var(--ruby-bright);
}

.dossier-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.dossier-data-item {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 14px;
  border-left: 2px solid var(--ruby-bright);
}

.dossier-data-item .label {
  font-family: var(--font-term);
  font-size: 0.72rem;
  color: var(--bone-gray);
  text-transform: uppercase;
}

.dossier-data-item .value {
  font-family: var(--font-body);
  font-size: 1.05rem;
  color: var(--bone-white);
  font-weight: 600;
}

.dossier-bio {
  background: rgba(0, 0, 0, 0.4);
  padding: 15px;
  border: 1px dashed var(--border-dim);
  margin-bottom: 24px;
}

.dossier-bio .bio-title {
  font-family: var(--font-term);
  font-size: 0.75rem;
  color: var(--ruby-bright);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.dossier-bio p {
  font-size: 0.95rem;
  color: var(--bone-gray);
  line-height: 1.5;
}

.dossier-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   TAB 6: SIMULATOR
   ========================================================================= */
.simulator-container {
  background: #080a0f;
  border: 2px solid var(--ruby-bright);
  clip-path: var(--terminal-clip);
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px var(--ruby-glow);
}

.sim-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-dim);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.sim-meters {
  display: flex;
  gap: 25px;
}

.meter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-term);
  font-size: 0.82rem;
}

.meter-bar {
  width: 120px;
  height: 8px;
  background: #1a1e28;
  overflow: hidden;
  clip-path: var(--terminal-clip-sm);
}

.meter-fill {
  height: 100%;
  transition: width 0.4s ease;
}

.meter-hp .meter-fill {
  background: var(--ruby-bright);
  box-shadow: 0 0 8px var(--ruby-bright);
}

.meter-sanity .meter-fill {
  background: var(--cyan-term);
  box-shadow: 0 0 8px var(--cyan-term);
}

.sim-log-terminal {
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border-dim);
  height: 380px;
  overflow-y: auto;
  padding: 20px;
  font-family: var(--font-term);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 20px;
  border-left: 3px solid var(--ruby-bright);
}

.log-entry {
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.log-entry.narrative {
  color: var(--bone-white);
}

.log-entry.action {
  color: var(--cyan-term);
}

.log-entry.roll {
  color: #ffb703;
  background: rgba(255, 183, 3, 0.1);
  padding: 4px 8px;
  border-left: 2px solid #ffb703;
}

.log-entry.danger {
  color: var(--ruby-bright);
  font-weight: 700;
  text-shadow: 0 0 8px var(--ruby-glow);
}

/* ==========================================================================
   TERMINAL TOP BAR & BRANDING
   ========================================================================== */
.terminal-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: #090c12;
  border-bottom: 1px solid var(--border-dim);
  position: relative;
  z-index: 100;
  gap: 10px;
}

.term-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.term-icon {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--ruby-bright), #550011);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  box-shadow: 0 0 10px rgba(255, 30, 70, 0.6);
  flex-shrink: 0;
}

.term-title-wrap {
  display: flex;
  flex-direction: column;
}

.term-sys-id {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: #fff;
  font-weight: 800;
  letter-spacing: 1px;
}

.term-sub-id {
  font-family: var(--font-term);
  font-size: 0.65rem;
  color: var(--cyan-term);
  letter-spacing: 0.5px;
}

.term-status-ticker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-term);
  font-size: 0.76rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  clip-path: var(--terminal-clip-sm);
}

.ticker-alert {
  color: var(--ruby-bright);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--ruby-bright);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--ruby-bright);
  animation: pulse-dot 1.2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

.ticker-net {
  color: var(--bone-gray);
}
.ticker-net strong {
  color: var(--cyan-term);
}

.term-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-ui-btn {
  background: #0d111a;
  border: 1px solid var(--border-dim);
  color: var(--bone-white);
  padding: 6px 12px;
  font-family: var(--font-term);
  font-size: 0.78rem;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.term-ui-btn:hover {
  border-color: var(--ruby-bright);
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 30, 70, 0.3);
}

/* Burger Button (Hidden on Desktop) */
.burger-btn {
  display: none;
  background: rgba(255, 30, 70, 0.15);
  border-color: var(--ruby-bright);
  color: #fff;
  font-weight: 700;
}

/* ==========================================================================
   MOBILE SLIDE-OUT BURGER DRAWER
   ========================================================================== */
.mobile-menu-drawer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-menu-drawer.open {
  visibility: visible;
  opacity: 1;
}

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 340px;
  height: 100%;
  background: #080b11;
  border-left: 2px solid var(--ruby-bright);
  box-shadow: -10px 0 35px rgba(0,0,0,0.9);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0, 0.2, 1);
  overflow-y: auto;
}

.mobile-menu-drawer.open .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 30, 70, 0.3);
  padding-bottom: 15px;
}

.drawer-close-btn {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--bone-gray);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.2s ease;
}

.drawer-close-btn:hover {
  border-color: var(--ruby-bright);
  color: #fff;
}

.drawer-status-box {
  margin: 16px 0;
  background: rgba(0, 0, 0, 0.5);
  border-left: 3px solid var(--ruby-bright);
  padding: 10px 12px;
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.drawer-nav-btn {
  background: #0d111a;
  border: 1px solid var(--border-dim);
  border-left: 3px solid transparent;
  color: var(--bone-white);
  padding: 12px 14px;
  font-family: var(--font-term);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-nav-btn:hover {
  border-color: var(--ruby-bright);
  background: rgba(255, 30, 70, 0.1);
  color: #fff;
  border-left-color: var(--ruby-bright);
}

.drawer-nav-btn.active {
  border-color: var(--ruby-bright);
  background: linear-gradient(90deg, rgba(255, 30, 70, 0.25), rgba(13, 17, 26, 0.95));
  color: #fff;
  border-left-color: var(--ruby-bright);
  box-shadow: 0 0 15px rgba(255, 30, 70, 0.3);
}

.drawer-nav-btn.admin-link {
  margin-top: 15px;
  border-color: var(--cyan-term);
  color: var(--cyan-term);
  background: rgba(0, 240, 255, 0.08);
}

.drawer-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 15px;
  text-align: center;
}

.sim-choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.sim-choice-btn {
  background: rgba(20, 24, 34, 0.85);
  border: 1px solid var(--border-dim);
  border-left: 3px solid var(--ruby-bright);
  color: var(--bone-white);
  padding: 16px 20px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  clip-path: var(--terminal-clip-sm);
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sim-choice-btn span.choice-flavor {
  font-family: var(--font-term);
  font-size: 0.72rem;
  color: var(--ruby-bright);
}

.sim-choice-btn:hover {
  background: rgba(255, 30, 70, 0.2);
  border-color: var(--ruby-bright);
  transform: translateY(-2px);
  box-shadow: 0 0 15px var(--ruby-glow);
}

/* ==========================================================================
   ADMIN PANEL MODAL
   ========================================================================== */
.admin-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal.open {
  display: flex;
}

.admin-box {
  background: #0a0d14;
  border: 2px solid var(--cyan-term);
  box-shadow: 0 0 50px var(--cyan-glow);
  clip-path: var(--terminal-clip);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-header {
  padding: 18px 24px;
  background: #131722;
  border-bottom: 1px solid rgba(0, 240, 255, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--cyan-term);
  letter-spacing: 1px;
}

.admin-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  font-family: var(--font-term);
}

.admin-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 10px;
}

.admin-tab-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-dim);
  color: var(--bone-gray);
  padding: 8px 14px;
  font-family: var(--font-term);
  font-size: 0.8rem;
  cursor: pointer;
}

.admin-tab-btn.active {
  background: var(--cyan-term);
  color: #000;
  font-weight: 700;
}

.admin-tab-pane {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.admin-tab-pane.active {
  display: flex;
}

.editable-outline {
  outline: 2px dashed var(--cyan-term) !important;
  background: rgba(0, 240, 255, 0.08) !important;
  cursor: text;
}

.custom-lore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 25px;
}

.custom-lore-card {
  background: var(--term-bg-panel);
  border: 1px solid var(--cyan-term);
  clip-path: var(--terminal-clip);
  padding: 24px;
  position: relative;
}

.custom-lore-card .del-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(255, 30, 70, 0.2);
  border: 1px solid var(--ruby-bright);
  color: var(--ruby-bright);
  padding: 2px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 2px;
}

/* Terminal Footer */
.terminal-footer {
  margin-top: 80px;
  border-top: 2px solid var(--border-bright);
  padding: 35px 30px;
  background: rgba(5, 6, 8, 0.98);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-term);
  font-size: 0.82rem;
  color: var(--bone-gray);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--bone-gray);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--ruby-bright);
}

/* Toast Alert */
.toast-notice {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: rgba(10, 13, 18, 0.98);
  border: 1px solid var(--ruby-bright);
  color: #fff;
  padding: 14px 22px;
  font-family: var(--font-term);
  font-size: 0.85rem;
  clip-path: var(--terminal-clip-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px var(--ruby-glow);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   FULL-SCREEN SPECIMEN LIGHTBOX MODAL
   ========================================================================== */
.specimen-lightbox-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.96);
  backdrop-filter: blur(16px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: terminalFade 0.25s ease forwards;
}

.specimen-lightbox-modal.open {
  display: flex;
}

.lightbox-overlay-hud {
  width: 100%;
  max-width: 1300px;
  height: 92vh;
  background: #080a0f;
  border: 2px solid var(--ruby-bright);
  box-shadow: 0 0 60px rgba(255, 30, 70, 0.4), inset 0 0 40px rgba(0, 0, 0, 0.95);
  clip-path: var(--terminal-clip);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.lightbox-top-bar {
  padding: 16px 24px;
  background: #10141e;
  border-bottom: 2px solid var(--ruby-bright);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  z-index: 10;
}

.lightbox-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.lightbox-viewport {
  flex: 1;
  overflow: auto;
  padding: 40px;
  background: radial-gradient(circle at center, #151a24 0%, #06070a 100%);
  position: relative;
  text-align: center;
  display: block;
  user-select: none;
}

.lightbox-image-container {
  display: inline-block;
  margin: auto;
  vertical-align: middle;
  min-height: 100%;
}

.lightbox-viewport img {
  display: inline-block;
  max-width: 90vw;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: contrast(1.1) drop-shadow(0 0 35px rgba(255, 30, 70, 0.4));
  transition: transform 0.15s ease-out;
  transform-origin: center center;
  cursor: grab;
}

.lightbox-viewport img:active {
  cursor: grabbing;
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE MOBILE & TABLET ADAPTATION
   ========================================================================== */

/* Tablets & Small Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .scanner-layout {
    grid-template-columns: 1fr;
  }
  .map-layout-grid {
    grid-template-columns: 1fr;
  }
  .dossier-layout {
    grid-template-columns: 1fr;
  }
  .term-frame {
    padding: 12px;
  }
}

/* Tablets & Phablets (max-width: 768px) */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .terminal-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }

  .term-brand {
    justify-content: center;
  }

  .term-status-ticker {
    text-align: center;
    font-size: 0.72rem;
    overflow-x: auto;
    white-space: nowrap;
    padding: 4px 0;
  }

  .term-btn-group {
    justify-content: center;
    width: 100%;
  }

  .term-btn-group button, .term-btn-group a {
    flex: 1;
    justify-content: center;
  }

  /* Smooth horizontal scrollable tab bar for mobile thumbs */
  .term-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    gap: 6px;
    scrollbar-width: none;
  }
  .term-tabs::-webkit-scrollbar {
    display: none;
  }

  .term-tab-btn {
    flex: 0 0 auto;
    padding: 10px 14px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .hero-title {
    font-size: 1.8rem;
    line-height: 1.2;
  }

  .hero-lead {
    font-size: 0.95rem;
  }

  .morph-switcher {
    flex-direction: column;
    width: 100%;
  }

  .morph-btn {
    width: 100%;
    text-align: center;
    padding: 10px;
    font-size: 0.78rem;
  }

  .anatomy-points-grid {
    grid-template-columns: 1fr;
  }

  .factions-grid {
    grid-template-columns: 1fr;
  }

  .timeline-grid {
    grid-template-columns: 1fr;
  }

  .sim-hud {
    flex-direction: column;
    gap: 12px;
  }

  .sim-status-item {
    width: 100%;
  }

  .sim-terminal {
    max-height: 350px;
    padding: 14px;
  }

  .lightbox-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .lightbox-controls {
    width: 100%;
    justify-content: space-between;
  }

  .lightbox-viewport {
    padding: 15px;
  }

  .lightbox-viewport img {
    max-width: 98%;
    max-height: 60vh;
  }

  .lightbox-footer-hud {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}

/* Phones (max-width: 480px) */
@media (max-width: 480px) {
  .hero-stats-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .btn-primary, .btn-secondary, .term-ui-btn {
    padding: 9px 12px;
    font-size: 0.75rem;
  }

  .tab-pane {
    padding: 10px 4px;
  }

  .world-map-svg-wrap {
    aspect-ratio: 4 / 3;
  }
}

/* ==========================================================================
   DESKTOP VS MOBILE STRICT SEPARATION
   ========================================================================== */

/* Desktop Only Rules (width >= 769px) */
@media (min-width: 769px) {
  .burger-btn {
    display: none !important;
  }
  .mobile-menu-drawer {
    display: none !important;
  }
  .mobile-continent-pills {
    display: none !important;
  }
  .terminal-sys-bar {
    display: flex !important;
    justify-content: space-between;
    padding: 6px 20px;
  }
  .terminal-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
  }
  .term-nav {
    display: flex !important;
  }
}

/* Tablets & Phones (max-width: 768px) */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .terminal-outer-frame {
    padding: 6px;
    border-width: 1px;
    box-shadow: none;
  }

  .terminal-sys-bar {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .desktop-net-uplink, .desktop-sys-status {
    display: none !important;
  }

  .terminal-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 10px 20px;
    gap: 12px;
  }

  .terminal-header::after {
    display: none;
  }

  .term-logo-area {
    justify-content: center;
  }

  .term-title h1 {
    font-size: 1.3rem;
  }

  .term-title .sub {
    font-size: 0.65rem;
  }

  .term-nav {
    display: none !important; /* Mobile uses Burger Menu Drawer */
  }

  .burger-btn {
    display: inline-flex !important;
  }

  .audio-btn-txt {
    display: none; /* Icon only on mobile */
  }

  .terminal-main-content {
    padding: 15px 8px 60px;
  }

  .hero-banner {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hero-heading {
    font-size: 1.4rem !important;
    line-height: 1.25;
  }

  .hero-lead {
    font-size: 0.88rem !important;
    line-height: 1.5;
  }

  .hero-stats-row {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin-bottom: 18px;
    width: 100%;
  }

  .stat-box {
    padding: 8px 4px !important;
    text-align: center;
  }

  .stat-val {
    font-size: 1rem !important;
  }

  .stat-lbl {
    font-size: 0.62rem !important;
    line-height: 1.15;
  }

  .hero-actions {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100%;
  }

  .hero-actions button {
    width: 100% !important;
    justify-content: center !important;
  }

  .morph-switcher {
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .morph-btn {
    width: 100%;
    text-align: center;
    padding: 10px;
    font-size: 0.78rem;
  }

  .scanner-master-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .specimen-list-scrollable {
    max-height: 250px;
  }

  .anatomy-points-grid {
    grid-template-columns: 1fr;
  }

  .factions-grid {
    grid-template-columns: 1fr;
  }

  .timeline-grid {
    grid-template-columns: 1fr;
  }

  .dossier-layout {
    grid-template-columns: 1fr;
  }

  .map-command-layout {
    grid-template-columns: 1fr;
  }

  .mobile-continent-pills {
    display: block !important;
  }

  .world-map-svg-wrap {
    width: 100%;
    aspect-ratio: 1200 / 620;
    max-height: 480px;
    overflow: hidden;
  }

  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .map-filter-group {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .map-telemetry-hud {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
  }

  .sim-hud {
    flex-direction: column;
    gap: 10px;
  }

  .sim-status-item {
    width: 100%;
  }

  .sim-terminal {
    max-height: 300px;
    padding: 12px;
  }

  .sim-choices-grid {
    grid-template-columns: 1fr;
  }

  .lightbox-top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .lightbox-controls {
    width: 100%;
    justify-content: space-between;
  }

  .lightbox-viewport {
    padding: 15px;
  }

  .lightbox-viewport img {
    max-width: 98%;
    max-height: 60vh;
  }
}

/* Small Phones (max-width: 480px) */
@media (max-width: 480px) {
  .hero-stats-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .btn-primary, .btn-secondary, .term-ui-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .tab-pane {
    padding: 8px 2px;
  }
}

@keyframes pulse-ring {
  0% { opacity: 0.5; stroke-width: 2; }
  50% { opacity: 0.9; stroke-width: 4; }
  100% { opacity: 0.5; stroke-width: 2; }
}

@keyframes poi-ring {
  0% { r: 6; opacity: 1; }
  100% { r: 20; opacity: 0; }
}

@keyframes float-crystal {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(3deg); }
}

/* ==========================================================================
   GLOBAL MOBILE & TABLET RESPONSIVE FIXES
   ========================================================================== */

html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

@media (max-width: 1024px) {
  .hero-banner, .scanner-layout, .map-bottom-details-grid, .dossier-builder-grid, .factions-grid {
    grid-template-columns: 1fr !important;
  }
  
  .terminal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px 14px;
  }
  
  .term-logo-area {
    justify-content: center;
    text-align: center;
  }

  .term-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    justify-content: flex-start;
    gap: 6px;
  }
  
  .term-nav::-webkit-scrollbar {
    display: none;
  }

  .term-tab-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  .terminal-sys-bar {
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .desktop-sys-status, .desktop-net-uplink {
    display: none !important;
  }

  .term-btn-group {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .audio-vol-slider {
    width: 50px !important;
  }

  .terminal-main-content {
    padding: 10px 8px !important;
  }

  .hero-banner {
    padding: 16px 12px !important;
  }

  .hero-heading {
    font-size: 1.4rem !important;
  }

  .hero-stats-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .hero-actions {
    flex-direction: column;
    gap: 8px;
  }

  .hero-actions button {
    width: 100%;
    justify-content: center;
  }

  .timeline-grid {
    grid-template-columns: 1fr !important;
  }

  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .map-filter-group {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .map-filter-btn {
    flex-shrink: 0;
  }

  .map-subtabs-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .map-subtab-btn {
    width: 100%;
    justify-content: center;
  }

  .hourly-cycle-timer {
    width: 100%;
    justify-content: center;
    margin-left: 0 !important;
  }

  .map-events-feed-grid {
    grid-template-columns: 1fr !important;
  }

  .dossier-builder-grid {
    grid-template-columns: 1fr !important;
  }

  .specimen-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .terminal-outer-frame {
    border: none;
    box-shadow: none;
  }

  .term-title h1 {
    font-size: 1.15rem;
  }

  .term-title .sub {
    font-size: 0.65rem;
  }

  .term-ui-btn {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .ticker-badge-live {
    font-size: 0.68rem;
    padding: 4px 8px;
  }
}
