:root {
  --fundo: #070a10;
  --superficie: #0d121b;
  --superficie-2: #111823;
  --linha: #1e2836;
  --texto: #e8edf5;
  --texto-fraco: #8d9bb0;
  --acento: #6ee7ff;
  --acento-2: #a78bfa;
  --ferramenta: #fbbf24;
  --obs: #34d399;
  --estado: #f472b6;
  --saida: #e2e8f0;
  --erro: #fb7185;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: grid;
  grid-template-columns: 390px 1fr;
  min-height: 100vh;
  background: var(--fundo);
}

/* ---------------- painel esquerdo ---------------- */
.painel {
  border-right: 1px solid var(--linha);
  padding: 26px 26px 22px;
  background: linear-gradient(180deg, #0b1017 0%, #070a10 100%);
  overflow-y: auto;
  max-height: 100vh;
}

.sobre {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--texto-fraco);
}

.painel h1 {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: .98;
  letter-spacing: -.03em;
  font-weight: 600;
}

.painel h1 em {
  font-style: normal;
  background: linear-gradient(92deg, var(--acento), var(--acento-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.resumo {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--texto-fraco);
}

.etapas {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 2px;
}

.etapas li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  padding: 7px 9px 7px 7px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background .28s ease, border-color .28s ease, transform .28s ease;
}

.etapas li h2 {
  margin: 0 0 2px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.etapas li p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--texto-fraco);
}

.etapas .num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--linha);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--texto-fraco);
  font-variant-numeric: tabular-nums;
  transition: all .28s ease;
}

.etapas li[data-ativo="1"] {
  background: var(--superficie-2);
  border-color: var(--linha);
  transform: translateX(2px);
}
.etapas li[data-ativo="1"] .num {
  color: #05121a;
  background: var(--acento);
  border-color: var(--acento);
}
.etapas li[data-ativo="1"] p { color: #b9c6d8; }

.nota-loop {
  border-left: 2px solid var(--linha);
  padding: 2px 0 2px 14px;
}
.nota-loop p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--texto-fraco);
}
.nota-loop strong { color: var(--texto); font-weight: 600; }

/* ---------------- palco / canvas ---------------- */
.palco {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--fundo);
}

.tela {
  position: relative;
  height: 74vh;
  min-height: 460px;
  overflow: hidden;
  background: radial-gradient(120% 100% at 60% 10%, #0f1622 0%, #070a10 62%);
  border-bottom: 1px solid var(--linha);
}

#cena {
  display: block;
  width: 100%;
  height: 100%;
}

.rotulos {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.rot {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #9fb0c6;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(7, 10, 16, .72);
  border: 1px solid rgba(110, 231, 255, .16);
  transition: color .25s ease, border-color .25s ease, opacity .25s ease;
}
.rot[data-ativo="1"] {
  color: #05121a;
  background: var(--acento);
  border-color: var(--acento);
  font-weight: 700;
}

/* KPIs */
.kpis {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 1px;
  background: var(--linha);
  border: 1px solid var(--linha);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.kpi {
  background: rgba(13, 18, 27, .88);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 178px;
}
.kpi-rot {
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--texto-fraco);
}
.kpi-val {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--texto);
}

/* estado atual */
.estado-agora {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  letter-spacing: .04em;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(13, 18, 27, .88);
  border: 1px solid var(--linha);
}
.ponto {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--acento);
  box-shadow: 0 0 12px var(--acento);
  transition: background .25s ease, box-shadow .25s ease;
}
.falha {
  color: var(--erro);
  font-weight: 600;
  padding-left: 9px;
  border-left: 1px solid var(--linha);
}

/* controles */
.controles {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(13, 18, 27, .9);
  border: 1px solid var(--linha);
  backdrop-filter: blur(10px);
}

button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--texto);
  background: var(--superficie-2);
  border: 1px solid var(--linha);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
button:hover { border-color: #2c3a4d; background: #16202d; }
button:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

.slider {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--texto-fraco);
}
.slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 3px;
  border-radius: 3px;
  background: #223042;
  outline: none;
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--acento);
  border: none;
  cursor: pointer;
}
.slider input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--acento); border: none; cursor: pointer;
}
.slider output {
  font-variant-numeric: tabular-nums;
  color: var(--texto);
  letter-spacing: 0;
  text-transform: none;
  font-size: 12px;
  min-width: 46px;
}

.chave {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--texto-fraco);
  cursor: pointer;
}
.chave input { accent-color: var(--erro); width: 14px; height: 14px; }

/* ---------------- leitura ---------------- */
.leitura {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  padding: 30px 34px 10px;
}
.leitura article h3 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--acento);
  font-weight: 600;
}
.leitura article p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.62;
  color: #b7c4d6;
}

.rodape {
  padding: 18px 34px 30px;
  color: #6b7a8f;
}
.rodape p { margin: 0; font-size: 11.5px; line-height: 1.6; max-width: 78ch; }

/* ---------------- responsivo ---------------- */
@media (max-width: 1080px) {
  #app { grid-template-columns: 1fr; }
  .painel {
    border-right: none;
    border-bottom: 1px solid var(--linha);
    max-height: none;
    padding: 26px 22px 30px;
  }
  .painel h1 { font-size: 32px; }
  .etapas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tela { height: 62vh; min-height: 380px; }
  .leitura { grid-template-columns: 1fr; gap: 18px; padding: 24px 22px 8px; }
  .rodape { padding: 14px 22px 26px; }
}

@media (max-width: 620px) {
  .etapas { grid-template-columns: 1fr; }
  .kpis { top: auto; bottom: 96px; right: 12px; }
  .kpi { min-width: 132px; padding: 6px 10px; }
  .kpi-val { font-size: 15px; }
  .controles { gap: 10px; padding: 9px 11px; }
  .slider input[type="range"] { width: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  .etapas li, .rot, .ponto, button { transition: none; }
}
