/* ==========================================================================
   Página do projeto "Caça-Fantasmas com Efeito Hall"
   Só estilos do simulador e dos blocos de código; o restante usa o style.css.
   ========================================================================== */

.eh-sim {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

@media (min-width: 900px) {
  .eh-sim { grid-template-columns: 360px 1fr; }
}

.eh-panel {
  background: var(--branco);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--sombra);
}

.eh-field { margin-bottom: 22px; }

.eh-field label {
  display: block;
  font-weight: 900;
  color: var(--azul);
  margin-bottom: 8px;
}

.eh-field input[type="range"] {
  width: 100%;
  accent-color: var(--azul);
}

.eh-hint {
  margin: 6px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--texto-suave);
}

.eh-readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.eh-readout {
  background: var(--cinza);
  border: 1px solid var(--borda);
  border-radius: 12px;
  padding: 10px 12px;
}

.eh-readout b {
  display: block;
  font-size: 1.5rem;
  color: var(--azul);
  font-variant-numeric: tabular-nums;
}

.eh-readout span {
  font-size: 0.8rem;
  color: var(--texto-suave);
}

.eh-actuators {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
}

.eh-actuator {
  text-align: center;
  font-size: 0.8rem;
  color: var(--texto-suave);
}

.eh-led {
  width: 46px;
  height: 46px;
  margin: 0 auto 6px;
  border-radius: 50%;
  border: 2px solid var(--azul);
  background: #e2e8f0;
  transition: background 0.1s, box-shadow 0.1s;
}

.eh-led-alerta.on {
  background: #ef4444;
  box-shadow: 0 0 20px #ef4444;
}

.eh-led-brilho {
  background: rgba(250, 204, 21, var(--b, 0));
  box-shadow: 0 0 calc(var(--b, 0) * 26px) rgba(250, 204, 21, var(--b, 0));
}

.eh-buzzer {
  font-weight: 900;
  padding: 8px 14px;
  border-radius: 10px;
  background: #e2e8f0;
  color: var(--azul);
  min-width: 150px;
  text-align: center;
}

.eh-buzzer.on {
  background: var(--amarelo);
}

.eh-canvas-wrap {
  background: var(--azul);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--sombra);
}

.eh-canvas-wrap canvas {
  width: 100%;
  height: 280px;
  display: block;
}

.eh-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 10px 4px 0;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.eh-legend svg {
  vertical-align: middle;
  margin-right: 6px;
}

.eh-note {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--texto-suave);
}

/* ---------- Código com botão de copiar ---------- */
.eh-code {
  position: relative;
}

.eh-code .code-block {
  margin-top: 8px;
  max-height: 520px;
  overflow: auto;
}

.eh-copy {
  position: absolute;
  top: 18px;
  right: 14px;
  background: var(--amarelo);
  color: #111827;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 900;
  cursor: pointer;
}

.eh-copy:hover { background: #fde047; }

.eh-table-scroll { overflow-x: auto; }

.eh-cover {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  justify-content: center;
}

.eh-cover img {
  width: 100%;
  max-width: 280px;
  border-radius: 14px;
  box-shadow: var(--sombra);
}

.eh-cover > div { flex: 1 1 320px; max-width: 560px; }

/* ---------- Alto contraste (widget de acessibilidade) ---------- */
html[data-a11y-contrast="on"] .eh-panel,
html[data-a11y-contrast="on"] .eh-readout,
html[data-a11y-contrast="on"] .eh-canvas-wrap {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

html[data-a11y-contrast="on"] .eh-field label,
html[data-a11y-contrast="on"] .eh-readout b {
  color: #facc15 !important;
}

html[data-a11y-contrast="on"] .eh-hint,
html[data-a11y-contrast="on"] .eh-readout span,
html[data-a11y-contrast="on"] .eh-actuator,
html[data-a11y-contrast="on"] .eh-note {
  color: #ffffff !important;
}

html[data-a11y-contrast="on"] .eh-buzzer {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff;
}

html[data-a11y-contrast="on"] .eh-buzzer.on {
  background: #ffff00 !important;
  color: #000000 !important;
}
