/* ============================================
  ChronoVLab Virtual - Styles
  Grupo de Cronologia • IFGW • UNICAMP
  ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #080d1a;
  --bg-secondary: #0e1629;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(14, 22, 41, 0.85);
  --accent: #00d4ff;
  --accent-dim: rgba(0, 212, 255, 0.15);
  --accent-2: #7c3aed;
  --accent-2-dim: rgba(124, 58, 237, 0.15);
  --accent-green: #10b981;
  --accent-green-dim: rgba(16, 185, 129, 0.15);
  --accent-orange: #f59e0b;
  --accent-orange-dim: rgba(245, 158, 11, 0.15);
  --accent-red: #ef4444;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  /* Era #64748b: 4.08:1 sobre o fundo, abaixo do mínimo AA de 4.5:1 para
     texto normal — e este token é usado em rótulos de 0.72 a 0.82rem, que
     são texto normal. #7c8a9e dá 5.14:1 até no fundo mais claro do site. */
  --text-muted: #7c8a9e;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --radius: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --nav-height: 72px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Indicador de foco visível. O CSS não tinha nenhuma regra de foco global,
   e o anel padrão do navegador tem contraste baixo sobre fundo escuro.
   :focus-visible só aparece para teclado, não no clique de mouse. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

/* --- Particle Canvas --- */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* --- Container --- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Navbar --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  transition: var(--transition);
  background: transparent;
}

.navbar.scrolled {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  z-index: 1001;
}

.logo-icon {
  font-size: 1.6rem;
}

.logo-text .accent {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.lang-btn {
  min-width: 44px;
  min-height: 36px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn:hover,
.lang-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  /* 44x44: alvo de toque confortável, é o botão mais usado no celular. */
  width: 44px;
  height: 44px;
  padding: 4px;
  z-index: 1001;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.nav-user {
  z-index: 1001;
}

.btn-user {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-user:hover {
  border-color: var(--accent);
}

.user-avatar {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

/* --- Mobile Nav --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-container {
    gap: 10px;
  }
  
  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }
  
  .nav-links.open {
    opacity: 1;
    visibility: visible;
  }
  
  .nav-link {
    font-size: 1.3rem;
    padding: 12px 24px;
  }

  .language-switcher {
    padding: 3px;
  }

  /* Não reduzir o alvo aqui: é justamente no celular que o toque precisa
     dos 44px. Só a fonte e o espaçamento horizontal encolhem. */
  .lang-btn {
    min-width: 40px;
    min-height: 40px;
    padding: 5px 6px;
    font-size: 0.72rem;
  }
}

/* --- Aviso de armazenamento bloqueado --- */
.stats-warning {
  margin-top: 12px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent-orange);
  background: var(--accent-orange-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.stats-warning[hidden] {
  display: none;
}

/* --- Aviso sem JavaScript --- */
.noscript-warning {
  position: relative;
  z-index: 3000;
  margin: 0;
  padding: 16px 24px;
  background: var(--accent-orange);
  color: #1a1000;
  font-weight: 600;
  text-align: center;
}

.noscript-warning span {
  display: block;
  font-weight: 400;
  opacity: 0.85;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

/* visibility: hidden (e não só opacity) tira o checkbox e o botão do modal
   da ordem de tabulação. Antes, depois de aceitar os termos, o teclado
   ainda entrava num formulário invisível. */
.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 460px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(1);
  transition: transform 0.4s ease;
}

.modal-overlay.hidden .modal {
  transform: scale(0.9);
}

.modal-header {
  text-align: center;
  margin-bottom: 32px;
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.consent-copy {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.consent-copy p {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.consent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.consent-list li {
  list-style: disc;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-error {
  font-size: 0.8rem;
  color: var(--accent-red);
  min-height: 18px;
}

.form-checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

/* Media no navegador: 16x16 CSS px, abaixo do mínimo de 24x24 do WCAG
   2.5.8. É o controle que libera o site inteiro — o alvo mais importante
   da página não pode ser o menor. 24px, e o rótulo continua clicável. */
.form-checkbox input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin-top: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.form-checkbox label {
  font-size: 0.82rem;
  /* Era --text-muted. O rótulo de um controle obrigatório não deve ser o
     texto mais apagado do diálogo. */
  color: var(--text-secondary);
  cursor: pointer;
  flex: 1;
  /* Alinha o texto ao centro do checkbox de 24px e amplia a área de toque
     do rótulo, que é parte legítima do alvo. */
  min-height: 24px;
  display: flex;
  align-items: center;
}

.form-checkbox .form-error {
  width: 100%;
}

.modal-footer-text {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 20px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0099cc);
  color: #000;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 30px rgba(0, 212, 255, 0.5);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1rem;
  border-radius: var(--radius-full);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 120px 24px 80px;
}

.hero-content {
  max-width: 800px;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 8px 20px;
  background: var(--accent-dim);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-green));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-description {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 60px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-stat-number {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
}

.hero-stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* --- Section Styles --- */
.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--accent-2-dim);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-2);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-title {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.section-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* --- Labs Section --- */
.labs-section {
  position: relative;
  z-index: 1;
  padding: 100px 0;
}

.lab-category {
  margin-bottom: 80px;
}

.lab-category:last-child {
  margin-bottom: 0;
}

.lab-category-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 32px;
  padding: 24px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

.lab-icon {
  font-size: 2.2rem;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--accent-dim);
}

#lab-decay .lab-icon { background: rgba(239, 68, 68, 0.1); }
#lab-thermo .lab-icon { background: rgba(245, 158, 11, 0.1); }
#lab-radiation .lab-icon { background: var(--accent-dim); }
#lab-games .lab-icon { background: var(--accent-green-dim); }

.lab-category-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.lab-category-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Experiment Cards --- */
.experiments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.experiment-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: var(--transition);
  overflow: hidden;
}

.experiment-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-glow {
  position: absolute;
  top: -100px;
  right: -100px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.experiment-card:hover .card-glow {
  opacity: 1;
}

.card-featured .card-glow {
  background: radial-gradient(circle, var(--accent-orange-dim), transparent 70%);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-icon {
  font-size: 2rem;
}

.card-badge {
  padding: 4px 12px;
  background: var(--accent-dim);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-featured {
  background: var(--accent-orange-dim);
  color: var(--accent-orange);
}

.badge-game {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.card-description {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tag {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Ação principal de cada card. Sem padding, a altura clicável era a da
   própria linha de texto (~22px), abaixo do mínimo de 24px do WCAG 2.5.8 e
   desconfortável no celular. O padding vertical leva o alvo a ~44px. */
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 4px;
  margin-left: -4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  transition: var(--transition);
}

.card-link:hover {
  gap: 10px;
}

.card-link svg {
  transition: transform 0.3s ease;
}

.card-link:hover svg {
  transform: translateX(4px);
}

/* --- About Section --- */
.about-section {
  position: relative;
  z-index: 1;
  padding: 100px 0;
  background: linear-gradient(180deg, transparent, var(--bg-secondary), transparent);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.about-content .section-badge {
  margin-bottom: 12px;
}

.about-content .section-title {
  text-align: left;
  margin-bottom: 20px;
}

.about-content p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.7;
}

.about-content strong {
  color: var(--text-primary);
}

.about-features {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 32px 0;
}

.about-feature {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.feature-icon {
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.about-feature strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.about-feature p {
  font-size: 0.82rem;
  margin-bottom: 0;
}

/* --- Atom Animation --- */
.about-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}

.atom-animation {
  position: relative;
  width: 300px;
  height: 300px;
}

.nucleus {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), var(--accent-2));
  box-shadow: 0 0 30px var(--accent-dim), 0 0 60px rgba(0, 212, 255, 0.1);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.15); }
}

.orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 50%;
}

.orbit-1 {
  width: 120px;
  height: 120px;
  margin-top: -60px;
  margin-left: -60px;
  animation: rotate 4s linear infinite;
}

.orbit-2 {
  width: 200px;
  height: 200px;
  margin-top: -100px;
  margin-left: -100px;
  animation: rotate 6s linear infinite reverse;
}

.orbit-3 {
  width: 280px;
  height: 280px;
  margin-top: -140px;
  margin-left: -140px;
  animation: rotate 8s linear infinite;
}

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

.electron {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent);
  top: -5px;
  left: 50%;
  margin-left: -5px;
}

.orbit-2 .electron {
  background: var(--accent-2);
  box-shadow: 0 0 15px var(--accent-2);
}

.orbit-3 .electron {
  background: var(--accent-green);
  box-shadow: 0 0 15px var(--accent-green);
}

/* --- Stats Section --- */
.stats-section {
  position: relative;
  z-index: 1;
  padding: 100px 0;
}

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.stat-icon {
  font-size: 2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-detail {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.stats-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
}

/* --- Bar Chart --- */
.chart-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  width: 130px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-track {
  flex: 1;
  height: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.chart-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: var(--radius-full);
  transition: width 0.8s ease;
  min-width: 0;
}

.chart-value {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* --- Recent Access List --- */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  font-size: 0.82rem;
}

.recent-item-icon {
  font-size: 1rem;
}

.recent-item-info {
  flex: 1;
  min-width: 0;
}

.recent-item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item-user {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.recent-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* --- Admin Section --- */
.stats-admin {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.stats-note {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

.stats-note + .stats-note {
  margin-top: 10px;
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  padding: 80px 0 40px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-top: 16px;
  line-height: 1.6;
}

.footer-links h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  color: var(--text-primary);
  animation: toastIn 0.3s ease;
  max-width: 360px;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* --- Scroll animations ---
   As regras abaixo dependem da classe .js-anim, aplicada pelo próprio
   app.js imediatamente antes de instalar o IntersectionObserver. Sem essa
   condição, qualquer falha no JS deixava todo o conteúdo do site com
   opacity: 0 — tela preta. */
.js-anim .lab-category,
.js-anim .about-grid,
.js-anim .stats-overview,
.js-anim .stats-detail,
.js-anim .stats-admin {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js-anim .lab-category.visible,
.js-anim .about-grid.visible,
.js-anim .stats-overview.visible,
.js-anim .stats-detail.visible,
.js-anim .stats-admin.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Quem pediu menos movimento não recebe a animação de entrada. */
@media (prefers-reduced-motion: reduce) {
  .js-anim .lab-category,
  .js-anim .about-grid,
  .js-anim .stats-overview,
  .js-anim .stats-detail,
  .js-anim .stats-admin {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  
  .about-visual {
    order: -1;
  }
  
  .about-content .section-title {
    text-align: center;
  }
  
  .about-content {
    text-align: center;
  }
  
  .about-features {
    align-items: center;
  }
  
  .stats-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 100px 16px 60px;
  }
  
  .hero-description {
    font-size: 1rem;
  }
  
  .hero-stats {
    gap: 32px;
  }
  
  .hero-stat-number {
    font-size: 1.5rem;
  }
  
  .experiments-grid {
    grid-template-columns: 1fr;
  }
  
  .lab-category-header {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
  
  .stats-overview {
    grid-template-columns: 1fr 1fr;
  }
  
  .admin-actions {
    flex-direction: column;
  }
  
  .admin-actions .btn {
    width: 100%;
    justify-content: center;
  }
  
  .modal {
    padding: 28px 20px;
  }
}

@media (max-width: 480px) {
  .stats-overview {
    grid-template-columns: 1fr;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .btn-lg {
    width: 100%;
    justify-content: center;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Selection --- */
::selection {
  background: var(--accent-dim);
  color: var(--accent);
}
