:root {
  color-scheme: light;
  --ink: #153c33;
  --ink-deep: #0d2d26;
  --paper: #f7f3e9;
  --paper-strong: #fffdf7;
  --muted: #64766f;
  --line: rgba(21, 60, 51, 0.14);
  --coral: #f16d57;
  --coral-dark: #ce503e;
  --sage: #d9e3d6;
  --shadow: 0 24px 60px rgba(17, 47, 40, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --sidebar: 250px;
  --reader-font-size: 18px;
}

* { box-sizing: border-box; }

html { max-width: 100%; overflow-x: hidden; scroll-behavior: smooth; }

body {
  margin: 0;
  max-width: 100%;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
button, a, label[for] { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 28px 20px;
  background: var(--ink-deep);
  color: #f8f5ea;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 6px 42px;
  color: inherit;
  text-decoration: none;
}

.brand img { border-radius: 13px; }
.brand span { display: grid; line-height: 1; }
.brand strong { white-space: nowrap; font-family: Georgia, serif; font-size: 21px; font-weight: 500; }
.brand small { margin-top: 6px; color: #a9bcb4; font-size: 9px; font-weight: 800; letter-spacing: 0.23em; }

.nav-list { display: grid; gap: 7px; }

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #afc1ba;
  cursor: pointer;
  text-align: left;
  transition: 160ms ease;
}

.nav-item span { width: 21px; color: #d8e4df; font-size: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: #f2eee3; color: var(--ink-deep); font-weight: 750; }
.nav-item.active span { color: var(--coral); }

.connection-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 15px;
  background: rgba(255,255,255,.04);
}

.connection-card div { display: grid; gap: 3px; }
.connection-card strong { font-size: 12px; }
.connection-card small { color: #91a9a0; font-size: 10px; line-height: 1.35; }
.connection-dot { width: 9px; height: 9px; margin-top: 3px; border-radius: 50%; background: #70c493; box-shadow: 0 0 0 4px rgba(112,196,147,.12); }
.connection-dot.offline { background: #f5b95f; box-shadow: 0 0 0 4px rgba(245,185,95,.12); }

.main-content { min-height: 100vh; margin-left: var(--sidebar); padding: 0 5vw 64px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 88px;
  background: rgba(247, 243, 233, .9);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px);
}

.search-box {
  display: flex;
  width: min(460px, 45vw);
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.56);
}

.search-box span { color: var(--muted); font-size: 22px; }
.search-box input { width: 100%; padding: 11px 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box:focus-within { border-color: rgba(21,60,51,.35); box-shadow: 0 0 0 4px rgba(21,60,51,.06); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.button, .icon-button, .chip, .reader-page-button {
  border: 0;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.button:active, .icon-button:active, .chip:active, .reader-page-button:active { transform: scale(.97); }
.button { display:inline-flex; min-height:43px; align-items:center; justify-content:center; gap:8px; padding:0 18px; border-radius:999px; font-weight:750; }
.button-primary { background: var(--ink); color: white; box-shadow: 0 10px 24px rgba(21,60,51,.18); }
.button-primary:hover { background: #1d5145; }
.button-whatsapp { background:#157a55; color:white; box-shadow:0 10px 24px rgba(21,122,85,.2); }
.button-whatsapp:hover { background:#116546; }
.button-icon { width:19px; height:19px; flex:0 0 auto; }
.button-light { background: #fffaf0; color: var(--ink-deep); }
.button-light:hover { background: white; box-shadow: 0 10px 24px rgba(0,0,0,.1); }
.button-quiet { background: transparent; color: var(--ink); }
.button-outline { border: 1px solid var(--line); background: transparent; }
.button-outline:hover { background: rgba(21,60,51,.06); }
.button-danger { background: #fff0ec; color: #9f382c; }
.text-button { padding: 10px 0; border: 0; background: transparent; color: #fff9ef; cursor: pointer; font-weight: 700; }
.text-button span { margin-left: 6px; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: transparent; font-weight: 700; }
.icon-button:hover { background: rgba(21,60,51,.08); }

.offline-banner { margin: 0 0 18px; padding: 12px 16px; border-radius: 13px; background: #fff0cf; color: #76551d; font-size: 13px; }
.update-banner { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:0 0 18px; padding:12px 16px; border-radius:13px; background:var(--ink); color:white; font-size:13px; }
.update-banner .button { min-height:36px; flex:0 0 auto; }
.hidden { display: none !important; }
.mobile-only { display: none; }

.view { display: none; animation: view-in 220ms ease both; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }

.hero-card {
  position: relative;
  display: grid;
  min-height: 360px;
  grid-template-columns: 1.2fr .8fr;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

.hero-card::before {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  top: -190px;
  right: 12%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(255,255,255,.025), 0 0 0 120px rgba(255,255,255,.018);
}

.hero-copy { position: relative; z-index: 2; align-self: center; padding: clamp(35px, 5vw, 68px); }
.eyebrow { margin: 0 0 12px; color: var(--coral); font-size: 10px; font-weight: 850; letter-spacing: .2em; }
.hero-copy h1, .page-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 400; letter-spacing: -.045em; }
.hero-copy h1 { max-width: 620px; font-size: clamp(44px, 5.4vw, 78px); line-height: .94; }
.hero-copy h1 em { color: #f3bcaa; font-weight: 400; }
.hero-copy > p:not(.eyebrow) { max-width: 570px; margin: 24px 0 28px; color: #d4e0db; line-height: 1.65; }
.hero-actions { display: flex; align-items: center; gap: 22px; }

.hero-art { position: relative; min-height: 320px; }
.book-stack { position: absolute; right: 10%; bottom: 18%; display: grid; width: 170px; height: 224px; place-items: center; border-radius: 9px 18px 18px 9px; box-shadow: -18px 24px 30px rgba(0,0,0,.2); transform-origin: bottom center; }
.book-stack::after { content:""; position:absolute; inset: 8px 8px 8px auto; width: 6px; border-radius: 10px; background: rgba(255,255,255,.35); }
.book-stack span { font-size: 10px; font-weight: 900; letter-spacing: .28em; writing-mode: vertical-rl; }
.book-one { z-index: 3; background: #f4c2af; color: var(--ink-deep); transform: rotate(8deg); }
.book-two { right: 30%; bottom: 14%; z-index: 2; background: #eef0df; color: var(--ink); transform: rotate(-7deg); }
.book-three { right: 49%; bottom: 11%; z-index: 1; background: #719b88; color: white; transform: rotate(-15deg); }
.pulse-orbit { position: absolute; top: 16%; right: 7%; width: 78px; height: 78px; border: 1px solid rgba(255,255,255,.26); border-radius: 50%; }
.pulse-orbit::before, .pulse-orbit::after { content:""; position:absolute; top: 50%; left: 50%; border-radius: 50%; transform: translate(-50%,-50%); }
.pulse-orbit::before { width: 10px; height: 10px; background: var(--coral); box-shadow: 0 0 0 8px rgba(241,109,87,.15); }
.pulse-orbit::after { width: 120px; height: 1px; background: rgba(255,255,255,.18); }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 52px 0 22px; }
.section-heading h2, .storage-card h2, .settings-card h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; font-weight: 400; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.collection-controls, .collection-page-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:10px; }
.sort-control { display:flex; min-height:42px; align-items:center; gap:8px; padding:0 12px; border:1px solid var(--line); border-radius:999px; background:rgba(255,255,255,.5); color:var(--muted); font-size:11px; font-weight:800; }
.sort-control select { max-width:150px; border:0; outline:0; background:transparent; color:var(--ink); cursor:pointer; font:inherit; }
.page-sort-control { width:max-content; margin:-18px 0 22px; }
.chip { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.chip.active { border-color: var(--ink); background: var(--ink); color: white; }

.collection-page-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 54px 0 34px;
}
.collection-page-heading h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(42px, 6vw, 72px); font-weight: 400; letter-spacing: -.045em; }
.collection-page-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.collection-emblem { display: grid; width: 82px; height: 102px; place-items: center; border-radius: 6px 14px 14px 6px; color: white; font-family: Georgia, serif; font-size: 38px; box-shadow: 0 14px 28px rgba(24,49,42,.16); }
.journal-emblem { background: #b65e4d; }
.guideline-emblem { background: #7a3340; }
.presentation-emblem { background: #536f7b; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 24px; }
.book-card { min-width: 0; }
.book-cover {
  position: relative;
  display: flex;
  aspect-ratio: 3 / 4;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 22px;
  border: 0;
  border-radius: 11px 21px 21px 11px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 17px 34px rgba(24,49,42,.14);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.book-cover:hover { transform: translateY(-5px); box-shadow: 0 24px 38px rgba(24,49,42,.19); }
.book-cover::before { content:""; position:absolute; inset:0; background: radial-gradient(circle at 80% 15%, rgba(255,255,255,.22), transparent 36%), linear-gradient(110deg, rgba(255,255,255,.08), transparent 42%); }
.book-cover::after { content:""; position:absolute; inset: 7px 7px 7px auto; width: 5px; border-radius: 8px; background: rgba(255,255,255,.26); }
.cover-mark { position:relative; display:grid; width:44px; height:44px; place-items:center; border:1px solid rgba(255,255,255,.45); border-radius:50%; font-family:Georgia,serif; font-size:21px; }
.cover-copy { position:relative; display:grid; gap:8px; }
.cover-copy small { font-size:9px; font-weight:850; letter-spacing:.18em; opacity:.8; }
.cover-copy strong { font-family: Georgia, serif; font-size: clamp(22px,2vw,30px); font-weight:400; line-height:1.05; }
.book-meta { padding: 15px 4px 0; }
.book-meta h3 { overflow:hidden; margin:0 0 5px; font-size:15px; text-overflow:ellipsis; white-space:nowrap; }
.book-meta p { margin:0; color:var(--muted); font-size:12px; }
.book-meta .item-date { margin-top: 5px; font-size: 11px; }
.shared-badge { display:inline-flex; margin-left:5px; padding:2px 6px; border-radius:99px; background:#dceee5; color:#12533f; font-size:8px; font-weight:900; letter-spacing:.08em; vertical-align:1px; }
.item-tags { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.item-tags span { max-width:100%; overflow:hidden; padding:3px 7px; border-radius:99px; background:rgba(21,60,51,.07); color:var(--ink); font-size:9px; font-weight:800; text-overflow:ellipsis; white-space:nowrap; }
.book-actions { display:flex; align-items:center; gap:7px; margin-top:11px; }
.card-action { display:grid; width:34px; height:34px; place-items:center; border:1px solid var(--line); border-radius:50%; background:rgba(255,255,255,.42); color:var(--ink); cursor:pointer; font-size:16px; transition:150ms ease; }
.card-action:hover { border-color:rgba(21,60,51,.3); background:white; transform:translateY(-1px); }
.card-action.favourite.active { border-color:rgba(241,109,87,.35); background:#fff0ec; color:var(--coral-dark); }
.card-action.delete { border-color:rgba(159,56,44,.2); color:#9f382c; }
.card-action.delete:hover { border-color:rgba(159,56,44,.45); background:#fff0ec; }
.card-action.share { margin-left:auto; }
.collection-journal .book-cover::before { background:radial-gradient(circle at 80% 15%, rgba(255,255,255,.23), transparent 36%), linear-gradient(145deg, rgba(255,255,255,.1), transparent 48%); }
.collection-guideline .book-cover { border-radius:8px 15px 15px 8px; }
.collection-guideline .book-cover::before { background:linear-gradient(90deg, rgba(255,255,255,.12), transparent 12%), radial-gradient(circle at 78% 17%, rgba(255,255,255,.2), transparent 34%); }
.collection-presentation .book-cover { border-radius:12px; }
.collection-presentation .book-cover::after { inset:auto 9px 9px; width:auto; height:5px; }
.progress-line { height:3px; margin-top:12px; overflow:hidden; border-radius:99px; background:rgba(21,60,51,.1); }
.progress-line span { display:block; height:100%; border-radius:inherit; background:var(--coral); }
.empty-state { grid-column:1/-1; padding:54px 20px; border:1px dashed rgba(21,60,51,.24); border-radius:var(--radius-md); text-align:center; }
.empty-state strong { display:block; margin-bottom:7px; font-family:Georgia,serif; font-size:24px; font-weight:400; }
.empty-state p { margin:0 0 18px; color:var(--muted); }

.page-heading { padding: 55px 0 34px; }
.page-heading h1 { font-size: clamp(42px,6vw,72px); }
.page-heading > p:last-child { color:var(--muted); }

.notes-list { display:grid; gap:14px; }
.note-card { display:grid; grid-template-columns:minmax(160px,.4fr) 1fr auto; align-items:start; gap:22px; padding:22px; border:1px solid var(--line); border-radius:var(--radius-md); background:rgba(255,255,255,.45); }
.note-card h3 { margin:0 0 5px; }
.note-card p { margin:0; color:var(--muted); line-height:1.6; white-space:pre-wrap; }
.note-actions { display:flex; align-items:center; gap:8px; }

.storage-layout { display:grid; gap:18px; max-width:900px; }
.storage-card, .settings-card { display:flex; align-items:center; gap:28px; padding:28px; border:1px solid var(--line); border-radius:var(--radius-md); background:rgba(255,255,255,.55); }
.storage-card p, .settings-card p { color:var(--muted); line-height:1.55; }
.storage-card > div:last-child { flex:1; }
.storage-ring { --storage:0deg; display:grid; width:130px; height:130px; flex:0 0 auto; place-content:center; border-radius:50%; background:radial-gradient(circle, var(--paper-strong) 60%, transparent 62%), conic-gradient(var(--coral) var(--storage), rgba(21,60,51,.09) 0); text-align:center; }
.storage-ring strong { font-family:Georgia,serif; font-size:29px; font-weight:400; }
.storage-ring span { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.15em; }
.storage-track { height:7px; overflow:hidden; border-radius:99px; background:rgba(21,60,51,.08); }
.storage-track span { display:block; width:0; height:100%; background:var(--coral); }
.fine-print { font-size:11px; }
.settings-card { justify-content:space-between; }
.settings-card h2 { font-size:25px; }
.settings-actions { display:flex; flex:0 0 auto; align-items:center; gap:9px; }
.danger-zone { border-color:rgba(159,56,44,.2); }
.shared-library-card { border-color:rgba(18,83,63,.22); background:linear-gradient(135deg,rgba(230,243,236,.82),rgba(255,255,255,.55)); }
.shared-library-card { align-items:flex-start; }
.shared-library-summary { min-width:0; flex:1; }
.sync-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; }
.sync-heading h2 { margin:0; }
.sync-pill { display:inline-flex; align-items:center; min-height:27px; padding:6px 10px; border-radius:999px; font-size:10px; font-weight:900; letter-spacing:.09em; }
.sync-pill.checking { background:#e9eef0; color:#53656a; }
.sync-pill.synced { background:#d7eee2; color:#0b6747; }
.sync-pill.offline, .sync-pill.update-needed { background:#fff0ce; color:#875a00; }
.sync-pill.unavailable { background:#f8ded9; color:#973d31; }
.sync-counts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; max-width:520px; margin:17px 0 13px; }
.sync-counts > div { display:grid; gap:3px; padding:13px 15px; border:1px solid rgba(21,60,51,.12); border-radius:13px; background:rgba(255,255,255,.6); }
.sync-counts strong { color:var(--ink-deep); font-family:Georgia,serif; font-size:26px; font-weight:400; }
.sync-counts span { color:var(--muted); font-size:10px; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.sync-time { margin-bottom:4px; font-size:12px; font-weight:700; }
.version-line strong { color:var(--ink); }

.share-page-heading { max-width: 760px; padding-bottom: 26px; }
.share-app-layout { display:grid; grid-template-columns:minmax(280px,440px) minmax(260px,1fr); align-items:start; gap:32px; max-width:980px; }
.share-app-card, .share-app-details { padding:24px; border:1px solid var(--line); border-radius:var(--radius-md); background:rgba(255,255,255,.58); box-shadow:0 18px 42px rgba(24,49,42,.08); }
.app-qr-code { display:block; width:100%; height:auto; border-radius:16px; background:white; }
.share-app-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:20px; }
.share-app-actions .button { flex:1 1 170px; }
.share-app-details { padding:34px; }
.share-app-details > img { border-radius:18px; box-shadow:0 12px 28px rgba(24,49,42,.14); }
.share-app-details .eyebrow { margin-top:28px; }
.share-app-details h2 { max-width:430px; margin:8px 0 16px; font-family:Georgia,serif; font-size:clamp(30px,4vw,46px); font-weight:400; line-height:1.08; letter-spacing:-.035em; }
.share-app-details > p:not(.eyebrow) { color:var(--muted); line-height:1.65; }
.share-app-url { display:inline-block; max-width:100%; margin:12px 0 20px; color:var(--coral-dark); font-weight:800; overflow-wrap:anywhere; }
.secure-install-card { margin-top:26px; padding:20px; border:1px solid rgba(21,60,51,.18); border-radius:18px; background:rgba(231,242,236,.72); }
.secure-install-heading { display:flex; align-items:flex-start; gap:13px; }
.secure-install-icon { display:grid; width:42px; height:42px; flex:0 0 auto; place-items:center; border-radius:13px; background:var(--ink); color:white; }
.secure-install-icon svg { width:25px; height:25px; }
.secure-install-heading .eyebrow { margin:1px 0 5px; }
.secure-install-heading h3 { margin:0; color:var(--ink-deep); font-family:Georgia,serif; font-size:22px; font-weight:400; line-height:1.15; }
.secure-install-steps { margin:17px 0 18px; padding-left:22px; color:var(--muted); font-size:13px; line-height:1.55; }
.secure-install-steps li + li { margin-top:7px; }
.secure-install-card .button { width:100%; background:rgba(255,255,255,.55); }

.reader { position:fixed; inset:0; z-index:80; display:grid; grid-template-rows:auto 1fr auto; visibility:hidden; background:#f6f0e4; opacity:0; transform:translateY(18px); transition:180ms ease; }
.reader.open { visibility:visible; opacity:1; transform:translateY(0); }
.reader-toolbar { display:flex; min-height:70px; align-items:center; gap:14px; padding:10px 22px; border-bottom:1px solid var(--line); background:rgba(255,253,247,.92); backdrop-filter:blur(15px); }
.reader-title-wrap { display:grid; min-width:0; }
.reader-title-wrap strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.reader-title-wrap span { margin-top:3px; color:var(--muted); font-size:9px; font-weight:800; letter-spacing:.16em; }
.reader-actions { display:flex; align-items:center; gap:4px; margin-left:auto; }
.text-size { font-size:12px; }
.reader-body { display:grid; min-height:0; grid-template-columns:1fr auto; }
.reader-stage { position:relative; min-width:0; min-height:0; overflow:auto; background:#f9f5ec; }
.reader-document { width:min(760px, calc(100% - 48px)); min-height:100%; margin:0 auto; padding:64px 20px 100px; font-family:Georgia,"Times New Roman",serif; font-size:var(--reader-font-size); line-height:1.8; color:#283d36; }
.reader-document h1 { margin-top:0; color:var(--ink-deep); font-size:2.4em; line-height:1.08; }
.reader-document h2 { margin-top:2em; color:var(--ink); font-size:1.5em; }
.reader-document p { margin:1.15em 0; }
.reader-document .lead { color:#53665f; font-size:1.18em; }
.reader-document .callout { margin:2em 0; padding:22px; border-left:4px solid var(--coral); border-radius:0 12px 12px 0; background:#fff9ee; }
.reader-document pre { white-space:pre-wrap; }
.epub-viewer, .file-viewer { width:100%; height:100%; border:0; background:white; }
.pdf-viewer { display:grid; justify-items:center; gap:18px; width:100%; min-height:100%; padding:18px 16px 80px; background:#d9ddd9; }
.pdf-page-shell { display:grid; width:min(100%,1000px); min-height:min(76vh,980px); place-items:center; overflow:hidden; border-radius:4px; background:white; box-shadow:0 8px 22px rgba(13,45,38,.16); }
.pdf-page-shell::before { content:"Page " attr(data-page); color:var(--muted); font-size:12px; }
.pdf-page-shell.rendering::before { content:"Rendering page " attr(data-page) "…"; }
.pdf-page-shell.rendered { min-height:0; }
.pdf-page-shell.rendered::before { content:none; }
.pdf-page-shell canvas { display:block; max-width:100%; height:auto; background:white; }
.pdf-page-error { max-width:340px; padding:22px; color:#9f382c; text-align:center; }
.reader.night .pdf-viewer { background:#10231e; }
.reader-message { display:grid; min-height:100%; place-content:center; padding:30px; color:var(--muted); text-align:center; }
.reader-notes { display:flex; width:330px; flex-direction:column; gap:18px; padding:28px; border-left:1px solid var(--line); background:#fffaf1; transform:translateX(100%); transition:180ms ease; margin-right:-330px; }
.reader-notes.open { margin-right:0; transform:translateX(0); }
.reader-notes-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.reader-notes-header .icon-button { flex:0 0 auto; background:rgba(21,60,51,.07); }
.reader-notes h2 { margin:0; font-family:Georgia,serif; font-size:28px; font-weight:400; }
.reader-notes textarea { width:100%; min-height:220px; flex:1; resize:none; padding:16px; border:1px solid var(--line); border-radius:14px; outline:0; background:white; color:var(--ink); line-height:1.6; }
.reader-notes textarea:focus { border-color:rgba(21,60,51,.38); box-shadow:0 0 0 4px rgba(21,60,51,.06); }
.reader-notes small { color:var(--muted); }
.reader-footer { display:grid; grid-template-columns:48px 1fr 48px; align-items:center; gap:18px; min-height:58px; padding:8px 22px calc(8px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); background:var(--paper-strong); }
.reader-page-button { display:grid; width:42px; height:42px; place-items:center; border-radius:50%; background:rgba(21,60,51,.07); }
.reader-progress-wrap { display:flex; align-items:center; gap:12px; }
.reader-progress { height:4px; flex:1; overflow:hidden; border-radius:99px; background:rgba(21,60,51,.1); }
.reader-progress span { display:block; width:0; height:100%; background:var(--coral); }
.reader-progress-wrap > span { width:58px; color:var(--muted); font-size:11px; text-align:right; }
.reader.night { background:#12221e; }
.reader.night .reader-stage, .reader.night .reader-document { background:#162a25; color:#dce6e1; }
.reader.night .reader-document h1, .reader.night .reader-document h2 { color:#fff7e8; }
.reader.night .reader-document .lead { color:#aebfb8; }
.reader.night .reader-document .callout { background:#1d3730; }

.import-dialog, .citation-dialog { width:min(620px,calc(100% - 28px)); max-height:calc(100vh - 28px); padding:0; border:0; border-radius:24px; background:transparent; box-shadow:var(--shadow); }
.import-dialog::backdrop, .citation-dialog::backdrop { background:rgba(9,35,29,.58); backdrop-filter:blur(5px); }
.dialog-card { max-height:calc(100vh - 28px); overflow:auto; padding:28px; border-radius:24px; background:var(--paper-strong); }
.dialog-heading { display:flex; justify-content:space-between; gap:20px; margin-bottom:22px; }
.dialog-heading h2 { margin:0; font-family:Georgia,serif; font-size:34px; font-weight:400; }
.import-kind-tabs { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:16px; }
.import-kind { display:flex; min-width:0; align-items:center; justify-content:center; gap:8px; min-height:50px; padding:8px; border:1px solid var(--line); border-radius:14px; background:transparent; color:var(--muted); cursor:pointer; font-size:12px; font-weight:800; }
.import-kind span { display:grid; width:27px; height:31px; place-items:center; border-radius:3px 7px 7px 3px; background:rgba(21,60,51,.08); color:var(--ink); font-family:Georgia,serif; font-size:15px; }
.import-kind.active { border-color:var(--ink); background:var(--ink); color:white; }
.import-kind.active span { background:rgba(255,255,255,.15); color:white; }
.drop-zone { display:grid; min-height:170px; place-content:center; gap:10px; padding:24px; border:1.5px dashed rgba(21,60,51,.3); border-radius:18px; background:rgba(217,227,214,.25); cursor:pointer; text-align:center; }
.drop-zone.dragging { border-color:var(--coral); background:rgba(241,109,87,.08); }
.drop-zone small, .dialog-note { color:var(--muted); line-height:1.5; }
.drop-zone input { display:none; }
.drop-icon { display:grid; width:50px; height:50px; margin:0 auto 4px; place-items:center; border-radius:50%; background:var(--ink); color:white; font-size:24px; }
.import-details { display:grid; gap:15px; margin-top:18px; padding-top:18px; border-top:1px solid var(--line); }
.selected-file { display:flex; min-width:0; align-items:center; justify-content:space-between; gap:12px; padding:10px 13px; border-radius:11px; background:rgba(21,60,51,.055); }
.selected-file span { overflow:hidden; font-size:12px; font-weight:800; text-overflow:ellipsis; white-space:nowrap; }
.selected-file small { flex:0 0 auto; color:var(--muted); }
.field-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field { display:grid; gap:7px; color:var(--ink); font-size:11px; font-weight:800; }
.field input, .field select, .field textarea { width:100%; min-width:0; min-height:43px; padding:9px 12px; border:1px solid var(--line); border-radius:11px; outline:0; background:white; color:var(--ink); font-size:14px; font-weight:500; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:rgba(21,60,51,.42); box-shadow:0 0 0 4px rgba(21,60,51,.06); }
.publish-option { display:grid; gap:13px; padding:16px; border:1px solid rgba(21,60,51,.18); border-radius:15px; background:rgba(231,242,236,.58); }
.publish-choice { display:flex; align-items:flex-start; gap:12px; color:var(--ink); cursor:pointer; }
.publish-choice input { width:19px; height:19px; flex:0 0 auto; margin-top:2px; accent-color:var(--ink); }
.publish-choice span { display:grid; gap:4px; }
.publish-choice strong { font-size:13px; }
.publish-choice small, .publish-status { color:var(--muted); font-size:11px; font-weight:500; line-height:1.45; }
.publish-status { margin:0; }
.citation-card { display:grid; gap:16px; }
.citation-card .dialog-heading { margin-bottom:0; }
.citation-card textarea { min-height:145px; resize:vertical; line-height:1.55; }
.save-item-button { width:100%; margin-top:2px; }
.dialog-note { margin:18px 2px 0; font-size:11px; }

.toast { position:fixed; z-index:120; right:22px; bottom:22px; max-width:min(390px,calc(100% - 44px)); padding:13px 17px; border-radius:13px; background:var(--ink-deep); color:white; box-shadow:var(--shadow); opacity:0; pointer-events:none; transform:translateY(12px); transition:180ms ease; }
.toast.show { opacity:1; transform:translateY(0); }
.sidebar-backdrop { display:none; }

@media (max-width: 900px) {
  :root { --sidebar: 230px; }
  .sidebar { transform:translateX(-105%); transition:180ms ease; box-shadow:var(--shadow); }
  body.nav-open .sidebar { transform:translateX(0); }
  .sidebar-backdrop { position:fixed; inset:0; z-index:25; background:rgba(8,31,26,.45); }
  body.nav-open .sidebar-backdrop { display:block; }
  .main-content { margin-left:0; padding-inline:24px; }
  .mobile-only { display:grid; }
  .hero-card { grid-template-columns:1fr; }
  .hero-art { position:absolute; inset:auto -50px -70px auto; width:45%; opacity:.55; transform:scale(.78); transform-origin:bottom right; }
  .hero-copy { padding-right:32%; }
  .reader-notes { position:absolute; z-index:5; inset:0 0 0 auto; height:100%; box-shadow:-20px 0 50px rgba(0,0,0,.15); }
}

@media (max-width: 620px) {
  .main-content { padding-inline:15px; padding-bottom:90px; }
  .topbar { min-height:72px; gap:8px; }
  .search-box { flex:1; width:auto; }
  .search-box input { min-width:0; }
  .button { padding-inline:14px; }
  .topbar .button-quiet { display:none; }
  .topbar .button-primary { width:43px; padding:0; font-size:0; }
  .topbar .button-primary span { font-size:20px; }
  .view, .hero-card, .hero-copy, .section-heading, .book-grid { width:100%; min-width:0; max-width:100%; }
  .hero-card { min-height:410px; }
  .hero-copy { align-self:start; padding:36px 24px; }
  .hero-copy h1 { max-width:100%; font-size:clamp(39px,11.5vw,45px); overflow-wrap:anywhere; }
  .hero-copy > p:not(.eyebrow) { max-width:100%; font-size:14px; }
  .hero-actions { align-items:flex-start; flex-direction:column; gap:8px; }
  .hero-art { width:70%; opacity:.42; }
  .section-heading { align-items:flex-start; flex-direction:column; margin-top:38px; }
  .collection-controls { width:100%; align-items:flex-start; justify-content:flex-start; }
  .collection-page-heading { grid-template-columns:58px 1fr; gap:14px; padding-top:34px; }
  .collection-page-actions { grid-column:1/-1; width:100%; }
  .collection-page-actions .button, .collection-page-actions .sort-control { width:100%; }
  .collection-page-actions .sort-control { justify-content:space-between; }
  .collection-emblem { width:58px; height:72px; font-size:27px; }
  .collection-page-heading h1 { font-size:40px; }
  .book-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px 12px; }
  .book-card, .book-cover { width:100%; min-width:0; max-width:100%; }
  .book-cover { padding:16px; border-radius:8px 15px 15px 8px; }
  .cover-copy strong { font-size:20px; }
  .book-meta h3 { font-size:13px; }
  .note-card { grid-template-columns:1fr; gap:10px; }
  .note-actions { width:100%; }
  .note-actions .button { flex:1; }
  .storage-card, .settings-card { align-items:flex-start; flex-direction:column; }
  .settings-card .button { width:100%; }
  .settings-actions { width:100%; flex-direction:column; }
  .share-app-layout { grid-template-columns:1fr; }
  .share-app-card, .share-app-details { padding:16px; }
  .share-app-details { padding:24px; }
  .reader-toolbar { padding-inline:8px; }
  .reader-actions { gap:0; }
  .reader-actions .text-size { display:none; }
  .reader-actions .icon-button { width:36px; height:36px; }
  #reader-theme { display:none; }
  .reader-actions .button { width:42px; padding:0; overflow:hidden; font-size:0; }
  .reader-actions .button::before { content:"≡"; font-size:18px; }
  .reader-document { width:100%; padding:38px 24px 90px; }
  .pdf-viewer { gap:10px; padding:10px 8px 70px; }
  .pdf-page-shell { width:100%; min-height:68vh; border-radius:2px; }
  .reader-notes { width:min(330px,90vw); margin-right:min(-330px,-90vw); }
  .reader-footer { gap:8px; padding-inline:10px; }
  .dialog-card { padding:21px; }
  .import-kind { gap:5px; font-size:10px; }
  .import-kind span { width:22px; height:27px; }
  .field-row { grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; transition-duration:.01ms !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; }
}
