/* ============================================================
   BASE — reset, tipografia e controles reutilizaveis
   ============================================================ */

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

/* Arrastar peca, puxar fio e mover a bancada sao gestos de clique-e-
   arrastar, e o navegador entende isso como selecionar texto. Por isso
   a selecao fica desligada na interface inteira. A excecao e o que o
   aluno pode querer copiar: a fala do GabuTRON e os campos de digitar. */
html { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.fala-texto, input, textarea, select, [contenteditable] {
  -webkit-user-select: text; user-select: text;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--vacuo);
  color: var(--luz);
  font-family: var(--mono);
  font-size: var(--t-base);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body { overflow: hidden; }

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: 0.02em; }
h1 { font-size: var(--t-med); }
h2 { font-size: var(--t-base); }
h3 { font-size: var(--t-min); color: var(--grafite); }
p  { margin: 0 0 var(--e2); }

a { color: var(--fosforo); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--fosforo);
  outline-offset: 2px;
}

.oculto { display: none !important; }

.so-leitor {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- botoes --------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--e2);
  min-height: 30px;
  padding: 5px 10px;
  background: transparent;
  color: var(--luz);
  border: var(--borda);
  border-radius: var(--raio);
  font: inherit;
  font-size: var(--t-min);
  cursor: pointer;
  transition: background var(--rapido), border-color var(--rapido);
}
.btn:hover { background: var(--casco-alto); border-color: var(--linha-viva); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { color: var(--poeira); cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-verde { border-color: var(--fosforo); color: var(--fosforo); }
.btn-verde:hover { background: var(--fosforo-op); }
.btn-perigo { border-color: var(--brasa); color: var(--brasa); }

.btn-icone { padding: 5px; min-width: 30px; justify-content: center; }

.btn.ativo { background: var(--fosforo-op); border-color: var(--fosforo); color: var(--fosforo); }

/* --- campos --------------------------------------------------- */

select, input[type="text"], input[type="number"] {
  background: var(--casco-alto);
  color: var(--luz);
  border: var(--borda);
  border-radius: var(--raio);
  font: inherit;
  font-size: var(--t-min);
  padding: 5px 6px;
}

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

.troca { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); padding: 7px 0; }
.troca label { color: var(--luz); font-size: var(--t-min); }
.troca small { display: block; color: var(--poeira); font-size: var(--t-micro); }

/* interruptor */
.chave {
  position: relative; flex: none;
  width: 40px; height: 20px;
  background: var(--casco-alto);
  border: var(--borda); border-radius: var(--raio);
  cursor: pointer;
}
.chave::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 14px;
  background: var(--poeira); border-radius: 1px;
  transition: transform var(--rapido), background var(--rapido);
}
.chave[aria-checked="true"] { border-color: var(--fosforo); }
.chave[aria-checked="true"]::after { transform: translateX(18px); background: var(--fosforo); }

/* --- janela modal (estilo terminal) --------------------------- */

.veu {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: var(--e3);
}

.janela {
  width: min(520px, 100%);
  max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--casco);
  border: 1px solid var(--linha-viva);
  border-radius: var(--raio);
}

.janela-topo {
  display: flex; align-items: center; gap: var(--e2);
  padding: 7px var(--e3);
  border-bottom: var(--borda);
  background: var(--casco-alto);
}
.janela-topo h2 { flex: 1; }
.janela-corpo { padding: var(--e3); overflow-y: auto; }
.janela-base {
  display: flex; gap: var(--e2); flex-wrap: wrap;
  padding: var(--e3); border-top: var(--borda);
}

.grupo { margin-bottom: var(--e4); }
.grupo > h3 {
  padding-bottom: var(--e1);
  margin-bottom: var(--e1);
  border-bottom: var(--borda);
}

.aviso {
  border: 1px solid var(--ambar);
  border-radius: var(--raio);
  padding: var(--e2) var(--e3);
  color: var(--ambar);
  font-size: var(--t-min);
}

/* barra de rolagem discreta */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--linha); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--linha-viva); }
