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

:root {
  --bg: #1c2331;
  --panel: rgba(14, 21, 35, 0.96);
  --line: rgba(56, 189, 248, 0.15);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --panel-radius: 12px;
  --accent: #38bdf8;
  --panel-width: 360px;
  --toggle-width: 24px;
  --toggle-overlap: 2px;
}

.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, #0d1627 0%, #020617 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: auto 1fr;
  padding: 16px;
  gap: 16px;
  position: relative;
  z-index: 10;
  pointer-events: none;
  /* Let clicks pass through gaps to globe behind */
}

/* Map takes full screen behind UI */
.map-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: auto;
}

#map {
  width: 100%;
  height: 100%;
}

.panel {
  position: relative;
  width: var(--panel-width);
  height: calc(100vh - 32px);
  z-index: 20;
  pointer-events: none;
  overflow: visible;
  transition: width 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  /* Let the wrapper take events */
}

.panel.collapsed {
  width: 0;
}

.panel-wrapper {
  background: rgba(14, 21, 35, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-top: 4px solid #0ea5e9;
  border-right: 2px solid rgba(14, 165, 233, 0.4);
  /* 3D thickness on right */
  border-radius: 4px;
  /* Sharper tech look */
  padding: 24px;
  overflow-y: auto;
  height: 100%;
  pointer-events: auto;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.8),
    inset 0 0 40px rgba(14, 165, 233, 0.1),
    0 10px 30px -10px rgba(14, 165, 233, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform-style: preserve-3d;
  transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform: perspective(1400px) rotateY(10deg) rotateX(-2deg) translateZ(0);
  transform-origin: left center;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  /* For scanlines */
  /* animation: holo-flicker removed – caused layer repaint flicker */
  width: var(--panel-width);
}

/* Glass-Hologram Scanlines */
.panel-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0) 0px, rgba(0, 0, 0, 0.1) 1px, rgba(0, 0, 0, 0) 2px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.02), transparent, rgba(56, 189, 248, 0.02));
  pointer-events: none;
  z-index: 10;
}

.panel-wrapper::after {
  content: none;
}

.panel.collapsed .panel-wrapper {
  transform: perspective(1400px) rotateY(45deg) translateX(-110%) scale(0.9);
  opacity: 0;
  pointer-events: none;
}

.panel-toggle {
  position: absolute;
  top: 50%;
  left: calc(100% - 23px);
  transform: translateY(-50%);
  width: var(--toggle-width);
  height: 64px;
  background: rgba(14, 21, 35, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-left: none;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 10px 0 20px rgba(0, 0, 0, 0.5), inset -2px 0 5px rgba(56, 189, 248, 0.2), inset 1px 0 0 rgba(56, 189, 248, 0.22);
  transition: all 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 50;
}

.panel-toggle::after {
  content: "◀";
  color: #e0f2fe;
  font-size: 10px;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.panel.collapsed .panel-toggle::after {
  transform: scaleX(-1);
}

.panel.collapsed .panel-toggle {
  left: -1px;
  /* Attach to the left edge of the collapsed container */
  border-left: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 0 8px 8px 0;
  transform: translateY(-50%);
}

.panel-toggle:hover {
  background: rgba(14, 165, 233, 0.4);
  transform: translateY(-50%) scaleX(1.06);
}

.panel-wrapper::-webkit-scrollbar {
  width: 6px;
}

.panel-wrapper::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.2);
  border-radius: 10px;
}

.panel-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.4);
}

h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow:
    0 0 15px rgba(14, 165, 233, 0.8),
    2px 0 1px rgba(255, 0, 0, 0.5),
    -2px 0 1px rgba(0, 255, 255, 0.5);
  font-family: "JetBrains Mono", monospace;
  animation: holo-glitch 6s infinite;
}

p.muted {
  font-size: 13px;
  line-height: 1.4;
  margin-top: 0;
  margin-bottom: 20px;
}

.panel-section {
  padding: 16px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  position: relative;
}

.panel-section::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.3), transparent);
}

.panel-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.panel-section:last-of-type::after {
  display: none;
}

.label {
  display: block;
  margin: 16px 0 8px;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.panel-section>.label:first-child {
  margin-top: 4px;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-text {
  font-size: 13px;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.live-bar {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.safe-mode-badge {
  margin-top: 12px;
  margin-bottom: 20px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
  border-radius: var(--panel-radius);
  padding: 6px 14px;
  letter-spacing: 0.05em;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
  }

  50% {
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
  }

  100% {
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
  }
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.live-dot.online {
  background: #00d084;
  box-shadow: 0 0 0 0 rgba(0, 208, 132, 0.7);
  animation: pulse 1.5s infinite;
}

.live-dot.offline {
  background: #ff5d5d;
}

input[type="text"],
select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 10px 32px 10px 14px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 2px;
  background: rgba(2, 6, 23, 0.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.3s;
  outline: none;
  backdrop-filter: blur(8px);
  cursor: pointer;
}

select:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background-color: rgba(2, 6, 23, 0.9);
}

input[type="text"]:focus,
select:focus {
  border-color: #38bdf8;
  background: rgba(2, 6, 23, 0.8);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 2px;
  accent-color: var(--accent);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent);
  border: none;
  transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px var(--accent);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.replay-block {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.38);
}

#forecast-controls {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.34);
}

.forecast-meta {
  margin-top: 8px;
  color: #94a3b8;
  font-size: 11px;
}

.forecast-refresh-btn {
  margin-top: 10px;
  width: 100%;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.85);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.forecast-refresh-btn:hover {
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.forecast-refresh-btn:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

.replay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.replay-label {
  margin: 0;
}

.replay-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-live-btn {
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.8);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.replay-live-btn:hover {
  border-color: var(--accent);
  color: #fff;
  background: rgba(56, 189, 248, 0.2);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
  text-shadow: 0 0 5px #fff;
}

.replay-live-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent);
}

.replay-live-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.replay-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
}

#replay-mode {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #38bdf8;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
  animation: glow-pulse 2s infinite ease-in-out;
}

@keyframes glow-pulse {

  0%,
  100% {
    opacity: 0.8;
    text-shadow: 0 0 5px rgba(56, 189, 248, 0.5);
  }

  50% {
    opacity: 1;
    text-shadow: 0 0 15px rgba(56, 189, 248, 1);
  }
}

.legend {
  margin-top: 14px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

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

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  /* Glow/digital look */
  display: inline-block;
  box-shadow: 0 0 8px currentColor, 0 0 12px currentColor;
}

.success {
  color: #00ff9d;
}

.failure {
  color: #ff3c3c;
}

.unknown {
  color: #8e9aaf;
}

.dot.success {
  background: #00ff9d;
}

.dot.failure {
  background: #ff3c3c;
}

.dot.unknown {
  background: #8e9aaf;
}

.dot.critical {
  background: #ff3c3c;
}

.dot.high {
  background: #ff8a3c;
}

.dot.elevated {
  background: #ffd166;
}

.dot.watch {
  background: #4ade80;
}

/* Marker: laser style */
.marker {
  width: 60px;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  transition: transform 0.25s ease;
  filter: drop-shadow(0 0 8px currentColor);
}

.marker:hover {
  transform: scale(1.07);
  z-index: 100 !important;
}

.marker-hit {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 56px;
  height: 148px;
  transform: translateX(-50%);
  background: transparent;
  cursor: pointer;
  z-index: 5;
  pointer-events: auto;
}

.marker--cluster .marker-hit {
  width: 76px;
  height: 160px;
}

.marker-core {
  position: absolute;
  bottom: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor, 0 0 18px currentColor;
  animation: marker-core-pulse 1.8s infinite ease-in-out;
  z-index: 3;
  pointer-events: auto;
  cursor: pointer;
}

.marker-laser {
  position: absolute;
  left: 50%;
  bottom: 17px;
  width: 3px;
  height: 78px;
  border-radius: 3px;
  background: linear-gradient(to top, currentColor 0%, rgba(255, 255, 255, 0.55) 20%, transparent 100%);
  transform-origin: bottom center;
  mix-blend-mode: screen;
  opacity: 0.72;
  filter: drop-shadow(0 0 8px currentColor);
  pointer-events: none;
  animation: laser-pulse 1.8s infinite ease-in-out;
  z-index: 2;
}

/* Wider invisible hit-area over the laser beam for easier clicking */
.marker-laser-hit {
  position: absolute;
  left: 50%;
  bottom: 17px;
  /* Start exactly at core center to pivot correctly */
  width: 24px;
  /* Sufficiently wide for easy capture, but not so wide it blocks others */
  height: 120px;
  /* Covers full beam height */
  transform-origin: bottom center;
  transform: translate(-50%, 0) rotate(var(--laser-angle, 0deg));
  /* Match the laser's rotation */
  pointer-events: auto;
  z-index: 4;
  cursor: pointer;
  background: transparent;
}

.marker-hover-glow {
  position: absolute;
  bottom: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 68%);
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.marker:hover .marker-hover-glow {
  opacity: 0.7;
  transform: scale(1.25);
  animation: marker-hover-ring 0.95s infinite ease-out;
}

.marker:hover .marker-core,
.marker-core:hover {
  box-shadow: 0 0 12px currentColor, 0 0 26px currentColor, 0 0 38px currentColor;
  animation-duration: 0.85s;
}

.marker:hover .marker-laser {
  width: 10px;
  /* Линия луча расширяется */
  opacity: 1;
  filter: drop-shadow(0 0 16px currentColor) drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
  animation-duration: 0.9s;
}

.marker.selected {
  z-index: 105 !important;
  transform: scale(1.15);
}

.marker.selected .marker-hover-glow {
  opacity: 1;
  transform: scale(1.6);
  animation: marker-hover-ring 0.7s infinite ease-out;
  border-width: 2px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 75%);
}

.marker.selected .marker-core {
  box-shadow: 0 0 20px currentColor, 0 0 40px currentColor, 0 0 60px currentColor, 0 0 15px #fff;
  animation-duration: 0.5s;
  transform: scale(1.3);
  background: #fff;
}

.marker.selected .marker-laser {
  width: 14px;
  opacity: 1;
  filter: drop-shadow(0 0 25px currentColor) drop-shadow(0 0 12px rgba(255, 255, 255, 1));
  animation-duration: 0.6s;
  background: linear-gradient(to top, currentColor 0%, #fff 25%, rgba(255, 255, 255, 0.8) 50%, transparent 100%);
}

.marker-cluster-count {
  position: absolute;
  top: -7px;
  right: -6px;
  z-index: 8;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Roboto Mono", "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  color: #d6f6ff;
  background: rgba(3, 8, 18, 0.92);
  border: 1px solid currentColor;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  pointer-events: auto;
  /* Make clicks on the badge work */
  cursor: pointer;
}

.marker-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-family: "JetBrains Mono", "IBM Plex Mono", monospace;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fff;
  opacity: 0.72;
  white-space: nowrap;
  margin-top: 6px;
  pointer-events: none;
  background: rgba(3, 8, 18, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 2px 4px;
}

@keyframes marker-core-pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }

  100% {
    transform: scale(0.82);
    opacity: 0.75;
  }
}

@keyframes laser-pulse {
  0% {
    transform: translate(-50%, 0) rotate(var(--laser-angle, 0deg)) scaleY(0.72);
    opacity: 0.42;
  }

  50% {
    transform: translate(-50%, 0) rotate(var(--laser-angle, 0deg)) scaleY(1.12);
    opacity: 0.95;
  }

  100% {
    transform: translate(-50%, 0) rotate(var(--laser-angle, 0deg)) scaleY(0.76);
    opacity: 0.48;
  }
}

/* Анимация laser-pulse-hit удалена, так как она сдвигала зону клика и мешала попадать мышкой */

@keyframes marker-hover-ring {
  0% {
    transform: scale(0.72);
    opacity: 0.68;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes marker-float {

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

  50% {
    transform: translateY(-4px);
  }
}

@keyframes marker-glitch {

  0%,
  100% {
    transform: translate(0);
    opacity: 1;
  }

  92% {
    transform: translate(0);
    opacity: 1;
  }

  93% {
    transform: translate(2px, 1px);
    opacity: 0.8;
  }

  94% {
    transform: translate(-2px, -1px);
    opacity: 0.9;
  }

  95% {
    transform: translate(0);
    opacity: 1;
  }
}

.stats {
  margin-top: 24px;
}

.last-event {
  margin-top: 16px;
  font-family: "Rajdhani", "Roboto Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  line-height: 1.4;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stats-grid.single-stat {
  grid-template-columns: 1fr;
}

.stats-grid>div,
.stat-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stat-card:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.stat-card:active {
  transform: translateY(0);
}

.stats-grid small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-grid strong {
  font-family: "Roboto Mono", "Share Tech Mono", monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.stat-card-action {
  color: #38bdf8;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.details {
  --details-tilt: -12deg;
  --details-hover-tilt: -4deg;
  position: absolute;
  right: 40px;
  bottom: 40px;
  width: 340px;
  background: rgba(14, 21, 35, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-top: 4px solid #0ea5e9;
  border-left: 2px solid rgba(14, 165, 233, 0.4);
  border-radius: 4px;
  /* Sharper, more technical look */
  padding: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.8),
    inset 0 0 40px rgba(14, 165, 233, 0.1);
  pointer-events: auto;
  z-index: 120;
  transform-style: preserve-3d;
  transform: perspective(1400px) rotateY(var(--details-tilt)) rotateX(4deg) translateZ(0);
  transform-origin: right center;
  transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
  /* For scanlines */
  /* animation: holo-flicker removed – caused layer repaint flicker */
}

.details.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
  transform: perspective(1400px) rotateY(-16deg) rotateX(5deg) translateY(18px) scale(0.96);
}

.details-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 4px;
  background: rgba(2, 6, 23, 0.9);
  color: #e2e8f0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 25;
  transition: all 0.2s ease;
}

.details-close-btn:hover {
  border-color: rgba(56, 189, 248, 0.9);
  color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.35);
}

/* Holographic Scanlines */
.details::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%,
      rgba(0, 255, 255, 0.05) 50%),
    linear-gradient(90deg,
      rgba(255, 0, 0, 0.02),
      rgba(0, 255, 0, 0.01),
      rgba(0, 0, 255, 0.02));
  background-size: 100% 3px, 3px 100%;
  pointer-events: none;
  z-index: 10;
}

/* Moving scanline beam */
.details::after {
  content: "";
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom,
      transparent,
      rgba(56, 189, 248, 0.05) 45%,
      rgba(56, 189, 248, 0.2) 50%,
      rgba(56, 189, 248, 0.05) 55%,
      transparent);
  animation: holo-scan 8s linear infinite;
  pointer-events: none;
  z-index: 11;
}

.details:hover {
  transform: perspective(1400px) rotateY(var(--details-hover-tilt)) rotateX(1deg) translateY(-8px) translateZ(40px);
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.9),
    0 0 60px rgba(14, 165, 233, 0.3);
  background: rgba(14, 21, 35, 0.85);
  border-color: rgba(56, 189, 248, 0.6);
}

.details.details--left {
  --details-tilt: 12deg;
  --details-hover-tilt: 4deg;
  transform-origin: left center;
}

.details h2 {
  margin: 0 0 4px;
  padding-right: 36px;
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow:
    0 0 10px rgba(14, 165, 233, 0.8),
    2px 0 1px rgba(255, 0, 0, 0.5),
    -2px 0 1px rgba(0, 255, 255, 0.5);
  font-family: "JetBrains Mono", monospace;
  animation: holo-glitch 5.3s infinite;
}

.details h2::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 0;
  /* Square/pixel style */
  box-shadow: 0 0 15px #38bdf8;
  animation: pulse 2s infinite;
}

.details .id-badge {
  color: #38bdf8;
  font-family: "Share Tech Mono", "Orbitron", monospace;
  font-size: 11px;
  margin-bottom: 14px;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.details p {
  margin: 0 0 5px;
  line-height: 1.4;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(56, 189, 248, 0.03);
  border-left: 2px solid rgba(56, 189, 248, 0.1);
  padding: 7px 10px;
  position: relative;
  transition: all 0.2s;
}

.details p:hover {
  background: rgba(56, 189, 248, 0.1);
  border-left-color: #38bdf8;
  padding-left: 16px;
}

.details p:last-child {
  border: none;
  background: transparent;
  padding: 12px 0 0 0;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  color: #94a3b8;
  align-items: flex-start;
  font-family: "Rajdhani", "Roboto Mono", monospace;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.details p b {
  font-weight: 500;
  color: rgba(148, 163, 184, 0.6);
  font-family: monospace;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.details p span {
  font-weight: 600;
  color: #38bdf8;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.details p span.success {
  color: #00ff9d;
  text-shadow: 0 0 10px rgba(0, 255, 157, 0.5);
}

.details p span.failure {
  color: #ff3c3c;
  text-shadow: 0 0 10px rgba(255, 60, 60, 0.5);
}

.details p span.unknown {
  color: #8e9aaf;
}

@keyframes holo-glitch {

  0%,
  90%,
  100% {
    transform: translate(0);
    text-shadow: 0 0 12px rgba(14, 165, 233, 0.8);
  }

  91% {
    transform: translate(-2px, 1px);
    text-shadow: 2px -1px 0 #ff00de, -2px 1px 0 #00fff6;
  }

  92% {
    transform: translate(2px, -1px);
    text-shadow: -2px 1px 0 #ff00de, 2px -1px 0 #00fff6;
  }

  93% {
    transform: translate(0);
  }
}

@keyframes holo-scan {
  0% {
    transform: translateY(-110%);
  }

  100% {
    transform: translateY(110%);
  }
}

@keyframes holo-flicker {

  0%,
  100% {
    opacity: 0.98;
    filter: brightness(1) contrast(1);
  }

  5% {
    opacity: 0.94;
    filter: brightness(1.2) contrast(1.1) saturate(1.2);
  }

  7% {
    opacity: 1;
    filter: brightness(1) contrast(1);
  }

  15% {
    opacity: 0.97;
    filter: brightness(0.9) contrast(0.95);
  }

  45% {
    opacity: 0.99;
    filter: brightness(1.05);
  }
}

.muted {
  color: var(--muted);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 208, 132, 0.7);
  }

  70% {
    box-shadow: 0 0 0 9px rgba(0, 208, 132, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 208, 132, 0);
  }
}

@media (max-width: 1024px) {
  .app {
    padding: 12px;
    gap: 12px;
  }

  .panel {
    height: calc(100vh - 24px);
  }
}

@media (max-width: 768px) {

  .details,
  .event-list-overlay {
    right: 20px;
    bottom: 20px;
    width: calc(100% - 40px);
    max-width: 400px;
  }
}

@media (max-width: 600px) {
  :root {
    --panel-width: 100vw !important;
  }

  .app {
    padding: 0 !important;
    display: block !important;
    height: 100% !important;
    gap: 0 !important;
  }

  .panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1000 !important;
    margin: 0 !important;
    transform: none !important;
    perspective: none !important;
    background: var(--panel) !important;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  }

  .panel.collapsed {
    transform: none !important;
    width: 100vw !important;
    visibility: hidden !important;
    pointer-events: none !important;
    background: transparent !important;
  }

  .panel.collapsed .panel-wrapper {
    opacity: 0 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
  }

  .panel-wrapper {
    transform: translateX(0) !important;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    width: 100% !important;
    height: 100% !important;
    padding: 24px 16px !important;
    box-shadow: none !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    transform-origin: center !important;
  }

  .panel-toggle {
    position: fixed !important;
    left: 0 !important;
    right: auto !important;
    top: 20px !important;
    transform: none !important;
    height: 48px !important;
    width: 48px !important;
    border-radius: 0 8px 8px 0 !important;
    border-left: none !important;
    border-right: 1px solid rgba(56, 189, 248, 0.4) !important;
    background: rgba(14, 21, 35, 0.95) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1100 !important;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.5) !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }

  .panel:not(.collapsed) .panel-toggle {
    left: auto !important;
    right: 20px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    background: rgba(220, 38, 38, 0.2) !important;
    /* Make it look like a close button */
  }

  .panel-toggle::after {
    content: "☰" !important;
    font-size: 22px !important;
    transform: none !important;
  }

  .panel:not(.collapsed) .panel-toggle::after {
    content: "✕" !important;
    color: #f87171 !important;
  }

  .details,
  .event-list-overlay {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 80vh !important;
    border-radius: 20px 20px 0 0 !important;
    transform: none !important;
    padding: 35px 16px 30px !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    z-index: 1500 !important;
  }

  .details::before,
  .event-list-overlay::before {
    content: "" !important;
    position: absolute !important;
    top: 12px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 45px !important;
    height: 5px !important;
    background: rgba(56, 189, 248, 0.4) !important;
    border-radius: 3px !important;
  }

  .close-btn,
  .details-close-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 26px !important;
    top: 5px !important;
    right: 5px !important;
    background: rgba(2, 6, 23, 0.6) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .details h2 {
    font-size: 18px !important;
    margin-top: 5px !important;
    padding-right: 40px !important;
  }

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

  .stat-card {
    padding: 16px !important;
  }

  h1 {
    font-size: 22px !important;
    text-align: center !important;
    margin-bottom: 8px !important;
  }

  .safe-mode-badge {
    display: flex !important;
    justify-content: center !important;
    margin: 10px auto 20px !important;
    width: fit-content !important;
  }

  input[type="text"],
  select {
    font-size: 16px !important;
  }

  .replay-block {
    padding: 12px !important;
  }

  .replay-actions {
    gap: 15px !important;
  }

  .replay-live-btn {
    padding: 10px 16px !important;
    font-size: 13px !important;
  }

  #toast-container {
    top: auto !important;
    bottom: 20px !important;
    right: 10px !important;
    left: 10px !important;
    max-width: none !important;
  }

  /* Modal Optimization for Mobile */
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
    /* Bottom-sheet style */
  }

  .modal-window {
    width: 100% !important;
    max-width: 100% !important;
    height: 90vh !important;
    max-height: 90vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    animation: modal-enter-mobile 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
  }

  @keyframes modal-enter-mobile {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  .modal-header {
    padding: 16px 20px !important;
    position: sticky !important;
    top: 0 !important;
    background: rgba(14, 21, 35, 0.98) !important;
    z-index: 10 !important;
  }

  .modal-header h2 {
    font-size: 16px !important;
  }

  .modal-content {
    padding: 20px 16px 40px !important;
    font-size: 15px !important;
    /* Larger text for readability on phones */
  }

  .modal-content h3 {
    font-size: 18px !important;
    margin-top: 20px !important;
  }
}


/* Event List Overlay */
.event-list-overlay {
  position: absolute;
  top: 40px;
  right: 40px;
  width: 380px;
  max-height: calc(100vh - 420px);
  background: rgba(14, 21, 35, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 4px;
  backdrop-filter: blur(16px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.1);
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
  /* animation: holo-flicker removed – caused layer repaint flicker */
}

.event-list-overlay.hidden {
  animation: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px) scale(0.95);
  pointer-events: none;
}

.list-header {
  padding: 16px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: rgba(56, 189, 248, 0.1);
}

.list-header-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.list-header h3 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  text-shadow: 0 0 10px rgba(14, 165, 233, 0.8);
}

.list-subtitle {
  font-size: 11px;
  line-height: 1.45;
  color: rgba(229, 231, 235, 0.88);
  font-family: "JetBrains Mono", monospace;
  max-width: 300px;
}

.list-subtitle .alerts-inline {
  color: rgba(255, 205, 86, 0.95);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 24px;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  position: relative;
  margin: -10px;
  /* Offset padding to keep positioning */
}

.close-btn:hover {
  color: #fff;
  transform: rotate(90deg) scale(1.1);
}

.list-content {
  overflow-y: auto;
  padding: 12px;
  flex: 1;
}

.list-item {
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(56, 189, 248, 0.1);
  border-left: 3px solid rgba(56, 189, 248, 0.2);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: all 0.2s;
}

.list-item:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.4);
  border-left-color: var(--accent);
  padding-left: 16px;
}

.list-item .item-id {
  font-family: "Share Tech Mono", "Orbitron", monospace;
  font-size: 10px;
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.list-item .item-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.list-item .item-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-item .item-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  margin-right: 8px;
  box-shadow: 0 0 8px currentColor;
}

.list-content::-webkit-scrollbar {
  width: 4px;
}

.list-content::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.2);
  border-radius: 10px;
}

/* ─── Toast Notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 340px;
}

.toast {
  pointer-events: auto;
  background: rgba(10, 15, 30, 0.92);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px 10px 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(56, 189, 248, 0.12),
    inset 0 1px 0 rgba(56, 189, 248, 0.1);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  animation: toast-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-family: "JetBrains Mono", "IBM Plex Mono", monospace;
  position: relative;
  overflow: hidden;
}

.toast::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--toast-accent, var(--accent));
  animation: toast-timer linear both;
  animation-duration: var(--toast-duration, 5s);
  width: 100%;
  transform-origin: left;
}

.toast.toast-critical {
  border-left-color: #ff3c3c;
  --toast-accent: #ff3c3c;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.7),
    0 0 25px rgba(255, 60, 60, 0.2);
}

.toast.toast-warning {
  border-left-color: #f4c95d;
  --toast-accent: #f4c95d;
}

.toast.toast-success {
  border-left-color: #00ff9d;
  --toast-accent: #00ff9d;
}

.toast.toast-info {
  border-left-color: #38bdf8;
  --toast-accent: #38bdf8;
}

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  filter: drop-shadow(0 0 6px var(--toast-accent, var(--accent)));
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--toast-accent, var(--accent));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.toast-desc {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #475569;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s;
  margin-top: 1px;
}

.toast-close:hover {
  color: #e2e8f0;
}

.toast.toast-hiding {
  opacity: 0;
  transform: translateX(20px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

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

@keyframes toast-timer {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

/* Notification permission badge */
.notif-permission-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 2px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.notif-permission-btn:hover {
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Panel Footer & Credits */
.panel-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: "JetBrains Mono", monospace;
}

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

.footer-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.2s, text-shadow 0.2s;
}

.footer-link:hover {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.credits {
  font-size: 9px;
  color: rgba(148, 163, 184, 0.5);
  letter-spacing: 0.05em;
  line-height: 1.4;
}

.accent-text {
  color: var(--accent);
  font-weight: 700;
  opacity: 0.8;
}

/* Legal Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.3s ease;
  pointer-events: auto !important;
}

.modal-window {
  background: rgba(14, 21, 35, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(14, 165, 233, 0.2);
  width: 100%;
  max-width: 650px;
  max-height: 85vh;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-enter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

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

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.modal-content {
  padding: 24px;
  overflow-y: auto;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.6;
}

.modal-content h3 {
  color: #fff;
  font-size: 16px;
  margin: 24px 0 12px;
  font-family: "JetBrains Mono", monospace;
}

.modal-content h3:first-child {
  margin-top: 0;
}

.modal-content p {
  margin-bottom: 16px;
}

.modal-content ul {
  margin-bottom: 16px;
  padding-left: 20px;
}

.modal-content li {
  margin-bottom: 8px;
}