:root {
  --onyx: #0b0a08;
  --onyx-2: #14120f;
  --verde: #16211a;
  --gold: #c9a35a;
  --gold-hi: #e6cf98;
  --ivory: #efe9dc;
  --ivory-2: rgba(239, 233, 220, 0.74);
  --ivory-3: rgba(239, 233, 220, 0.56);
  --rule: rgba(201, 163, 90, 0.34);
  --rule-soft: rgba(239, 233, 220, 0.14);
  --paper: #f7f5f0;
  --card: #ffffff;
  --tint: #efebe2;
  --ink: #15130f;
  --ink-2: #5f584c;
  --ink-3: #8a8172;
  --brass: #7f5f29;
  --line: rgba(21, 19, 15, 0.1);
  --ok: #a9d6a5;
  --aviso: #f3b562;
  --erro: #f2907c;
  --display: "Bodoni Moda", "Bodoni 72", Didot, Georgia, serif;
  --texto: Jost, Futura, "Avenir Next", system-ui, sans-serif;
  --gutter: clamp(16px, 4.4vw, 56px);
  --saida: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--onyx);
  color: var(--ivory);
  font: 400 1rem/1.5 var(--texto);
  accent-color: var(--gold);
  overflow-x: clip;
}
::selection { background: var(--gold); color: var(--onyx); }
h1, h2, p, ul, dl, dd, figure, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
button, input { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
[hidden] { display: none !important; }

.salto {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--gold); color: var(--onyx); padding: 10px 14px; border-radius: 2px; font-weight: 500;
}
.salto:focus { top: 12px; }

/* ——— banca: palco 3D + painel ——— */
.banca { display: block; }
.palco {
  position: sticky; top: 0; z-index: 5;
  height: 56svh; min-height: 340px;
  display: flex; flex-direction: column;
  background: var(--onyx);
  border-bottom: 1px solid var(--rule);
}
.cena { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(120% 90% at 50% 100%, #1b1814, var(--onyx) 70%); }
.cena canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline-offset: -3px; }
.cena canvas:active { cursor: grabbing; }

.topo {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 10px var(--gutter) 28px;
  background: linear-gradient(rgba(11, 10, 8, 0.82), rgba(11, 10, 8, 0));
  pointer-events: none;
}
.topo > * { pointer-events: auto; }
.marca { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marca img { width: 42px; height: auto; flex: none; }
h1 {
  font: 500 clamp(1.2rem, 0.7rem + 2.2vw, 2.9rem)/1 var(--display);
  font-variation-settings: "opsz" 40;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.seg {
  display: inline-flex; flex: none;
  border: 1px solid var(--rule-soft); border-radius: 2px;
  background: rgba(11, 10, 8, 0.72);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.seg label { position: relative; display: flex; flex: 1; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span, .seg button {
  flex: 1; display: grid; place-items: center;
  min-height: 44px; padding: 0 14px;
  color: var(--ivory-2); font-weight: 500; font-size: 0.9375rem; line-height: 1.15; text-align: center; white-space: nowrap;
  transition: background-color 0.25s var(--saida), color 0.25s var(--saida);
}
.seg i { font-style: normal; }
.seg label + label span, .seg button + button { border-left: 1px solid var(--rule-soft); }
.seg label:hover span, .seg button:hover { color: var(--ivory); background: rgba(239, 233, 220, 0.07); }
.seg input:checked + span { background: var(--ivory); color: var(--onyx); }
.seg input:focus-visible + span { outline: 2px solid var(--gold-hi); outline-offset: 2px; position: relative; z-index: 1; }
.seg-ouro input:checked + span { background: var(--gold); color: var(--onyx); }
.seg button { background: none; border: 0; border-radius: 0; cursor: pointer; }
.seg button[aria-pressed="true"] { color: var(--gold-hi); }
.seg-largo { display: flex; }
.seg-largo span { white-space: normal; padding: 6px 8px; }
.so-largo { display: none; }

.barra {
  position: absolute; left: 0; right: 0; bottom: 45px; z-index: 3;
  display: flex; gap: 8px; padding: 0 var(--gutter) 8px;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.barra::-webkit-scrollbar { display: none; }
.dica { display: none; }

.faixa-veredito {
  flex: none; display: flex; align-items: center; gap: 10px;
  height: 45px; padding: 0 var(--gutter);
  background: var(--onyx-2); border-top: 1px solid var(--rule-soft);
  color: var(--ivory-2); text-decoration: none; font-size: 0.9375rem; white-space: nowrap; overflow: hidden;
}
.faixa-veredito b { font-weight: 600; color: var(--v, var(--ivory)); }
.faixa-veredito svg { flex: none; width: 18px; height: 18px; color: var(--v); }
.faixa-veredito span { overflow: hidden; text-overflow: ellipsis; }

.carga {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-content: center; justify-items: center; gap: 18px;
  background: var(--onyx);
  transition: opacity 0.7s var(--saida), visibility 0.7s;
}
.carga.fora { opacity: 0; visibility: hidden; }
.carga img { width: 150px; height: auto; }
.carga p { color: var(--ivory-3); font-size: 0.9375rem; }
.carga-fio { width: 150px; height: 1px; background: var(--rule-soft); position: relative; overflow: hidden; }
.carga-fio::after { content: ""; position: absolute; inset: 0; background: var(--gold); transform-origin: left; animation: fio 1.6s var(--saida) infinite; }
@keyframes fio { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

.sem-3d { position: absolute; inset: 0; overflow: auto; padding: 96px var(--gutter) 60px; display: grid; gap: 14px; align-content: start; justify-items: center; }
.sem-3d p { max-width: 46ch; text-align: center; color: var(--ivory-2); }
.sem-3d svg { width: min(100%, 560px); background: var(--paper); border-radius: 2px; }

/* ——— painel ——— */
.painel { padding: 4px var(--gutter) 40px; background: var(--onyx); }
.grupo { padding: 22px 0; border-top: 1px solid var(--rule-soft); display: grid; gap: 12px; }
.grupo legend { float: left; width: 100%; padding: 0; font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.005em; }
.grupo legend + * { clear: both; }
.grupo legend em {
  font-style: normal; font-weight: 400; font-size: 0.8125rem; color: var(--gold);
  border: 1px solid var(--rule); border-radius: 2px; padding: 2px 7px; margin-left: 8px; vertical-align: 2px;
}
.nota { color: var(--ivory-3); font-size: 0.9375rem; line-height: 1.45; max-width: 46ch; }
.nota:empty { display: none; }
.medidas { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.medidas label { display: grid; gap: 6px; color: var(--ivory-2); font-size: 0.9375rem; }
.campo { display: inline-flex; align-items: center; gap: 8px; color: var(--ivory-3); }
.campo input {
  width: 5.6em; min-height: 44px; padding: 0 10px;
  background: var(--onyx-2); border: 1px solid var(--rule-soft); border-radius: 2px;
  color: var(--ivory); font-variant-numeric: tabular-nums; font-size: 1.0625rem;
}
.campo input:focus-visible { outline-offset: 1px; border-color: var(--gold); }

.liga { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; cursor: pointer; }
.liga span { display: grid; }
.liga small { color: var(--ivory-3); font-size: 0.875rem; }
.liga input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 46px; height: 26px; border-radius: 2px; cursor: pointer;
  background: var(--onyx-2); border: 1px solid var(--ivory-3);
  position: relative; transition: background-color 0.25s var(--saida), border-color 0.25s var(--saida);
}
.liga input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 1px;
  background: var(--ivory-3); transition: transform 0.3s var(--saida), background-color 0.25s;
}
.liga input:checked { background: rgba(201, 163, 90, 0.22); border-color: var(--gold); }
.liga input:checked::after { transform: translateX(20px); background: var(--gold); }

.botao {
  min-height: 48px; padding: 0 22px; justify-self: start;
  background: transparent; border: 1px solid rgba(239, 233, 220, 0.4); border-radius: 2px;
  font-weight: 500; letter-spacing: 0.03em; cursor: pointer;
  transition: background-color 0.3s var(--saida), color 0.3s var(--saida);
}
.botao:hover { background: var(--ivory); color: var(--onyx); }

/* ——— veredito ——— */
.veredito { padding: 20px 0 22px; display: grid; gap: 12px; scroll-margin-top: 57svh; }
.veredito[data-v="cabe"], .faixa-veredito[data-v="cabe"] { --v: var(--ok); }
.veredito[data-v="apertado"], .faixa-veredito[data-v="apertado"] { --v: var(--aviso); }
.veredito[data-v="nao"], .faixa-veredito[data-v="nao"] { --v: var(--erro); }
.v-palavra { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 2.25rem; line-height: 1; letter-spacing: -0.03em; color: var(--v); }
.v-palavra svg { width: 34px; height: 34px; flex: none; }
.v-frase { color: var(--ivory-2); max-width: 44ch; text-wrap: pretty; }
.medidor { display: grid; gap: 6px; }
.medidor-topo { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9375rem; color: var(--ivory-2); }
.medidor-topo b { font-weight: 500; color: var(--ivory); }
.medidor-topo span { font-variant-numeric: tabular-nums; text-align: right; }
.medidor-topo .falta { color: var(--v); }
.trilho { position: relative; height: 10px; background: var(--onyx-2); border: 1px solid var(--rule-soft); border-radius: 1px; }
.trilho i { position: absolute; inset: 0 auto 0 0; background: var(--ivory-3); transition: width 0.5s var(--saida), background-color 0.3s; }
.trilho i.passa { background: var(--v); }
.trilho u { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ivory); transition: left 0.5s var(--saida); }
.v-dica { color: var(--ivory-2); font-size: 0.9375rem; padding-left: 12px; border-left: 1px solid var(--v); max-width: 44ch; }

/* ——— folhas claras ——— */
.folha { background: var(--paper); color: var(--ink); color-scheme: light; padding: clamp(56px, 8vw, 112px) var(--gutter); position: relative; z-index: 6; }
.folha-2 { background: var(--tint); }
.folha ::selection { background: var(--ink); color: var(--paper); }
.folha :focus-visible { outline-color: var(--brass); }
.miolo { max-width: 1240px; margin-inline: auto; }
.folha h2 { font-weight: 600; font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.9rem); line-height: 1.04; letter-spacing: -0.035em; margin-bottom: clamp(24px, 3vw, 40px); max-width: 20ch; text-wrap: balance; }
.folha h2 span { color: var(--ink-3); }
.duas { display: grid; gap: clamp(28px, 4vw, 64px); }
.planta { background: var(--card); border-radius: 20px; box-shadow: 0 0 0 1px var(--line), 0 28px 56px -32px rgba(21, 19, 15, 0.4); padding: clamp(10px, 2vw, 24px); }
.planta svg { width: 100%; height: auto; }
.planta figcaption { color: var(--ink-2); font-size: 0.9375rem; padding: 10px 6px 4px; }
.conta { display: grid; gap: 28px; align-content: start; }
.conta h3 { margin: 0 0 4px; font-weight: 600; font-size: 1.1875rem; letter-spacing: -0.01em; }
.conta table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.conta th, .conta td { padding: 9px 0; text-align: right; border-bottom: 1px solid var(--line); font-weight: 400; white-space: nowrap; }
.conta th:first-child, .conta td:first-child { text-align: left; white-space: normal; padding-right: 12px; }
.conta thead th { color: var(--ink-2); font-size: 0.875rem; }
.conta td + td, .conta th + th { padding-left: 14px; }
.conta .sub td { color: var(--ink-2); font-size: 0.9375rem; padding-top: 14px; border-bottom-color: transparent; }
.conta tfoot td { font-weight: 600; border-bottom: 0; }
.conta tfoot tr:last-child td { color: var(--ink-2); font-weight: 400; }
.conta .mau { color: #a8371f; font-weight: 600; }
.conta .bom { color: #2f6b34; font-weight: 600; }
.conta p { color: var(--ink-2); font-size: 0.9375rem; max-width: 60ch; }
.lista { list-style: none; display: grid; gap: 14px; max-width: 62ch; }
.lista li { padding-left: 20px; position: relative; line-height: 1.55; }
.lista li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 1px; background: var(--brass); }
.levar { display: grid; max-width: 62ch; }
.levar div { padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 2px; }
.levar div:last-child { border-bottom: 1px solid var(--line); }
.levar dt { font-weight: 600; }
.levar dd { color: var(--ink-2); line-height: 1.55; }

.rodape { position: relative; z-index: 6; padding: 36px var(--gutter) 44px; color: var(--ivory-3); font-size: 0.9375rem; display: grid; gap: 6px; background: var(--onyx); }
.rodape p { max-width: 70ch; }

@media (min-width: 620px) {
  .so-largo { display: inline; }
  .marca img { width: 56px; }
}
@media (min-width: 1000px) {
  .banca { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 30vw, 440px); height: 100svh; min-height: 660px; }
  .palco { position: relative; height: auto; min-height: 0; border-bottom: 0; }
  .painel { overflow-y: auto; padding: 8px 32px 40px; border-left: 1px solid var(--rule); scrollbar-width: thin; scrollbar-color: var(--rule) transparent; overscroll-behavior: contain; }
  .topo { padding: 22px 28px 48px; }
  .barra { bottom: 22px; padding: 0 28px; justify-content: center; }
  .faixa-veredito { display: none; }
  .veredito { scroll-margin-top: 0; padding-top: 24px; }
  .dica { display: block; position: absolute; right: 28px; bottom: 84px; z-index: 3; color: var(--ivory-3); font-size: 0.875rem; transition: opacity 0.6s; pointer-events: none; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
  .dica.fora { opacity: 0; }
  .duas { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
  .duas-texto { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
