@font-face {
  font-family: "Inter";
  src: url("./fonts/inter-latin-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #28333a;
  --muted: #748087;
  --soft-muted: #929ca2;
  --accent: #527c7e;
  --accent-deep: #3f696b;
  --canvas: #e9eef1;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(250, 252, 252, 0.78);
  --glass-line: rgba(255, 255, 255, 0.74);
  --hairline: rgba(53, 70, 76, 0.1);
  --shadow: 0 22px 70px rgba(68, 91, 99, 0.11), 0 3px 12px rgba(61, 83, 91, 0.06);
  --serif: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  scroll-behavior: smooth;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 13% 12%, rgba(183, 210, 207, 0.55), transparent 33rem),
    radial-gradient(ellipse at 90% 31%, rgba(210, 211, 225, 0.44), transparent 35rem),
    radial-gradient(ellipse at 47% 82%, rgba(220, 228, 224, 0.72), transparent 38rem),
    var(--canvas);
}

body::before {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.14;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.88' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.17'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid rgba(82, 124, 126, 0.55);
  outline-offset: 3px;
}

.app-shell {
  width: min(100% - 64px, 1240px);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(48px, env(safe-area-inset-bottom));
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  animation: arrive 700ms cubic-bezier(.2,.75,.25,1) both;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.055em;
}

.wordmark-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--accent-deep);
  border: 1px solid rgba(82, 124, 126, 0.2);
  border-radius: 10px;
  background: rgba(255,255,255,.43);
}

.wordmark-mark svg { width: 18px; height: 18px; }

.header-note, .local-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .015em;
}
.header-tools { display: flex; align-items: center; gap: 12px; }
.install-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: 0 4px 14px rgba(61,83,91,.08);
  color: var(--accent-deep);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.privacy-dot, .status-ring {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6b9690;
  box-shadow: 0 0 0 3px rgba(107, 150, 144, .12);
}

.library-view {
  max-width: 1020px;
  margin: 72px auto 0;
  animation: arrive 760ms 70ms cubic-bezier(.2,.75,.25,1) both;
}

.library-intro { margin: 0 0 34px 4px; }
.eyebrow {
  margin: 0 0 15px;
  color: var(--accent-deep);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .16em;
}

.library-intro h1, .reader-section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(42px, 5.3vw, 66px);
  font-weight: 400;
  line-height: .99;
  letter-spacing: -.052em;
}
.library-intro h1 em {
  color: var(--accent-deep);
  font-weight: 400;
}

.intro-copy {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.shelf-surface {
  min-height: 395px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 26px;
  background: var(--glass);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.8);
  backdrop-filter: blur(28px) saturate(1.28);
  -webkit-backdrop-filter: blur(28px) saturate(1.28);
}

.shelf-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 25px;
  border-bottom: 1px solid var(--hairline);
}
.shelf-label { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.shelf-count { color: var(--soft-muted); font-size: 12px; }

.empty-state {
  display: flex;
  min-height: 335px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 24px 20px 29px;
  text-align: center;
}

.book-illustration {
  position: relative;
  width: 76px;
  height: 75px;
  margin: 0 0 18px;
  animation: float 6s ease-in-out infinite;
}
.book-shadow {
  position: absolute;
  right: 9px;
  bottom: 3px;
  left: 7px;
  height: 9px;
  border-radius: 50%;
  background: rgba(90, 118, 120, .15);
  filter: blur(5px);
}
.book-back {
  position: absolute;
  top: 13px;
  left: 14px;
  width: 45px;
  height: 54px;
  border: 1px solid rgba(82, 124, 126, .32);
  border-radius: 5px 7px 7px 5px;
  background: #c9d9d5;
  transform: rotate(-9deg);
}
.book-front {
  position: absolute;
  top: 9px;
  left: 19px;
  display: flex;
  width: 42px;
  height: 56px;
  align-items: center;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 4px 7px 7px 4px;
  background: linear-gradient(145deg, #f6f7f1, #e6eeea);
  box-shadow: 3px 4px 8px rgba(65, 91, 93, .12), inset 3px 0 rgba(87, 130, 128, .12);
  transform: rotate(5deg);
}
.book-rule {
  width: 21px;
  height: 1px;
  margin-top: 15px;
  background: #aabbb5;
}
.book-rule.short { width: 14px; margin-top: 5px; }
.book-stamp {
  margin-top: auto;
  margin-bottom: 8px;
  color: #698884;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .12em;
}
.spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #96b8ad;
}
.spark-one { top: 14px; right: 4px; }
.spark-two { top: 33px; left: 4px; width: 3px; height: 3px; opacity: .65; }

.empty-state h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -.035em;
}
.empty-state > p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.open-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 19px;
  border: 1px solid rgba(46, 92, 92, .18);
  border-radius: 14px;
  background: linear-gradient(180deg, #628c89, #4c7776);
  box-shadow: 0 5px 13px rgba(67, 112, 111, .18), inset 0 1px rgba(255,255,255,.24);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}
.open-button svg { width: 17px; height: 17px; }
.open-button:hover { transform: translateY(-1px); box-shadow: 0 8px 17px rgba(67,112,111,.22); filter: brightness(1.035); }
.open-button:active { transform: translateY(0) scale(.985); }
.device-note { margin-top: 12px; color: var(--soft-muted); font-size: 11px; }

.library-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 6px 0;
  color: var(--soft-muted);
  font-size: 11px;
}
.local-status { font-size: 11px; }
.status-ring { width: 6px; height: 6px; }

.reader-demo {
  max-width: 1020px;
  margin: 125px auto 0;
  animation: arrive 760ms 150ms cubic-bezier(.2,.75,.25,1) both;
}
.reader-section-heading { margin: 0 0 27px 4px; }
.reader-section-heading .eyebrow { margin-bottom: 12px; }
.reader-section-heading h2 {
  color: #35444a;
  font-size: clamp(32px, 4vw, 47px);
  line-height: 1.06;
}

.reader-stage {
  position: relative;
  display: flex;
  min-height: 710px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 100px 28px 98px;
  border: 1px solid rgba(255,255,255,.67);
  border-radius: 30px;
  background:
    radial-gradient(ellipse at 20% 40%, rgba(196, 216, 211, .7), transparent 40%),
    radial-gradient(ellipse at 83% 53%, rgba(205, 210, 222, .68), transparent 39%),
    rgba(224, 231, 233, .48);
  box-shadow: inset 0 1px rgba(255,255,255,.7);
}
.reader-wash {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .43;
  pointer-events: none;
}
.reader-wash-left { top: 16%; left: 8%; background: #a8c9bd; }
.reader-wash-right { right: 7%; bottom: 10%; background: #babfd1; }

.glass {
  border: 1px solid rgba(255,255,255,.74);
  background: rgba(250, 252, 252, .68);
  box-shadow: 0 10px 35px rgba(60, 81, 91, .13), inset 0 1px rgba(255,255,255,.8);
  backdrop-filter: blur(30px) saturate(1.35);
  -webkit-backdrop-filter: blur(30px) saturate(1.35);
}
.reader-toolbar {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 24px;
  left: 24px;
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 13px;
  padding: 7px 10px;
  border-radius: 19px;
}
.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #526268;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}
.icon-button svg { width: 19px; height: 19px; }
.icon-button:hover { background: rgba(76, 116, 116, .09); }
.icon-button:active { transform: scale(.94); }
.document-heading { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.document-heading strong {
  overflow: hidden;
  color: #344148;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.document-heading span { color: #879297; font-size: 10px; }
.toolbar-actions { display: flex; align-items: center; gap: 2px; }

.paper-page {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  min-height: 516px;
  padding: 57px 55px 42px;
  background: #fbfaf6;
  box-shadow: 0 18px 45px rgba(49, 62, 67, .18), 0 2px 7px rgba(49,62,67,.09);
  transform: rotate(-.45deg);
}
.paper-content { color: #3d4543; }
.paper-kicker {
  margin: 0;
  color: #8c9b91;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
  letter-spacing: .15em;
}
.paper-accent { width: 26px; height: 2px; margin: 31px 0 20px; background: #91a89b; }
.paper-content h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 43px;
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.055em;
}
.paper-deck {
  max-width: 235px;
  margin: 15px 0 25px;
  color: #7b817d;
  font-family: var(--serif);
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
}
.paper-divider { width: 100%; height: 1px; margin: 0 0 19px; background: #e2e4dd; }
.paper-paragraph {
  margin: 0 0 15px;
  color: #626964;
  font-family: var(--serif);
  font-size: 11px;
  line-height: 1.85;
}
.paper-byline {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  color: #99a19b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 7px;
  letter-spacing: .12em;
}

.reader-controls {
  position: absolute;
  z-index: 2;
  bottom: 23px;
  left: 50%;
  display: flex;
  min-height: 56px;
  align-items: center;
  gap: 3px;
  padding: 7px 10px;
  border-radius: 18px;
  transform: translateX(-50%);
}
.page-step { width: 34px; height: 36px; }
.page-readout { display: flex; align-items: center; gap: 6px; padding: 0 6px; }
.page-readout input {
  width: 32px;
  padding: 5px 3px;
  border: 1px solid rgba(92, 117, 120, .16);
  border-radius: 7px;
  background: rgba(255,255,255,.55);
  color: #435256;
  text-align: center;
  font-size: 11px;
}
.page-total, .zoom-readout { color: #7d898d; font-size: 11px; white-space: nowrap; }
.control-divider { width: 1px; height: 23px; margin: 0 8px; background: rgba(74, 91, 96, .15); }
.zoom-button { width: 32px; height: 36px; }
.zoom-readout { min-width: 35px; color: #59686c; text-align: center; }
.reader-caption { margin: 13px 0 0; color: var(--soft-muted); text-align: center; font-size: 11px; }

@keyframes arrive {
  from { opacity: 0; transform: translateY(11px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #e5e9e8;
    --muted: #a2acab;
    --soft-muted: #879492;
    --accent: #9abbb2;
    --accent-deep: #a9c8bd;
    --canvas: #1b2428;
    --glass: rgba(38, 50, 54, .68);
    --glass-strong: rgba(38, 50, 54, .84);
    --glass-line: rgba(255, 255, 255, .12);
    --hairline: rgba(223, 238, 232, .1);
    --shadow: 0 22px 70px rgba(0, 0, 0, .26), 0 3px 12px rgba(0, 0, 0, .16);
  }
  body {
    background:
      radial-gradient(ellipse at 12% 8%, rgba(74, 112, 104, .34), transparent 34rem),
      radial-gradient(ellipse at 91% 28%, rgba(81, 84, 113, .3), transparent 36rem),
      radial-gradient(ellipse at 48% 84%, rgba(59, 84, 79, .3), transparent 40rem),
      var(--canvas);
  }
  .wordmark-mark { background: rgba(255,255,255,.05); border-color: rgba(174, 204, 192, .22); }
  .shelf-surface { border-color: rgba(255,255,255,.12); }
  .book-back { background: #58736c; border-color: rgba(177, 205, 191, .28); }
  .book-front { background: linear-gradient(145deg, #dce7df, #bfcfc6); border-color: rgba(255,255,255,.4); }
  .book-shadow { background: rgba(0,0,0,.32); }
  .reader-section-heading h2 { color: #dfe7e3; }
  .reader-stage {
    border-color: rgba(255,255,255,.12);
    background:
      radial-gradient(ellipse at 20% 40%, rgba(65, 103, 94, .34), transparent 40%),
      radial-gradient(ellipse at 83% 53%, rgba(76, 78, 104, .34), transparent 39%),
      rgba(29, 42, 46, .58);
  }
  .glass {
    border-color: rgba(255,255,255,.15);
    background: rgba(39, 52, 57, .78);
    box-shadow: 0 10px 35px rgba(0,0,0,.23), inset 0 1px rgba(255,255,255,.1);
  }
  .icon-button { color: #cad4d1; }
  .icon-button:hover { background: rgba(177, 209, 196, .1); }
  .document-heading strong { color: #e1e8e5; }
  .document-heading span { color: #9ba9a7; }
  .page-readout input { background: rgba(255,255,255,.07); color: #e2e9e6; border-color: rgba(255,255,255,.14); }
  .zoom-readout { color: #c3d0cd; }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 36px, 540px);
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }
  .library-view { margin-top: 57px; }
  .library-intro { margin-bottom: 26px; }
  .library-intro h1 { font-size: clamp(46px, 12vw, 60px); }
  .shelf-surface { min-height: 390px; border-radius: 23px; }
  .shelf-topline { padding: 17px 19px; }
  .empty-state { min-height: 334px; }
  .library-footer { padding: 15px 2px 0; }
  .reader-demo { margin-top: 91px; }
  .reader-section-heading { margin-bottom: 20px; }
  .reader-section-heading h2 { font-size: 37px; }
  .reader-stage {
    min-height: min(740px, 82dvh);
    padding: 95px 15px 91px;
    border-radius: 24px;
  }
  .reader-toolbar { top: 14px; right: 12px; left: 12px; min-height: 58px; gap: 6px; padding: 6px; border-radius: 17px; }
  .reader-toolbar > .icon-button { width: 34px; }
  .toolbar-actions { gap: 0; }
  .toolbar-actions .icon-button { width: 32px; }
  .document-heading strong { font-size: 11px; }
  .document-heading span { font-size: 9px; }
  .paper-page { width: min(100%, 370px); min-height: 474px; padding: 45px 37px 34px; }
  .paper-content h3 { font-size: 38px; }
  .paper-paragraph { font-size: 10.5px; }
  .reader-controls { bottom: 14px; min-height: 52px; }
}

@media (max-width: 390px) {
  .app-shell { width: calc(100% - 28px); }
  .header-note { font-size: 11px; }
  .shelf-count { font-size: 11px; }
  .reader-toolbar { right: 9px; left: 9px; }
  .reader-toolbar > .icon-button { width: 30px; }
  .toolbar-actions .icon-button { width: 29px; }
  .document-heading strong { max-width: 120px; }
  .paper-page { padding-right: 29px; padding-left: 29px; }
  .reader-controls { gap: 1px; padding-right: 7px; padding-left: 7px; }
  .control-divider { margin: 0 4px; }
}

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

[hidden] { display: none !important; }

.shelf-topline > div { display: flex; align-items: center; gap: 11px; }
.compact-open { display: none; min-height: 38px; padding: 0 13px; border-radius: 12px; font-size: 12px; }
.library-view.has-documents .compact-open { display: inline-flex; }
.document-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 17px;
  padding: 22px;
}
.document-card {
  position: relative;
  min-width: 0;
  overflow: visible;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: rgba(255,255,255,.35);
  box-shadow: 0 8px 24px rgba(68,91,99,.08), inset 0 1px rgba(255,255,255,.65);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  animation: arrive 300ms ease both;
}
.document-open {
  display: block;
  width: 100%;
  padding: 10px 10px 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.document-thumb {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 5;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(74,91,96,.08);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(250,250,247,.95), rgba(226,235,231,.9));
}
.document-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.thumb-placeholder { color: #70908a; font-size: 11px; letter-spacing: .12em; }
.document-details { min-width: 0; padding: 12px 13px 14px; }
.document-name {
  display: block;
  overflow: hidden;
  padding-right: 27px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}
.document-meta span { white-space: nowrap; }
.document-menu-wrap { position: absolute; right: 10px; bottom: 12px; z-index: 3; }
.document-menu-trigger {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.document-menu-trigger:hover, .document-menu-trigger[aria-expanded="true"] {
  border-color: var(--hairline);
  background: rgba(255,255,255,.5);
}
.document-menu-trigger svg { width: 18px; height: 18px; }
.document-menu {
  position: absolute;
  right: 0;
  bottom: 36px;
  display: grid;
  min-width: 146px;
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 14px;
  background: rgba(248,250,250,.92);
  box-shadow: 0 14px 38px rgba(36,52,59,.2);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.document-menu button {
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #344148;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}
.document-menu button:hover { background: rgba(76,116,116,.1); }
.document-menu button[data-action="delete"] { color: #a43f45; }

.reader-view {
  position: fixed;
  z-index: 20;
  inset: 0;
}
body.reading { overflow: hidden; }
.reader-stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 20% 38%, rgba(196,216,211,.57), transparent 40%),
    radial-gradient(ellipse at 83% 55%, rgba(205,210,222,.55), transparent 39%),
    var(--canvas);
}
.reader-pages {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: calc(86px + env(safe-area-inset-top)) 14px calc(98px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.page-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  overflow: hidden;
  border-radius: 2px;
  background: #fbfaf6;
  box-shadow: 0 16px 42px rgba(30,45,51,.18), 0 2px 7px rgba(30,45,51,.1);
  transition: width 140ms ease;
}
.page-frame canvas { display: block; width: 100%; height: auto; }
.page-loading {
  position: absolute;
  color: #899794;
  font-size: 12px;
}
.reader-toolbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  left: max(14px, env(safe-area-inset-left));
  max-width: 760px;
  margin: 0 auto;
  padding: 7px 10px;
  border-radius: 18px;
}
.toolbar-actions .icon-button { width: 38px; }
.reader-controls {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  gap: 7px;
  min-height: 53px;
  padding: 6px 9px;
  border-radius: 999px;
  transform: translateX(-50%);
}
.zoom-button { width: 38px; height: 38px; }
.page-indicator {
  min-width: 58px;
  color: var(--ink);
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.reader-stage.controls-hidden #reader-top-controls,
.reader-stage.controls-hidden #reader-bottom-controls {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-7px);
}
.reader-stage.controls-hidden #reader-bottom-controls { transform: translate(-50%, 7px); }
#reader-top-controls, #reader-bottom-controls {
  transition: opacity 180ms ease, transform 180ms ease;
}
#reader-document-title { max-width: min(42vw, 420px); }
#print-frame { position: fixed; width: 0; height: 0; border: 0; }

.app-dialog {
  width: min(92vw, 390px);
  padding: 25px;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 22px;
  background: var(--glass-strong);
  box-shadow: 0 24px 70px rgba(31,48,54,.24), inset 0 1px rgba(255,255,255,.7);
  color: var(--ink);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
}
.app-dialog::backdrop { background: rgba(20,31,35,.28); backdrop-filter: blur(5px); }
.app-dialog h2 { margin: 0 0 16px; font-size: 20px; font-weight: 600; letter-spacing: -.03em; }
.app-dialog .eyebrow { margin-bottom: 10px; }
.app-dialog label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.app-dialog input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: rgba(255,255,255,.45);
  color: var(--ink);
}
.dialog-copy { margin: -5px 0 19px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.quiet-button, .danger-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: rgba(255,255,255,.35);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.danger-button { border-color: rgba(164,63,69,.18); background: #a43f45; color: white; }
.dialog-actions .open-button { min-height: 42px; }

.toast {
  position: fixed;
  z-index: 90;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 16px;
  width: fit-content;
  max-width: min(440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 11px 15px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 999px;
  background: rgba(39,52,57,.9);
  box-shadow: 0 10px 30px rgba(15,24,27,.2);
  color: #fff;
  text-align: center;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.drop-curtain {
  position: fixed;
  z-index: 80;
  inset: 14px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(82,124,126,.55);
  border-radius: 28px;
  background: rgba(224,237,233,.82);
  color: #3f696b;
  font-size: 18px;
  font-weight: 600;
  backdrop-filter: blur(22px);
}

@media (prefers-color-scheme: dark) {
  .document-card { border-color: rgba(255,255,255,.12); background: rgba(38,50,54,.68); }
  .document-thumb { border-color: rgba(255,255,255,.08); background: linear-gradient(145deg,#e1e4df,#cbd4cf); }
  .document-menu { border-color: rgba(255,255,255,.16); background: rgba(35,47,52,.96); }
  .document-menu button { color: #e0e8e5; }
  .reader-stage { background: radial-gradient(ellipse at 20% 38%,rgba(65,103,94,.36),transparent 40%), radial-gradient(ellipse at 83% 55%,rgba(76,78,104,.34),transparent 39%),var(--canvas); }
  .page-frame { box-shadow: 0 16px 42px rgba(0,0,0,.35),0 2px 7px rgba(0,0,0,.2); }
  .app-dialog { border-color: rgba(255,255,255,.14); }
  .app-dialog input { background: rgba(255,255,255,.07); }
  .quiet-button { background: rgba(255,255,255,.06); }
  .drop-curtain { background: rgba(31,48,46,.88); color: #b7d4c9; }
}
@media (max-width: 900px) {
  .document-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .shelf-topline > div { gap: 8px; }
  .document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px; }
  .document-details { padding: 10px 10px 12px; }
  .document-name { font-size: 11px; }
  .document-meta { gap: 4px 7px; font-size: 9px; }
  .document-menu-wrap { right: 7px; bottom: 8px; }
  .reader-pages { padding-right: 8px; padding-left: 8px; }
  .reader-toolbar { right: 10px; left: 10px; min-height: 54px; gap: 5px; padding: 5px; }
  .reader-toolbar > .icon-button { width: 34px; }
  .toolbar-actions .icon-button { width: 34px; }
  .document-heading strong { font-size: 11px; }
  .document-heading span { font-size: 9px; }
  .app-dialog { position: fixed; right: 0; bottom: 0; left: 0; width: 100%; max-width: none; margin: 0; padding: 28px 22px calc(22px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; animation: sheet-up 220ms ease both; }
}
@keyframes sheet-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
