:root{--navy:#08335f;--blue:#067cc5;--blue2:#15a2df;--ink:#18334d;--muted:#63758a;--line:rgba(10,83,142,.14);--paper:#f8fcff;--page-ratio:1.41327;--pw:390px}
*{box-sizing:border-box}html{min-height:100%;background:#ecf6ff}body{margin:0;color:var(--ink);font-family:Inter,'Segoe UI',Arial,sans-serif;background:radial-gradient(ellipse at 52% 38%,#fff 5%,#f1f9ff 52%,#e3f2fc 100%);min-height:100vh}button{font:inherit;cursor:pointer}button:disabled{opacity:.36;cursor:not-allowed}button:focus-visible,.toc-item:focus-visible{outline:3px solid #01a5f1;outline-offset:3px}.app-shell{max-width:1650px;margin:auto;position:relative;min-height:100vh;display:flex;flex-direction:column}.app-header{height:82px;display:flex;justify-content:space-between;align-items:center;padding:10px clamp(18px,4vw,72px);border-bottom:1px solid rgba(20,100,155,.1);background:rgba(255,255,255,.60);backdrop-filter:blur(12px)}.brand{display:flex;align-items:center;gap:11px}.brand img{height:54px;width:54px;object-fit:contain}.brand-name{color:#087fce;letter-spacing:.08em;font-size:20px;font-weight:820}.brand-sub{font-size:10px;letter-spacing:.2em;color:#456683;font-weight:680;margin-top:2px}.header-actions{display:flex;align-items:center;gap:24px}.edition{color:#7890a3;font-size:11px;letter-spacing:.18em;font-weight:650}.main-content{width:100%;flex:1;display:flex;flex-direction:column;align-items:center;min-height:0;position:relative;padding:21px 20px 8px}.editorial-heading{text-align:center;max-width:900px;margin-bottom:4px}.eyebrow{font-size:10px;letter-spacing:.28em;color:#2379ac;font-weight:750}.divider-dot{font-size:8px;margin:0 6px}.editorial-heading h1{font-size:clamp(19px,2.2vw,35px);letter-spacing:-.035em;font-weight:450;margin:9px 0 4px;color:#0c3965}.editorial-heading h1 em{font-weight:670;font-style:normal;color:#0e89cd}.editorial-heading p{font-size:12px;color:#7b8b9b;margin:0 0 3px}.book-section{position:relative;display:flex;align-items:center;justify-content:center;width:100%;margin:8px auto 3px;min-height:calc(var(--pw)*var(--page-ratio) + 12px)}.book-stage{width:calc(var(--pw)*2);height:calc(var(--pw)*var(--page-ratio));perspective:2200px;position:relative;filter:drop-shadow(0 20px 22px rgba(10,64,107,.14))}.desktop-book{position:absolute;inset:0;transform-style:preserve-3d}.desktop-book::before{content:"";position:absolute;inset:0;border-radius:3px;background:linear-gradient(90deg,rgba(15,92,139,.13) 0%,white 47%,rgba(11,95,153,.2) 50%,white 53%,rgba(15,92,139,.12) 100%);box-shadow:0 9px 25px rgba(3,63,107,.10),inset 0 0 0 1px #d4e8f7}.book-sheet{position:absolute;top:0;left:50%;width:50%;height:100%;transform-origin:left center;transform-style:preserve-3d;transition:transform 860ms cubic-bezier(.37,.03,.27,1);will-change:transform;cursor:pointer}.book-sheet.flipped{transform:rotateY(-180deg)}.paper-face{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;overflow:hidden;background:#fff;border:1px solid rgba(25,101,154,.17);box-shadow:inset 0 0 1px rgba(25,101,154,.1)}.paper-face::after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,rgba(0,36,78,.16),transparent 14%,transparent 89%,rgba(0,35,77,.07));mix-blend-mode:multiply}.face-back{transform:rotateY(180deg)}.paper-face img{display:block;width:100%;height:100%;object-fit:fill;user-select:none;-webkit-user-drag:none}.paper-face.cover::after{background:linear-gradient(90deg,rgba(0,50,104,.18),transparent 24%,transparent 83%,rgba(2,49,90,.15))}.mobile-book{display:none}.book-side{position:absolute;top:46%;width:45px;height:68px;border-radius:40px;border:1px solid rgba(24,102,159,.16);background:rgba(255,255,255,.75);box-shadow:0 6px 20px rgba(12,72,119,.10);display:grid;place-items:center;color:#087ec8;transition:background .15s,transform .15s}.book-side:hover:not(:disabled){background:white;transform:scale(1.05)}.book-side span{font-size:37px;font-weight:200;line-height:1}.side-prev{left:max(0px,calc(50% - var(--pw) - 90px))}.side-next{right:max(0px,calc(50% - var(--pw) - 90px))}.control-panel{width:min(100%,1110px);margin:12px auto 0;display:flex;align-items:center;justify-content:space-between;gap:24px;background:rgba(255,255,255,.9);border:1px solid var(--line);border-radius:15px;padding:9px 13px;box-shadow:0 8px 26px rgba(25,96,144,.07)}.control-group{display:flex;gap:7px;align-items:center}.button-strong{height:37px;padding:0 14px;border-radius:8px;background:#f1f8ff;border:1px solid #c9dff1;color:#135482;font-size:13px;font-weight:650;white-space:nowrap}.button-strong.primary{background:#087ec8;color:white;border-color:#087ec8}.button-strong:hover:not(:disabled){background:#daeeff}.button-strong.primary:hover:not(:disabled){background:#056ba9}.button-strong span{font-size:18px;vertical-align:-1px}.tiny-button,.nav-chip{border:1px solid #d2e5f2;background:#fff;color:#397192;min-height:36px;border-radius:8px;padding:0 11px;font-size:12px;font-weight:700}.tiny-button{font-size:17px;padding:0 10px}.nav-chip{display:inline-flex;align-items:center;gap:8px}.nav-chip:hover:not(:disabled),.tiny-button:hover:not(:disabled){background:#eef8ff}.status-group{min-width:160px;max-width:230px;width:100%;text-align:center}.page-count{font-size:12px;font-weight:700;color:#315c79;white-space:nowrap}.progress-track{height:3px;background:#d5e7f6;border-radius:6px;margin-top:8px;overflow:hidden}.progress-fill{width:10%;height:100%;border-radius:6px;background:linear-gradient(90deg,#0886d2,#1ab8ed);transition:width .3s}.toc{width:min(100%,1110px);margin:12px auto 0;background:#fff;border:1px solid var(--line);box-shadow:0 8px 25px rgba(11,73,113,.06);border-radius:12px;padding:17px 20px}.toc[hidden]{display:none}.toc-header{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px;color:#154569;font-size:14px}.toc-header span{font-size:11px;color:#8092a1}.toc-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:12px}.toc-item{border:1px solid #d9e9f4;border-radius:7px;background:#f6fbff;text-align:left;overflow:hidden;padding:0;transition:transform .2s,box-shadow .2s}.toc-item:hover{transform:translateY(-3px);box-shadow:0 5px 14px rgba(0,75,140,.16)}.toc-item[aria-current="page"]{outline:2px solid #168dce}.toc-item img{display:block;width:100%;aspect-ratio:1/1.413;object-fit:cover}.toc-item span{display:block;padding:6px;font-size:10px;font-weight:650;color:#315771;min-height:34px}.helper{color:#8396a5;text-align:center;font-size:11px;margin:13px 0}.helper span{font-size:16px;vertical-align:middle;margin-right:3px}.footer{padding:10px clamp(18px,4vw,72px) 16px;display:flex;gap:10px;justify-content:space-between;font-size:10px;color:#8a9cac;letter-spacing:.015em}.toast{position:fixed;bottom:25px;left:50%;transform:translate(-50%,18px);padding:12px 17px;border-radius:8px;color:white;background:#0b5685;box-shadow:0 7px 24px rgba(0,34,77,.24);opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;font-size:13px;z-index:99}.toast.visible{opacity:1;transform:translate(-50%,0)}
@media(max-width:900px){.edition{display:none}.book-side{width:36px;height:52px}.side-prev{left:0}.side-next{right:0}.main-content{padding-left:15px;padding-right:15px}}
@media(max-width:760px){.app-header{height:70px;padding:7px 14px}.brand img{width:47px;height:47px}.brand-name{font-size:17px}.brand-sub{font-size:9px}.header-actions .nav-chip span:last-child{display:none}.editorial-heading h1{font-size:22px;line-height:1.12;margin-top:10px}.editorial-heading p{font-size:11px;line-height:1.38;margin-top:8px}.eyebrow{font-size:9px;letter-spacing:.16em}.main-content{padding:15px 12px 8px}.book-stage{width:var(--pw);perspective:1400px}.desktop-book{display:none}.mobile-book{display:block;position:relative;width:100%;height:100%;transform-style:preserve-3d;filter:drop-shadow(0 12px 19px rgba(0,52,108,.15))}.mobile-under,.mobile-current{position:absolute;inset:0;background:white;box-shadow:0 0 0 1px rgba(0,79,134,.09)}.mobile-under img,.mobile-current img{width:100%;height:100%;object-fit:fill;display:block;user-select:none;-webkit-user-drag:none}.mobile-current{transform-origin:left center;backface-visibility:hidden;-webkit-backface-visibility:hidden;transform-style:preserve-3d}.mobile-current.turn-next{animation:turn-next .72s cubic-bezier(.3,.06,.35,1) forwards}.mobile-current.turn-prev{transform-origin:right center;animation:turn-prev .72s cubic-bezier(.3,.06,.35,1) forwards}.mobile-current::after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,rgba(0,30,80,.14),transparent 24%);opacity:0}.mobile-current.turn-next::after,.mobile-current.turn-prev::after{opacity:1}@keyframes turn-next{0%{transform:rotateY(0deg);filter:brightness(1)}42%{filter:brightness(.86)}100%{transform:rotateY(-180deg);filter:brightness(.65)}}@keyframes turn-prev{0%{transform:rotateY(0deg);filter:brightness(1)}42%{filter:brightness(.86)}100%{transform:rotateY(180deg);filter:brightness(.65)}}.book-section{min-height:calc(var(--pw)*var(--page-ratio) + 10px)}.book-side{border-radius:6px;width:33px;height:53px;top:50%;background:rgba(255,255,255,.91)}.side-prev{left:0}.side-next{right:0}.control-panel{padding:8px 5px;gap:6px;flex-wrap:wrap;justify-content:center}.control-group{gap:4px}.button-strong{font-size:11px;height:34px;padding:0 10px}.tiny-button{height:34px;min-height:34px;padding:0 8px;font-size:15px}.status-group{order:-1;min-width:100%;max-width:100%;margin:0;padding:3px 0 6px}.progress-track{width:180px;margin:6px auto 0}.extras .nav-chip{padding:0 8px;min-height:34px;font-size:11px}.toc-grid{grid-template-columns:repeat(3,1fr);gap:9px}.helper{font-size:10px}.footer{flex-direction:column;align-items:center;text-align:center;padding:11px;font-size:9px;line-height:1.4}}
@media(max-width:385px){.extras .nav-chip span{display:none}.control-panel{gap:2px}.book-side{width:28px}}
@media(prefers-reduced-motion:reduce){.book-sheet{transition-duration:.15s}.mobile-current.turn-next{animation-duration:.15s}.mobile-current.turn-prev{animation-duration:.15s}}


/* ===== Ajustes v2: leitura melhor no celular e índice funcional ===== */
.toc-open{overflow:hidden}
@media(max-width:760px){
  .app-shell{min-height:100dvh}
  .app-header{height:58px;padding:8px 12px;position:sticky;top:0;z-index:20;background:rgba(246,250,253,.96);backdrop-filter:blur(8px)}
  .brand img{width:40px;height:40px}
  .brand-name{font-size:16px}
  .brand-sub,.editorial-heading p,.helper,.footer{display:none}
  .editorial-heading{padding:2px 2px 0;margin-bottom:4px}
  .editorial-heading h1{font-size:18px;line-height:1.1;margin:6px 0 0;text-align:center}
  .eyebrow{font-size:8px;letter-spacing:.13em;text-align:center;display:block}
  .main-content{padding:8px 8px 10px}
  .book-section{margin-top:2px;min-height:calc(100dvh - 160px)}
  .book-stage{width:var(--pw);height:calc(var(--pw) * var(--page-ratio));max-width:100%}
  .mobile-book{border-radius:8px;overflow:hidden;background:#fff;box-shadow:0 10px 28px rgba(0,52,108,.16)}
  .mobile-under,.mobile-current{border-radius:8px;overflow:hidden}
  .mobile-current{will-change:transform,opacity}
  .mobile-current::after{display:none}
  .mobile-current.slide-next{animation:slide-next .38s ease forwards}
  .mobile-current.slide-prev{animation:slide-prev .38s ease forwards}
  @keyframes slide-next{0%{transform:translateX(0);opacity:1}100%{transform:translateX(-102%);opacity:.82}}
  @keyframes slide-prev{0%{transform:translateX(0);opacity:1}100%{transform:translateX(102%);opacity:.82}}
  .book-side{width:34px;height:60px;top:50%;transform:translateY(-50%);background:rgba(255,255,255,.94);box-shadow:0 5px 16px rgba(0,45,97,.16);z-index:10}
  .book-side:hover:not(:disabled){transform:translateY(-50%) scale(1.04)}
  .side-prev{left:2px}.side-next{right:2px}
  .control-panel{position:sticky;bottom:0;z-index:25;background:rgba(255,255,255,.98);backdrop-filter:blur(10px);border-radius:14px 14px 0 0;padding:8px 6px 10px;box-shadow:0 -8px 24px rgba(5,44,84,.08);margin-top:10px}
  .control-group{gap:5px}
  .button-strong,.tiny-button,.nav-chip{height:34px;min-height:34px}
  .status-group{order:-1;min-width:100%;max-width:100%;margin:0;padding:2px 0 6px}
  .page-count{font-size:12px}
  .progress-track{width:min(220px,76vw)}
  .toc{position:fixed;left:8px;right:8px;top:68px;bottom:12px;z-index:40;overflow:auto;border-radius:14px;padding:14px 14px 18px;box-shadow:0 18px 45px rgba(1,26,54,.22)}
  .toc-grid{grid-template-columns:repeat(2,1fr);gap:10px}
  .toc-item span{font-size:11px;min-height:40px}
}


/* ===== V3: índice com overlay rolável no desktop ===== */
.toc{position:fixed;left:50%;transform:translateX(-50%);top:96px;bottom:24px;width:min(1180px,calc(100vw - 40px));margin:0;z-index:45;overflow:auto;border-radius:16px;padding:20px 22px 24px;box-shadow:0 20px 55px rgba(7,41,76,.18)}
.toc-header{position:sticky;top:-20px;background:#fff;padding:2px 0 14px;z-index:2;display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.toc-header > div{display:flex;flex-direction:column;gap:4px}
.toc-close{border:1px solid #d2e5f2;background:#f8fcff;color:#396887;border-radius:10px;width:38px;height:38px;font-size:18px;line-height:1;font-weight:700;display:grid;place-items:center;flex:0 0 auto}
.toc-close:hover{background:#eef8ff}
.toc-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
body.toc-open::before{content:"";position:fixed;inset:0;background:rgba(7,30,56,.22);backdrop-filter:blur(2px);z-index:40}
@media (max-width:1200px){
  .toc-grid{grid-template-columns:repeat(4,1fr)}
}
@media (max-width:900px){
  .toc-grid{grid-template-columns:repeat(3,1fr)}
}
@media (max-width:760px){
  .toc-header{top:-14px;padding-bottom:12px}
  .toc-close{width:34px;height:34px;font-size:16px}
}

/* V3 refinamento: índice ocupa a altura disponível e rola independentemente da página. */
.toc{overscroll-behavior:contain;scrollbar-gutter:stable;max-height:calc(100dvh - 120px);-webkit-overflow-scrolling:touch}
@media(max-width:760px){
  .toc{left:8px;right:8px;top:68px;bottom:12px;width:auto;max-height:calc(100dvh - 80px);transform:none;padding:14px 14px 18px}
  .toc-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
