/* Manual de Bordo · Stroke
   Direção: cockpit de carro de performance à noite. Preto profundo com grade de telemetria,
   feixes de farol em long exposure, um acento âmbar de conta-giros com brilho real e um
   ciano de instrumento só nos dígitos. Tema escuro único (não segue o sistema). */

:root {
  --bg: #08080a;
  --surface: rgba(16, 16, 19, 0.92);
  --surface-2: #17171b;
  --line: rgba(255, 255, 255, 0.08);
  --line-forte: rgba(255, 255, 255, 0.16);
  --text: #f1eee8;
  --muted: #a6a29b;

  --accent: #ff7a1a;
  --accent-alto: #ff9440;
  --accent-ink: #1c0e03;
  --accent-soft: rgba(255, 122, 26, 0.12);
  --accent-glow: rgba(255, 122, 26, 0.45);
  --ciano: #6fd6ff;
  --ciano-glow: rgba(111, 214, 255, 0.55);
  --danger: #ff8a70;

  --display: "Chakra Petch", "Trebuchet MS", "Segoe UI", sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* raio: controles 4px, cartões 10px. Cantos quase retos: é painel, não app. */
  --r-ctl: 4px;
  --r-card: 10px;

  --sombra: 0 30px 60px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --sombra-ativa: 0 0 0 1px rgba(255, 122, 26, 0.28), 0 0 48px -12px var(--accent-glow), 0 30px 60px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --topo-h: 56px;
  --aviso-h: 44px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

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

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

/* ---------- Atmosfera ---------- */

.atmos {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
/* grade de telemetria, esmaecida nas bordas */
.atmos::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 100% 56px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px) 0 0 / 56px 100%;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 30%, transparent 100%);
}
/* vinheta + calor do painel no canto inferior direito */
.atmos::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 100% 100%, rgba(255, 122, 26, 0.10), transparent 70%),
    radial-gradient(ellipse 90% 80% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
}
/* faróis em long exposure: faixas longas, borradas, atravessando devagar */
.feixe {
  position: absolute; left: -30vw;
  width: 160vw; height: 140px;
  border-radius: 999px;
  filter: blur(26px);
  opacity: 0.55;
  will-change: transform;
  animation: varrer 22s var(--ease) infinite alternate;
}
.feixe--1 {
  top: 18%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 122, 26, 0.22) 35%, rgba(255, 170, 80, 0.36) 52%, rgba(255, 122, 26, 0.18) 68%, transparent 100%);
  transform: rotate(-7deg);
  animation-duration: 26s;
}
.feixe--2 {
  top: 58%; height: 90px;
  background: linear-gradient(90deg, transparent 0%, rgba(111, 214, 255, 0.10) 40%, rgba(111, 214, 255, 0.20) 55%, transparent 100%);
  transform: rotate(-5deg);
  animation-duration: 34s;
  animation-delay: -12s;
}
.feixe--3 {
  top: 78%; height: 200px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 122, 26, 0.12) 30%, rgba(255, 140, 40, 0.24) 50%, transparent 80%);
  transform: rotate(-9deg);
  animation-duration: 30s;
  animation-delay: -20s;
}
@keyframes varrer {
  from { translate: -14vw 0; opacity: 0.35; }
  50%  { opacity: 0.7; }
  to   { translate: 14vw 0; opacity: 0.4; }
}

.topo, .palco, .aviso { position: relative; z-index: 1; }

/* ---------- Topo ---------- */

.topo {
  position: sticky; top: 0; z-index: 10;
  background: rgba(8, 8, 10, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topo__linha {
  height: var(--topo-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: 0 var(--s4);
  max-width: 1200px; margin: 0 auto;
}
.marca {
  display: flex; align-items: center; gap: var(--s3);
  text-decoration: none; color: inherit; white-space: nowrap;
}
.marca__stroke {
  font-family: var(--display); font-weight: 700; font-size: 15px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
  text-shadow: 0 0 12px var(--accent-glow);
}
.marca__nome { font-size: 14px; color: var(--muted); padding-left: var(--s3); border-left: 1px solid var(--line-forte); }

.topo__acoes { display: flex; align-items: center; gap: var(--s3); min-width: 0; flex-shrink: 1; }
.salvar-status { font-size: 13px; color: var(--ciano); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--display); letter-spacing: 0.04em; }
.salvar-status.erro { color: var(--danger); white-space: normal; font-family: var(--body); letter-spacing: 0; }
.salvar-status:empty { display: none; }

/* celular: cabeçalho fica só com a marca curta e o botão; status desce pra baixo da barra */
@media (max-width: 599px) {
  .topo:has(.topo__acoes:not([hidden])) .marca__nome { display: none; }
  .topo__acoes { flex-wrap: wrap; justify-content: flex-end; }
  .salvar-status { white-space: normal; text-align: right; }
}

/* barra de RPM: um segmento por bloco, inclinado como marcha, acende bloco a bloco */
.progresso {
  display: flex; gap: 5px;
  height: 7px; padding: 0 var(--s4);
  max-width: 1200px; margin: 0 auto var(--s3);
}
.progresso__seg {
  position: relative; flex: 1 1 0;
  background: rgba(255, 255, 255, 0.07);
  transform: skewX(-18deg);
  overflow: hidden;
}
.progresso__seg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-alto));
  transform-origin: left;
  transform: scaleX(var(--fill, 0));
  transition: transform 0.45s var(--ease);
}
.progresso__seg--ativo { overflow: visible; }
.progresso__seg--ativo::after {
  box-shadow: 0 0 10px var(--accent-glow), 0 0 22px var(--accent-glow);
  animation: pulsar 1.8s ease-in-out infinite;
}
@keyframes pulsar {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.72; }
}

/* ---------- Palco / telas ---------- */

.palco {
  min-height: calc(100dvh - var(--topo-h));
  padding: var(--s6) var(--s4) calc(var(--aviso-h) + var(--s7));
  display: grid; align-content: start;
  max-width: 1200px; margin: 0 auto;
}

/* Entrada: coluna única no celular, duas colunas no desktop */
.tela--entrada {
  display: grid; gap: var(--s7);
  align-items: start;
  padding-top: var(--s4);
}
.titulo {
  font-size: clamp(48px, 9.5vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
/* risco de conta-giros sob o título */
.titulo::after {
  content: ""; display: block;
  width: 88px; height: 4px; margin-top: var(--s5);
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow), 0 0 32px var(--accent-glow);
  transform: skewX(-18deg);
}
.contexto { margin-top: var(--s5); max-width: 42ch; color: var(--muted); font-size: 18px; }

/* pílulas de estatística: número grande aceso, rótulo pequeno em caixa alta */
.pilulas {
  list-style: none; margin: var(--s6) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2);
  max-width: 560px;
}
.pilula {
  display: grid; gap: 2px; align-content: start;
  padding: 14px 12px 12px;
  border: 1px solid rgba(255, 122, 26, 0.32);
  border-radius: var(--r-ctl);
  background: linear-gradient(180deg, rgba(255, 122, 26, 0.10), rgba(255, 122, 26, 0.03));
  box-shadow: 0 0 28px -10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.pilula strong {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(30px, 4vw, 44px); line-height: 1;
  color: var(--accent-alto);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px var(--accent-glow);
}
.pilula strong:empty::before { content: "\2013"; color: var(--muted); text-shadow: none; }
.pilula__rotulo {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); line-height: 1.35;
}

/* ---------- Cartão (base compartilhada: entrada, pergunta, final) ---------- */

.cartao {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--sombra);
  overflow: hidden;
}
.cartao--ativo { box-shadow: var(--sombra-ativa); border-color: rgba(255, 122, 26, 0.35); }

/* faixa do bloco: cabeçalho colorido do cartão */
.cartao__cabeca {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 12px var(--s5);
  background: linear-gradient(90deg, rgba(255, 122, 26, 0.22), rgba(255, 122, 26, 0.06) 55%, transparent);
  border-bottom: 1px solid rgba(255, 122, 26, 0.30);
}
.cartao__bloco {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-size: 13px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-alto);
}
/* luz-piloto do bloco */
.cartao__bloco::before {
  content: ""; width: 8px; height: 8px; flex: none;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow), 0 0 16px var(--accent-glow);
  transform: skewX(-18deg);
}
.cartao__contador {
  font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: 0.08em;
  color: var(--ciano); font-variant-numeric: tabular-nums; white-space: nowrap;
  text-shadow: 0 0 10px var(--ciano-glow);
}
.cartao__corpo { padding: var(--s5); display: grid; gap: var(--s4); }

/* linha de chegada: quadriculado sutil na faixa */
.cartao__cabeca--chegada {
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.07) 0 25%, transparent 0 50%) 0 0 / 18px 18px,
    linear-gradient(90deg, rgba(255, 122, 26, 0.18), rgba(255, 122, 26, 0.04));
}
.final__numero {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(64px, 10vw, 104px); line-height: 0.95; letter-spacing: -0.02em;
  color: var(--accent-alto); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px var(--accent-glow), 0 0 60px rgba(255, 122, 26, 0.25);
}
.final__numero span { font-size: 0.42em; color: var(--muted); text-shadow: none; letter-spacing: 0.04em; margin-left: 6px; }
.final__numero:empty { display: none; }

/* ---------- Campos ---------- */

.campo { display: grid; gap: var(--s2); }
.campo label, .setores legend { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

input[type="text"], input[type="url"], textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: var(--r-ctl);
  padding: 13px 14px;
  color: var(--text);
  font-size: 17px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input::placeholder, textarea::placeholder { color: #8b867d; }
input:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 24px -6px var(--accent-glow);
}
textarea { min-height: 176px; resize: vertical; line-height: 1.55; }

/* cartões de setor: código no quadrado (luz de painel) + nome + descrição */
.setores { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.setores legend { padding: 0; margin-bottom: var(--s2); }
.setores__grade { display: grid; gap: 6px; grid-auto-rows: 1fr; }

.setor { position: relative; display: block; }
.setor input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
/* tile de painel: sigla acesa à esquerda, faixa lateral e LED no canto quando ligado */
.setor__caixa {
  position: relative;
  display: grid; grid-template-columns: 40px 1fr; gap: var(--s3); align-items: center;
  height: 100%; min-height: 58px;
  padding: 8px 32px 8px 10px;
  border: 1px solid var(--line-forte); border-radius: var(--r-ctl);
  background: linear-gradient(180deg, #1a1a1f 0%, #131317 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s, background 0.18s;
}
/* faixa lateral (apagada) */
.setor__caixa::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: 0; transition: opacity 0.18s;
}
/* LED no canto superior direito */
.setor__caixa::after {
  content: ""; position: absolute; top: 10px; right: 10px; width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition: background-color 0.18s, box-shadow 0.18s;
}
.setor__cod {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 1px solid rgba(255, 122, 26, 0.35); border-radius: var(--r-ctl);
  background: rgba(255, 122, 26, 0.06);
  font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: 0.1em;
  color: var(--accent-alto);
  text-shadow: 0 0 10px rgba(255, 122, 26, 0.35);
  transition: background-color 0.18s, color 0.18s, box-shadow 0.18s, border-color 0.18s, text-shadow 0.18s;
}
.setor__texto { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.setor__nome { font-family: var(--display); font-weight: 600; font-size: 17px; letter-spacing: 0.01em; line-height: 1.15; }
.setor__desc { font-size: 14px; color: var(--muted); line-height: 1.3; }
.setor:hover .setor__caixa { border-color: rgba(255, 122, 26, 0.55); transform: translateY(-1px); }
.setor:hover .setor__cod { border-color: rgba(255, 122, 26, 0.7); box-shadow: 0 0 14px -4px var(--accent-glow); }
.setor:has(input:checked) .setor__caixa {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 122, 26, 0.16) 0%, rgba(255, 122, 26, 0.06) 100%), #16161a;
  box-shadow: 0 0 0 1px rgba(255, 122, 26, 0.35), 0 0 32px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}
.setor:has(input:checked) .setor__caixa::before { opacity: 1; }
.setor:has(input:checked) .setor__caixa::after { background: var(--accent-alto); box-shadow: 0 0 8px 1px var(--accent-glow); }
.setor:has(input:checked) .setor__cod {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  text-shadow: none; box-shadow: 0 0 18px var(--accent-glow);
}
.setor:has(input:checked) .setor__desc { color: var(--text); opacity: 0.85; }
.setor:has(input:focus-visible) .setor__caixa { outline: 2px solid var(--accent); outline-offset: 2px; }

.campo__fixo { font-size: 15px; color: var(--muted); padding: 10px 12px; border: 1px dashed var(--line-forte); border-radius: var(--r-ctl); }
.campo__fixo strong { color: var(--accent-alto); font-family: var(--display); }

.rascunho {
  padding: var(--s3) var(--s4);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--r-ctl) var(--r-ctl) 0;
  font-size: 15px;
}

.entrada__acoes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.nota { font-size: 14px; color: var(--muted); }

/* ---------- Botões ---------- */

.botao {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: 0.03em;
  cursor: pointer; white-space: nowrap;
  transition: background-color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.botao:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.botao:disabled { cursor: not-allowed; opacity: 0.4; transform: none; box-shadow: none; }

.botao--primario {
  background: var(--accent); color: var(--accent-ink);
  min-height: 52px; padding: 0 30px;
  box-shadow: 0 0 24px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.botao--primario:hover:not(:disabled) {
  background: var(--accent-alto);
  box-shadow: 0 0 36px -4px var(--accent-glow), 0 8px 24px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.botao--fantasma { background: transparent; border-color: var(--line-forte); color: var(--text); }
.botao--fantasma:hover:not(:disabled) { border-color: rgba(255, 122, 26, 0.6); background: var(--accent-soft); }
.botao--compacto { min-height: 38px; padding: 0 14px; font-size: 14px; }

.botao--texto { background: transparent; color: var(--muted); padding: 0 8px; min-height: 36px; font-family: var(--body); font-weight: 500; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px; }
.botao--texto:hover { color: var(--text); }

/* ---------- Telas de pergunta e final ---------- */

.tela--pergunta, .tela--final { display: grid; justify-items: center; padding-top: var(--s3); }
.tela--pergunta .cartao, .tela--final .cartao { max-width: 720px; }

/* transição entre perguntas: desliza e aparece (direção conforme avança ou volta) */
.cartao.entra { animation: entra 0.3s var(--ease); }
.cartao.entra-volta { animation: entra-volta 0.3s var(--ease); }
@keyframes entra {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: none; }
}
@keyframes entra-volta {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: none; }
}

.cartao__pergunta { font-size: clamp(24px, 3.4vw, 32px); line-height: 1.2; text-wrap: balance; }
.cartao__pergunta:focus { outline: none; }
.cartao__apoio { color: var(--muted); font-size: 16px; }
.cartao__apoio:empty { display: none; }

.cartao__nav {
  display: flex; justify-content: space-between; gap: var(--s3);
  padding-top: var(--s2);
}
.cartao__nav--fim { justify-content: flex-start; }
.cartao__erro { font-size: 15px; color: var(--danger); }

.puladas { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.puladas__titulo { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s2); }
.pulada {
  width: 100%; text-align: left;
  display: grid; grid-template-columns: 3ch 1fr; gap: var(--s3); align-items: baseline;
  padding: 10px 12px;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-ctl);
  cursor: pointer; font-size: 15px; line-height: 1.4; font-family: var(--body);
  transition: border-color 0.18s, background-color 0.18s;
}
.pulada:hover { border-color: var(--accent); background: var(--accent-soft); }
.pulada__n { font-family: var(--display); font-weight: 600; color: var(--ciano); font-variant-numeric: tabular-nums; text-shadow: 0 0 8px var(--ciano-glow); }

/* ---------- Aviso fixo ---------- */

.aviso {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  min-height: var(--aviso-h);
  display: flex; align-items: center; justify-content: center;
  padding: 10px var(--s4);
  background: rgba(8, 8, 10, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); text-align: center;
}
.aviso a { color: var(--accent-alto); text-underline-offset: 3px; }

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
  .palco { padding: var(--s7) var(--s6) calc(var(--aviso-h) + var(--s8)); }
  .tela--entrada { grid-template-columns: 1.05fr 1fr; gap: var(--s8); padding-top: var(--s6); }
  .entrada__form .cartao__corpo { padding: var(--s6); gap: var(--s5); }
  .cartao__cabeca { padding: 14px var(--s7); }
  .tela--pergunta .cartao__corpo, .tela--final .cartao__corpo { padding: var(--s6) var(--s7); gap: var(--s5); }
  .tela--pergunta, .tela--final { padding-top: var(--s6); }
}

/* ---------- Movimento reduzido: tudo estático ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .feixe { opacity: 0.4; }
}
