:root {
  --bg-dark: #020617;
  --bg-card: rgba(15, 23, 42, 0.4);
  --border-card: rgba(148, 163, 184, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-purple: #818cf8;
  --accent-glow: rgba(56, 189, 248, 0.5);
  
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-tech: 'Orbitron', sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg-dark);
  font-family: var(--font-sans);
  color: var(--text-main);
  overflow: hidden;
}

/* ── Ambient Backgrounds ── */
.ambient-light {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
  animation: float 20s ease-in-out infinite alternate;
}
.light-1 {
  top: -10%; left: -10%;
  width: 50vw; height: 50vw;
  background: radial-gradient(circle, rgba(56,189,248,0.15) 0%, transparent 70%);
}
.light-2 {
  bottom: -20%; right: -10%;
  width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(129,140,248,0.15) 0%, transparent 70%);
  animation-delay: -5s;
}
.light-3 {
  top: 40%; left: 50%;
  width: 40vw; height: 40vw;
  background: radial-gradient(circle, rgba(56,189,248,0.1) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5%, 5%) scale(1.1); }
}

#network-canvas {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
}

/* ── Layout ── */
.page-container {
  position: relative;
  z-index: 10;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ── Glass Panel ── */
.glass-panel {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-card);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
              inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  transition: all 0.5s ease;
}

/* ── Header ── */
.panel-header {
  text-align: center;
}
.title {
  font-family: var(--font-tech);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}
.highlight {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}
.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Display Area ── */
.display-area {
  position: relative;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Radar Scanner */
.scanner-container {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}

.radar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.05) 0%, transparent 70%);
  overflow: hidden;
}

.radar-sweep {
  position: absolute;
  top: 50%; left: 50%;
  width: 50%; height: 50%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(56, 189, 248, 0.1) 60deg, rgba(56, 189, 248, 0.8) 90deg, transparent 90deg);
  transform-origin: 0 0;
  animation: radar-spin 3s linear infinite;
  display: none; /* activated on scan */
}

.radar-core {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 20px; height: 20px;
  background: var(--accent-blue);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--accent-blue), 0 0 30px var(--accent-blue);
  animation: pulse 2s ease-in-out infinite;
}

.ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(56, 189, 248, 0.3);
}
.ring-1 { width: 30%; height: 30%; animation: spin-slow 15s linear infinite; }
.ring-2 { width: 60%; height: 60%; border-style: solid; border-color: rgba(129, 140, 248, 0.2); animation: spin-slow 20s linear infinite reverse; }
.ring-3 { width: 90%; height: 90%; border-style: dotted; animation: spin-slow 25s linear infinite; }

@keyframes radar-spin { 100% { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; } 50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; box-shadow: 0 0 25px var(--accent-blue), 0 0 50px var(--accent-blue); } }
@keyframes spin-slow { 100% { transform: translate(-50%, -50%) rotate(360deg); } }

/* Result UI */
.result-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  animation: fade-up 0.8s ease-out forwards;
}

@keyframes fade-up {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.brand-reveal {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80px;
}

.brand-name {
  font-family: var(--font-tech);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-main);
  text-shadow: 0 0 20px rgba(255,255,255,0.2), 0 0 40px rgba(56, 189, 248, 0.4);
  letter-spacing: 2px;
  transition: opacity 0.5s;
}

.brand-image {
  display: none;
  max-height: 90px;
  max-width: 250px;
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(255,255,255,0.2));
  opacity: 0;
  transition: opacity 0.8s ease;
}
.brand-image.visible { opacity: 1; }

.success-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}
.success-badge svg { width: 16px; height: 16px; }

/* ── Controls ── */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.primary-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(129, 140, 248, 0.1));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 1px;
  padding: 1rem 2.5rem;
  border-radius: 100px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.1);
  position: relative;
  overflow: hidden;
}

.primary-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(56, 189, 248, 0.25), 0 0 10px rgba(129, 140, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.8);
}
.primary-btn:active { transform: translateY(1px); }

.primary-btn.scanning {
  pointer-events: none;
  background: transparent;
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}
.primary-btn.scanning .btn-icon {
  animation: spin 1s linear infinite;
}

.btn-icon { width: 20px; height: 20px; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.status-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-family: var(--font-tech);
  letter-spacing: 1px;
  height: 20px;
  transition: color 0.3s;
}

/* ── Side Actions ── */
.side-actions {
  position: fixed;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 20;
}
.action-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.action-btn svg { width: 20px; height: 20px; }
.action-btn:hover {
  color: var(--accent-blue);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateX(-4px);
  background: rgba(56, 189, 248, 0.05);
}

/* ── Mobile Responsive ── */
@media (max-width: 640px) {
  .glass-panel { padding: 2rem 1.5rem; border-radius: 20px; }
  .side-actions { right: 0.5rem; gap: 0.5rem; }
  .action-btn { width: 38px; height: 38px; border-radius: 10px; }
  .action-btn svg { width: 18px; height: 18px; }
  .primary-btn { padding: 0.875rem 2rem; }
  .display-area { height: 240px; }
  .scanner-container { width: 200px; height: 200px; }
  .brand-name { font-size: 2rem; }
}
