:root {
  --bg-dark: #07040d;
  --bg-panel: rgba(18, 10, 28, 0.85);
  --bg-input: #12091d;
  --primary: #bf5af2;
  --primary-glow: rgba(191, 90, 242, 0.5);
  --secondary: #00f0ff;
  --secondary-glow: rgba(0, 240, 255, 0.5);
  --accent: #39ff14;
  --accent-glow: rgba(57, 255, 20, 0.5);
  --danger: #ff0055;
  --danger-glow: rgba(255, 0, 85, 0.5);
  --text: #e6dfec;
  --text-muted: #8c7b9e;
  --border: rgba(191, 90, 242, 0.25);
  --border-focus: rgba(0, 240, 255, 0.6);
  --font-title: 'Orbitron', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* CRT Scanlines Overlay */
body::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%);
  background-size: 100% 4px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.7;
}

/* Cyberpunk grid background */
.grid-bg {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background-image: 
    linear-gradient(to right, rgba(191, 90, 242, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(191, 90, 242, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -1;
  pointer-events: none;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
  border-left: 1px solid var(--border);
}
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
  box-shadow: 0 0 5px var(--primary-glow);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
  box-shadow: 0 0 10px var(--secondary-glow);
}

/* App Layout */
header {
  background: rgba(10, 5, 17, 0.95);
  border-bottom: 2px solid var(--primary);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 0 15px var(--primary-glow);
  z-index: 10;
}

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

.logo {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 10px var(--primary-glow), 0 0 20px var(--primary-glow);
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  color: var(--secondary);
  text-shadow: 0 0 10px var(--secondary-glow);
}

.logo-badge {
  font-size: 10px;
  background: var(--danger);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-tabs {
  display: flex;
  gap: 10px;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  clip-path: polygon(0 0, 90% 0, 100% 30%, 100% 100%, 10% 100%, 0 70%);
}

.tab-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Main Container */
.main-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: 340px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 5;
  backdrop-filter: blur(10px);
}

.sidebar-search {
  padding: 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  font-family: var(--font-mono);
  outline: none;
  font-size: 12px;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
}

.filter-tags {
  display: flex;
  gap: 8px;
}

.filter-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px;
  font-size: 10px;
  cursor: pointer;
  text-transform: uppercase;
}

.filter-btn.active {
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: 0 0 6px var(--secondary-glow);
}

.log-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.log-item {
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  background: rgba(10, 5, 20, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.log-item:hover {
  background: rgba(191, 90, 242, 0.1);
  border-color: var(--primary);
  transform: translateX(4px);
}

.log-item.active {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.log-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
}

.log-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  align-items: center;
}

.log-item-num {
  font-family: var(--font-title);
  font-size: 11px;
  color: var(--primary);
  font-weight: bold;
}

.log-item.active .log-item-num {
  color: var(--secondary);
}

.log-item-status-badge {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 2px;
  text-transform: uppercase;
  background: rgba(57, 255, 20, 0.15);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.log-item.missing .log-item-status-badge {
  background: rgba(255, 0, 85, 0.15);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.log-item-title {
  font-weight: bold;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

.log-item-coords {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Content Area */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(10, 5, 20, 0.4);
}

.view-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
}

/* Log Detail Header */
.detail-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 8, 25, 0.6);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.detail-title-block {
  flex: 1;
}

.detail-log-num {
  font-family: var(--font-title);
  color: var(--secondary);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.detail-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 10px rgba(255,255,255,0.1);
  margin-bottom: 8px;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.meta-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.meta-val {
  font-size: 11px;
  color: #fff;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-val a {
  color: var(--secondary);
  text-decoration: none;
}
.meta-val a:hover {
  text-decoration: underline;
}

/* Neural Sync Progress */
.sync-box {
  min-width: 150px;
}

.sync-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  margin-top: 4px;
  position: relative;
}

.sync-bar-fill {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  width: 0%;
  transition: width 0.8s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.sync-bar-fill.desync {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
}

/* Detail Body & Split Layout */
.detail-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.image-panel {
  flex: 1.2;
  border-right: 1px solid var(--border);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  z-index: 100000;
  transform: translateZ(1px); /* Elevate above crt-overlay which is at Z=0 */
}

.image-viewer {
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  filter: none;                   /* V20: no default filter — Photo Mode only */
  transition: opacity 0.3s ease, filter 0.2s ease;
}

/* Glitch/Static Placeholder Screen */
.static-placeholder {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: #0d0615;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  z-index: 0;
  overflow: hidden;
}

.static-placeholder::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.4) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 6px, 6px 100%;
  opacity: 0.8;
  z-index: 2;
}

.static-icon {
  font-size: 40px;
  color: var(--danger);
  text-shadow: 0 0 10px var(--danger-glow);
  animation: flicker 1.5s infinite;
}

.static-text {
  font-family: var(--font-title);
  color: var(--danger);
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--danger-glow);
  animation: glitch-text 2s infinite;
}

.static-subtext {
  font-size: 11px;
  color: var(--text-muted);
}

.text-panel {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
  background: rgba(7, 4, 13, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.log-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  margin-bottom: 25px;
  position: relative;
}

/* Image controls */
.image-controls {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(7, 4, 13, 0.8);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 4px;
  display: flex;
  gap: 10px;
  z-index: 3;
}

.img-btn {
  background: transparent;
  border: none;
  color: var(--secondary);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  font-family: var(--font-mono);
}
.img-btn:hover {
  text-shadow: 0 0 5px var(--secondary-glow);
  color: #fff;
}

.img-indicator {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

/* Story Gap Planner Styling */
.planner-container {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.planner-sidebar {
  width: 250px;
  border-right: 1px solid var(--border);
  background: rgba(12, 6, 20, 0.7);
  display: flex;
  flex-direction: column;
}

.planner-sidebar-title {
  padding: 15px;
  font-family: var(--font-title);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--secondary);
  border-bottom: 1px solid var(--border);
  letter-spacing: 1px;
}

.gap-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.gap-item {
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--danger);
  background: rgba(255, 0, 85, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gap-item:hover {
  background: rgba(255, 0, 85, 0.08);
}

.gap-item.active {
  background: rgba(255, 0, 85, 0.15);
  border-color: var(--danger);
  box-shadow: 0 0 8px rgba(255, 0, 85, 0.2);
}

.gap-item.completed {
  border-color: var(--accent);
  background: rgba(57, 255, 20, 0.05);
}

.gap-item-num {
  font-family: var(--font-title);
  font-size: 11px;
  color: var(--danger);
  font-weight: bold;
}
.gap-item.completed .gap-item-num {
  color: var(--accent);
}

.gap-item-title {
  font-size: 12px;
  color: #fff;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.planner-content {
  flex: 1;
  padding: 25px;
  overflow-y: auto;
  background: rgba(7, 4, 13, 0.5);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.planner-form-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-title {
  font-family: var(--font-title);
  font-size: 16px;
  color: #fff;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 10px;
  color: var(--secondary);
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 1px;
}

.form-input, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: all 0.3s ease;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.btn-row {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.action-btn {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 10px 20px;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px var(--primary-glow);
}

.action-btn.secondary {
  border-color: var(--secondary);
  color: var(--secondary);
}

.action-btn.secondary:hover {
  background: var(--secondary);
  color: #000;
  box-shadow: 0 0 10px var(--secondary-glow);
}

/* Animations */
@keyframes flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    opacity: 0.99;
  }
  20%, 24%, 55% {
    opacity: 0.4;
  }
}

@keyframes glitch-text {
  0%, 100% { transform: none; }
  10% { transform: skew(-2deg, -1deg); color: #00f0ff; }
  12% { transform: skew(1deg, 2deg); color: #ff0055; }
  14% { transform: none; }
  30% { transform: skew(1deg, -1deg); }
  31% { transform: none; }
}

.glitch-flash {
  animation: glitch-anim 0.25s linear;
}

@keyframes glitch-anim {
  0% { transform: translate(0); filter: hue-rotate(0deg); }
  20% { transform: translate(-3px, 2px); filter: hue-rotate(90deg); }
  40% { transform: translate(2px, -3px); }
  60% { transform: translate(-1px, -1px); filter: hue-rotate(180deg); }
  80% { transform: translate(3px, 1px); }
  100% { transform: translate(0); filter: hue-rotate(360deg); }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  padding: 12px 24px;
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 0 15px var(--accent-glow);
  font-family: var(--font-mono);
  z-index: 10000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.1, 0.8, 0.3, 1);
}

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

/* Audio Controls Styling */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 5, 20, 0.4);
  border: 1px solid var(--border);
  padding: 4px 10px;
  height: 34px;
  clip-path: polygon(0 0, 95% 0, 100% 30%, 100% 100%, 5% 100%, 0 70%);
}

.audio-btn {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.audio-btn:hover {
  text-shadow: 0 0 8px var(--primary-glow);
  transform: scale(1.1);
}

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

.vol-label {
  font-family: var(--font-title);
  font-size: 8px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 65px;
  height: 2px;
  background: var(--border);
  outline: none;
  transition: background 0.3s ease;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 6px;
  height: 12px;
  background: var(--secondary);
  box-shadow: 0 0 6px var(--secondary-glow);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.2s;
}

.vol-slider::-webkit-slider-thumb:hover {
  background: #fff;
  box-shadow: 0 0 10px var(--secondary-glow);
}

.vol-pct {
  font-size: 9px;
  color: var(--secondary);
  font-family: var(--font-mono);
  width: 28px;
  text-align: right;
}

/* Dossier Scanning Line Animation */
.dossier-photo-frame::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; width: 100%; height: 2px;
  background: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
  opacity: 0.6;
  animation: scanline-dossier 3s infinite linear;
}

@keyframes scanline-dossier {
  0% { top: 0; }
  50% { top: 100%; }
  100% { top: 0; }
}

/* Custom Scrollbar for Terminal Screen */
#terminal-screen::-webkit-scrollbar {
  width: 4px;
}
#terminal-screen::-webkit-scrollbar-thumb {
  background: var(--secondary);
  box-shadow: 0 0 4px var(--secondary-glow);
}

/* Startup Intro Screen */
#intro-screen {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: #050209;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.8s cubic-bezier(0.8, 0, 0.2, 1), opacity 0.8s ease;
  user-select: none;
}

#intro-screen.fade-out {
  transform: translateY(-100vh);
  opacity: 0;
  pointer-events: none;
}

.intro-grid {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: 
    linear-gradient(rgba(191, 90, 242, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(191, 90, 242, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.intro-box {
  width: 500px;
  background: rgba(10, 5, 20, 0.95);
  border: 1px solid var(--primary);
  box-shadow: 0 0 30px rgba(191, 90, 242, 0.25);
  padding: 30px;
  position: relative;
  font-family: var(--font-mono);
  clip-path: polygon(0 0, 93% 0, 100% 12%, 100% 100%, 7% 100%, 0 88%);
}

.intro-header {
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary-glow);
  letter-spacing: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.intro-terminal {
  font-size: 11px;
  color: var(--secondary);
  text-shadow: 0 0 3px var(--secondary-glow);
  height: 120px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 25px;
}

.intro-progress-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  position: relative;
  margin-bottom: 10px;
}

.intro-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
  transition: width 0.15s linear;
}

.intro-status {
  font-size: 9px;
  color: var(--text-muted);
  text-align: right;
  letter-spacing: 1px;
}

/* Sidebar Integrity Status Card */
.sidebar-status-card {
  margin: 15px 15px 5px 15px;
  padding: 12px;
  background: rgba(10, 5, 20, 0.4);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  clip-path: polygon(0 0, 90% 0, 100% 25%, 100% 100%, 10% 100%, 0 75%);
}

.status-header {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

#sidebar-integrity-pct {
  color: var(--primary);
  text-shadow: 0 0 5px var(--primary-glow);
  font-weight: bold;
}

.status-bar-bg {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
  overflow: hidden;
}

.status-bar-fill {
  height: 100%;
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary-glow);
  transition: width 0.5s ease;
}

.status-footer {
  font-size: 8px;
  color: var(--secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Radar Ping Visual for SLurl link */
.radar-ping {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  position: relative;
}

.radar-ping::after {
  content: "";
  position: absolute;
  top: -6px; left: -6px; right: -6px; bottom: -6px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  animation: radar-ping-anim 1.5s infinite ease-out;
  opacity: 0;
}

@keyframes radar-ping-anim {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Search Highlights */
.search-highlight {
  background: var(--primary);
  color: #050209;
  font-weight: bold;
  text-shadow: none;
  border-radius: 2px;
  padding: 0 2px;
}

/* RPG Attribute Notches */
.stat-notch {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.stat-notch.active {
  background: var(--secondary);
  border-color: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
}
.stat-notch:hover {
  border-color: #fff;
}

/* Perk buttons */
.perk-btn {
  border-color: var(--border);
  color: var(--text-muted);
}
.perk-btn.active {
  background: var(--primary) !important;
  color: #000 !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 10px var(--primary-glow);
  font-weight: bold;
}

/* Hacking Matrix protocol buttons */
.hack-node-btn {
  background: rgba(10, 5, 20, 0.7);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: bold;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.hack-node-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  box-shadow: 0 0 8px var(--secondary-glow);
}
.hack-node-btn.active-row-col {
  border-color: var(--primary);
  color: var(--primary);
}
.hack-node-btn.selected {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Timeline Components */
.timeline-item {
  display: flex;
  gap: 20px;
  position: relative;
}

.timeline-marker {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #030107;
  border: 2px solid var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--secondary);
  box-shadow: 0 0 10px var(--secondary-glow);
  z-index: 2;
  cursor: pointer;
  transition: all 0.2s;
}
.timeline-marker:hover {
  transform: scale(1.15);
  border-color: #fff;
  color: #fff;
}
.timeline-marker.milestone {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}
.timeline-marker.gap {
  border-color: var(--danger);
  color: var(--danger);
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.5);
}

.timeline-content-card {
  flex: 1;
  background: rgba(10, 5, 20, 0.7);
  border: 1px solid var(--border);
  padding: 15px;
  border-radius: 2px;
  clip-path: polygon(0 0, 96% 0, 100% 12px, 100% 100%, 4% 100%, 0 calc(100% - 12px));
  transition: all 0.2s;
  cursor: pointer;
}
.timeline-content-card:hover {
  border-color: var(--secondary);
  background: rgba(20, 10, 35, 0.8);
}

/* Custom Scrollbar for Chatbot Screen */
#chatbot-screen::-webkit-scrollbar {
  width: 4px;
}
#chatbot-screen::-webkit-scrollbar-thumb {
  background: var(--primary);
  box-shadow: 0 0 4px var(--primary-glow);
}

/* Inventory Slots styling */
.inventory-slot {
  aspect-ratio: 1;
  background: rgba(10, 5, 20, 0.6);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  box-sizing: border-box;
}

.inventory-slot:hover {
  border-color: var(--secondary);
  background: rgba(191, 90, 242, 0.1);
  box-shadow: 0 0 5px var(--secondary-glow);
}

.inventory-slot.has-item {
  border-color: var(--primary);
  background: rgba(191, 90, 242, 0.05);
}

.inventory-slot.has-item:hover {
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.inventory-slot.selected {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Coords Index Directory List */
.coords-directory-item {
  background: rgba(5, 2, 9, 0.6);
  border: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  transition: all 0.2s;
}

.coords-directory-item:hover {
  border-color: var(--secondary);
  background: rgba(191, 90, 242, 0.05);
}

.coords-directory-item .btn-teleport-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--secondary);
  font-family: var(--font-mono);
  font-size: 8px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.coords-directory-item .btn-teleport-copy:hover {
  background: var(--secondary);
  color: #000;
  border-color: var(--secondary);
  box-shadow: 0 0 5px var(--secondary-glow);
}

/* Cyberdeck Upgrade Slots */
.cyberdeck-slot-card {
  border: 1px solid var(--border);
  background: rgba(10,5,20,0.6);
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.cyberdeck-slot-card:hover {
  border-color: var(--primary);
  background: rgba(191,90,242,0.05);
}
.cyberdeck-slot-card.equipped {
  border-color: var(--accent);
  color: #fff;
}

/* Netrunner Mail Inbox item */
.netrunner-mail-card {
  border: 1px solid var(--border);
  background: rgba(5,2,9,0.7);
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 9px;
  line-height: 1.3;
}
.netrunner-mail-card:hover {
  border-color: var(--secondary);
  background: rgba(191,90,242,0.05);
  box-shadow: 0 0 4px var(--secondary-glow);
}
.netrunner-mail-card.unread {
  border-color: var(--primary);
  border-left: 3px solid var(--primary);
}

/* V5 CRT Scanline Overlay */
#crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 4px, 6px 100%;
  z-index: 50;
  pointer-events: none;
  opacity: var(--crt-scanline-opacity, 0.15);
  transition: opacity 0.2s;
}

/* V5 CRT curvature transform class for main wrapper */
.crt-warp-active {
  transform: perspective(1000px) rotateX(var(--crt-warp-val, 0deg)) rotateY(0deg) scale(var(--crt-scale-val, 1.0));
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

/* V5 DNA Splicer Slots */
.splicer-slot-card {
  border: 1px solid var(--border);
  background: rgba(5,2,9,0.5);
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.splicer-slot-card:hover {
  border-color: var(--primary);
  background: rgba(191,90,242,0.05);
}
.splicer-slot-card.spliced {
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 5px var(--primary-glow);
}

/* Combat Animations */
@keyframes text-glow-danger {
  0% { text-shadow: 0 0 4px rgba(255,59,48,0.4); }
  100% { text-shadow: 0 0 12px rgba(255,59,48,0.9); }
}

.combat-btn:hover {
  box-shadow: 0 0 10px var(--danger-glow);
  transform: translateY(-1px);
}

/* V7 Heartbeat pulse animation */
@keyframes heart-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  14% { transform: scale(1.3); opacity: 1; }
  28% { transform: scale(1); opacity: 0.8; }
  42% { transform: scale(1.3); opacity: 1; }
  70% { transform: scale(1); opacity: 0.8; }
}
.heart-pulsing {
  display: inline-block;
  animation: heart-pulse var(--heart-duration, 1.2s) infinite ease-in-out;
  color: var(--danger);
  text-shadow: 0 0 4px var(--danger-glow);
}

/* V8 Low HP Glitch effects */
#app-container.low-hp-glitching {
  animation: app-lowhp-glitch 0.4s infinite alternate;
  border: 2px solid var(--danger) !important;
  box-shadow: 0 0 30px rgba(255, 59, 48, 0.4) !important;
}

@keyframes app-lowhp-glitch {
  0% {
    filter: hue-rotate(0deg) contrast(1.1);
    transform: skew(0deg) scale(1);
  }
  30% {
    filter: hue-rotate(-5deg) contrast(1.2) saturate(1.3);
    transform: skew(-0.3deg) scale(0.999);
  }
  60% {
    filter: hue-rotate(5deg) contrast(0.9) brightness(0.95);
    transform: skew(0.3deg) scale(1.001);
  }
  100% {
    filter: hue-rotate(0deg) contrast(1.0);
    transform: skew(0deg) scale(1);
  }
}

/* =========================================
   MOBILE RESPONSIVENESS (Mobile Update)
   ========================================= */
@media (max-width: 850px) {
  /* Enable native scrolling, block horizontal overflow */
  html, body {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    width: 100% !important;
  }
  
  /* Background fixes */
  .grid-bg {
    width: 100% !important;
  }
  
  /* 1. Header Layout */
  header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 15px;
    padding: 10px !important;
    height: auto !important;
    width: 100%;
  }
  
  .logo-container {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px !important;
    height: auto !important;
  }
  
  .v20-nav-bar {
    width: 100%;
    flex-direction: column !important; /* Stack audio and nav groups vertically */
    align-items: flex-start !important;
    height: auto !important;
    gap: 15px !important;
  }
  
  .v20-nav-group {
    flex-wrap: wrap;
    height: auto !important;
    gap: 5px;
  }
  
  .audio-controls {
    width: 100%;
    flex-wrap: wrap;
    border-right: none !important;
    padding: 0 !important;
    height: auto !important;
    gap: 10px !important;
  }
  
  .channel-select-container {
    border-left: none !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
  }
  
  /* Hide the progress slider on mobile to save horizontal space */
  .progress-slider-container {
    display: none !important;
  }
  
  /* 2. Main Layout */
  .main-wrapper {
    flex-direction: column !important;
    overflow: visible !important;
    height: auto !important;
    width: 100%;
  }
  
  /* 3. Sidebar (Logs List & Cards) */
  .sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    max-height: none !important; /* Let it grow naturally */
    overflow: visible !important;
    display: block !important; /* Stop flex squeezing */
  }
  
  /* FIX: The log list was squished to 0px height! Make it scrollable and visible */
  .log-list {
    flex: none !important;
    height: 300px !important; /* Fixed height for the log list */
    overflow-y: auto !important; /* Internal scrolling just for logs */
    border-bottom: 1px dashed var(--border);
    margin-bottom: 10px;
  }
  
  /* 4. Content Area */
  .content-area {
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
    width: 100%;
  }
  
  /* 5. Detail View (Image + Text) */
  .detail-body {
    flex-direction: column !important;
    overflow: visible !important;
    height: auto !important;
  }
  
  .image-panel {
    min-height: 250px;
    flex: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }
  
  .text-panel {
    overflow: visible !important;
    height: auto !important;
  }
  
  /* Hide non-essential desktop badges on mobile */
  #sys-status-badge, #v18-weather-badge, #sys-bpm-badge, #top-audio-visualizer {
    display: none !important;
  }

  /* =========================================
     COMPLETE BUGFIX PASS: OVERFLOW & WRAP
     ========================================= */
  
  /* Global max-width enforcement and box-sizing */
  *, *::before, *::after {
    max-width: 100vw !important;
    box-sizing: border-box !important;
  }
  
  /* Disable all strict 'nowrap' rules on mobile that break layouts */
  .log-title, .log-date, .meta-value, .v20-nav-label, .search-input, .filter-btn {
    white-space: normal !important;
    word-wrap: break-word !important;
  }
  
  /* Ensure filter buttons (ALL LOGS | STABLE | GAPS) can wrap naturally */
  .filter-tags {
    flex-wrap: wrap !important;
  }
  
  .filter-btn {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }
  
  /* Inputs shouldn't overflow their container */
  .search-input {
    width: 100% !important;
  }
  
  /* Modals/Popups with fixed desktop widths must be clamped */
  .cyber-modal-content {
    width: 100% !important;
    max-width: 95vw !important;
    margin: 0 auto !important;
  }
}
