@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;700&family=Lora:wght@400;600&display=swap');
*{box-sizing:border-box}
:root{--accent:#2563EB;--navy:#0B1B3A;--ink:#0F172A;--muted:#475569;--line:#CBD5E1;--bg:#F4F6FA}
body{margin:0;font-family:Inter,system-ui,sans-serif;background:var(--bg);color:var(--ink)}
a{color:#1D4ED8}a:hover{color:#1E3A8A}
h1,h2{font-family:'Space Grotesk',sans-serif;letter-spacing:-.01em;margin:0}
input,select,textarea,button{font:inherit}
input:focus,textarea:focus,button:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.hidden{display:none!important}
.btn{min-height:46px;padding:0 18px;border:0;border-radius:10px;background:var(--accent);color:#fff;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none}
.btn:hover{filter:brightness(1.08);color:#fff}
.btn.light{background:#fff;color:var(--ink);border:1px solid var(--line);font-weight:500}
.btn.dark{background:var(--navy)}
.btn.ghost{background:transparent;color:#E2E8F0;border:1px solid #334155;font-weight:500}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:14px;font-weight:500;color:#1E293B}
.field input,.field select{min-height:46px;padding:0 12px;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--ink)}
.row2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.file-btn{position:relative;cursor:pointer}
.file-btn input{position:absolute;width:1px;height:1px;opacity:0}
.logo{width:42px;height:42px;border-radius:11px;background:var(--accent);display:flex;align-items:center;justify-content:center;font-family:'Space Grotesk',sans-serif;font-weight:700;color:#fff}
.brand{display:flex;align-items:center;gap:10px;font-family:'Space Grotesk',sans-serif;font-weight:700;font-size:20px}
/* auth pages */
.auth{min-height:100vh;display:flex;flex-wrap:wrap}
.auth-side{flex:1 1 420px;background:var(--navy);color:#fff;padding:48px;display:flex;flex-direction:column;justify-content:space-between;gap:40px}
.auth-side h1{font-size:44px;line-height:1.1}
.auth-side p{color:#C7D2E5;font-size:17px;line-height:1.6;max-width:460px}
.auth-main{flex:999 1 560px;display:flex;align-items:center;justify-content:center;padding:48px 24px}
.card{width:100%;max-width:440px;background:#fff;border:1px solid #E2E8F0;border-radius:20px;padding:40px;box-shadow:0 12px 40px rgba(15,23,42,.08);display:flex;flex-direction:column;gap:20px}
.card h2{font-size:28px}
.muted{color:var(--muted);font-size:15px;margin:0}
.ok{padding:16px;border-radius:12px;background:#ECFDF5;border:1px solid #A7F3D0;color:#065F46}
.err{padding:12px 16px;border-radius:10px;background:#FEF2F2;border:1px solid #FECACA;color:#991B1B;font-size:14px}
/* app */
header.top{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;padding:14px 32px;background:var(--navy);color:#fff}
main.lib{max-width:1200px;margin:0 auto;padding:36px 32px;display:flex;flex-direction:column;gap:24px}
.lib-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px}
.lib-head h1{font-size:32px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:24px}
.book{border:0;padding:0;background:transparent;text-align:left;cursor:pointer;display:flex;flex-direction:column;gap:8px;color:var(--ink)}
.cover{aspect-ratio:3/4;width:100%;border-radius:6px 14px 14px 6px;box-shadow:inset 10px 0 0 rgba(0,0,0,.15),0 8px 20px rgba(15,23,42,.14);display:flex;flex-direction:column;justify-content:space-between;padding:18px;color:#fff;object-fit:cover;background:#fff}
.cover .t{font-family:'Space Grotesk',sans-serif;font-size:20px;font-weight:700;line-height:1.2}
.cover .a{font-size:13px;opacity:.85}
.small{font-size:14px;color:var(--muted)}
.progress{padding:16px 20px;border-radius:12px;background:#EFF6FF;border:1px solid #BFDBFE;display:flex;flex-direction:column;gap:10px;color:#1E3A8A;font-weight:600}
.bar{height:8px;border-radius:99px;background:#DBEAFE;overflow:hidden}.bar div{height:100%;width:0;background:var(--accent)}
.empty{padding:48px;text-align:center;border:2px dashed var(--line);border-radius:16px;color:var(--muted)}
.modal{position:fixed;inset:0;background:rgba(11,27,58,.6);display:flex;align-items:center;justify-content:center;padding:24px;z-index:10}
.modal .box{width:100%;max-width:540px;background:#fff;border-radius:18px;overflow:hidden;box-shadow:0 24px 60px rgba(0,0,0,.3)}
.box-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:22px 24px}
.x{width:44px;height:44px;border:0;border-radius:99px;background:#F1F5F9;font-size:20px;cursor:pointer;flex:none}
.box-cover{padding:28px;display:flex;justify-content:center}
.box-cover .cover{width:150px}
.box-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:20px 24px}
.box-foot .acts{display:flex;flex-wrap:wrap;gap:8px}
.danger{color:#B91C1C}
/* reader */
.reader{min-height:100vh;display:flex;flex-direction:column;background:#1E293B;color:#fff}
.rbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:10px 24px;background:#0F172A}
.rbar .l,.rbar .r{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.stage{flex:1;display:flex;align-items:center;justify-content:center;gap:16px;padding:28px 12px}
.arrow{width:48px;height:48px;border:0;border-radius:99px;background:#334155;color:#fff;font-size:24px;cursor:pointer;flex:none}
.spread{display:flex;flex-wrap:wrap;justify-content:center;box-shadow:0 20px 50px rgba(0,0,0,.45);max-width:calc(100vw - 160px)}
.pg{width:min(400px,40vw);aspect-ratio:3/4;background:#fff;color:var(--ink);display:flex;flex-direction:column;justify-content:space-between;padding:32px;overflow:hidden}
.pg img{width:100%;height:100%;object-fit:contain;display:block}
.pg.img{padding:0}
.pg p{font-family:Lora,Georgia,serif;font-size:17px;line-height:1.6;white-space:pre-line;margin:0}
.pg .n{font-size:12px;opacity:.55;align-self:center}
.pinfo{margin:0 0 20px;text-align:center;font-size:13px;color:#94A3B8}
.thumbs{flex:1;display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:22px;padding:28px;align-content:start}
.thumb{border:0;background:transparent;color:#E2E8F0;font-size:13px;cursor:pointer;display:flex;flex-direction:column;gap:8px;align-items:center}
.thumb .tp{width:100%;aspect-ratio:3/4;background:#fff;border-radius:4px;object-fit:contain}
.thumb.on .tp{outline:3px solid var(--accent);outline-offset:3px}
/* editor */
.ebar{display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:12px 24px;background:#fff;border-bottom:1px solid #E2E8F0}
.ebar input{min-height:44px;padding:0 12px;border:1px solid #E2E8F0;border-radius:9px;background:#F8FAFC}
.ebody{display:flex;flex-wrap:wrap;gap:24px;padding:24px}
.eside{flex:0 1 130px;display:flex;flex-direction:column;gap:10px;max-height:75vh;overflow:auto;padding:4px}
.eside button{aspect-ratio:3/4;width:100%;border-radius:8px;border:1px solid var(--line);background:#fff;font-size:13px;color:var(--muted);cursor:pointer;padding:0;overflow:hidden}
.eside button img{width:100%;height:100%;object-fit:contain}
.eside button.on{border:2px solid var(--accent)}
.ecenter{flex:999 1 420px;display:flex;flex-direction:column;align-items:center;gap:14px}
.epage{width:100%;max-width:520px;aspect-ratio:3/4;background:#fff;border-radius:10px;box-shadow:0 12px 36px rgba(15,23,42,.12);padding:32px;display:flex;flex-direction:column;gap:14px}
.epage img{flex:1;min-height:0;width:100%;object-fit:contain}
.epage textarea{flex:1;border:0;resize:none;font-family:Lora,Georgia,serif;font-size:19px;line-height:1.6;background:transparent;color:var(--ink)}
.eacts{display:flex;flex-wrap:wrap;justify-content:center;gap:10px}
@media (max-width:700px){.pg{width:80vw}.spread{max-width:100%}.stage{gap:6px}.arrow{width:40px;height:40px}.auth-side h1{font-size:34px}.card{padding:28px}}
