:root {
  --bg: #0b1424;
  --panel: #12203a;
  --panel-2: #172a4b;
  --line: #26406a;
  --ink: #eef2f8;
  --muted: #a9c7e8;
  --gold: #f0b94a;
  --gold-2: #ffd36a;
  --coral: #ff9f8a;
  --teal: #6fe0d4;
  --violet: #c4b2ff;
  --steel: #9fd0ff;
  --serif: Georgia, 'Times New Roman', serif;
  --ui: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--serif); }
a { color: var(--gold-2); }
img { max-width: 100%; }

/* ---------- capa ---------- */
.cover { position: relative; min-height: 78vh; display: grid; place-items: center; text-align: center; padding: 56px 20px 70px;
  background: linear-gradient(180deg, rgba(5,10,22,.35), var(--bg) 96%), url('../assets/porto.svg') center / cover; border-bottom: 1px solid var(--line); }
.cover .logo { width: min(620px, 90vw); filter: drop-shadow(0 10px 30px rgba(0,0,0,.6)); }
.cover h1 { margin: 6px 0 4px; font-size: clamp(1.4rem, 3.4vw, 2.1rem); letter-spacing: .28em; text-transform: uppercase; color: var(--ink); font-weight: normal; }
.cover p { margin: 0 auto 22px; max-width: 34em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 26px; }
.chip { font: 600 .9rem var(--ui); padding: 7px 16px; border: 1px solid var(--gold); border-radius: 99px; color: var(--gold-2); background: rgba(11,20,36,.6); }
.btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn { font: 700 .95rem var(--ui); text-decoration: none; padding: 11px 22px; border-radius: 10px; background: var(--gold); color: #1b1305; border: 1px solid var(--gold); }
.btn.ghost { background: transparent; color: var(--gold-2); }
.btn:hover { filter: brightness(1.1); }
.fan { display: flex; justify-content: center; margin: 34px 0 0; }
.fan img { width: clamp(70px, 12vw, 120px); margin: 0 -10px; border-radius: 8px; box-shadow: 0 10px 24px rgba(0,0,0,.55); transition: transform .3s; }
.fan img:nth-child(1) { transform: rotate(-12deg) translateY(8px); } .fan img:nth-child(2) { transform: rotate(-6deg) translateY(2px); }
.fan img:nth-child(3) { transform: rotate(0); z-index: 2; } .fan img:nth-child(4) { transform: rotate(6deg) translateY(2px); } .fan img:nth-child(5) { transform: rotate(12deg) translateY(8px); }
.fan img:hover { transform: translateY(-14px) rotate(0); z-index: 3; }

/* ---------- estrutura ---------- */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; max-width: 1180px; margin: 0 auto; padding: 40px 24px 90px; }
.toc { position: sticky; top: 24px; align-self: start; font: .92rem/1.35 var(--ui); max-height: calc(100vh - 48px); overflow: auto; }
.toc h2 { font: 700 .75rem var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 7px 14px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; margin-left: -2px; }
.toc a:hover, .toc a.on { color: var(--gold-2); border-left-color: var(--gold); background: linear-gradient(90deg, rgba(240,185,74,.1), transparent); }
main section { margin-bottom: 64px; }
h2.sec { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 14px; color: var(--gold-2); display: flex; align-items: center; gap: 14px; }
h2.sec .n { font: 700 .85rem var(--ui); width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--gold); color: #1b1305; flex: none; }
h3 { margin: 28px 0 8px; font-size: 1.2rem; color: var(--ink); }
p { margin: 0 0 14px; }
.lead { font-size: 1.12rem; color: #dbe6f5; }
ul, ol { padding-left: 1.3em; } li { margin-bottom: 6px; }
strong { color: #fff; }
em.pearl, .pearl { font-style: normal; white-space: nowrap; }
.pearl img { width: 1em; height: 1em; vertical-align: -.15em; margin-right: .15em; }

.callout { display: flex; gap: 14px; padding: 14px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--gold); margin: 18px 0; font-size: .98rem; }
.callout.warn { border-left-color: var(--coral); } .callout.tip { border-left-color: var(--teal); }
.callout b.t { font: 700 .75rem var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); display: block; margin-bottom: 2px; }
.callout.warn b.t { color: var(--coral); } .callout.tip b.t { color: var(--teal); }
.callout p:last-child { margin-bottom: 0; }

/* ---------- componentes ---------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.tile h4 { margin: 0 0 6px; font-size: 1.05rem; color: var(--gold-2); }
.tile p { margin: 0; font-size: .96rem; color: #dbe6f5; }
.tile .big { font: 700 2rem var(--ui); color: var(--gold); line-height: 1; margin-bottom: 8px; }

ol.steps { counter-reset: s; list-style: none; padding: 0; }
ol.steps li { counter-increment: s; position: relative; padding: 4px 0 4px 52px; margin-bottom: 14px; min-height: 40px; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--panel-2); border: 2px solid var(--gold); color: var(--gold-2); font: 700 1rem var(--ui); display: grid; place-items: center; }

/* ---------- anatomia ---------- */
.anat-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 32px; align-items: center; }
.anat { position: relative; width: 250px; }
.anat > img { width: 100%; display: block; border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.mk { position: absolute; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #1b1305; font: 800 .9rem var(--ui); display: grid; place-items: center; transform: translate(-50%, -50%); box-shadow: 0 0 0 3px rgba(11,20,36,.85); }
.legend { list-style: none; padding: 0; margin: 0; }
.legend li { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.legend .mk { position: static; transform: none; flex: none; }

/* ---------- tabelas ---------- */
.tbl { width: 100%; border-collapse: collapse; font: .94rem/1.4 var(--ui); background: var(--panel); border-radius: 12px; overflow: hidden; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--panel-2); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { font-weight: 700; color: var(--gold-2); white-space: nowrap; }
.tbl .y { color: var(--teal); font-weight: 700; } .tbl .n { color: var(--coral); font-weight: 700; }
.scroll { overflow-x: auto; }

.actions3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.act { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; grid-template-columns: 64px 1fr; gap: 6px 16px; align-items: start; }
.act img { width: 64px; height: 64px; grid-row: span 2; }
.act h4 { margin: 0; font-size: 1.12rem; color: var(--gold-2); }
.act .eff { margin: 0; font-size: .95rem; color: #dbe6f5; }
.act .tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font: 600 .74rem var(--ui); padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--teal); border-color: rgba(111,224,212,.5); } .tag.no { color: var(--coral); border-color: rgba(255,159,138,.5); }

/* ---------- personagens ---------- */
.role { display: grid; grid-template-columns: 200px 1fr; gap: 28px; padding: 24px; margin-bottom: 20px; border-radius: 18px; background: linear-gradient(135deg, var(--panel), var(--bg)); border: 1px solid var(--line); border-left: 5px solid var(--rc); }
.role > img { width: 200px; border-radius: 12px; box-shadow: 0 14px 34px rgba(0,0,0,.55); }
.role h3 { margin: 0 0 4px; font-size: 1.6rem; color: var(--rc); display: flex; align-items: center; gap: 12px; }
.role h3 img { width: 40px; height: 40px; }
.role .sub { font: 600 .8rem var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.role dl { margin: 0; display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: .98rem; }
.role dt { font: 700 .74rem var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--rc); padding-top: 4px; }
.role dd { margin: 0; }

/* ---------- fluxo ---------- */
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 18px 0; }
.flow .st { flex: 1 1 130px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; font: .86rem/1.35 var(--ui); position: relative; }
.flow .st img { width: 42px; height: 42px; display: block; margin: 0 auto 6px; }
.flow .st b { display: block; color: var(--gold-2); font-size: .95rem; }
.flow .st small { color: var(--muted); }
.flow .st.opt { border-style: dashed; }
.flow .ar { align-self: center; color: var(--gold); font: 700 1.4rem var(--ui); }

/* ---------- exemplos ---------- */
.ex { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin: 18px 0; }
.ex h4 { margin: 0 0 4px; color: var(--gold-2); font-size: 1.1rem; }
.ex .setup { font: .88rem var(--ui); color: var(--muted); margin: 0 0 14px; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg .av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 700 .9rem var(--ui); color: #1b1305; background: var(--c); }
.msg .tx { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 8px 14px; font-size: .96rem; max-width: 40em; }
.msg.nar .tx { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-style: italic; border-radius: 10px; }
.msg.nar .av { visibility: hidden; }
.result { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: rgba(240,185,74,.1); border: 1px solid rgba(240,185,74,.4); font-size: .95rem; }

/* ---------- FAQ ---------- */
details { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 0 18px; }
details[open] { border-color: var(--gold); }
summary { cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--ink); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; color: var(--gold); font: 700 1.3rem var(--ui); line-height: 1; }
details[open] summary::after { content: '–'; }
details p { color: #dbe6f5; }

footer { text-align: center; color: var(--muted); font: .85rem var(--ui); padding: 30px 20px 50px; border-top: 1px solid var(--line); }

/* ---------- responsivo ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-left: 16px; padding-right: 16px; }
  .toc { position: static; max-height: none; margin-bottom: 36px; }
  .toc ol { columns: 2; border-left: 0; } .toc a { border-left: 0; padding: 5px 0; }
  .anat-wrap, .role { grid-template-columns: 1fr; }
  .anat { margin: 0 auto; } .role > img { width: 170px; margin: 0 auto; }
}

/* ---------- impressão ---------- */
@page { size: A4; margin: 16mm 15mm; }
@media print {
  :root { --bg: #fff; --panel: #f4f6fa; --panel-2: #e6ebf3; --line: #c5cedc; --ink: #101826; --muted: #4a5a70; --gold: #a86a0c; --gold-2: #8a5206; --coral: #b13a2c; --teal: #0d7a72; }
  body { font-size: 11pt; line-height: 1.5; background: #fff; color: #101826; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  strong { color: #000; }
  .cover { min-height: 0; height: 250mm; break-after: page; color: #fff; --ink: #fff; --muted: #cfe0f5; --gold-2: #ffd36a; background: linear-gradient(180deg, rgba(5,10,22,.5), #0b1424 96%), url('../assets/porto.svg') center / cover; }
  .cover .btns { display: none; }
  .toc { display: none; }
  .layout { display: block; padding: 0; max-width: none; }
  main section { break-inside: auto; margin-bottom: 26px; }
  h2.sec, h3, .ex h4 { break-after: avoid; }
  .role, .ex, .act, .tile, details, .callout, .flow .st, .msg { break-inside: avoid; }
  details { display: block; } details > summary::after { display: none; }
  .role, .ex, .tile, .act, details, .callout, .tbl, .flow .st, .msg .tx { background: #f4f6fa; }
  .role { background: #f4f6fa; } .msg .tx { background: #e6ebf3; }
  .fan img, .role > img, .anat > img { box-shadow: none; }
  .scroll { overflow: visible; }
  footer { border: 0; }
  a { color: inherit; text-decoration: none; }
}
