/**
 * PHM Tech — PHM Physics CSS
 * Design System Institucional Nobre com suporte a Claro, Sépia e Escuro
 * Prof. Paulo Henrique Maciel · PHM Tech
 */

/* --------------------------------------------------------------------------
   1. TOKENS ESPECÍFICOS DO PHM PHYSICS
   -------------------------------------------------------------------------- */
:root {
  --phys-gold: #d97706;
  --phys-gold-light: #fbbf24;
  --phys-gold-dark: #b45309;
  --phys-gold-glow: rgba(217, 119, 6, 0.2);
  --phys-cyan: #0d9488;
  --phys-emerald: #10b981;
  --phys-purple: #6366f1;
}

/* --------------------------------------------------------------------------
   2. CONTAINER PRINCIPAL DO APP & CONTROLE DE LARGURA
   -------------------------------------------------------------------------- */
html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  position: relative !important;
}

.container,
.phm-shell-container {
  max-width: 1360px;
  width: 100%;
  margin-inline: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  box-sizing: border-box;
}

.physics-main-app {
  min-height: calc(100vh - 120px);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   3. HERO BANNER PRINCIPAL & 4 CARDS MÉTRICOS (KPIS)
   -------------------------------------------------------------------------- */
.physics-hero-section {
  padding: 3rem 0 2.25rem 0;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-soft) 100%);
  border-bottom: 1px solid var(--line);
}

[data-theme="dark"] .physics-hero-section {
  background: linear-gradient(180deg, #060b17 0%, #0b1329 100%);
}

.physics-master-hero {
  text-align: center;
  max-width: 860px;
  margin: 0 auto 2.25rem auto;
}

.physics-hero-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
  margin-bottom: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

[data-theme="dark"] .physics-hero-badge {
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.25);
}

.physics-hero-title {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: clamp(2.2rem, 4.2vw, 3.2rem);
  font-weight: 600;
  color: var(--navy);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
}

.physics-hero-highlight {
  color: #d97706;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: initial;
}

[data-theme="dark"] .physics-hero-highlight {
  color: #fbbf24;
}

.physics-hero-lead {
  font-size: 1.05rem;
  color: var(--text-soft);
  line-height: 1.65;
  max-width: 760px;
  margin: 0 auto;
}

/* 4 CARDS MÉTRICOS DO LABORATÓRIO (KPIS) */
.physics-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.15rem;
}

.physics-kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.physics-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.physics-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-simulators::before { background: #d97706; }
.kpi-phenomena::before { background: #0d9488; }
.kpi-calculators::before { background: #0284c7; }
.kpi-quiz::before { background: #4f46e5; }

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-phenomena .kpi-card-icon { color: #0d9488; }
.kpi-calculators .kpi-card-icon { color: #0284c7; }
.kpi-quiz .kpi-card-icon { color: #4f46e5; }

.kpi-card-val {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-card-sub {
  font-size: 0.76rem;
  color: var(--text-soft);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   4. NAVEGAÇÃO POR ABAS DO LABORATÓRIO
   -------------------------------------------------------------------------- */
.physics-tabs-section {
  padding: 1.75rem 0 1rem 0;
}

.physics-nav-tabs {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.phys-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.phys-tab-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
  border-color: #d97706;
}

.phys-tab-btn.active {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

[data-theme="dark"] .phys-tab-btn.active {
  background: #d97706;
  color: #ffffff;
  border-color: #fbbf24;
}

.phys-tab-content {
  display: none;
  animation: physFadeIn 0.3s ease;
  padding-bottom: 3rem;
}

.phys-tab-content.active {
  display: block;
}

@keyframes physFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   5. SELETOR DE SIMULADORES (SUB-NAV)
   -------------------------------------------------------------------------- */
.sim-selector-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.25rem 0 2rem 0;
  flex-wrap: wrap;
}

.sim-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-selector-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.sim-selector-btn.active {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border-color: #d97706;
  font-weight: 700;
}

[data-theme="dark"] .sim-selector-btn.active {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border-color: #fbbf24;
}

/* --------------------------------------------------------------------------
   6. GRID DE TRABALHO DO SIMULADOR (CANVAS + CONTROLES)
   -------------------------------------------------------------------------- */
.sim-grid-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 960px) {
  .sim-grid-layout {
    grid-template-columns: 1fr;
  }
}

.sim-canvas-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.sim-canvas-wrapper {
  position: relative;
  background: #070c18;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sim-canvas-wrapper canvas {
  width: 100%;
  height: 380px;
  display: block;
}

.sim-canvas-wrapper--prisma {
  min-height: 480px;
}

.sim-canvas-wrapper--prisma canvas {
  height: 480px;
}

.sim-stats-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  z-index: 10;
}

.stat-badge {
  background: rgba(11, 19, 41, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  text-align: right;
}

.stat-lbl {
  display: block;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-val {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.92rem;
  color: #fbbf24;
  font-weight: 700;
}

/* Painel de Controles */
.sim-controls-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.sim-panel-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}

.sim-panel-desc {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.55;
  margin: 0;
}

.sim-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sim-control-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.sim-select,
.sim-input-number {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.sim-select:focus,
.sim-input-number:focus {
  border-color: #d97706;
}

.sim-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-badge {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.8rem;
  font-weight: 700;
  color: #d97706;
  background: rgba(217, 119, 6, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

[data-theme="dark"] .slider-badge {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.sim-slider {
  width: 100%;
  accent-color: #d97706;
  cursor: pointer;
}

.sim-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.sim-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.2rem;
}

.sim-actions-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.sim-actions-row .phm-button {
  flex: 1;
  min-width: 120px;
  justify-content: center;
  border-radius: 4px;
}

.sim-fact-box {
  background: rgba(217, 119, 6, 0.06);
  border-left: 3px solid #d97706;
  border-radius: 0 4px 4px 0;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.sim-fact-box strong {
  color: var(--navy);
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.84rem;
}

.sim-fact-box p {
  margin: 0;
}

/* Medidores de Energia do Pêndulo */
.energy-meters {
  background: #070c18;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.energy-meter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.meter-lbl {
  width: 180px;
  flex-shrink: 0;
  font-weight: 600;
}

.meter-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.05s linear;
}

.meter-fill.ec { background: #38bdf8; }
.meter-fill.ep { background: #f59e0b; }

/* --------------------------------------------------------------------------
   7. ABA 2: FENÔMENOS DO COTIDIANO
   -------------------------------------------------------------------------- */
.cotidiano-intro-box {
  text-align: center;
  max-width: 720px;
  margin: 1rem auto 2rem auto;
}

.cotidiano-intro-box h2 {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.cotidiano-intro-box p {
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.6;
}

/* Barra de Ferramentas: Temas e Busca */
.fenomenos-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.fenomenos-themes {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.fenomenos-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fenomenos-theme-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
  border-color: #d97706;
}

.fenomenos-theme-btn.active {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border-color: #d97706;
  font-weight: 700;
  box-shadow: none;
}

[data-theme="dark"] .fenomenos-theme-btn.active {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border-color: #fbbf24;
}

.theme-count {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: var(--surface-soft);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.9;
}

.fenomenos-search-box {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: center;
}

.fenomenos-search-box input {
  width: 100%;
  padding: 0.7rem 2.6rem 0.7rem 2.6rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fenomenos-search-box input:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.fenomenos-search-box .search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-soft);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 0.9rem;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-soft);
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}

.clear-search-btn:hover {
  color: var(--text);
}

/* Card e Tabela de Fenômenos */
.fenomenos-table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.fenomenos-table-responsive {
  width: 100%;
  overflow-x: auto;
}

.fenomenos-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.fenomenos-table th {
  padding: 1rem 1.25rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.fenomenos-table td {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  vertical-align: middle;
}

.fenomeno-row {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.fenomeno-row:hover {
  background: var(--surface-soft);
}

.fenomeno-row:last-child td {
  border-bottom: none;
}

.fenomeno-title-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.fenomeno-title-text {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.96rem;
  line-height: 1.35;
}

.fenomeno-summary-text {
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.4;
}

.fenomenos-theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}

.fenomenos-theme-badge.theme-calor {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.fenomenos-theme-badge.theme-eletromagnetismo {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.fenomenos-theme-badge.theme-optica {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.fenomenos-theme-badge.theme-mecanica {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .fenomenos-theme-badge.theme-calor { color: #f87171; }
[data-theme="dark"] .fenomenos-theme-badge.theme-eletromagnetismo { color: #fbbf24; }
[data-theme="dark"] .fenomenos-theme-badge.theme-optica { color: #2dd4bf; }
[data-theme="dark"] .fenomenos-theme-badge.theme-mecanica { color: #60a5fa; }

.fenomenos-principle-badge {
  display: inline-block;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-soft);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  line-height: 1.35;
}

.fenomeno-explore-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid rgba(217, 119, 6, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

[data-theme="dark"] .fenomeno-explore-btn {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.fenomeno-explore-btn:hover {
  background: #d97706;
  color: #ffffff;
  border-color: #d97706;
}

.fenomenos-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-soft);
}

.fenomenos-empty p {
  margin-top: 0.75rem;
  font-size: 1rem;
}

/* Janela Modal do Fenômeno */
.fenomeno-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(6, 10, 20, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.fenomeno-modal-overlay.is-active {
  display: flex;
  animation: modalOverlayFadeIn 0.2s ease forwards;
}

@keyframes modalOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fenomeno-modal-dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalDialogScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalDialogScaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.fenomeno-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.fenomeno-modal-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fenomeno-modal-close-x {
  background: transparent;
  border: none;
  font-size: 1.85rem;
  line-height: 1;
  color: var(--text-soft);
  cursor: pointer;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.fenomeno-modal-close-x:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.fenomeno-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.fenomeno-modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.35;
  margin: 0;
}

.fenomeno-modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-section-subtitle {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.modal-text-content {
  font-size: 0.98rem;
  line-height: 1.68;
  color: var(--text);
  white-space: pre-line;
  margin: 0;
}

.fenomeno-modal-box-fact {
  background: rgba(217, 119, 6, 0.06);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-left: 4px solid #d97706;
  border-radius: 4px;
  padding: 1rem 1.15rem;
}

.box-icon-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: #d97706;
  margin-bottom: 0.45rem;
}

[data-theme="dark"] .box-icon-label {
  color: #fbbf24;
}

.box-text-content {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.fenomeno-modal-box-formula {
  background: rgba(13, 148, 136, 0.06);
  border: 1px solid rgba(13, 148, 136, 0.25);
  border-left: 4px solid #0d9488;
  border-radius: 4px;
  padding: 1rem 1.15rem;
}

.fenomeno-modal-box-formula .box-icon-label {
  color: #0d9488;
}

[data-theme="dark"] .fenomeno-modal-box-formula .box-icon-label {
  color: #2dd4bf;
}

.formula-code {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
}

.fenomeno-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  background: var(--surface-soft);
}

.fenomeno-modal-btn-close {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 4px;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  transition: all 0.2s ease;
}

.fenomeno-modal-btn-close:hover {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border-color: #d97706;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   8. ABA 3: CALCULADORAS TÁTEIS & CURIOSIDADES
   -------------------------------------------------------------------------- */
.calculadoras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.calc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.calc-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calc-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .calc-icon-box {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.calc-header h3 {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.35rem;
}

.calc-header p {
  font-size: 0.86rem;
  color: var(--text-soft);
  line-height: 1.5;
  margin: 0;
}

.calc-input-wrapper {
  margin: 1rem 0;
}

.calc-input-wrapper label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.planet-grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.planet-pill {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.65rem 0.85rem;
  text-align: center;
  transition: transform 0.15s, border-color 0.15s;
}

.planet-pill:hover {
  transform: translateY(-2px);
  border-color: #d97706;
}

.planet-name {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.planet-weight {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
}

/* Radar do Trovão */
.radar-box {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.radar-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.radar-btn {
  flex: 1;
  min-width: 130px;
  padding: 0.85rem 1rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.radar-btn.lightning {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border-color: #d97706;
}

[data-theme="dark"] .radar-btn.lightning {
  color: #fbbf24;
  border-color: #fbbf24;
}

.radar-btn.thunder {
  background: var(--surface-soft);
  color: var(--text-muted);
}

.radar-btn.thunder.primary {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  animation: pulseThunder 1s infinite alternate;
}

@keyframes pulseThunder {
  from { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4); }
  to { box-shadow: 0 0 0 10px rgba(2, 132, 199, 0); }
}

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

.radar-display {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem;
}

.display-item .d-lbl {
  display: block;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.display-item .d-val {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy);
}

.display-item .d-val.highlight {
  color: #d97706;
}

[data-theme="dark"] .display-item .d-val.highlight {
  color: #fbbf24;
}

.radar-safety-alert {
  background: rgba(239, 68, 68, 0.08);
  border-left: 3px solid #ef4444;
  border-radius: 0 4px 4px 0;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.radar-safety-alert strong {
  color: #ef4444;
  display: block;
  margin-bottom: 0.25rem;
}

/* --------------------------------------------------------------------------
   9. ABA 4: QUIZ DO LABORATÓRIO
   -------------------------------------------------------------------------- */
.quiz-intro-box {
  text-align: center;
  max-width: 720px;
  margin: 1rem auto 2.5rem auto;
}

.quiz-intro-box h2 {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 1.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.quiz-intro-box p {
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.6;
}

.quiz-single-container {
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.quiz-stepper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.quiz-stepper-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.quiz-step-indicator {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quiz-score-tracker {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.82rem;
  color: var(--text-soft);
  background: var(--surface-soft);
  padding: 0.35rem 0.85rem;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.quiz-score-tracker strong {
  color: #0d9488;
  font-weight: 800;
}

.quiz-progress-track {
  width: 100%;
  height: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: #0d9488;
  border-radius: 2px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.quiz-active-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: modalOverlayFadeIn 0.25s ease;
}

.quiz-q {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0;
  line-height: 1.45;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-option-btn {
  text-align: left;
  padding: 0.95rem 1.25rem;
  border-radius: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: #d97706;
  background: var(--surface);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.1);
}

.quiz-option-btn.correct {
  background: rgba(13, 148, 136, 0.12) !important;
  border-color: #0d9488 !important;
  color: #0d9488 !important;
  font-weight: 700;
}

.quiz-option-btn.wrong {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

.quiz-explanation {
  padding: 1.15rem 1.35rem;
  border-radius: 4px;
  background: rgba(13, 148, 136, 0.08);
  border-left: 4px solid #0d9488;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
  animation: modalDialogScaleIn 0.25s ease;
}

.quiz-explanation.is-wrong {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
}

.quiz-explanation strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

.quiz-explanation.is-wrong strong {
  color: #ef4444;
}

.quiz-feedback-text {
  margin: 0;
}

.quiz-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  animation: modalOverlayFadeIn 0.2s ease;
}

.btn-quiz-card-restart {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  border-radius: 4px;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-quiz-card-restart:hover {
  background: rgba(217, 119, 6, 0.12);
  border-color: #d97706;
  color: #d97706;
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-quiz-card-restart:hover {
  color: #fbbf24;
}

.btn-quiz-next {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.6rem;
  border-radius: 4px;
  font-family: var(--font-heading);
  font-size: 0.94rem;
  font-weight: 700;
  background: #d97706;
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
  transition: all 0.2s ease;
}

.btn-quiz-next:hover {
  background: #b45309;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.35);
}

/* Modal de Resultado Final */
.quiz-modal-dialog {
  max-width: 620px;
  border-radius: 6px;
}

.quiz-modal-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.quiz-result-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .quiz-result-icon-wrap {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.quiz-result-score-wrap {
  text-align: center;
}

.quiz-result-score-lbl {
  display: block;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.quiz-modal-score-val {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin: 0 0 0.35rem 0;
}

.quiz-modal-score-pct {
  display: inline-block;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.88rem;
  font-weight: 700;
  color: #0d9488;
  background: rgba(13, 148, 136, 0.12);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.quiz-modal-quote-box {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-left: 4px solid #d97706;
  border-radius: 4px;
  padding: 1.15rem 1.35rem;
  text-align: left;
}

.quote-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.82rem;
  color: #d97706;
  margin-bottom: 0.45rem;
}

[data-theme="dark"] .quote-header {
  color: #fbbf24;
}

.quote-phrase-text {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.4;
  margin: 0;
}

.quiz-modal-advice-box {
  text-align: left;
}

.btn-quiz-restart {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border-radius: 4px;
  border: 1px solid rgba(217, 119, 6, 0.35);
}

[data-theme="dark"] .btn-quiz-restart {
  color: #fbbf24;
}

.btn-quiz-restart:hover {
  background: #d97706;
  color: #ffffff;
}

/* Botão Voltar ao Topo */
.btn-back-to-top {
  border-radius: 4px !important;
}

/* ==========================================================================
   CABEÇALHO CANÔNICO DO ECOSSISTEMA PHM TECH (PADRÃO EDITORIAL NOBRE)
   ========================================================================== */

html,
body.laboratory-profile,
body.app-body,
body {
  overflow-x: hidden;
  max-width: 100vw;
}

.phm-ecosystem-header {
  position: relative !important;
  width: 100% !important;
  max-width: 100vw !important;
  height: auto !important;
  min-height: 64px !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}

.phm-ecosystem-header .phm-ecosystem-header__inner {
  max-width: 1360px !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

/* 4 Botões Utilitários Compactos Ghost (34×34px desktop / 30×30px mobile, cantos de 4px, borda 1px) */
.phm-ecosystem-header .nav-pref-trigger,
.phm-ecosystem-header .phm-projects-menu > summary,
.phm-ecosystem-header .phm-hub-back,
.phm-ecosystem-header .menu-toggle {
  display: inline-flex !important;
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 4px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-light, #94a3b8) !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

/* Ocultar caret nativo e textos extras do launcher e voltar ao hub */
.phm-ecosystem-header .phm-projects-menu > summary::-webkit-details-marker {
  display: none !important;
}

.phm-ecosystem-header .phm-projects-menu > summary span,
.phm-ecosystem-header .phm-projects-menu > summary svg:last-child,
.phm-ecosystem-header .phm-hub-back span {
  display: none !important;
}

.phm-ecosystem-header .phm-projects-menu > summary svg:first-child,
.phm-ecosystem-header .phm-hub-back svg {
  margin: 0 !important;
}

/* Painel do menu de projetos fechado não pode ocupar espaço ou gerar overflow */
.phm-ecosystem-header details.phm-projects-menu:not([open]) .phm-projects-menu__panel,
details.phm-projects-menu:not([open]) .phm-projects-menu__panel {
  display: none !important;
}

/* Hover e estados ativos - Dark (Default) */
.phm-ecosystem-header .nav-pref-trigger:hover,
.phm-ecosystem-header .phm-projects-menu > summary:hover,
.phm-ecosystem-header .phm-projects-menu[open] > summary,
.phm-ecosystem-header .phm-hub-back:hover,
.phm-ecosystem-header .menu-toggle:hover {
  border-color: rgba(245, 158, 11, 0.5) !important;
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
}

/* Ação local: Reiniciar */
.phm-ecosystem-header .btn-header-action {
  height: 34px !important;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 0.8rem !important;
  border-radius: 4px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-light, #94a3b8) !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.phm-ecosystem-header .btn-header-action:hover {
  border-color: rgba(245, 158, 11, 0.5) !important;
  background: rgba(245, 158, 11, 0.12) !important;
  color: #fbbf24 !important;
}

/* Abas Editoriais - Laboratório de Física */
.phm-ecosystem-header .header-editorial-nav a {
  border-radius: 4px !important;
  transition: all 0.15s ease;
}

.phm-ecosystem-header .header-editorial-nav a:hover {
  color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.1) !important;
}

.phm-ecosystem-header .header-editorial-nav a.active {
  background: rgba(245, 158, 11, 0.18) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
}

/* Tema Claro (Light) */
[data-theme="light"] .phm-ecosystem-header .nav-pref-trigger,
[data-theme="light"] .phm-ecosystem-header .phm-projects-menu > summary,
[data-theme="light"] .phm-ecosystem-header .phm-hub-back,
[data-theme="light"] .phm-ecosystem-header .menu-toggle,
[data-theme="light"] .phm-ecosystem-header .btn-header-action {
  border-color: var(--border, #E2E8F0) !important;
  color: var(--text-muted, #475569) !important;
}

[data-theme="light"] .phm-ecosystem-header .nav-pref-trigger:hover,
[data-theme="light"] .phm-ecosystem-header .phm-projects-menu > summary:hover,
[data-theme="light"] .phm-ecosystem-header .phm-projects-menu[open] > summary,
[data-theme="light"] .phm-ecosystem-header .phm-hub-back:hover,
[data-theme="light"] .phm-ecosystem-header .menu-toggle:hover,
[data-theme="light"] .phm-ecosystem-header .btn-header-action:hover {
  background: rgba(217, 119, 6, 0.12) !important;
  border-color: rgba(217, 119, 6, 0.4) !important;
  color: #b45309 !important;
}

[data-theme="light"] .phm-ecosystem-header .header-editorial-nav a:hover {
  color: #b45309 !important;
  background: rgba(217, 119, 6, 0.08) !important;
}

[data-theme="light"] .phm-ecosystem-header .header-editorial-nav a.active {
  background: rgba(217, 119, 6, 0.16) !important;
  color: #b45309 !important;
  border: 1px solid rgba(217, 119, 6, 0.45) !important;
}

/* Tema Sépia (Sepia) */
[data-theme="sepia"] .phm-ecosystem-header .nav-pref-trigger,
[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu > summary,
[data-theme="sepia"] .phm-ecosystem-header .phm-hub-back,
[data-theme="sepia"] .phm-ecosystem-header .menu-toggle,
[data-theme="sepia"] .phm-ecosystem-header .btn-header-action {
  border-color: var(--border, #DDD1B8) !important;
  color: var(--text-light, #4A3825) !important;
}

[data-theme="sepia"] .phm-ecosystem-header .nav-pref-trigger:hover,
[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu > summary:hover,
[data-theme="sepia"] .phm-ecosystem-header .phm-projects-menu[open] > summary,
[data-theme="sepia"] .phm-ecosystem-header .phm-hub-back:hover,
[data-theme="sepia"] .phm-ecosystem-header .menu-toggle:hover,
[data-theme="sepia"] .phm-ecosystem-header .btn-header-action:hover {
  background: rgba(180, 83, 9, 0.12) !important;
  border-color: rgba(180, 83, 9, 0.35) !important;
  color: #92400e !important;
}

[data-theme="sepia"] .phm-ecosystem-header .header-editorial-nav a:hover {
  color: #92400e !important;
  background: rgba(180, 83, 9, 0.08) !important;
}

[data-theme="sepia"] .phm-ecosystem-header .header-editorial-nav a.active {
  background: rgba(180, 83, 9, 0.16) !important;
  color: #92400e !important;
  border: 1px solid rgba(180, 83, 9, 0.35) !important;
}

/* Menu Hambúrguer Móvel e Gaveta Editorial */
.phm-ecosystem-header .menu-toggle {
  display: none !important;
}

@media (max-width: 900px) {
  .phm-ecosystem-header .phm-ecosystem-header__inner,
  .phm-ecosystem-header .nav-wrap {
    justify-content: flex-start !important;
  }
  .phm-ecosystem-header .phm-ecosystem-header__actions {
    margin-left: 0 !important;
  }
  .phm-ecosystem-header .menu-toggle {
    display: inline-flex !important;
  }
  .phm-ecosystem-header .header-editorial-nav {
    display: none !important;
  }
  .phm-ecosystem-header .header-editorial-nav.open {
    display: flex !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-card, #0b1329);
    border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
    padding: 1rem 1.25rem;
    gap: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    z-index: 999;
  }
  .phm-ecosystem-header .header-editorial-nav.open a {
    padding: 0.65rem 0.85rem !important;
    font-size: 0.85rem !important;
    border-radius: 4px !important;
  }
  [data-theme="light"] .phm-ecosystem-header .header-editorial-nav.open {
    background: #ffffff;
    border-bottom-color: var(--border, #E2E8F0);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  }
  [data-theme="sepia"] .phm-ecosystem-header .header-editorial-nav.open {
    background: #FAF4E6;
    border-bottom-color: var(--border, #DDD1B8);
    box-shadow: 0 10px 25px rgba(67, 52, 34, 0.12);
  }
}

/* Contenção Móvel e Eliminação de Overflow Horizontal */
@media (max-width: 640px) {
  .container,
  .phm-shell-container {
    padding-inline: 0.75rem !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .phm-ecosystem-header .phm-ecosystem-header__inner,
  .phm-ecosystem-header .nav-wrap {
    justify-content: flex-start !important;
    padding-inline: 0.35rem !important;
    gap: 0.2rem !important;
  }
  .phm-ecosystem-header .nav-left-cluster {
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .phm-ecosystem-header .app-logo-wordmark {
    height: 20px !important;
    max-width: 90px !important;
    width: auto !important;
  }
  .phm-ecosystem-header .btn-header-action {
    display: none !important;
  }
  .phm-ecosystem-header .nav-cluster-divider {
    display: none !important;
  }
  .phm-ecosystem-header .phm-ecosystem-header__actions {
    margin-left: 0 !important;
    gap: 0.15rem !important;
    flex-shrink: 0 !important;
  }
  .phm-ecosystem-header .nav-pref-trigger,
  .phm-ecosystem-header .phm-projects-menu > summary,
  .phm-ecosystem-header .phm-hub-back,
  .phm-ecosystem-header .menu-toggle {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 4px !important;
    justify-content: center !important;
  }
  .physics-hero-badge {
    display: inline-flex !important;
    flex-wrap: wrap !important;
    white-space: normal !important;
    max-width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
    font-size: 0.65rem !important;
    line-height: 1.35 !important;
    word-break: break-word !important;
  }
  .physics-hero-title {
    font-size: 1.8rem !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }
  .physics-kpis-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .physics-kpi-card {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .physics-tabs-section,
  .phys-tab-content,
  .sim-panel {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .physics-nav-tabs,
  .sim-selector-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding-bottom: 0.35rem !important;
  }
  .phys-tab-btn,
  .sim-selector-btn {
    flex-shrink: 0 !important;
  }
  .sim-grid-layout {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .sim-canvas-card,
  .sim-canvas-wrapper,
  canvas {
    max-width: 100% !important;
  }
  main .container,
  footer .container,
  .physics-hero-section .container,
  .physics-tabs-section .container {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .phm-ecosystem-header .container {
    overflow: visible !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 360px) {
  .phm-ecosystem-header .app-logo-wordmark {
    height: 18px !important;
    max-width: 75px !important;
  }
  .phm-ecosystem-header .nav-pref-trigger,
  .phm-ecosystem-header .phm-projects-menu > summary,
  .phm-ecosystem-header .phm-hub-back,
  .phm-ecosystem-header .menu-toggle {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
  }
}

/* Salvaguarda de Acessibilidade: Skip Link fora do fluxo visual quando não focado */
.phm-skip-link {
  position: absolute !important;
  top: -9999px !important;
  left: 1rem !important;
  z-index: 999999 !important;
  padding: 0.5rem 1rem !important;
  background: var(--bg-card, #0b1329) !important;
  color: #fbbf24 !important;
  border: 1px solid #d97706 !important;
  border-radius: 4px !important;
  font-family: var(--font-body, system-ui, sans-serif) !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.phm-skip-link:focus,
.phm-skip-link:focus-visible {
  top: 1rem !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  outline: 2px solid #fbbf24 !important;
}