:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #0f0f15;
  --bg-card: rgba(20, 20, 28, 0.7);
  --bg-card-hover: rgba(30, 30, 42, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(239, 68, 68, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --red-accent: #ef4444;
  --red-glow: rgba(239, 68, 68, 0.25);
  --emerald-accent: #10b981;
  --amber-accent: #f59e0b;
  --blue-accent: #3b82f6;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(239, 68, 68, 0.07) 0%, transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dc2626, #991b1b);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--red-glow);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.brand-title span {
  color: var(--red-accent);
}

.stealth-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--emerald-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald-accent);
  box-shadow: 0 0 8px var(--emerald-accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: var(--red-accent);
  color: white;
  box-shadow: 0 2px 10px var(--red-glow);
}

.btn-primary:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Metric Strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.5rem 2rem 0;
  max-width: 1600px;
  margin: 0 auto;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.stat-card .label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card .val {
  font-size: 1.65rem;
  font-weight: 900;
  margin-top: 0.25rem;
  color: var(--text-main);
}

.stat-card .sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Main Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Panel Card */
.panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-body {
  padding: 1.5rem;
  flex: 1;
}

/* Radar Container */
.radar-wrapper {
  position: relative;
  width: 100%;
  max-width: 580px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#radar-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.radar-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.radar-ring-dashed {
  fill: none;
  stroke: rgba(239, 68, 68, 0.25);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.radar-axis {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.radar-center-hub {
  fill: #18181b;
  stroke: rgba(239, 68, 68, 0.5);
  stroke-width: 2;
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.3));
}

.radar-sweep-line {
  transform-origin: 250px 250px;
  animation: sweep 8s linear infinite;
}

@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-node {
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.radar-node:hover {
  transform: scale(1.25);
  filter: drop-shadow(0 0 12px currentColor);
}

.radar-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
.dot-red { width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.7); }
.dot-orange { width: 9px; height: 9px; border-radius: 50%; background: #f97316; box-shadow: 0 0 7px rgba(249, 115, 22, 0.6); }
.dot-yellow { width: 9px; height: 9px; border-radius: 50%; background: #eab308; box-shadow: 0 0 7px rgba(234, 179, 8, 0.6); }
.dot-cyan { width: 9px; height: 9px; border-radius: 50%; background: #38bdf8; box-shadow: 0 0 8px rgba(56, 189, 248, 0.6); }

/* Radar Scope Filter Bar */
.radar-scope-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.3rem 0.4rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.scope-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scope-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.scope-btn.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ffffff;
}

.scope-btn[data-scope="global"].active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.radar-ring-global {
  fill: none;
  stroke: rgba(56, 189, 248, 0.35);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

.badge-scope-domestic {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-scope-global {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Live Signals Stream */
.signals-stream {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.signals-stream::-webkit-scrollbar {
  width: 5px;
}
.signals-stream::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
}

.signal-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.signal-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(2px);
}

.signal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.signal-competitor {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-main);
}

.signal-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.badge-critical { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }

.signal-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.signal-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.signal-footer {
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* Competitor Intel Section */
.competitors-section {
  padding: 0 2rem 2.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

.table-responsive {
  overflow-x: auto;
}

.intel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.intel-table th {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.intel-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.intel-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.posture-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.posture-leader { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.posture-challenger { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.posture-aggressive { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.posture-emerging { background: rgba(234, 179, 8, 0.15); color: #facc15; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  padding: 2rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.4rem;
}

/* Battlecard styling */
.battlecard-hero {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.battlecard-section {
  margin-bottom: 1.25rem;
}

.battlecard-section h4 {
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--red-accent);
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.killer-angle-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 1rem;
  color: #fecaca;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Toast */
#toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #18181b;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--red-accent);
  border-radius: 8px;
  padding: 0.8rem 1.2rem;
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
}

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