/* ============ A ARTE DE PENSAR — estilos ============ */
:root {
  --paper: #f5edd9;
  --paper-2: #ece0c3;
  --ink: #2b2118;
  --ink-soft: #5b4a3a;
  --gold: #9a7b3c;
  --gold-2: #c9a55a;
  --gold-3: #e7cf8f;
  --red: #8c2f24;
  --green: #3f6b3a;
  --leather: #2a1b14;
  --table: #17110d;
  --display: "Cormorant Garamond", "Garamond", Georgia, serif;
  --serif: "EB Garamond", "Garamond", Georgia, "Times New Roman", serif;
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .35  0 0 0 0 .27  0 0 0 0 .16  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--serif);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(120, 80, 45, .35), transparent 65%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, .6), transparent 60%),
    var(--table);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

/* ---------- barra superior ---------- */
#topbar {
  flex: none; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  padding-top: env(safe-area-inset-top); color: var(--gold-3);
  background: linear-gradient(#0f0a07, rgba(15, 10, 7, .6));
  border-bottom: 1px solid rgba(201, 165, 90, .18); z-index: 20;
}
.brand { font-family: var(--display); font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: 15px; white-space: nowrap; }
.ind { flex: 1; text-align: center; min-width: 0; line-height: 1.15; }
#pageInd { font-size: 14px; color: #f0e2bd; }
#sectionInd { font-size: 12px; color: rgba(231, 207, 143, .65); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { display: flex; gap: 4px; }
.tb {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 6px 9px; font-size: 14px; color: var(--gold-3); display: inline-flex; gap: 6px; align-items: center;
  transition: background .2s, border-color .2s;
}
.tb:hover { background: rgba(201, 165, 90, .12); border-color: rgba(201, 165, 90, .3); }
.tb.score { border-color: rgba(201, 165, 90, .35); }
#scoreBadge { font-variant-numeric: tabular-nums; }

/* ---------- palco do livro ---------- */
#stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }
#bookWrap { transition: transform .9s cubic-bezier(.2, .7, .2, 1); transform-origin: 50% 0; }
body.at-cover #bookWrap { transform: scale(var(--cover-scale, .86)); }
#book { position: relative; perspective: 2600px; touch-action: pan-y; transition: opacity .6s; }
body:not(.ready) #book { opacity: 0; }

.slot { position: absolute; top: 0; width: var(--pw); height: 100%; }
.spread .sl { left: 0; }
.spread .sr { left: var(--pw); }
.single .sl { display: none; }
.single .sr { left: 0; }
.slot:not(:empty) { box-shadow: 0 18px 40px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35); }
/* espessura do bloco de páginas */
.spread .sr:not(:empty)::after, .spread .sl:not(:empty)::after, .single .sr:not(:empty)::after {
  content: ""; position: absolute; top: 3px; bottom: 3px; width: 6px; pointer-events: none;
  background: repeating-linear-gradient(90deg, #e3d6b6 0 1px, #cdbf9d 1px 2px);
  border-radius: 0 3px 3px 0;
}
.spread .sr:not(:empty)::after, .single .sr:not(:empty)::after { right: -5px; }
.spread .sl:not(:empty)::after { left: -5px; transform: scaleX(-1); }
.spread.at-start .sr::after, .spread.at-end .sl::after { display: none; }

.leaf {
  position: absolute; top: 0; width: var(--pw); height: 100%; z-index: 5;
  transform-origin: 0 50%; transform-style: preserve-3d; will-change: transform;
}
.spread .leaf { left: var(--pw); }
.single .leaf { left: 0; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.face.back { transform: rotateY(180deg); }
.flipping .face { box-shadow: 0 0 calc(var(--fold, 0) * 40px) rgba(0, 0, 0, calc(var(--fold, 0) * .4)); }
.shade { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0; }
.front .shade { background: linear-gradient(to right, rgba(0, 0, 0, .05), rgba(60, 40, 20, .25) 60%, rgba(0, 0, 0, .55)); }
.back .shade { background: linear-gradient(to left, rgba(0, 0, 0, .05), rgba(60, 40, 20, .25) 60%, rgba(0, 0, 0, .55)); }
/* reflexo da curvatura do papel */
.flipping .face::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: linear-gradient(to right, transparent 55%, rgba(255, 255, 255, calc(var(--fold, 0) * .28)) 82%, transparent 96%);
}
.flipping .face.back::after { background: linear-gradient(to left, transparent 55%, rgba(255, 255, 255, calc(var(--fold, 0) * .28)) 82%, transparent 96%); }
.fshadow { position: absolute; top: 0; height: 100%; z-index: 4; pointer-events: none; opacity: 0; }
.fs-r { background: linear-gradient(to right, rgba(0, 0, 0, .38), transparent); }
.fs-l { background: linear-gradient(to left, rgba(0, 0, 0, .38), transparent); }
.flipping .slot .page * { pointer-events: none; }

/* cantos para arrastar */
.corner { position: absolute; bottom: 0; width: 64px; height: 64px; z-index: 6; cursor: grab; touch-action: none; }
.corner::before {
  content: ""; position: absolute; bottom: 0; width: 0; height: 0; transition: width .25s, height .25s;
}
.c-r { right: 0; }
.c-r::before { right: 0; background: linear-gradient(315deg, transparent 50%, #d8caa7 50%, #fbf5e6 100%); border-top-left-radius: 4px; box-shadow: -3px -3px 6px rgba(0, 0, 0, .18); }
.c-l { left: 0; }
.c-l::before { left: 0; background: linear-gradient(45deg, transparent 50%, #d8caa7 50%, #fbf5e6 100%); border-top-right-radius: 4px; box-shadow: 3px -3px 6px rgba(0, 0, 0, .18); }
@media (hover: hover) { #book:not(.flipping) .corner::before { width: 18px; height: 18px; } #book .corner:hover::before { width: 48px; height: 48px; } }
@media (hover: none) { .corner::before { width: 22px; height: 22px; } }
.at-start .c-l, .at-end .c-r, .flipping .corner { display: none; }
.at-start .c-r { cursor: pointer; }
.single .corner { width: 48px; height: 48px; }

/* ---------- página ---------- */
.page {
  position: absolute; inset: 0; overflow: hidden;
  background: var(--noise), radial-gradient(ellipse at 50% 40%, var(--paper) 55%, var(--paper-2) 130%);
  font-size: 1em; line-height: 1.5; color: var(--ink);
}
.page::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.spread .page.right::before, .single .page::before { background: linear-gradient(to right, rgba(60, 40, 15, .22), rgba(60, 40, 15, .06) 3%, transparent 9%); }
.spread .page.left::before { background: linear-gradient(to left, rgba(60, 40, 15, .22), rgba(60, 40, 15, .06) 3%, transparent 9%); }
.page-back { background: var(--noise), linear-gradient(to left, #e9dcbd, var(--paper)); }
.page-inner { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 2.2em 2.3em 1.2em; }
.spread .page.right .page-inner { padding-left: 2.7em; }
.spread .page.left .page-inner { padding-right: 2.7em; }
.run-head {
  flex: none; text-align: center; font-family: var(--display); font-size: .78em; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold); padding-bottom: .5em; margin-bottom: .9em;
  border-bottom: 1px solid rgba(154, 123, 60, .35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page-body {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: .35em; margin-right: -.35em;
  scrollbar-width: thin; scrollbar-color: rgba(154, 123, 60, .5) transparent; overscroll-behavior: contain;
}
.page-body::-webkit-scrollbar { width: 5px; }
.page-body::-webkit-scrollbar-thumb { background: rgba(154, 123, 60, .45); border-radius: 3px; }
.page.has-more .page-body { -webkit-mask-image: linear-gradient(#000 calc(100% - 2.2em), transparent); mask-image: linear-gradient(#000 calc(100% - 2.2em), transparent); }
.page.has-more .page-inner::after {
  content: "role para continuar ↓"; position: absolute; left: 0; right: 0; bottom: 2.3em; text-align: center;
  font-size: .72em; letter-spacing: .1em; color: var(--gold); font-style: italic; pointer-events: none;
}
.footnotes:empty { display: none; }
.footnotes { flex: none; font-size: .74em; line-height: 1.35; color: var(--ink-soft); border-top: 1px solid rgba(154, 123, 60, .35); margin-top: .5em; padding-top: .35em; max-height: 22%; overflow-y: auto; }
.footnotes p { margin: .15em 0; }
.footnotes sup, .fn-ref { color: var(--gold); font-weight: 600; font-size: .75em; }
.folio { flex: none; text-align: center; font-family: var(--display); color: var(--gold); font-size: .85em; padding-top: .4em; letter-spacing: .1em; }
.folio span::before, .folio span::after { content: "—"; margin: 0 .5em; opacity: .6; }

.ribbon {
  position: absolute; top: -4px; right: 1.4em; width: 1.25em; height: 2.6em; z-index: 3; border: 0; padding: 0;
  background: linear-gradient(90deg, rgba(140, 47, 36, .25), rgba(140, 47, 36, .35));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); transition: background .2s, height .2s;
}
.ribbon:hover { height: 2.9em; background: rgba(140, 47, 36, .55); }
.ribbon.on { background: linear-gradient(90deg, #7a2419, #a63b2d, #7a2419); height: 3.1em; }
.spread .page.left .ribbon { right: auto; left: 1.4em; }

/* tipografia */
.pg-title { font-family: var(--display); font-weight: 700; font-size: 1.55em; line-height: 1.12; margin: 0 0 .55em; color: var(--ink); }
.pg-title .muted { font-size: .6em; font-weight: 500; }
.sub { font-family: var(--display); font-weight: 700; font-size: 1.15em; margin: .8em 0 .3em; color: var(--ink); }
.txt { margin: 0 0 .6em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.txt.small, .small { font-size: .88em; }
.muted { color: var(--ink-soft); opacity: .85; }
.center { text-align: center; }
.dropcap::first-letter { font-family: var(--display); float: left; font-size: 3.4em; line-height: .8; padding: .06em .08em 0 0; color: var(--red); font-weight: 700; }
kbd { font-family: var(--serif); border: 1px solid var(--gold); border-radius: 3px; padding: 0 .3em; font-size: .9em; background: rgba(255, 255, 255, .5); }
.list { margin: .2em 0 .7em; padding-left: 1.2em; }
.list li { margin: .2em 0; }
.list li::marker { color: var(--gold); }
.term { border-bottom: 1px dotted var(--gold); color: #5a3b14; cursor: help; }
.term:hover, .term:focus { background: rgba(201, 165, 90, .22); outline: none; }
mark.hl { background: linear-gradient(transparent 35%, rgba(233, 196, 106, .65) 35%); color: inherit; cursor: pointer; padding: 0 1px; }
.ornament { display: block; width: 46%; max-width: 200px; margin: .8em auto; }
.illus { text-align: center; margin: .4em auto .6em; }
.illus.small svg { width: 52%; max-height: 8em; }
.illus-svg { display: inline-block; width: 100%; height: auto; }
.illus-svg .ink { stroke: var(--ink); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.illus-svg .gold { stroke: var(--gold); }
.illus-svg .cap { font-family: var(--display); font-size: 9px; letter-spacing: 2px; fill: var(--gold); stroke: none; }

.quote { margin: .7em 0; padding: .1em 0 .1em 1em; border-left: 2px solid var(--gold-2); }
.quote blockquote { margin: 0; font-style: italic; font-size: 1.04em; line-height: 1.42; }
.quote.para blockquote { font-style: normal; }
.quote figcaption { margin-top: .3em; font-size: .82em; color: var(--ink-soft); }
.qtag { display: inline-block; font-family: var(--serif); font-style: normal; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; padding: 0 .45em; border: 1px solid rgba(154, 123, 60, .6); border-radius: 999px; color: var(--gold); vertical-align: middle; line-height: 1.5; }
.box { background: rgba(201, 165, 90, .13); border: 1px solid rgba(154, 123, 60, .35); border-radius: 3px; padding: .6em .8em; margin: .7em 0; }
.box-title { font-family: var(--display); font-weight: 700; font-size: .92em; letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin-bottom: .25em; }
.box-text { font-size: .96em; text-align: justify; hyphens: auto; }
.bio { border-top: 1px solid var(--gold-2); border-bottom: 1px solid var(--gold-2); padding: .5em 0; margin: .4em 0 .7em; }
.bio-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .3em; }
.bio-name { font-family: var(--display); font-weight: 700; font-size: 1.3em; }
.bio-meta { font-size: .82em; color: var(--ink-soft); font-style: italic; }
.bio-works { font-size: .85em; margin: .25em 0 .4em; color: var(--ink-soft); }
.bio-works span { font-variant: small-caps; letter-spacing: .05em; color: var(--gold); }
.concepts { margin: .4em 0; }
.concepts dt { font-family: var(--display); font-weight: 700; font-size: 1.05em; color: var(--red); margin-top: .45em; }
.concepts dd { margin: 0 0 .1em; font-size: .95em; }

.reflect { border: 1px dashed var(--gold); border-radius: 4px; padding: .6em .8em; margin: .8em 0; background: rgba(255, 252, 240, .55); }
.rf-label, .pz-kind { font-family: var(--display); font-weight: 700; font-size: .8em; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.rf-q { font-style: italic; font-size: 1.04em; margin: .3em 0 .5em; }
.reflect textarea, #panelBody textarea, #panelBody input, .cert-form input {
  width: 100%; font: inherit; font-size: .95em; color: var(--ink); background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(154, 123, 60, .45); border-radius: 3px; padding: .45em .55em; resize: vertical;
}
.reflect textarea:focus, #panelBody textarea:focus, #panelBody input:focus { outline: 2px solid rgba(201, 165, 90, .5); }
.rf-row { display: flex; align-items: center; gap: .6em; margin-top: .35em; }
.rf-saved { font-size: .82em; color: var(--green); }

/* botões */
.btn {
  font-family: var(--display); font-weight: 700; letter-spacing: .08em; font-size: .95em;
  border: 1px solid var(--gold); background: var(--ink); color: var(--gold-3); border-radius: 3px;
  padding: .45em 1em; transition: transform .15s, background .2s, opacity .2s;
}
.btn:hover:not(:disabled) { background: #3a2c20; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; }
.btn.small { font-size: .82em; padding: .35em .8em; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover:not(:disabled) { background: rgba(201, 165, 90, .18); }
.btn.ghost.light { color: var(--gold-3); border-color: rgba(231, 207, 143, .5); }
.btn.gold { background: linear-gradient(#d8b569, #a9823a); color: #1e140c; border-color: #6d5426; box-shadow: 0 2px 10px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn.gold:hover:not(:disabled) { background: linear-gradient(#e5c47a, #b58d44); }
.btn.big { font-size: 1.05rem; padding: .7em 2.2em; letter-spacing: .25em; }
.link { background: none; border: 0; padding: 0; color: #6b4a1c; text-decoration: underline; text-decoration-color: var(--gold); font: inherit; }

/* ---------- capa e contracapa ---------- */
.kind-cover, .kind-backcover {
  background: var(--noise),
    radial-gradient(ellipse at 30% 20%, rgba(120, 70, 40, .45), transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(0, 0, 0, .55), transparent 60%),
    linear-gradient(135deg, #3b241a, var(--leather) 60%, #1c120d);
  color: var(--gold-3);
}
.page.kind-cover::before { background: linear-gradient(to right, rgba(0, 0, 0, .55), rgba(255, 220, 160, .08) 2.5%, transparent 6%) !important; }
.page.kind-backcover::before { background: linear-gradient(to left, rgba(0, 0, 0, .55), rgba(255, 220, 160, .08) 2.5%, transparent 6%) !important; }
.cover-frame {
  position: absolute; inset: 1.4em; border: 2px solid rgba(201, 165, 90, .7); outline: 1px solid rgba(201, 165, 90, .35); outline-offset: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; padding: 2em 1.4em 1.4em;
}
.cover-top { color: var(--gold-2); }
.cover-top .laurel { width: 5em; }
.cover-kicker { font-family: var(--display); letter-spacing: .32em; text-transform: uppercase; font-size: .78em; margin-top: .4em; }
.cover-title {
  font-family: var(--display); font-weight: 700; font-size: 3.3em; line-height: .98; margin: .2em 0 0; letter-spacing: .08em;
  background: linear-gradient(180deg, #f7e3a8, #c9a55a 55%, #8f6d2c); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .55));
}
.cover-title span { font-size: .5em; letter-spacing: .3em; vertical-align: middle; }
.cover-rule { width: 40%; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-2), transparent); margin: .6em auto; position: relative; }
.cover-rule::after { content: "◆"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -55%); font-size: .7em; color: var(--gold-2); }
.cover-sub { font-style: italic; font-size: 1.08em; max-width: 18em; margin: 0 auto; color: #ead8a6; }
.cover-emblem { width: 38%; max-width: 11em; opacity: .92; }
.cover-emblem .illus-svg .ink, .cover-emblem .illus-svg .gold { stroke: var(--gold-2); }
.cover-emblem .illus-svg [fill="#f3e9d2"] { fill: rgba(201, 165, 90, .12); }
.cover-emblem.small { width: 30%; }
.cover-foot { font-family: var(--display); letter-spacing: .3em; text-transform: uppercase; font-size: .68em; color: rgba(231, 207, 143, .6); }
.cover-frame.back { justify-content: center; gap: 1em; }
.back-blurb { font-size: 1.05em; max-width: 19em; margin: 0 auto; color: #ead8a6; }
.back-quote { font-style: italic; font-size: 1.1em; max-width: 17em; margin: 0 auto; }
.back-quote span { display: block; font-style: normal; font-size: .75em; margin-top: .4em; color: var(--gold-2); }
.back-end { font-family: var(--display); letter-spacing: .14em; text-transform: uppercase; font-size: .85em; color: var(--gold-2); }

/* chamada abaixo da capa */
#coverCta {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center; color: #ead8a6; padding: 0 16px;
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .5s, transform .5s;
}
body.at-cover #coverCta { opacity: 1; pointer-events: auto; transform: none; }
#coverCta p { font-style: italic; font-size: clamp(14px, 2.2vw, 18px); margin: 0 0 10px; text-shadow: 0 1px 3px #000; }
.cta-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
body.at-cover #navbar { visibility: hidden; }

/* ---------- páginas especiais ---------- */
.turn-hint { margin-top: 1em; padding: .6em .8em; border-left: 3px solid var(--red); background: rgba(140, 47, 36, .07); font-size: .92em; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { background: rgba(140, 47, 36, .14); } }
.howto { padding-left: 1.1em; margin: 0 0 .7em; }
.howto li { margin: .35em 0; font-size: .95em; }
.howto li::marker { content: "✦  "; color: var(--gold); }
.toc-part { margin-bottom: .7em; }
.toc-link { display: flex; align-items: baseline; width: 100%; background: none; border: 0; padding: .22em 0; text-align: left; font-size: .98em; gap: .4em; }
.toc-link > span { flex: 0 1 auto; max-width: 84%; }
.toc-link i { flex: 1; border-bottom: 1px dotted rgba(91, 74, 58, .5); transform: translateY(-.25em); min-width: 1em; }
.toc-link b { font-family: var(--display); color: var(--gold); font-weight: 700; }
.toc-link.part { font-family: var(--display); font-weight: 700; font-size: 1.04em; letter-spacing: .04em; color: var(--red); margin-top: .3em; }
.toc-link:hover > span { color: var(--red); }
.toc-link em { font-family: var(--display); font-style: normal; color: var(--gold); margin-right: .2em; }
.toc-st { font-size: .75em; color: var(--ink-soft); margin-left: .3em; }
.toc-st.ok { color: var(--green); font-weight: 700; }

.part-page, .opener { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.part-num, .op-num { font-family: var(--display); letter-spacing: .4em; text-transform: uppercase; color: var(--gold); font-size: .95em; }
.part-title { font-family: var(--display); font-size: 2.1em; line-height: 1.05; margin: .3em 0 0; }
.part-illus svg { width: 60%; max-height: 9em; }
.part-text { text-align: center; font-style: italic; max-width: 26em; font-size: .95em; }
.part-list { list-style: none; padding: 0; margin: .3em 0 0; font-family: var(--display); font-size: 1.05em; }
.part-list em { font-style: normal; color: var(--gold); margin-right: .4em; }
.op-title { font-family: var(--display); font-weight: 700; font-size: 2.15em; line-height: 1.05; margin: .25em 0 0; max-width: 12em; }
.op-illus { width: 100%; }
.op-illus svg { width: 62%; max-height: 10.5em; }
.op-epi { max-width: 24em; text-align: left; font-size: .92em; }
.op-lead { font-style: italic; color: var(--ink-soft); max-width: 22em; font-size: .98em; margin: .3em 0 0; }
.ch-status { text-align: center; border: 1px solid rgba(154, 123, 60, .4); border-radius: 4px; padding: .6em; background: rgba(255, 252, 240, .5); }
.st-ok { font-family: var(--display); font-weight: 700; color: var(--green); font-size: 1.15em; }
.st-pend { font-size: .95em; }
.glossary dt { font-family: var(--display); font-weight: 700; font-size: 1.04em; color: var(--red); margin-top: .45em; }
.glossary dd { margin: 0; font-size: .88em; line-height: 1.38; }
.lined { height: 70%; background: repeating-linear-gradient(transparent 0 1.6em, rgba(154, 123, 60, .3) 1.6em calc(1.6em + 1px)); margin-bottom: 1em; }
.meter { height: 6px; border-radius: 3px; background: rgba(154, 123, 60, .2); overflow: hidden; margin: .5em 0; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .5s; }
.meter.thin { height: 3px; margin: .3em 0 0; display: block; }

/* ---------- desafios ---------- */
.puzzle { border: 1px solid rgba(154, 123, 60, .55); border-radius: 4px; background: rgba(255, 252, 240, .6); padding: .6em .75em .7em; margin: .5em 0; position: relative; }
.puzzle::before { content: ""; position: absolute; inset: 3px; border: 1px solid rgba(154, 123, 60, .18); border-radius: 2px; pointer-events: none; }
.pz-head { display: flex; justify-content: space-between; gap: .5em; align-items: baseline; flex-wrap: wrap; }
.pz-status { font-size: .74em; color: var(--green); font-weight: 600; }
.pz-title { font-family: var(--display); font-size: 1.15em; margin: .15em 0 .35em; }
.pz-scenario, .pz-q { margin: .35em 0 .5em; font-size: .97em; }
.pz-q { font-weight: 600; }
.pz-context { font-style: italic; background: rgba(201, 165, 90, .12); border-left: 2px solid var(--gold); padding: .4em .6em; margin: .4em 0; font-size: .94em; }
.pz-actions { display: flex; gap: .5em; margin-top: .55em; flex-wrap: wrap; }
.pz-result { margin-top: .6em; border-top: 1px solid rgba(154, 123, 60, .35); padding-top: .5em; font-size: .93em; }
.pz-score { display: flex; justify-content: space-between; align-items: center; gap: .5em; font-family: var(--display); font-weight: 700; font-size: 1.05em; margin-bottom: .3em; }
.pz-score span { font-size: .85em; padding: .05em .55em; border-radius: 999px; background: rgba(154, 123, 60, .2); white-space: nowrap; }
.pz-score.full { color: var(--green); }
.pz-score.part { color: #8a6418; }
.pz-score.zero { color: var(--red); }
.pz-explain { margin: .3em 0; text-align: justify; }
.pz-list { margin: .3em 0; padding-left: 1.1em; }
.pz-list li { margin: .3em 0; }
.pz-list li.r::marker { content: "✓ "; color: var(--green); }
.pz-list li.w::marker { content: "✗ "; color: var(--red); }
.pz-list .ex { color: var(--ink-soft); }
.hint { font-size: .8em; color: var(--ink-soft); font-style: italic; margin: .4em 0 0; }
.opts { display: flex; flex-direction: column; gap: .3em; margin: .3em 0; }
.opt {
  text-align: left; font-size: .93em; line-height: 1.3; background: rgba(255, 255, 255, .55); border: 1px solid rgba(154, 123, 60, .45);
  border-radius: 3px; padding: .4em .6em; transition: background .15s, border-color .15s;
}
.opt:hover:not(:disabled) { background: rgba(201, 165, 90, .2); border-color: var(--gold); }
.opt.picked { border-color: var(--ink); background: rgba(201, 165, 90, .3); box-shadow: inset 3px 0 0 var(--gold); }
.opt.right { border-color: var(--green); background: rgba(63, 107, 58, .14); box-shadow: inset 3px 0 0 var(--green); }
.opt.wrong { border-color: var(--red); background: rgba(140, 47, 36, .1); box-shadow: inset 3px 0 0 var(--red); }
.opt.dim { opacity: .45; }
.fb { font-size: .9em; margin: .3em 0; padding: .3em .5em; border-radius: 3px; }
.fb.ok { background: rgba(63, 107, 58, .1); }
.fb.no { background: rgba(140, 47, 36, .08); }
.soc-step { margin: .3em 0 .5em; }
.soc-step.past { opacity: .62; font-size: .9em; }
.soc-step.past .opt:not(.right), .soc-step.past .fb { display: none; }
.soc-n { font-family: var(--display); font-weight: 700; color: var(--gold); margin-right: .3em; }
.soc-q { margin: .3em 0; font-weight: 600; }
.chip { font-size: .85em; border: 1px solid rgba(154, 123, 60, .55); background: rgba(255, 255, 255, .6); border-radius: 999px; padding: .2em .7em; margin: .15em; transition: all .15s; }
.chip:hover:not(:disabled) { border-color: var(--ink); }
.chip.sel, .chip.active { background: var(--ink); color: var(--gold-3); border-color: var(--ink); }
.chip.answered:not(.active) { border-color: var(--green); color: var(--green); }
.chip.answered::after { content: " ✓"; }
.chip.used { opacity: .25; text-decoration: line-through; }
.cave-wrap svg { width: 100%; max-height: 12em; display: block; margin: 0 auto; border: 1px solid rgba(154, 123, 60, .4); border-radius: 3px; }
.cave-wrap .hot { cursor: pointer; transition: filter .2s; }
.cave-wrap .hot:hover, .cave-wrap .hot:focus { filter: drop-shadow(0 0 4px #c9a55a) brightness(1.08); outline: none; }
.cave-wrap .hot.active { filter: drop-shadow(0 0 5px #8c2f24); }
.cave-chips { text-align: center; margin: .3em 0; }
.cave-label { margin: .2em 0; font-size: .95em; }
.cp-sent { line-height: 2; margin: .3em 0; font-size: .97em; }
.blank { min-width: 5.5em; border: 0; border-bottom: 2px solid var(--gold); background: rgba(201, 165, 90, .12); padding: 0 .4em; margin: 0 .15em; font-size: .95em; border-radius: 2px 2px 0 0; line-height: 1.5; }
.blank.sel { background: rgba(201, 165, 90, .45); }
.blank.filled { font-weight: 600; }
.blank.right { border-color: var(--green); background: rgba(63, 107, 58, .15); }
.blank.wrong { border-color: var(--red); background: rgba(140, 47, 36, .12); text-decoration: line-through; }
.cp-bank { margin: .4em 0; text-align: center; }
.mt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; }
.mt-col { display: flex; flex-direction: column; gap: .3em; }
.mt-item { font-size: .85em; line-height: 1.25; text-align: left; border: 1px solid rgba(154, 123, 60, .5); background: rgba(255, 255, 255, .6); border-radius: 3px; padding: .35em 1.2em .35em .45em; position: relative; }
.mt-item.sel { background: var(--ink); color: var(--gold-3); }
.mt-item.linked { border-width: 2px; padding: calc(.35em - 1px) calc(1.2em - 1px) calc(.35em - 1px) calc(.45em - 1px); }
.mt-item.c0 { border-color: #9a7b3c; background: rgba(154, 123, 60, .2); }
.mt-item.c1 { border-color: #4f6d8a; background: rgba(79, 109, 138, .16); }
.mt-item.c2 { border-color: #8c2f24; background: rgba(140, 47, 36, .13); }
.mt-item.c3 { border-color: #3f6b3a; background: rgba(63, 107, 58, .16); }
.mt-item.c4 { border-color: #6b4a7a; background: rgba(107, 74, 122, .15); }
.mt-item.c5 { border-color: #b0702a; background: rgba(176, 112, 42, .16); }
.mt-item.right::after { content: "✓"; position: absolute; right: .3em; top: .2em; color: var(--green); font-weight: 700; }
.mt-item.wrong::after { content: "✗"; position: absolute; right: .3em; top: .2em; color: var(--red); font-weight: 700; }
.ord-list { list-style: none; padding: 0; margin: .3em 0; }
.ord-item { display: flex; align-items: center; gap: .45em; border: 1px solid rgba(154, 123, 60, .45); background: rgba(255, 255, 255, .55); border-radius: 3px; padding: .3em .4em; margin: .25em 0; font-size: .9em; line-height: 1.3; }
.ord-item.right { border-color: var(--green); background: rgba(63, 107, 58, .12); }
.ord-item.wrong { border-color: var(--red); background: rgba(140, 47, 36, .08); }
.ord-n { font-family: var(--display); font-weight: 700; color: var(--gold); min-width: 1em; }
.ord-t { flex: 1; }
.ord-ctrl { display: flex; flex-direction: column; gap: 2px; }
.ord-btn { border: 1px solid rgba(154, 123, 60, .5); background: rgba(255, 255, 255, .7); font-size: .65em; padding: .1em .55em; border-radius: 2px; line-height: 1.2; }
.ord-btn:disabled { opacity: .25; }
.seq-dots { display: flex; gap: .35em; justify-content: center; margin: .2em 0 .4em; }
.seq-dots i { width: .6em; height: .6em; border-radius: 50%; border: 1px solid var(--gold); }
.seq-dots i.cur { background: var(--gold-2); }
.seq-dots i.r { background: var(--green); border-color: var(--green); }
.seq-dots i.w { background: var(--red); border-color: var(--red); }
.seq-fb { font-size: .9em; margin-top: .4em; }
.seq-fb .btn { margin-top: .4em; display: block; }
.ws-text { margin: .3em 0; font-style: italic; font-size: 1.04em; border-left: 2px solid var(--gold-2); padding-left: .7em; }
.det-text { line-height: 1.65; font-size: .96em; background: rgba(255, 255, 255, .45); border: 1px solid rgba(154, 123, 60, .3); padding: .5em .6em; border-radius: 3px; }
.seg { cursor: pointer; border-radius: 2px; transition: background .15s; }
.seg:hover { background: rgba(201, 165, 90, .2); }
.seg.flagged { background: rgba(233, 196, 106, .55); text-decoration: underline wavy var(--red); text-underline-offset: 3px; }
.seg.found { background: rgba(63, 107, 58, .2); text-decoration: underline wavy var(--green); }
.seg.missed { background: rgba(140, 47, 36, .14); text-decoration: underline dashed var(--red); }
.seg.falsepos { background: rgba(0, 0, 0, .06); text-decoration: line-through; }
.seg.locked { cursor: default; }
.deb-q { font-family: var(--display); font-weight: 700; font-size: 1.1em; text-align: center; margin: .2em 0 .5em; }
.deb-cards { display: flex; flex-direction: column; gap: .4em; }
.deb-card { border: 1px solid rgba(154, 123, 60, .45); border-radius: 3px; padding: .4em .6em; background: rgba(255, 255, 255, .55); font-size: .9em; transition: opacity .3s; }
.deb-card.picked { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--gold); }
.deb-card.dim { opacity: .5; }
.deb-who { font-family: var(--display); font-weight: 700; font-size: 1.08em; color: var(--red); margin-bottom: .1em; }
.deb-arg { line-height: 1.38; margin-bottom: .35em; }
.views { display: flex; flex-direction: column; gap: .35em; margin-top: .4em; }
.view { border-left: 2px solid var(--gold); padding: .15em 0 .15em .6em; font-size: .93em; }
.view-school { font-family: var(--display); font-weight: 700; color: var(--red); }

/* ---------- barra inferior ---------- */
#navbar {
  flex: none; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  padding-bottom: env(safe-area-inset-bottom); max-width: 760px; width: 100%; margin: 0 auto;
}
.nb { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(201, 165, 90, .35); background: rgba(0, 0, 0, .25); color: var(--gold-3); font-size: 20px; line-height: 1; flex: none; transition: background .2s, opacity .2s; }
.nb:hover:not(:disabled) { background: rgba(201, 165, 90, .18); }
.nb:disabled { opacity: .3; }
#prevCh, #nextCh { font-size: 16px; width: 32px; height: 32px; opacity: .8; }
#slider { flex: 1; min-width: 0; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--gold-2) var(--pct, 0%), rgba(201, 165, 90, .2) var(--pct, 0%)); outline: none; }
#slider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--gold-3); border: 2px solid #6d5426; cursor: pointer; }
#slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--gold-3); border: 2px solid #6d5426; cursor: pointer; }

/* ---------- painel lateral ---------- */
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 94vw); z-index: 40; display: flex; flex-direction: column;
  background: var(--noise), var(--paper); box-shadow: -10px 0 40px rgba(0, 0, 0, .5);
  transform: translateX(105%); transition: transform .35s cubic-bezier(.2, .7, .2, 1);
}
#drawer.open { transform: none; }
.dr-head { display: flex; align-items: center; border-bottom: 1px solid rgba(154, 123, 60, .4); background: rgba(201, 165, 90, .12); padding-top: env(safe-area-inset-top); }
.tabs { flex: 1; display: flex; overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; padding: 14px 10px 12px; font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .04em; color: var(--ink-soft); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--red); border-bottom-color: var(--red); }
#closeDrawer { background: none; border: 0; font-size: 26px; padding: 0 14px; color: var(--ink-soft); }
#panelBody { flex: 1; overflow-y: auto; padding: 12px 16px 24px; font-size: 15.5px; }
#scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 35; }
.pl-head { font-family: var(--display); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 12.5px; color: var(--gold); margin: 16px 0 6px; border-bottom: 1px solid rgba(154, 123, 60, .3); padding-bottom: 3px; }
.pl-row { display: flex; width: 100%; justify-content: space-between; gap: 8px; align-items: flex-start; background: none; border: 0; border-radius: 3px; padding: 7px 6px; text-align: left; font-size: 15px; }
.pl-row:hover { background: rgba(201, 165, 90, .16); }
.pl-row > span { flex: 1; min-width: 0; }
.pl-row small { display: block; color: var(--ink-soft); font-size: 12.5px; margin-top: 2px; }
.pl-row b { font-family: var(--display); color: var(--gold); }
.pl-row em { font-family: var(--display); font-style: normal; color: var(--gold); }
.pl-item { display: flex; align-items: flex-start; }
.pl-item .x { background: none; border: 0; font-size: 20px; color: var(--ink-soft); padding: 4px 8px; }
.diary-entry { border-left: 2px solid var(--gold); padding: 4px 0 4px 10px; margin: 10px 0; }
.de-prompt { font-style: italic; font-size: 13.5px; color: var(--ink-soft); }
.de-text { white-space: pre-wrap; margin: 3px 0; }
.de-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); }
#diarySave { margin-top: 6px; }
.pl-gloss .g-item { border-bottom: 1px solid rgba(154, 123, 60, .18); padding-bottom: 6px; }
#gSearch { margin: 4px 0 6px; }
.prog-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 6px 0 10px; }
.prog-top div { border: 1px solid rgba(154, 123, 60, .4); border-radius: 4px; padding: 8px 4px; background: rgba(255, 255, 255, .4); }
.prog-top b { display: block; font-family: var(--display); font-size: 24px; color: var(--red); }
.prog-top span { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ach { border: 1px solid rgba(154, 123, 60, .3); border-radius: 4px; padding: 8px; font-size: 13px; filter: grayscale(1); opacity: .5; }
.ach.on { filter: none; opacity: 1; background: rgba(201, 165, 90, .15); border-color: var(--gold); }
.ach span { font-size: 22px; display: block; }
.ach b { display: block; font-family: var(--display); font-size: 14.5px; }
.ach small { color: var(--ink-soft); line-height: 1.25; display: block; }

/* ---------- popover, botão flutuante, toasts, modal ---------- */
#popover { position: fixed; z-index: 50; background: var(--noise), #fbf5e5; border: 1px solid var(--gold); border-radius: 4px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 15px; }
#popover p { margin: 4px 0 6px; line-height: 1.4; }
.pop-term { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--red); }
#floatBtn { position: fixed; z-index: 45; background: var(--ink); color: var(--gold-3); border: 1px solid var(--gold); border-radius: 999px; padding: 7px 14px; font-size: 14px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
#toasts { position: fixed; left: 50%; bottom: 66px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; background: rgba(28, 20, 15, .95); color: #f0e2bd; border: 1px solid rgba(201, 165, 90, .5); border-radius: 6px; padding: 9px 16px; font-size: 14.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); opacity: 0; transform: translateY(12px); transition: opacity .35s, transform .35s; max-width: 90vw; }
.toast.in { opacity: 1; transform: none; }
.toast.ach { border-color: var(--gold-2); background: linear-gradient(135deg, #2c1e15, #1c140f); }
.t-ico { font-size: 22px; }
#modal { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--noise), var(--paper); border-radius: 6px; max-width: 720px; width: 100%; max-height: 94vh; overflow-y: auto; padding: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.cert-form label { display: block; font-size: 14px; color: var(--ink-soft); }
.cert-form input { margin-top: 4px; font-size: 17px; }
.certificate { margin: 14px 0; padding: 10px; background: #fbf6e8; border: 3px double var(--gold); }
.cert-inner { border: 1px solid var(--gold-2); padding: 24px 22px; text-align: center; color: var(--ink); }
.cert-inner .laurel { width: 90px; color: var(--gold); }
.cert-k { font-family: var(--display); letter-spacing: .35em; text-transform: uppercase; color: var(--gold); font-size: 13px; }
.cert-t { font-family: var(--display); font-weight: 700; font-size: 38px; letter-spacing: .08em; margin: 4px 0 10px; }
.cert-name { font-family: var(--display); font-style: italic; font-size: 32px; color: var(--red); border-bottom: 1px solid var(--gold-2); display: inline-block; min-width: 60%; padding: 0 10px 4px; margin: 4px 0 10px; }
.cert-inner p { max-width: 34em; margin: 6px auto; }
.cert-meta { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; font-family: var(--display); color: var(--gold); margin: 12px 0 6px; font-size: 15px; }
.cert-q { font-style: italic; font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) { .tb .lbl { display: none; } }
@media (max-width: 760px) {
  .brand { display: none; }
  #topbar { padding: 0 6px; gap: 4px; }
  .tb { padding: 6px 7px; }
  .ind { text-align: left; }
}
@media (max-width: 480px) {
  .hide-xs { display: none; }
  #pageInd { font-size: 13px; }
  #navbar { gap: 5px; padding: 0 8px; }
}
.mode-single .page-inner { padding: 1.7em 1.4em 1em 1.6em; }
.mode-single .cover-title { font-size: 3em; }

@media (prefers-reduced-motion: reduce) {
  #bookWrap, #drawer, .toast { transition: none; }
  .turn-hint { animation: none; }
}

/* ---------- impressão do certificado ---------- */
@media print {
  @page { size: landscape; margin: 12mm; }
  html, body { height: auto; overflow: visible; background: #fff; display: block; }
  body > *:not(#modal) { display: none !important; }
  #modal { position: static; background: none; padding: 0; display: block !important; }
  .modal-card { box-shadow: none; max-height: none; overflow: visible; background: #fff; padding: 0; }
  .cert-form, .modal-actions { display: none !important; }
  .certificate { margin: 0; }
}
