/* Academia: papel creme, verde da casa, dourado como detalhe. */
@font-face { font-family: "Michelangelus"; src: url("michelangelus.ttf") format("truetype"); font-weight: 400; font-display: swap; }
:root {
    --brand: #2d4a2d; --brand-dark: #1c301c; --cream: #fafaf8; --paper: #fff;
    --gold: #a67c00; --gold-light: #d4af37; --ink: #1f2421; --muted: #646a65; --line: #e6e4dc;
    --soft: #f1f0e9; --good: #2f7a3e; --bad: #a8432f; --blue: #1f6fd1; --history: #8a4b2a; --case: #1d6f73;
    --serif: "Fraunces", Georgia, serif; --sans: "Karla", system-ui, sans-serif;
    --title: "Michelangelus", "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--cream); color: var(--ink);
    font: 1.0625rem/1.7 var(--sans); }
a { color: var(--brand); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 450; line-height: 1.2; color: var(--brand-dark); }
h1 { font-size: clamp(2rem, 6vw, 2.9rem); letter-spacing: -.015em; margin: .2em 0 .35em; }
h2 { font-size: 1.5rem; margin: 2em 0 .5em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 2rem; padding: 1rem clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--line); }
.wordmark { font-family: var(--title); font-size: 1.75rem; color: var(--gold); text-decoration: none; }
.tabs { display: flex; gap: .25rem; }
.tabs a { padding: .3rem .85rem; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .95rem; }
.tabs a:hover { background: var(--soft); }
.tabs a[aria-current] { background: var(--brand); color: var(--cream); }
.back-site { margin-left: auto; font-size: .85rem; color: var(--muted); text-decoration: none; }

.page { flex: 1; width: 100%; max-width: 46rem; margin: 0 auto; padding: 3rem 1.25rem; }
.page.wide { max-width: 62rem; }
.bottom { display: flex; justify-content: center; gap: 1.5rem; padding: 1.5rem; border-top: 1px solid var(--line); font-size: .8rem; }
.bottom a { color: var(--muted); }
.notice { background: var(--soft); border-radius: .5rem; padding: .6rem 1rem; font-size: .9rem; }
.kicker { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); }
.lead { font-size: 1.2rem; color: var(--muted); margin-top: 0; }
.rule { font-size: 1.2rem; border-top: 1px solid var(--line); padding-top: 1.4rem; margin-top: 3rem; }

.hero { text-align: center; padding: 2rem 0 1rem; }
.wordmark.big { display: block; font-size: clamp(3.2rem, 14vw, 6.5rem); font-weight: 400; line-height: 1.1; margin: 0; }
.hero p { font-size: 1.2rem; color: var(--muted); margin: .5rem 0 2rem; }
.doors { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; }
.door, .card, .drills a { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: var(--ink);
    background: var(--paper); border: 1px solid var(--line); border-radius: .75rem; padding: 1rem 1.15rem;
    transition: border-color .15s, transform .15s; }
.door:hover, .card:hover, .drills a:hover { border-color: var(--brand); transform: translateY(-2px); }
.door strong { font-family: var(--serif); font-weight: 450; font-size: 1.45rem; color: var(--brand); }
.door span, .summary, .drills span { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.grid > div { display: grid; }
.card strong { font-family: var(--serif); font-weight: 450; font-size: 1.2rem; line-height: 1.3; }
.card .question { font-style: italic; color: var(--brand); }
.card-historia { border-top: 3px solid var(--gold-light); }
.card-experimento { border-top: 3px solid var(--blue); }
.card-conceito { border-top: 3px solid var(--brand); }
.sources { border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1rem; font-size: .72rem; line-height: 1.55; color: var(--muted); opacity: .85; }
.sources h2 { font: 700 .68rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 .4rem; }
.sources ul { list-style: none; padding: 0; margin: 0; }
.sources li { margin-bottom: .25rem; }
.card-descoberta { border-top: 3px solid var(--history); }
.card-caso { border-top: 3px solid var(--case); }
.family-descoberta, .card-descoberta .kicker { color: var(--history); }
.family-caso, .card-caso .kicker { color: var(--case); }
.family-descoberta::before, .card-descoberta .kicker::before { content: "⧗ "; }
.family-caso::before, .card-caso .kicker::before { content: "◎ "; }

.filters, .lens-tabs, .controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters button, .lens-tabs button { font: 700 .85rem var(--sans); color: var(--brand); background: transparent;
    border: 1px solid var(--line); border-radius: 999px; padding: .35rem .9rem; cursor: pointer; }
.filters button[aria-pressed="true"], .lens-tabs button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--cream); }

.chapter h2 .number { color: var(--gold); margin-right: .35rem; }
.toc { list-style: none; padding: 0; counter-reset: item; columns: 2 20rem; column-gap: 2.5rem; }
.toc li { break-inside: avoid; counter-increment: item; border-top: 1px solid var(--line); padding: .9rem 0 .9rem 2.75rem; position: relative; }
.toc li::before { content: counter(item); position: absolute; left: .25rem; top: .9rem; font-family: var(--serif); color: var(--gold); font-size: 1.2rem; }
.toc > li > a { display: block; text-decoration: none; }
.toc > li > a strong { display: block; font-family: var(--serif); font-weight: 450; font-size: 1.2rem; }
.toc > li > a span { color: var(--muted); font-size: .95rem; }
.through, .chips { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.through { margin: .4rem 0 0; }
.through a, .chips a { background: var(--soft); border-radius: 999px; padding: .1rem .7rem; text-decoration: none; }

.prose strong { color: var(--brand-dark); }
.prose li::marker { color: var(--gold); }
.note { border-left: 3px solid var(--gold-light); background: var(--soft); border-radius: 0 .5rem .5rem 0; padding: .7rem 1.1rem; margin: 1.5rem 0; }
.note summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.predict, .lenses, .sim { background: var(--paper); border: 1px solid var(--line); border-radius: .9rem; padding: 1.25rem; margin: 2rem 0; }
.ask { font-family: var(--serif); font-size: 1.2rem; }
.ask p { margin: .4rem 0 .9rem; }
.options { display: grid; gap: .5rem; }
.options button { font: inherit; text-align: left; background: var(--cream); color: var(--ink); border: 1.5px solid var(--line);
    border-radius: .6rem; padding: .7rem 1rem; cursor: pointer; }
.options button:hover:enabled { border-color: var(--brand); }
.options button:disabled { cursor: default; opacity: .6; }
.options button.right { opacity: 1; border-color: var(--good); background: #e9f4ea; }
.options button.wrong { opacity: 1; border-color: var(--bad); background: #f8ebe7; }
.lens { min-height: 5rem; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: .25rem 0; }

.button { display: inline-block; font: 700 .95rem var(--sans); text-decoration: none; background: var(--brand); color: var(--cream);
    border: 1.5px solid var(--brand); border-radius: .6rem; padding: .65rem 1.2rem; cursor: pointer; }
.button:hover:enabled, a.button:hover { background: var(--brand-dark); }
.button.ghost { background: transparent; color: var(--brand); }
.button.ghost:hover:enabled, a.button.ghost:hover { background: var(--soft); }
.button:disabled { opacity: .35; cursor: default; }
.here { margin: 2.5rem 0 0; padding: 1rem 1.25rem; background: var(--soft); border-radius: .75rem; }
.here ol { margin: .5rem 0 0; padding-left: 1.2rem; }
.here a { text-decoration: none; }
.here a[aria-current] { font-weight: 700; color: var(--gold); }

/* Treino */
.drills { list-style: none; padding: 0; display: grid; gap: .6rem; }
.drills .all a { background: var(--brand); border-color: var(--brand); color: var(--cream); }
.drills .all span { color: var(--cream); opacity: .8; }
.session-top { display: flex; align-items: center; gap: 1rem; width: 100%; max-width: 46rem; margin: 0 auto; padding: 1.25rem; }
.close { text-decoration: none; color: var(--muted); font-size: 1.2rem; }
.progress { flex: 1; height: .8rem; background: var(--line); border-radius: 999px; overflow: hidden; }
.end > section, .end-seen, .end-soon { margin: 1.5rem 0; }
.end-reread { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.end-reread[hidden], .end-reread a[hidden] { display: none; }
.end-next { background: var(--paper); border: 1px solid var(--line); border-radius: 1.1rem; padding: 1.5rem; }
.end-next strong { display: block; font-size: 1.35rem; color: var(--brand-dark); margin-top: .4rem; }
.end-next p { margin: .4rem 0 1.1rem; }
.end-seen { font-size: .9rem; }
.end-seen a { display: inline-block; margin: .2rem .3rem; }
.end-doors > div { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin-top: .7rem; }
.end-doors a { flex: 1 1 11rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .9rem;
    background: var(--paper); text-decoration: none; font-weight: 700; color: var(--brand-dark); }
.end-doors a:hover { border-color: var(--gold); }
.end-doors small { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--gold); }
.end-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; margin-top: 2rem; font-size: .9rem; }
.end-foot button { border: 0; padding: 0; background: none; font: inherit; text-decoration: underline; cursor: pointer; color: inherit; }
.practice-links { display: flex; flex-wrap: wrap; gap: .6rem; }
.verbete { display: inline; font: inherit; letter-spacing: inherit; padding: 0; border: 0; background: none; cursor: help; color: #1f6f6b;
    border-bottom: 2px dotted currentColor; line-height: 1.2; }
.verbete:hover, .verbete[aria-expanded="true"] { background: #e4f0ee; }
.verbete-card { position: fixed; z-index: 20; display: flex; flex-direction: column; gap: .4rem; width: min(18rem, calc(100vw - 1rem));
    max-height: calc(100vh - 1rem); overflow-y: auto; padding: .85rem; background: var(--paper); border: 1px solid var(--line);
    border-radius: .9rem; box-shadow: 0 12px 32px rgb(28 48 28 / .18); font: 400 .9rem/1.45 var(--sans); color: var(--ink);
    text-align: left; letter-spacing: normal; text-transform: none; }
.verbete-card img { width: 100%; height: 9rem; object-fit: contain; border-radius: .5rem; background: var(--cream); }
.verbete-card strong { font-size: 1rem; color: var(--brand-dark); }
.verbete-card .verbete-more { font-weight: 700; }
.verbete-card small { font-size: .68rem; color: var(--muted); }
.verbete-card small a { color: inherit; }
.ions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; padding: 1.25rem; margin-bottom: 1rem; border-radius: 1rem; background: #e9f1f8; }
.ions button { width: 4rem; height: 4rem; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); font: 700 1rem var(--sans); color: var(--ink); cursor: pointer; transition: opacity .4s, transform .4s; }
.ions button:disabled { cursor: default; }
.ions.mixed button[data-solid] { background: #f2d33c; border-color: #c9a800; }
.ions button.wrong { border-color: var(--bad); border-width: 3px; }
.ions button.out { opacity: .2; transform: translateY(-.5rem); }
.prose blockquote { margin: 1.5rem 0; padding: .85rem 1.1rem; background: #fbf4e1; border-left: 3px solid var(--gold-light); border-radius: .5rem; }
.prose blockquote p { margin: 0; }
.counter { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .7rem; margin-bottom: 1rem; }
.counter span { flex: 1 1 100%; text-align: center; font-weight: 700; }
.counter button { width: 2.4rem; height: 2.4rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--cream); color: var(--brand); font-size: 1.2rem; cursor: pointer; }
.counter strong { min-width: 2ch; text-align: center; font-family: var(--serif); font-size: 1.5rem; }
.counter output { min-width: 4.5rem; color: var(--gold); font-weight: 700; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--gold-light)); transition: width .4s; }
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 36rem; margin: 0 auto;
    padding: 1rem 1.25rem 5rem; text-align: center; }
.exercise { display: flex; flex-direction: column; gap: 1.25rem; }
.exercise h2 { font-size: 1.6rem; margin: .5rem 0; }
.exercise form { display: grid; gap: 1rem; }
.exercise input { font: inherit; text-align: center; padding: .8rem; border: 1.5px solid var(--line); border-radius: .6rem; background: var(--paper); }
.exercise .controls { justify-content: center; }
.exercise .back { font-size: 1.2rem; background: var(--paper); border: 1px dashed var(--gold-light); border-radius: .9rem; padding: 1.5rem; margin: 0; }
.feedback { border-radius: .75rem; padding: .9rem 1.2rem; }
.feedback p { margin: .25rem 0 0; }
.feedback.right { background: #e9f4ea; color: var(--good); }
.feedback.wrong { background: #f8ebe7; color: var(--bad); }

/* Simulações */
.equation { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .6rem; }
.term { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.term strong { font-family: var(--serif); font-weight: 450; font-size: 1.35rem; white-space: nowrap; }
.term button { width: 2.2rem; height: 2rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--cream); color: var(--brand); font-size: 1.1rem; cursor: pointer; }
.count { border-collapse: collapse; }
.count th, .count td { padding: .25rem 1rem; border-bottom: 1px solid var(--line); }
.count td { color: var(--bad); }
.count tr.match td { color: var(--good); }
.burner { height: 9rem; width: 9rem; display: flex; align-items: flex-end; justify-content: center; border-bottom: .8rem solid #7d8488; }
.flame { width: 3.5rem; height: 6rem; border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; background: radial-gradient(circle at 50% 80%, #dff0ff, var(--blue) 75%); transition: all .3s; }
.sim[data-level="low"] .flame { height: 7.5rem; background: radial-gradient(circle at 50% 80%, #fff3b0, #e8941f 75%); }
.sim[data-level="very"] .flame { height: 5rem; background: radial-gradient(circle at 50% 80%, #d9822b, #3b3330 75%); box-shadow: 0 -2.5rem 1.5rem rgba(50, 45, 40, .45); }
.prose table { width: 100%; margin: 1.5rem 0; border-collapse: separate; border-spacing: 0; background: var(--paper);
    border: 1px solid var(--line); border-radius: .9rem; overflow: hidden; }
.prose th { text-align: left; padding: .6rem 1.15rem; background: var(--soft); font-size: .72rem; text-transform: uppercase;
    letter-spacing: .14em; color: var(--gold); }
.prose td { padding: .9rem 1.15rem; border-top: 1px solid var(--line); vertical-align: middle; }
.prose td:first-child { font-weight: 700; color: var(--brand-dark); width: 45%; }
@media (max-width: 640px) {
    /* No celular cada linha vira um bloco: nome em cima, desenho embaixo. */
    .prose thead { display: none; }
    .prose table, .prose tbody, .prose tr, .prose td { display: block; width: 100%; }
    .prose td:first-child { width: 100%; padding-bottom: 0; }
    .prose td + td { border-top: 0; padding-top: .35rem; overflow-x: auto; }
}
.sim { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.sim .controls { justify-content: center; }
.status { margin: 0; min-height: 1.7em; font-weight: 700; color: var(--brand); }
.glass { width: 9rem; height: 11rem; border: 3px solid #b9c9cc; border-top: 0; border-radius: 0 0 1.5rem 1.5rem; display: flex; align-items: flex-end; overflow: hidden; }
.bubbles { position: relative; width: 100%; height: 75%; background: #dcecf3; }
.bubbles i { position: absolute; bottom: 0; width: .65rem; height: .65rem; border-radius: 50%; background: #fff; border: 1px solid #9cc0d0; opacity: 0; animation: rise 1.6s ease-in 4; }
@keyframes rise { 0% { bottom: 0; opacity: 1; } 100% { bottom: 100%; opacity: 0; } }
.crystals { display: grid; grid-template-columns: repeat(3, 2.75rem); gap: .6rem; padding: 1rem; }
.crystals i { height: 2.75rem; background: var(--blue); transform: rotate(45deg) scale(.8); border-radius: .3rem; transition: background 1.4s; }
.sim.dry .crystals i { background: #e7e9ea; box-shadow: 0 0 0 1px #c9ced1; }
.vessel { position: relative; width: 9rem; height: 8rem; border: 3px solid #b9c9cc; border-radius: 1rem; background: #eef6f8; }
.lid { position: absolute; top: -.9rem; left: 25%; width: 50%; height: .8rem; background: var(--brand); border-radius: .3rem; transition: transform .5s; }
.sim.opened .lid { transform: translate(70%, -1rem) rotate(25deg); }
.metal { position: absolute; bottom: .6rem; left: 20%; width: 60%; height: 1.4rem; background: #7d8488; border-radius: .4rem; transition: box-shadow 1.2s; }
.sim.heated .metal { box-shadow: 0 -.45rem 0 #c9913f; }
.scale { font: 700 1.8rem ui-monospace, monospace; background: var(--brand-dark); color: var(--gold-light); border-radius: .5rem; padding: .2rem 1.5rem; }

.search { position: sticky; top: 0; z-index: 5; background: var(--cream); padding: .6rem 0; }
.search input { width: 100%; font: inherit; padding: .65rem 1.1rem; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); }
.search input:focus { border-color: var(--brand); }
.glossary { padding-bottom: 50vh; }
.glossary h2 { font-size: 2rem; color: var(--gold); border-bottom: 1px solid var(--line); margin: 1.5rem 0 0; scroll-margin-top: 4.5rem; }
.entry { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 4.5rem; }
.entry > div { flex: 1; min-width: 0; }
.entry h3 { margin: 0 0 .25rem; font-size: 1.2rem; }
.entry p { margin: 0 0 .35rem; }
.entry img { width: 5.5rem; height: 5.5rem; object-fit: contain; border-radius: .6rem; background: var(--paper); border: 1px solid var(--line); }
.entry a { font-size: .9rem; }
.entry small { display: block; font-size: .68rem; color: var(--muted); }
.entry small a { font-size: inherit; color: inherit; }
.rail { position: fixed; z-index: 10; top: 50%; transform: translateY(-50%); right: max(.35rem, calc(50% - 27rem)); height: min(78vh, 36rem);
    width: 2rem; display: flex; flex-direction: column; padding: .5rem 0; background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
    box-shadow: 0 .4rem 1.2rem rgba(30, 48, 30, .1); cursor: grab; touch-action: none; user-select: none; }
.rail.dragging { cursor: grabbing; }
.rail span { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; font-size: .68rem; font-weight: 700; line-height: 1; color: var(--brand); }
.rail span.empty { color: #c6c8c0; }
.rail span.on { color: var(--cream); }
.rail i { position: absolute; left: 50%; width: 1.5rem; height: 1.5rem; margin: -.75rem 0 0 -.75rem; border-radius: 50%; background: var(--brand); transition: top .15s; }
.rail b { position: absolute; right: 2.9rem; width: 3.6rem; height: 3.6rem; margin-top: -1.8rem; display: flex; align-items: center; justify-content: center;
    border-radius: 50% 50% .3rem 50%; background: var(--brand); color: var(--cream); font: 450 2rem var(--serif); opacity: 0; pointer-events: none; transition: opacity .2s, top .15s; }
.rail.dragging b, .rail:focus-visible b { opacity: 1; }
.rail.dragging i, .rail.dragging b { transition: opacity .2s; }
@media (max-width: 62rem) { .page.has-rail { padding-right: 3.2rem; } }
.deeper, .worked, .discovery, .chain { margin: 2rem 0; border-radius: .9rem; }
.deeper { border: 1.5px dashed var(--gold-light); padding: 1rem 1.25rem; }
.deeper summary, .worked summary, .why summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.worked { background: var(--paper); border: 1px solid var(--line); padding: 1.25rem; }
.worked h3 { margin: .3rem 0; }
.worked details { border-top: 1px solid var(--line); padding: .7rem 0; }
.worked details:last-child { padding-bottom: 0; }
.discovery { background: var(--soft); padding: 1.25rem; }
.discovery h2 { margin: .2rem 0 .5rem; }
.discovery ol { list-style: none; margin: 0; padding: 0 0 0 1.2rem; border-left: 2px solid var(--gold-light); }
.discovery li { position: relative; padding-bottom: .5rem; }
.discovery li::before { content: ""; position: absolute; left: -1.62rem; top: .45rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--gold); }
.discovery h3 { font-size: 1.05rem; margin: 0; }
.chain { border-left: 3px solid var(--brand); padding: .25rem 0 .25rem 1.1rem; }
.why { margin-top: .5rem; }
.why .why { padding-left: .9rem; border-left: 1px solid var(--line); }
.level { display: block; margin-bottom: .5rem; }
.coef { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.coef label { display: flex; align-items: center; gap: .25rem; }
.coef input { width: 3rem; text-align: center; font: inherit; padding: .35rem; border: 1.5px solid var(--line); border-radius: .4rem; }
.picked { padding-left: 1.4rem; text-align: left; min-height: 2rem; }
.exercise textarea { width: 100%; min-height: 6rem; font: inherit; padding: .7rem 1rem; border: 1.5px solid var(--line); border-radius: .6rem; margin-bottom: .8rem; }
@media (max-width: 640px) { .top { gap: .6rem 1rem; } .tabs { order: 3; width: 100%; } .page { padding-top: 2rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .bubbles i { animation-duration: 4s; } }
