/* Mesa da Vitória — estilos
   Paleta: verde de campo cirúrgico, aço, fita indicadora de autoclave. */

:root {
  color-scheme: light;
  --bg: #eef4f2;
  --bg-2: #e3ecea;
  --surface: #ffffff;
  --surface-2: #f6faf9;
  --ink: #122322;
  --ink-2: #3c5250;
  --ink-3: #6b807e;
  --line: #d3e0dd;
  --line-2: #bccdca;
  --drape: #0e5b55;
  --drape-2: #16776f;
  --drape-ink: #ffffff;
  --drape-soft: #d8ebe7;
  --rose: #c8456a;
  --rose-soft: #f8e1e8;
  --tape: #efe3c4;
  --tape-mark: #3a332a;
  --ok: #1f8a4c;
  --ok-soft: #dcf2e4;
  --bad: #c0392b;
  --bad-soft: #f9e0dc;
  --shadow: 0 1px 2px rgba(15, 45, 42, .06), 0 6px 20px rgba(15, 45, 42, .07);

  --g-dierese: #c4413a;
  --g-preensao: #2c68b0;
  --g-hemostasia: #b77c0c;
  --g-exposicao: #2a8756;
  --g-sintese: #7549b0;
  --g-especiais: #52676d;
  --g-acessorios: #9b5328;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 14px;
  --r-sm: 9px;
  --gutter: clamp(16px, 4vw, 32px);
  --maxw: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1514;
    --bg-2: #0f1c1b;
    --surface: #132321;
    --surface-2: #172a28;
    --ink: #e3eeec;
    --ink-2: #b3c5c2;
    --ink-3: #849896;
    --line: #223936;
    --line-2: #2e4a46;
    --drape: #1f8f84;
    --drape-2: #27a497;
    --drape-ink: #041211;
    --drape-soft: #143632;
    --rose: #ec7898;
    --rose-soft: #3a1d27;
    --tape: #3b3526;
    --tape-mark: #d9cba4;
    --ok: #4cc47f;
    --ok-soft: #133524;
    --bad: #ef7a6c;
    --bad-soft: #3b1a17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --g-dierese: #ec7068;
    --g-preensao: #6ea1e6;
    --g-hemostasia: #e2ac3c;
    --g-exposicao: #5cc08a;
    --g-sintese: #ab86e6;
    --g-especiais: #93a9ae;
    --g-acessorios: #d98a58;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1514;
  --bg-2: #0f1c1b;
  --surface: #132321;
  --surface-2: #172a28;
  --ink: #e3eeec;
  --ink-2: #b3c5c2;
  --ink-3: #849896;
  --line: #223936;
  --line-2: #2e4a46;
  --drape: #1f8f84;
  --drape-2: #27a497;
  --drape-ink: #041211;
  --drape-soft: #143632;
  --rose: #ec7898;
  --rose-soft: #3a1d27;
  --tape: #3b3526;
  --tape-mark: #d9cba4;
  --ok: #4cc47f;
  --ok-soft: #133524;
  --bad: #ef7a6c;
  --bad-soft: #3b1a17;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --g-dierese: #ec7068;
  --g-preensao: #6ea1e6;
  --g-hemostasia: #e2ac3c;
  --g-exposicao: #5cc08a;
  --g-sintese: #ab86e6;
  --g-especiais: #93a9ae;
  --g-acessorios: #d98a58;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--drape-2); }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.15; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 700; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 650; }
h3 { font-size: 1.2rem; font-weight: 650; }
h4 { font-size: 1.02rem; font-weight: 650; margin-top: 1.2em; }
p { margin: 0 0 .9em; }
.mono { font-family: var(--f-mono); }
.label {
  font-family: var(--f-mono); font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- fita indicadora de autoclave ---------- */
.tape {
  --p: 0%;
  position: relative; height: 12px; border-radius: 3px; overflow: hidden;
  background: var(--tape);
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in srgb, var(--tape-mark) 12%, transparent) 7px 12px);
}
.tape::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p);
  background: var(--tape);
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, var(--tape-mark) 7px 12px);
  transition: width .6s ease;
}
.tape-rule { height: 6px; border-radius: 2px; background: var(--tape);
  background-image: repeating-linear-gradient(-45deg, transparent 0 6px, var(--tape-mark) 6px 10px); opacity: .8; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--drape); color: var(--drape-ink);
  border-bottom: 1px solid color-mix(in srgb, #000 20%, var(--drape));
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex-shrink: 0; }
.brand-mark { width: 34px; height: 34px; }
.brand-name { font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; line-height: 1; }
.brand-name small { display: block; font-family: var(--f-mono); font-weight: 400; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; opacity: .75; margin-top: 3px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: inherit; text-decoration: none; font-weight: 700; font-size: .92rem;
  padding: 8px 12px; border-radius: 999px; opacity: .82; white-space: nowrap;
}
.nav a:hover { opacity: 1; background: color-mix(in srgb, var(--drape-ink) 12%, transparent); }
.nav a[aria-current="page"] { opacity: 1; background: var(--drape-ink); color: var(--drape); }
.theme-btn {
  background: transparent; border: 1px solid color-mix(in srgb, var(--drape-ink) 35%, transparent);
  color: inherit; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
}
.theme-btn svg { width: 18px; height: 18px; }

main { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 110px; }
.view { animation: rise .35s ease both; }
@keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view, .flash-inner { animation: none !important; transition: none !important; } }

.bottom-nav { display: none; }
@media (max-width: 860px) {
  .nav { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    text-decoration: none; color: var(--ink-3); font-size: .68rem; font-weight: 700; padding: 4px 0; border-radius: 10px;
  }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a[aria-current="page"] { color: var(--drape-2); background: var(--drape-soft); }
  .theme-btn { margin-left: auto; }
  main { padding-top: 20px; }
}

/* ---------- componentes ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px; padding: 10px 18px;
  font-weight: 700; font-size: .95rem; text-decoration: none; line-height: 1.2;
  background: var(--drape); color: var(--drape-ink); transition: transform .12s ease, background .2s;
}
.btn:hover { background: var(--drape-2); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.rose { background: var(--rose); color: #fff; }
.btn.small { padding: 7px 13px; font-size: .85rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; line-height: 1.5;
  background: color-mix(in srgb, var(--c, var(--ink-3)) 13%, transparent);
  color: color-mix(in srgb, var(--c, var(--ink-3)) 85%, var(--ink));
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ink-3)); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head p { color: var(--ink-2); margin: 6px 0 0; max-width: 62ch; }

.callout {
  margin: 1.1em 0; padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--drape-soft); border: 1px solid color-mix(in srgb, var(--drape) 25%, transparent);
}

/* ---------- início ---------- */
.hero {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 28px; align-items: stretch; margin-bottom: 34px;
}
.hero-text { display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.hero-text .label { color: var(--rose); }
.hero-text h1 em { font-style: normal; color: var(--drape-2); }
.hero-text p { color: var(--ink-2); font-size: 1.06rem; max-width: 52ch; margin: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.daily {
  display: grid; grid-template-rows: auto 1fr; overflow: hidden; text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
}
.daily-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.daily-body { display: grid; grid-template-columns: 140px 1fr; gap: 14px; padding: 14px 16px; align-items: center; }
.daily-body .ph { aspect-ratio: 1; }
.daily-body h3 { margin: 4px 0 6px; font-size: 1.35rem; }
.daily-body p { margin: 0; color: var(--ink-2); font-size: .93rem; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .daily-body { grid-template-columns: 96px 1fr; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 34px; }
.stat { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.stat b { font-family: var(--f-display); font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-2); font-size: .88rem; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* régua da mesa: grupos em ordem */
.mesa-strip {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line); margin-bottom: 34px; background: var(--surface);
}
.mesa-strip a {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 14px; text-decoration: none; color: var(--ink);
  border-top: 5px solid var(--c); border-right: 1px solid var(--line); min-width: 0;
}
.mesa-strip a:last-child { border-right: 0; }
.mesa-strip a:hover { background: var(--surface-2); }
.mesa-strip .n { font-family: var(--f-mono); font-size: .72rem; color: var(--ink-3); }
.mesa-strip b { font-family: var(--f-display); font-size: 1.05rem; }
.mesa-strip small { color: var(--ink-2); font-size: .8rem; line-height: 1.35; }
@media (max-width: 900px) { .mesa-strip { grid-template-columns: repeat(2, 1fr); } .mesa-strip a { border-bottom: 1px solid var(--line); } }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.tile { padding: 18px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--line-2); }
.tile p { margin: 0; color: var(--ink-2); }

/* ---------- foto ---------- */
.ph {
  position: relative; background: var(--surface-2); border-radius: var(--r-sm); overflow: hidden;
  display: grid; place-items: center; max-width: 100%;
}
.ph img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ph.missing { background: color-mix(in srgb, var(--c, var(--ink-3)) 9%, var(--surface-2)); }
.ph .ph-icon { width: 38%; max-width: 120px; opacity: .55; color: var(--c, var(--ink-3)); }

/* ---------- catálogo ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.search {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 10px 16px; max-width: 520px;
}
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 1rem; }
.search svg { width: 18px; height: 18px; color: var(--ink-3); flex-shrink: 0; }
.group-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.group-chips button {
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 6px 13px;
  font-weight: 700; font-size: .86rem; display: inline-flex; align-items: center; gap: 7px;
}
.group-chips button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); display: inline-block; }
.group-chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
@media (max-width: 460px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.inst-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit; overflow: hidden; position: relative;
  transition: border-color .2s, transform .2s;
}
.inst-card:hover { border-color: var(--c); transform: translateY(-2px); }
.inst-card .ph { aspect-ratio: 4/3; border-radius: 0; border-bottom: 1px solid var(--line); }
.inst-card .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.inst-card h3 { font-size: 1rem; line-height: 1.25; }
.inst-card .alias { font-size: .8rem; color: var(--ink-3); line-height: 1.3; }
.inst-card .known {
  position: absolute; top: 8px; right: 8px; background: var(--ok); color: #fff; border-radius: 999px;
  font-size: .68rem; font-weight: 700; padding: 2px 8px;
}
.group-title { display: flex; align-items: center; gap: 12px; margin: 30px 0 14px; }
.group-title::before { content: ""; width: 14px; height: 14px; border-radius: 4px; background: var(--c); }
.group-title p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }

/* ---------- detalhe do instrumento ---------- */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--ink-3); margin-bottom: 16px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-2); }
.detail { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.detail-photo { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 860px) { .detail-photo { position: static; } }
.detail-photo .ph { aspect-ratio: 4/3; border: 1px solid var(--line); }
.detail-photo .ph img { cursor: zoom-in; }
.credit { font-size: .74rem; color: var(--ink-3); line-height: 1.4; }
.credit a { color: var(--ink-3); }
.detail h1 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); margin: 8px 0 4px; }
.detail .alias-line { color: var(--ink-2); margin-bottom: 14px; }
.facts { display: flex; flex-direction: column; gap: 0; margin: 18px 0; border-top: 1px solid var(--line); }
.fact { display: grid; grid-template-columns: 130px 1fr; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.fact dt { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding-top: 3px; }
.fact dd { margin: 0; }
@media (max-width: 520px) { .fact { grid-template-columns: 1fr; gap: 2px; } }
.memo {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--rose-soft);
  border: 1px solid color-mix(in srgb, var(--rose) 30%, transparent);
}
.memo b { color: var(--rose); font-family: var(--f-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; display: block; margin-bottom: 2px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 30px; }
.pager a { max-width: 48%; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(5, 14, 13, .92); display: grid; place-items: center; padding: 20px;
}
.lightbox img { max-height: 88vh; max-width: 100%; border-radius: 8px; background: #fff; }
.lightbox button { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }

/* ---------- matérias ---------- */
.mat-list { display: flex; flex-direction: column; gap: 26px; }
.mat-cap h3 { margin-bottom: 10px; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mat-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; position: relative; }
.mat-card:hover { border-color: var(--drape-2); }
.mat-card p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.mat-card .done { position: absolute; top: 14px; right: 14px; color: var(--ok); font-weight: 700; font-size: .76rem; }
.mat-card h4 { margin: 0; font-size: 1.08rem; padding-right: 50px; }

.article { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 36px; align-items: start; }
@media (max-width: 900px) { .article { grid-template-columns: 1fr; } .toc { display: none; } }
.toc { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 2px; }
.toc a { text-decoration: none; color: var(--ink-2); font-size: .9rem; padding: 6px 10px; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--ink); border-color: var(--drape-2); }
.prose { max-width: 74ch; }
.prose h2 { margin: 36px 0 14px; padding-top: 6px; scroll-margin-top: 80px; }
.prose h2:first-of-type { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table-wrap { overflow-x: auto; margin: 1em 0 1.3em; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.prose th { text-align: left; font-family: var(--f-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); background: var(--surface-2); font-weight: 500; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose figure { margin: 1.2em 0 1.4em; }
.prose figure .ph { aspect-ratio: 16/10; border: 1px solid var(--line); }
.prose figure figcaption { margin-top: 6px; }
.tabela-cols table { columns: 1; }

.mesa-diagrama { display: flex; border-radius: var(--r-sm); overflow: hidden; margin: 1em 0; border: 1px solid var(--line); flex-wrap: wrap; }
.mesa-diagrama span { flex: 1 1 90px; padding: 12px 8px; text-align: center; font-weight: 700; font-size: .86rem; color: #fff; }
.mesa-diagrama span:nth-child(1) { background: var(--g-dierese); }
.mesa-diagrama span:nth-child(2) { background: var(--g-preensao); }
.mesa-diagrama span:nth-child(3) { background: var(--g-hemostasia); }
.mesa-diagrama span:nth-child(4) { background: var(--g-exposicao); }
.mesa-diagrama span:nth-child(5) { background: var(--g-especiais); }
.mesa-diagrama span:nth-child(6) { background: var(--g-sintese); }
:root[data-theme="dark"] .mesa-diagrama span { color: #0b1514; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mesa-diagrama span { color: #0b1514; } }

.fluxo { display: flex; flex-wrap: wrap; gap: 6px; margin: 1em 0; }
.fluxo span {
  flex: 1 1 140px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); font-weight: 700; font-size: .88rem; position: relative;
}
.fluxo span:nth-child(1) { border-top: 4px solid var(--bad); }
.fluxo span:nth-child(2) { border-top: 4px solid var(--g-hemostasia); }
.fluxo span:nth-child(3) { border-top: 4px solid var(--drape-2); }
.fluxo span:nth-child(4) { border-top: 4px solid var(--ok); }

.escala-fios { display: flex; align-items: end; gap: 6px; margin: 1em 0; overflow-x: auto; padding-bottom: 4px; }
.escala-fios span {
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: .78rem; min-width: 34px;
}
.escala-fios span::before { content: ""; width: calc(var(--e) * 1.3px); height: 60px; background: var(--ink-2); border-radius: 3px; min-width: 1px; }

.tempos-lista li { margin-bottom: .8em; }
.mat-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- flashcards ---------- */
.fc-setup { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.fc-deck { padding: 18px; display: flex; flex-direction: column; gap: 8px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); }
.fc-deck:hover { border-color: var(--drape-2); }
.fc-deck p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.fc-stage { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.fc-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flash { perspective: 1400px; cursor: pointer; }
.flash-inner {
  position: relative; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .8, .3, 1);
  min-height: 380px;
}
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; padding: 18px; gap: 12px; overflow: auto;
}
.flash-face.back { transform: rotateY(180deg); }
.flash-face .ph { flex: 1; min-height: 200px; }
.flash-face .q { font-family: var(--f-display); font-size: 1.35rem; font-weight: 650; line-height: 1.3; }
.flash-face .hint { color: var(--ink-3); font-size: .85rem; text-align: center; margin-top: auto; }
.flash-face h3 { font-size: 1.6rem; }
.fc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fc-actions .btn { padding: 14px; }
.btn.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.btn.good { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.boxes { display: flex; gap: 6px; }
.boxes span { flex: 1; text-align: center; font-family: var(--f-mono); font-size: .72rem; padding: 6px 4px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.boxes span b { display: block; font-size: 1rem; font-family: var(--f-display); }

/* ---------- simulado ---------- */
.sim-config { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .sim-config { grid-template-columns: 1fr; } }
.sim-box { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.check {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .92rem;
  background: var(--surface);
}
.check:has(input:checked) { border-color: var(--drape-2); background: var(--drape-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--drape); flex-shrink: 0; }
.check small { color: var(--ink-3); margin-left: auto; font-family: var(--f-mono); font-size: .72rem; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: .9rem; }
.seg button[aria-pressed="true"] { background: var(--drape); color: var(--drape-ink); border-color: var(--drape); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.quiz { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.quiz-top { display: flex; align-items: center; gap: 14px; }
.quiz-top .tape { flex: 1; }
.quiz-top .count { font-family: var(--f-mono); font-size: .85rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.qcard { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.qcard .ph { aspect-ratio: 16/10; border: 1px solid var(--line); }
.qtext { font-family: var(--f-display); font-size: 1.3rem; font-weight: 600; line-height: 1.35; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 1rem; line-height: 1.4;
}
.opt:hover { border-color: var(--line-2); background: var(--surface-2); }
.opt .k {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center;
  font-family: var(--f-mono); font-size: .78rem; flex-shrink: 0; margin-top: -1px;
}
.opt.sel { border-color: var(--drape); background: var(--drape-soft); }
.opt.sel .k { background: var(--drape); color: var(--drape-ink); border-color: var(--drape); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .k { background: var(--ok); color: #fff; border-color: var(--ok); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt[disabled] { cursor: default; }
.explain { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: .95rem; }
.explain b { display: block; margin-bottom: 2px; }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; }
.timer { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--ink-2); }

.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; padding: 24px; margin-bottom: 20px; }
@media (max-width: 560px) { .result-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; } }
.ring { width: 150px; height: 150px; }
.ring text { font-family: var(--f-display); font-weight: 700; fill: var(--ink); }
.review { display: flex; flex-direction: column; gap: 10px; }
.review-item { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--ok); }
.review-item.wrong { border-left-color: var(--bad); }
.review-item .q { font-weight: 700; }
.review-item .a { font-size: .92rem; color: var(--ink-2); }
.review-item .a .you-bad { color: var(--bad); font-weight: 700; }
.review-item .a .you-ok { color: var(--ok); font-weight: 700; }

/* ---------- progresso ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 52px; gap: 12px; align-items: center; font-size: .92rem; }
.bar-row .tape { height: 10px; }
.bar-row b { font-family: var(--f-mono); font-size: .82rem; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .bar-row { grid-template-columns: 1fr 52px; } .bar-row .tape { grid-column: 1 / -1; order: 3; } }
.hist { width: 100%; border-collapse: collapse; font-size: .92rem; }
.hist th { text-align: left; font-family: var(--f-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 500; }
.hist th, .hist td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.hist td.n { font-variant-numeric: tabular-nums; font-family: var(--f-mono); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-weight: 700; font-size: .8rem; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.mid { background: color-mix(in srgb, var(--g-hemostasia) 18%, transparent); color: var(--g-hemostasia); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.backup { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: .9rem;
  box-shadow: var(--shadow);
}
.credits-list { font-size: .85rem; color: var(--ink-2); columns: 2 320px; column-gap: 28px; }
.credits-list li { break-inside: avoid; margin-bottom: 6px; }
footer.site { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 120px; color: var(--ink-3); font-size: .85rem; }
footer.site .tape-rule { margin-bottom: 14px; }

/* diagramas das posições */
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 1.2em 0; }
.pos-fig { margin: 0 !important; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px 10px; }
.pos-fig svg { width: 100%; height: auto; display: block; }
.pos-fig figcaption { font-size: .82rem; font-weight: 700; color: var(--ink-2); text-align: center; }
.pos-fig .table { stroke: var(--ink-3); stroke-width: 5; stroke-linecap: round; }
.pos-fig .post { stroke: var(--line-2); stroke-width: 4; stroke-linecap: round; }
.pos-fig .body { stroke: var(--drape-2); }
.pos-fig .head { fill: var(--drape-2); }
.pos-fig .nose { fill: var(--rose); }
.pos-fig .pad { fill: var(--g-hemostasia); opacity: .7; }
.article > *, .detail > *, .sim-config > *, .two-col > *, .hero > * { min-width: 0; }
.prose table { min-width: 520px; }
.prose .tabela-cols table { min-width: 0; }
