/* ==============================================================================
   Pills.Lab — Bio-Digital Laboratory & 3D Interactive Portal
   Design: Surreal Futuristic Laboratory / Swiss Minimal Typography
   Inspired by Resn (resn.co.nz) & Active Theory
   ============================================================================== */

:root {
  --bg-dark: #030509;
  --bg-lab: radial-gradient(circle at 50% 45%, #080f1d 0%, #030509 75%);
  --cyan-neon: #38bdf8;
  --amber-neon: #f59e0b;
  --purple-neon: #a855f7;
  --text-main: #f8fafc;
  --text-dim: #64748b;
  --text-muted: #94a3b8;
  --border-glass: rgba(255, 255, 255, 0.08);
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  background-image: var(--bg-lab);
  font-family: var(--font-sans);
  color: var(--text-main);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* 3D WebGL Canvas Container */
#webgl-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

/* Grid Sutil de Laboratório */
.lab-grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-size: 60px 60px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  pointer-events: none;
  z-index: 2;
}

/* ==============================================================================
   UI HUD OVERLAYS (HEADER & TELEMETRY)
   ============================================================================== */
.hud-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 40px;
}

/* Top Navigation Bar */
.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: auto;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

.brand-logo-mark img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lab-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #34d399;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  animation: pulse 2s infinite ease-in-out;
}

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

.sound-toggle-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.sound-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==============================================================================
   CENTRAL DYNAMIC FORMULA HUD (HOVER CARD)
   ============================================================================== */
.hud-formula-preview {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(10, 16, 30, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  backdrop-filter: blur(24px);
  border-radius: 18px;
  padding: 24px 32px;
  max-width: 540px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.hud-formula-preview.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.formula-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.formula-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.formula-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

.formula-metrics {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan-neon);
  margin-bottom: 18px;
  letter-spacing: 0.5px;
}

.portal-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-radius: 9999px;
  background: var(--text-main);
  color: #030712;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

.portal-action-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 15px 30px rgba(56, 189, 248, 0.4);
}

/* ==============================================================================
   BOTTOM TELEMETRY & CONTROLS
   ============================================================================== */
.hud-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: auto;
}

.telemetry-block {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

.telemetry-block strong {
  color: var(--text-muted);
}

.hint-interactive {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  padding: 8px 18px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  backdrop-filter: blur(10px);
}

.hint-hand {
  font-size: 14px;
  animation: floatHand 2s infinite ease-in-out;
}

@keyframes floatHand {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.footer-credits a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.2s;
}

.footer-credits a:hover {
  color: var(--cyan-neon);
}

/* ==============================================================================
   WARP DIMENSIONAL ZOOM OVERLAY
   ============================================================================== */
#warp-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity 0.45s ease-out;
}

#warp-overlay.active {
  opacity: 0.95;
}

/* ==============================================================================
   RESPONSIVIDADE (MOBILE)
   ============================================================================== */
@media (max-width: 768px) {
  .hud-layer {
    padding: 20px 24px;
  }

  .brand-tagline {
    display: none;
  }

  .telemetry-block {
    display: none;
  }

  .hud-formula-preview {
    bottom: 90px;
    padding: 20px;
  }

  .formula-title {
    font-size: 20px;
  }

  .formula-desc {
    font-size: 12px;
  }

  .formula-metrics {
    display: none;
  }
}
