/* =====================================================================
   ILHA — identidade visual v3 (clara, editorial)
   Inspiração: painéis claros com barra lateral, faixa de topo bege,
   cartões brancos, botões pretos e títulos serifados.
   ===================================================================== */
:root {
  --bg: #f5f4ef;
  --bg2: #efede5;
  --creme: #ecede2;
  --surface: #ffffff;
  --surface2: #f6f5f0;
  --surface3: #ecebe3;
  --border: #e5e3da;
  --border2: #d5d2c5;
  --text: #1c1c1a;
  --text2: #4d4b45;
  --muted: #8c8a81;
  --preto: #1c1c1a;
  --grass: #4f7d3b;
  --grass2: #7aa45f;
  --dry: #b88f2e;
  --sand: #c9a95c;
  --earth: #a8673d;
  --sea: #3b7ea1;
  --sky: #4a86b8;
  --danger: #c4513b;
  --warn: #c48720;
  --good: #3f8a4f;
  --gene: #7b5fb0;
  --cursor: #c4513b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 12px 32px rgba(28, 28, 26, .10);
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
  --lateral: 248px;
  --timebar-h: 68px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--text); }
button, select, input { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -.015em; margin: 0; }
h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.15; }
h3 { font-size: 1.08rem; font-family: var(--sans); font-weight: 600; letter-spacing: -.005em; }
p { margin: .4em 0 .9em; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ic.grande { width: 26px; height: 26px; }
.kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- Barra lateral ---------- */
.lateral {
  position: fixed; inset: 0 auto 0 0; width: var(--lateral); z-index: 70;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 16px 16px; overflow-y: auto;
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 0 8px 18px; }
.marca-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--preto); display: grid; place-items: center; }
.marca-ic svg { width: 30px; height: 30px; }
.marca b { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; display: block; line-height: 1.1; }
.marca small { color: var(--muted); font-size: .74rem; }
.menu { display: flex; flex-direction: column; gap: 1px; }
.menu-t { font-size: .72rem; color: var(--muted); padding: 14px 10px 6px; }
.menu a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--text2); font-size: .9rem; }
.menu a:hover { background: var(--surface2); color: var(--text); }
.menu a.ativo { background: var(--surface3); color: var(--text); font-weight: 500; }
.lateral-cta { margin-top: auto; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; display: grid; gap: 6px; justify-items: center; }
.lateral-cta p { margin: 0 0 6px; font-size: .8rem; color: var(--text2); }
.veu { display: none; }

/* ---------- Área principal ---------- */
.principal { margin-left: var(--lateral); min-height: 100vh; padding-bottom: calc(var(--timebar-h) + 24px); }
main { padding: 0 32px; max-width: 1400px; }
.topo {
  position: sticky; top: 0; z-index: 50; height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 32px;
  background: rgba(245, 244, 239, .86); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topo-titulo { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-dir { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.dur-mini { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px; color: var(--text2); }
.dur-mini input { width: 120px; }
.dur-mini output { font-family: var(--mono); font-size: .82rem; color: var(--text); min-width: 62px; }
.fonte-badge { font-size: .76rem; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--border2); color: var(--text2); background: var(--surface); white-space: nowrap; }
.fonte-badge.lab { border-color: var(--warn); color: #8a5a0e; background: #fbf1dc; }
.icone-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.so-mobile { display: none; }
.banner-lab { display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 32px; background: #fbf1dc; color: #6e4a10; border-bottom: 1px solid #ecd6a8; font-size: .86rem; position: sticky; top: 64px; z-index: 45; }
body.modo-lab .banner-lab { display: flex; }

/* ---------- Botões e controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border2); color: var(--text); padding: 9px 16px; border-radius: 11px; font-size: .9rem; font-weight: 500;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--preto); color: #fff; border-color: var(--preto); }
.btn.pri:hover { background: #33332f; }
.btn.peq { padding: 5px 11px; font-size: .8rem; border-radius: 9px; }
.btn.grande { padding: 13px 20px; font-size: 1rem; }
.btn.bloco { width: 100%; }
.btn[aria-pressed="true"] { background: var(--preto); color: #fff; border-color: var(--preto); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.mais-ic { font-weight: 400; font-size: 1.05rem; line-height: 1; }
.botoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
input[type=range] { accent-color: var(--preto); width: 100%; cursor: pointer; }
select, input[type=number] { background: var(--surface); border: 1px solid var(--border2); border-radius: 9px; padding: 7px 10px; }
.link-sutil { font-size: .82rem; color: var(--text2); }

/* ---------- Faixa de topo (herói + central) ---------- */
.faixa-topo { background: var(--creme); border-radius: 0 0 24px 24px; margin: 0 -32px; padding: 40px 32px 28px; }
.heroi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; align-items: center; }
.heroi h1 { font-size: clamp(2.4rem, 4.6vw, 4rem); line-height: 1.02; margin: 12px 0 16px; font-weight: 400; }
.heroi h1 em { font-style: italic; color: var(--grass); }
.heroi .lead { font-size: 1.04rem; color: var(--text2); max-width: 58ch; }
.heroi-dados { display: grid; gap: 14px; }
.mini-graf { background: transparent; }
.mg-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.mg-cab b { font-weight: 500; }
.heroi-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--border2); padding-top: 14px; }
.hs { padding: 0 14px 0 0; }
.hs + .hs { padding-left: 14px; border-left: 1px solid var(--border2); }
.hs .v { font-family: var(--sans); font-size: 1.85rem; font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.hs .l { color: var(--text2); font-size: .78rem; line-height: 1.35; margin-top: 6px; }
@media (max-width: 1100px) { .heroi { grid-template-columns: 1fr; } .heroi-stats { grid-template-columns: repeat(2, 1fr); row-gap: 14px; } .hs:nth-child(3) { border-left: 0; padding-left: 0; } }

.central { margin-top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; box-shadow: 0 1px 0 rgba(28,28,26,.03); }
.central-cab { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.central-cab h2 { font-size: 1.45rem; margin-top: 4px; }
.central-grid { display: grid; grid-template-columns: 1.1fr 1.3fr 1fr 1.1fr; gap: 14px; }
.cc-bloco { background: var(--surface2); border: 1px solid var(--border); border-radius: 13px; padding: 14px 16px; }
.cc-t { font-size: .8rem; color: var(--text2); font-weight: 500; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.cc-dur-val { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 4px; }
.cc-dur-val b { font-size: 2.4rem; font-weight: 400; letter-spacing: -.02em; }
.cc-escala { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .68rem; color: var(--muted); margin-top: 2px; }
.chips-sel { display: flex; flex-wrap: wrap; gap: 7px; }
.chips-sel button { cursor: pointer; border: 1px solid var(--border2); background: var(--surface); border-radius: 99px; padding: 7px 12px; font-size: .84rem; transition: all .15s; }
.chips-sel button:hover { border-color: var(--text); }
.chips-sel button[aria-pressed="true"] { background: var(--preto); color: #fff; border-color: var(--preto); }
.seg { display: inline-flex; background: var(--surface3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 8px; cursor: pointer; font-size: .82rem; color: var(--text2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(28,28,26,.12); font-weight: 500; }
.cc-acao { display: flex; flex-direction: column; gap: 8px; justify-content: center; background: var(--surface); }
@media (max-width: 1200px) { .central-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .central-grid { grid-template-columns: 1fr; } }

/* ---------- Seções ---------- */
section.sec { padding: 44px 0 8px; }
section.sec.destaque { position: relative; }
section.sec.destaque::before { content: ''; position: absolute; inset: 20px -20px -10px; background: var(--bg2); border-radius: 24px; z-index: -1; }
.sec-cab { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.sec-cab .kicker { display: block; margin-bottom: 8px; }
.sec-cab p { color: var(--text2); max-width: 78ch; margin: 6px 0 0; }
.pp { font-size: 1.02rem; color: var(--text) !important; line-height: 1.55; margin-top: 10px !important; }
.cartao { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; position: relative; }
.cartao > h3 { margin-bottom: 2px; display: flex; align-items: center; gap: 8px; }
.cartao .sub { color: var(--muted); font-size: .84rem; margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1150px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .span2 { grid-column: auto; } }

/* guia */
#guia { padding-top: 24px; }
.guia { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 46px 16px 18px; }
.guia-passo { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--text2); }
.guia-passo b { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--preto); color: #fff; font-size: .78rem; }
.guia-x { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: var(--muted); font-size: 1.3rem; cursor: pointer; }
.guia.oculto { display: none; }
@media (max-width: 760px) { .guia { grid-template-columns: 1fr; } }

/* capítulos */
.capitulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.capitulo { text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; color: var(--text); transition: transform .15s, border-color .15s, box-shadow .15s; }
.capitulo:hover { transform: translateY(-2px); border-color: var(--border2); box-shadow: var(--shadow); }
.capitulo.ativo { background: var(--preto); color: #fff; border-color: var(--preto); }
.capitulo.ativo p, .capitulo.ativo .cap-n { color: #c9c7bd; }
.capitulo.ativo .cap-q { color: #fff; }
.capitulo .cap-n { font-family: var(--mono); font-size: .68rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.capitulo .cap-ic { font-size: 1.6rem; line-height: 1; }
.capitulo b { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; line-height: 1.25; }
.capitulo p { margin: 0; font-size: .86rem; color: var(--text2); }
.capitulo .cap-q { margin-top: auto; padding-top: 6px; font-size: .78rem; color: var(--text); font-weight: 500; }

/* ---------- Painel ---------- */
.painel { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 1000px) { .painel { grid-template-columns: minmax(0, 1fr); } }
.momento { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.momento .quando { font-family: var(--serif); font-size: 1.55rem; }
.estacao-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 99px; font-size: .78rem; border: 1px solid var(--border2); background: var(--surface); }
.simples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sc { border-radius: var(--radius); padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; position: relative; }
.sc .sc-t { display: flex; align-items: center; gap: 8px; color: var(--text2); font-size: .84rem; }
.sc .sc-t i { font-style: normal; font-size: 1.15rem; }
.sc .sc-t::after { content: ''; margin-left: auto; width: 9px; height: 9px; border-radius: 50%; background: var(--estado, var(--muted)); }
.sc .sc-v { font-size: 1.9rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
.sc .sc-v small { font-size: .9rem; color: var(--muted); }
.sc .sc-f { font-size: .88rem; color: var(--text2); }
.sc.bom { --estado: var(--good); } .sc.alerta { --estado: var(--warn); } .sc.mau { --estado: var(--danger); } .sc.info { --estado: var(--sky); }
.sc.largo { grid-column: 1 / -1; }
.frase-momento { margin-top: 12px; font-family: var(--serif); font-size: 1.15rem; line-height: 1.5; background: var(--creme); border-radius: var(--radius); padding: 16px 18px; }
@media (max-width: 420px) { .simples { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 13px; min-height: 86px; display: flex; flex-direction: column; gap: 2px; }
.kpi .k-l { font-size: .72rem; color: var(--muted); display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .k-v { font-size: 1.25rem; font-weight: 600; line-height: 1.2; }
.kpi .k-v small { font-size: .7rem; color: var(--muted); font-weight: 400; }
.kpi .k-d { font-size: .75rem; color: var(--text2); }
.kpi .k-d.up { color: var(--good); } .kpi .k-d.down { color: var(--danger); }
.kpi.alerta { border-color: rgba(196, 81, 59, .45); }
.saude { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 16px; align-items: center; margin-top: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.saude svg { width: 110px; height: 110px; }
.saude-comp { display: grid; gap: 5px; font-size: .8rem; }
.barra { height: 6px; background: var(--surface3); border-radius: 9px; overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: 9px; background: var(--grass); transition: width .4s; }
.comp-l { display: flex; justify-content: space-between; color: var(--text2); }
details.formula { margin-top: 8px; font-size: .8rem; color: var(--text2); }
details.formula summary { cursor: pointer; color: var(--text); text-decoration: underline; }
details.formula code { font-family: var(--mono); font-size: .74rem; color: var(--earth); }

/* ---------- Ilha ---------- */
.ilha-box { position: relative; border-radius: var(--radius); overflow: hidden; background: #0d2a36; }
.ilha-box svg { display: block; width: 100%; height: auto; }
.ilha-ctrl { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; z-index: 2; }
.ilha-ctrl .btn { background: rgba(255,255,255,.9); }
.ilha-ctrl .btn[aria-pressed="true"] { background: var(--preto); color: #fff; }
.ilha-info { position: absolute; top: 12px; right: 12px; z-index: 2; text-align: right; background: rgba(255,255,255,.92); padding: 7px 12px; border-radius: 11px; font-size: .78rem; color: var(--text2); }
.ilha-info b { font-size: 1.2rem; color: var(--text); font-weight: 600; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--text2); }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
@keyframes onda { from { transform: translateX(0); } to { transform: translateX(-60px); } }
.ondas { animation: onda 6s linear infinite; }
@media (prefers-reduced-motion: reduce) { .ondas { animation: none; } html { scroll-behavior: auto; } }

/* ---------- Gráficos ---------- */
.grafico { position: relative; width: 100%; overflow: hidden; }
.grafico canvas { display: block; width: 100%; touch-action: pan-y; }
.g-tooltip { position: absolute; pointer-events: none; z-index: 5; min-width: 150px; max-width: 290px; background: var(--preto); color: #f2f1ec; border-radius: 10px; padding: 9px 11px; font-size: .78rem; box-shadow: var(--shadow); opacity: 0; transition: opacity .12s; }
.g-tooltip.vis { opacity: 1; }
.g-tooltip .tt-t { font-weight: 600; margin-bottom: 4px; font-size: .8rem; color: #fff; }
.g-tooltip .tt-r { display: flex; justify-content: space-between; gap: 12px; color: #d6d4cb; }
.g-tooltip .tt-r b { font-family: var(--mono); font-weight: 500; color: #fff; }
.g-tooltip .tt-s { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.g-leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--text2); margin-top: 8px; }
.g-leg span { display: inline-flex; align-items: center; gap: 6px; }
.g-leg i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.g-leg i.bar { height: 10px; width: 10px; }
.g-leg i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; }
.ctrl-linha { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pop-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
@media (max-width: 1150px) { .pop-layout { grid-template-columns: minmax(0, 1fr); } }
.detalhe h4 { margin: 0 0 8px; font-family: var(--serif); font-weight: 500; font-size: 1.2rem; }
.dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .84rem; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; font-family: var(--mono); text-align: right; }
.hint { font-size: .78rem; color: var(--muted); }

/* ---------- Observações ---------- */
.insights { display: grid; gap: 10px; }
.insight { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px; animation: entra .35s ease both; position: relative; overflow: hidden; }
.insight::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--sky); }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.insight.bom::before { background: var(--good); } .insight.alerta::before { background: var(--warn); } .insight.mau::before { background: var(--danger); }
.insight .ic { font-size: 1.25rem; line-height: 1.2; width: auto; height: auto; stroke: none; }
.insight p { margin: 0; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: .7rem; padding: 2px 8px; border-radius: 99px; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }

/* ---------- Pirâmide / genealogia ---------- */
.piramide svg, .genealogia svg { width: 100%; height: auto; display: block; }
.genealogia { overflow-x: auto; }
.genealogia svg { min-width: 720px; }
.gnode { cursor: pointer; transition: opacity .15s; }
.genealogia.foco .gnode:not(.on), .genealogia.foco .glink:not(.on) { opacity: .12; }

/* ---------- Linha do tempo ---------- */
.timeline { position: relative; display: grid; gap: 10px; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border2); }
.ev { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; cursor: pointer; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; text-align: left; width: 100%; min-width: 0; transition: border-color .15s; }
.ev:hover, .ev.ativo { border-color: var(--text); }
.ev::before { content: ''; position: absolute; left: -22px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--sky); box-shadow: 0 0 0 3px var(--bg); }
.ev.bom::before { background: var(--good); } .ev.alerta::before { background: var(--warn); } .ev.mau::before { background: var(--danger); }
.ev .ic { font-size: 1.3rem; width: auto; height: auto; stroke: none; }
.ev .quando { font-family: var(--mono); font-size: .74rem; color: var(--muted); white-space: nowrap; }
.ev b { display: block; }
.ev span.t { color: var(--text2); font-size: .86rem; }

/* ---------- Tabelas ---------- */
.tabela-box { overflow: auto; max-height: 520px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
thead th { position: sticky; top: 0; background: var(--surface2); color: var(--text2); font-weight: 500; z-index: 1; }
tbody tr:hover { background: var(--surface2); }
tbody tr.sel { background: var(--creme); }
td.num, td .num { font-family: var(--mono); }
tbody tr { cursor: pointer; }
.cen-tab tbody tr.sel td:first-child { font-weight: 600; }
.prob { display: inline-block; min-width: 48px; padding: 2px 8px; border-radius: 7px; font-family: var(--mono); font-size: .78rem; text-align: center; }

/* ---------- Experimentos ---------- */
.pred-card { display: flex; flex-direction: column; gap: 8px; }
.pred-card .pc-top { display: flex; align-items: center; gap: 10px; }
.pred-card .pc-ic { font-size: 1.9rem; line-height: 1; width: 48px; height: 48px; display: grid; place-items: center; background: var(--surface2); border-radius: 12px; }
.pred-card b { font-family: var(--serif); font-weight: 500; font-size: 1.15rem; }
.pred-card p { margin: 0; font-size: .86rem; color: var(--text2); }
.pred-card .pc-fatos { display: flex; flex-wrap: wrap; gap: 5px; }
.pred-card .btn { margin-top: auto; align-self: flex-start; }
.licao { background: var(--creme); border-color: transparent; }
.aviso { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); background: #fbf1dc; border: 1px solid #ecd6a8; color: #6e4a10; font-size: .86rem; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 24px; }
.slider { display: grid; gap: 4px; }
.slider .sl-top { display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; }
.slider .sl-top output { font-family: var(--mono); color: var(--text); }
.slider .sl-desc { font-size: .74rem; color: var(--muted); }
.slider.mod .sl-top span { color: var(--warn); font-weight: 500; }
.grupo-t { font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); grid-column: 1 / -1; margin-top: 10px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.lab-pred { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.lp { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .84rem; }
.lp.on { border-color: var(--preto); background: var(--surface); }
.lp label.lp-t { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.lp input[type=number] { width: 72px; }
.lp input[type=checkbox] { accent-color: var(--preto); width: 16px; height: 16px; }
.carregando { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(245, 244, 239, .7); backdrop-filter: blur(4px); }
.carregando.vis { display: grid; }
.carregando .cx { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 28px; text-align: center; min-width: 280px; box-shadow: var(--shadow); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--surface3); border-top-color: var(--preto); border-radius: 50%; animation: gira 0.9s linear infinite; margin: 0 auto 12px; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- Relatório / método ---------- */
.qa { display: grid; gap: 8px; }
.qa details { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.qa summary { cursor: pointer; font-weight: 500; }
.qa p { margin: 8px 0 2px; color: var(--text2); }
.conclusao { font-family: var(--serif); font-size: 1.1rem; line-height: 1.6; }
.conclusao p { margin: 0 0 .8em; }
.metodo h3 { margin: 16px 0 6px; }
.metodo ul, .metodo ol { margin: 4px 0 10px; padding-left: 20px; color: var(--text2); }
.eq { font-family: var(--mono); font-size: .78rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; overflow-x: auto; color: var(--earth); white-space: pre; }
.ref { font-size: .82rem; color: var(--text2); padding-left: 1.4em; text-indent: -1.4em; margin: 0 0 6px; }
.tag { font-size: .68rem; padding: 1px 6px; border-radius: 5px; border: 1px solid; margin-left: 4px; vertical-align: 1px; }
.tag.lit { color: var(--sky); } .tag.hip { color: var(--warn); } .tag.cal { color: var(--gene); }
.glossario { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.glossario div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: .86rem; color: var(--text2); }
.glossario b { display: block; color: var(--text); margin-bottom: 3px; font-weight: 600; }

/* "Ver mais" */
details.mais { margin-top: 16px; }
details.mais > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; border: 1px solid var(--border2); background: var(--surface); color: var(--text2); font-size: .86rem; user-select: none; }
details.mais > summary::-webkit-details-marker { display: none; }
details.mais > summary::before { content: '＋'; color: var(--text); font-weight: 600; }
details.mais[open] > summary::before { content: '－'; }
details.mais > summary:hover { border-color: var(--text); color: var(--text); }
details.mais[open] > summary { margin-bottom: 14px; }

/* ajuda "?" */
.ajuda, .ajuda-ex { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: .66rem; font-weight: 700; background: var(--surface3); color: var(--text2); border: 1px solid var(--border2); cursor: help; vertical-align: 1px; position: relative; font-family: var(--sans); }
.ajuda:hover::after, .ajuda:focus::after { content: attr(data-dica); position: absolute; z-index: 30; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 260px; white-space: normal; text-align: left; font-weight: 400; font-size: .8rem; line-height: 1.45; background: var(--preto); color: #f2f1ec; border-radius: 9px; padding: 9px 11px; box-shadow: var(--shadow); text-transform: none; letter-spacing: 0; }
.ajuda:focus { outline: 2px solid var(--text); outline-offset: 1px; }

/* estações */
.estacoes4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 720px) { .estacoes4 { grid-template-columns: repeat(2, 1fr); } }
.est-card { border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--border); background: var(--surface); font-size: .82rem; color: var(--text2); }
.est-card b { display: block; color: var(--text); font-family: var(--serif); font-weight: 500; font-size: 1.02rem; margin: 4px 0; }
.est-card .ic { font-size: 1.4rem; width: auto; height: auto; stroke: none; }
.est-card.atual { background: var(--preto); color: #d6d4cb; border-color: var(--preto); }
.est-card.atual b, .est-card.atual .mono { color: #fff !important; }

/* ---------- Máquina do tempo ---------- */
.timebar {
  position: fixed; left: var(--lateral); right: 0; bottom: 0; z-index: 60; height: var(--timebar-h);
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 0 32px;
}
.tb-btns { display: flex; gap: 4px; }
.tb-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; background: var(--surface); border: 1px solid var(--border2); font-size: .82rem; }
.tb-btn:hover { border-color: var(--text); }
.tb-btn.play { width: 44px; background: var(--preto); color: #fff; border-color: var(--preto); font-size: .95rem; }
.tb-quando { width: 190px; white-space: nowrap; overflow: hidden; font-variant-numeric: tabular-nums; }
.tb-quando b { font-family: var(--serif); font-weight: 500; font-size: 1.05rem; display: block; line-height: 1.2; }
.tb-quando span { font-family: var(--mono); font-size: .74rem; color: var(--muted); }
.tb-slider { position: relative; }
.tb-marcas { position: absolute; left: 0; right: 0; top: -6px; height: 6px; pointer-events: none; }
.tb-marcas i { position: absolute; width: 2px; height: 6px; background: var(--warn); border-radius: 2px; }
.tb-sel { display: flex; gap: 6px; align-items: center; }
.tb-sel select { padding: 5px 7px; font-size: .8rem; }

.rodape { padding: 40px 32px 20px; color: var(--muted); font-size: .8rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .lateral { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
  body.menu-aberto .lateral { transform: none; }
  body.menu-aberto .veu { display: block; position: fixed; inset: 0; background: rgba(28,28,26,.3); z-index: 65; }
  .principal { margin-left: 0; }
  .timebar { left: 0; }
  .so-mobile { display: grid; }
}
@media (max-width: 900px) {
  :root { --timebar-h: 108px; }
  .timebar { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; padding: 8px 16px; gap: 8px 12px; }
  .tb-slider { grid-column: 1 / -1; grid-row: 2; }
  .tb-sel { justify-self: end; }
  .tb-quando { display: none; }
}
@media (max-width: 720px) {
  main { padding: 0 16px; }
  .topo { padding: 0 16px; gap: 10px; }
  .faixa-topo { margin: 0 -16px; padding: 26px 16px 20px; }
  .so-desk, .topo-titulo { display: none; }
  .dur-mini input { width: 80px; }
  .banner-lab { padding: 8px 16px; }
  section.sec.destaque::before { inset: 20px -10px -10px; }
  .ev { grid-template-columns: auto minmax(0, 1fr); } .ev .quando { grid-column: 2; }
  .heroi-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .tb-btn { width: 32px; height: 32px; } .tb-btn.play { width: 40px; }
  .tb-sel select:last-child { display: none; }
  .dur-mini svg { display: none; }
  .fonte-badge, body.modo-lab .fonte-badge { display: none; }
}
@media (max-width: 400px) { #tbAnoMenos, #tbAnoMais { display: none; } }

/* ---------- Impressão ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .lateral, .topo, .timebar, .banner-lab, #laboratorio, #guia, .central, .ilha-ctrl, .botoes, .ctrl-linha, .nao-imprime, .carregando { display: none !important; }
  .principal { margin: 0; padding: 0; }
  details.mais > *:not(summary) { display: block; }
  section.sec { break-inside: avoid-page; padding: 14px 0; }
  .cartao { break-inside: avoid; }
  .tabela-box { max-height: none; overflow: visible; }
}

/* destaque do botao Simular quando ha alteracoes pendentes */
@keyframes pulsa { 0%, 100% { box-shadow: 0 0 0 0 rgba(28,28,26,.35); } 50% { box-shadow: 0 0 0 7px rgba(28,28,26,0); } }
.btn.pulsa { animation: pulsa 1.4s ease infinite; }

/* ---------- Central de experimento v2.5 ---------- */
.seg.col { display: flex; flex-direction: column; align-items: stretch; }
.seg.col button { text-align: left; padding: 8px 11px; }
.cc-nota { margin: 10px 0 0; font-size: .78rem; color: var(--muted); }
.cc-acoes { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-top: 14px; }
.cc-sorte { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; font-size: .86rem; color: var(--text2); }
.cc-sorte input { accent-color: var(--preto); width: 16px; height: 16px; }
.cc-acoes .link-sutil { margin-left: auto; }
.cc-res { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cc-res:empty { display: none; }
.cr-itens { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.cr-i b { display: block; font-size: 1.25rem; font-weight: 500; letter-spacing: -.01em; line-height: 1.2; }
.cr-i span { font-size: .76rem; color: var(--muted); }
.cr-btns { display: flex; gap: 8px; }
.cc-hist { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hist { cursor: pointer; border: 1px solid var(--border2); background: var(--surface2); border-radius: 99px; padding: 4px 11px; font-size: .76rem; color: var(--text2); }
.hist:hover { border-color: var(--text); color: var(--text); }
@media (max-width: 640px) { .cc-acoes .link-sutil { margin-left: 0; } }
/* ---------- v3: idioma, poderes, mapa, sala de aula ---------- */
.lang { display: inline-flex; background: var(--surface); border: 1px solid var(--border2); border-radius: 10px; padding: 3px; flex-shrink: 0; }
.lang button { border: 0; background: none; padding: 5px 9px; border-radius: 7px; cursor: pointer; font-size: .78rem; font-weight: 600; color: var(--text2); }
.lang button.on { background: var(--preto); color: #fff; }
.poderes { margin-top: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.pd-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.pd-btns { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 6px; }
.pd-btn { display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer; border: 1px solid var(--border2); background: var(--surface2); border-radius: 10px; padding: 7px 10px; font-size: .8rem; color: var(--text); transition: border-color .15s, transform .1s; }
.pd-btn i { font-style: normal; font-size: 1.1rem; }
.pd-btn:hover:not(:disabled) { border-color: var(--text); transform: translateY(-1px); }
.pd-btn:disabled { opacity: .45; cursor: not-allowed; }
.pd-lista { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pd-lista:empty { display: none; }
.pd-item { display: inline-flex; border: 1px solid var(--border2); border-radius: 99px; overflow: hidden; background: var(--creme); }
.pd-item button { border: 0; background: none; cursor: pointer; font-size: .76rem; padding: 4px 9px; color: var(--text); }
.pd-item .pd-x { border-left: 1px solid var(--border2); font-size: .9rem; color: var(--danger); }
.sm-box { margin-top: 16px; }
.sm-box:empty { display: none; }
.sm-grade { display: grid; gap: 4px; align-items: stretch; max-width: 720px; }
.sm-cel { border: 0; border-radius: 8px; min-height: 46px; cursor: pointer; font-family: var(--mono); font-size: .8rem; color: #1c1c1a; transition: transform .1s; }
.sm-cel:hover { transform: scale(1.05); outline: 2px solid var(--text); }
.sm-rot { font-family: var(--mono); font-size: .72rem; color: var(--muted); display: grid; place-items: center end; padding-right: 6px; white-space: nowrap; }
.sm-rot.x { place-items: start center; padding: 2px 0 0; }
.sm-eixo-y, .sm-eixo-x { font-size: .8rem; color: var(--text2); margin: 4px 0; }
.sm-eixo-x { max-width: 720px; text-align: center; }
.aula h3 { margin: 6px 0 12px; font-family: var(--serif); font-weight: 500; font-size: 1.12rem; line-height: 1.3; }
.aula-ops { display: grid; gap: 6px; margin-bottom: 10px; }
.aula-op { text-align: left; cursor: pointer; border: 1px solid var(--border2); background: var(--surface2); border-radius: 10px; padding: 9px 12px; font-size: .9rem; color: var(--text); }
.aula-op:hover:not(:disabled) { border-color: var(--text); }
.aula-op:disabled { cursor: default; opacity: .75; }
.aula-op.certa { background: #dcecd9; border-color: var(--good); opacity: 1; font-weight: 500; }
.aula-op.errada { background: #f6ddd6; border-color: var(--danger); opacity: 1; }
.aula-res { font-size: .88rem; color: var(--text2); border-left: 3px solid var(--warn); padding-left: 10px; }
.aula-res.ok { border-left-color: var(--good); }
.aula-disc { margin: 0; padding-left: 20px; color: var(--text2); display: grid; gap: 6px; }
.tecla { display: inline-block; border: 1px solid var(--border2); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; font-family: var(--mono); font-size: .76rem; background: var(--surface2); color: var(--text); }
.topo-btn { position: fixed; right: 18px; bottom: calc(var(--timebar-h) + 14px); z-index: 55; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border2); background: var(--surface); cursor: pointer; font-size: 1rem; box-shadow: var(--shadow); }
@media (max-width: 720px) { .lang button { padding: 5px 6px; } .dur-mini { display: none; } }
@media print { .poderes, .topo-btn, #sensibilidade, #aula, #sobre { display: none !important; } }
.hist-d{display:inline-block;max-width:24ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}

#genealogia{max-width:100%;overflow-x:auto}
#genealogia svg{max-width:100%;height:auto}
#genetica *{min-width:0}
#genetica .genealogia svg{min-width:720px}
#sensibilidade *{min-width:0}
#sensibilidade select{width:100%;max-width:100%}
#pdQuando.feita{color:var(--good,#3d7a4a);font-weight:600}
#pdPlay{margin:6px 0 8px}
#pdPlay[hidden]{display:none}
