:root {
  color-scheme: light;
  --ink: #18171a;
  --muted: #716d75;
  --faint: #a6a1aa;
  --paper: #ffffff;
  --surface: #f8f7f4;
  --surface-soft: #f1efeb;
  --line: rgba(35, 30, 40, 0.10);
  --purple: #5e17eb;
  --purple-dark: #4912b7;
  --purple-soft: #eee8fd;
  --green: #117a50;
  --green-soft: #e5f6ed;
  --amber: #956516;
  --amber-soft: #fff3d5;
  --red: #b32936;
  --red-soft: #feecef;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --gutter: clamp(6rem, 16vw, 14rem);
  --font-body: "Rubik", ui-sans-serif, system-ui, sans-serif;
  --font-logo: "Young Serif", Georgia, serif;
  font-family: var(--font-body);
  font-optical-sizing: auto;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.5; }
h1, h2, h3, h4, h5, h6, strong, b, button { font-weight: 500; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
[hidden] { display: none !important; }

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topnav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem var(--gutter); background: rgba(255, 255, 255, .9); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px) saturate(150%); }
.brand { color: var(--purple); font-family: var(--font-logo); font-weight: 400; font-size: 1.4rem; line-height: 1; text-decoration: none; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-submit { white-space: nowrap; }
.top-submit svg { width: 17px; height: 17px; }
@media (min-width: 721px) {
  #view[data-page="paper"] { --gutter: clamp(2.4rem, 6.4vw, 5.6rem); }
}
.topnav-search { position: relative; flex: 1; min-width: 0; max-width: 35rem; margin-inline: auto; }
.topnav-search > span[data-icon] { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); width: 1.125rem; height: 1.125rem; display: grid; place-items: center; color: var(--muted); line-height: 0; pointer-events: none; }
.topnav-search > span[data-icon] svg { width: 100%; height: 100%; }
#global-search { width: 100%; min-height: 2.875rem; padding: 0.7rem 0.85rem 0.7rem 2.5rem; border: 1px solid rgba(35, 30, 40, .14); border-radius: 999px; color: var(--ink); background: var(--surface); outline: none; font: inherit; font-size: .86rem; transition: border-color 150ms ease, box-shadow 150ms ease; }
#global-search:focus { border-color: rgba(94, 23, 235, .65); box-shadow: 0 0 0 3px rgba(94, 23, 235, .10); }
#global-search::-webkit-search-cancel-button { cursor: pointer; }
.account-menu { position: relative; }
.avatar-button { display: block; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; transition: box-shadow 150ms ease; }
.avatar-button:hover { box-shadow: inset 0 0 0 999px rgba(24, 23, 26, .1); }
.avatar-button:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--purple); font-size: .82rem; font-weight: 500; line-height: 1; overflow: hidden; }
img.avatar { object-fit: cover; }
.avatar-xl { width: 84px; height: 84px; font-size: 1.6rem; flex: 0 0 auto; }
.menu-pop { position: absolute; top: calc(100% + 10px); right: 0; z-index: 40; min-width: 214px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(20, 15, 30, .16); }
.menu-hello { margin: 0; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); font-size: 1.05rem; font-weight: 500; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-size: .84rem; text-decoration: none; cursor: pointer; text-align: left; }
.menu-pop a > span[data-icon], .menu-pop button > span[data-icon] { width: 18px; height: 18px; display: grid; flex: 0 0 18px; place-items: center; color: var(--muted); line-height: 0; }
.menu-pop svg { width: 17px; height: 17px; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-soft); }
#view { width: 100%; margin: 0; padding: 1.5rem var(--gutter) 4.5rem; outline: none; container-type: inline-size; }
.page-title { margin: 0 0 20px; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.1; letter-spacing: -0.01em; }
.profile-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.profile-handle { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.profile-bio { margin: 10px 0 0; max-width: 640px; font-size: .9rem; }
.profile-school { margin: 8px 0 0; color: var(--muted); font-size: .8rem; }
.profile-actions { display: flex; gap: 4px; margin-left: auto; align-self: start; }
.profile-meta { margin: 0 0 24px; color: var(--muted); font-size: .86rem; }
.profile-meta strong { color: var(--ink); font-weight: 500; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.doc-info { grid-column: 1 / -1; }
@container (min-width: 1020px) {
  .doc-layout { grid-template-columns: 300px minmax(0, 1fr) 300px; }
  .doc-info { grid-column: auto; }
}
@container (max-width: 699px) {
  .doc-layout { grid-template-columns: 1fr; }
}
.doc-info h1 { margin: 8px 0 0; font-size: clamp(1.5rem, 2.4vw, 2rem); line-height: 1.2; }
.doc-info .abstract { margin: 14px 0 0; color: #4f4b53; font-size: .92rem; line-height: 1.7; }
.doc-info .tags { margin-top: 12px; }
.cite-note { margin: 12px 0 0; color: var(--muted); font-size: .78rem; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat, .card { background: var(--surface); border: 1px solid transparent; border-radius: 12px; }
.stat { min-height: 132px; padding: 20px; }
.stat small { display: block; color: var(--muted); font-size: .78rem; }
.stat strong { display: block; margin-top: 12px; font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1; }
.two-col { grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); margin-top: 16px; align-items: start; }
.card { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.card h2, .section-title { margin: 0; font-size: 1rem; }
.card-head a { color: var(--purple); font-size: .78rem; font-weight: 500; text-decoration: none; }

.paper-list, .activity-list { display: grid; }
.paper-row, .activity-row { display: grid; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.paper-row:first-child, .activity-row:first-child { border-top: 0; }
.paper-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.paper-row.cols-2 { grid-template-columns: minmax(0, 1fr) auto; }
.paper-row h3, .activity-row h3 { margin: 0; font-size: .91rem; line-height: 1.35; }
.paper-row p, .activity-row p { margin: 3px 0 0; color: var(--muted); font-size: .74rem; }
.activity-row { grid-template-columns: minmax(0, 1fr) auto; }
.activity-row strong { color: var(--green); font-size: 1rem; }
.card.card-plain { background: transparent; border-color: transparent; padding-left: 0; padding-right: 0; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; padding: 4px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--muted); font-size: .68rem; font-weight: 500; text-transform: capitalize; }
.badge.approved { color: var(--green); background: var(--green-soft); }
.badge.review { color: var(--amber); background: var(--amber-soft); }
.badge.rejected { color: var(--red); background: var(--red-soft); }

.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border: 1px solid transparent; border-radius: 999px; color: white; background: var(--purple); font-weight: 500; font-size: .86rem; text-decoration: none; cursor: pointer; transition: transform 140ms var(--ease-out), background-color 160ms ease, opacity 160ms ease; }
.button:active { transform: scale(.97); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-small { min-height: 38px; padding: 8px 13px; border-radius: 999px; font-size: .78rem; }
.button-secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.button-danger { color: var(--red); background: var(--red-soft); }
.button svg { width: 17px; height: 17px; }
.button > span[data-icon] { width: 18px; height: 18px; display: grid; flex: 0 0 18px; place-items: center; line-height: 0; }
.button > span[data-icon] svg { display: block; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; cursor: pointer; transition: transform 100ms var(--ease-out); }
.icon-button:active { transform: scale(.95); }
.icon-button svg { display: block; width: 22px; height: 22px; stroke-width: 2; }
.button svg, .view-toggle button svg, .save-btn svg, .tool-btn svg, .top-submit svg, .doc-ph svg, .menu-pop svg, .tile svg { stroke-width: 2; }
.cite-hero .button { width: 100%; }
.action-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.tile { display: grid; justify-items: center; align-content: start; gap: 7px; padding: 12px 6px; border: 1px solid transparent; border-radius: 10px; background: var(--surface); color: var(--ink); font-size: .7rem; font-weight: 500; cursor: pointer; transition: border-color 150ms ease; }
.tile svg { width: 20px; height: 20px; }
.tile:hover { border-color: var(--ink); }
.tile:disabled { opacity: .55; cursor: default; }
.tile[aria-pressed="true"] { color: var(--purple); }
.tile[aria-pressed="true"] svg { fill: currentColor; }
.tile-ic { display: contents; }
.link-btn.inline { display: inline; margin: 0 0 0 6px; }
.cite-note { margin: 12px 0 0; color: var(--muted); font-size: .78rem; }
.link-btn { padding: 0; margin-top: 6px; border: 0; background: none; color: var(--purple); font-size: .8rem; font-weight: 500; cursor: pointer; }
.abstract.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.doc-more h2 { margin: 0 0 6px; font-size: .95rem; }
.more-list { display: grid; }
.more-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; }
.more-row:first-child { border-top: 0; }
.more-thumb { width: 56px; margin: 0; }
.more-row small { display: block; color: var(--muted); font-size: .68rem; }
.more-row strong { display: block; margin: 2px 0; font-size: .8rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reader-sep { width: 1px; height: 22px; margin-inline: 4px; background: var(--line); }
.icon-button > span[data-icon] { width: 22px; height: 22px; display: grid; place-items: center; line-height: 0; }

.filters { position: sticky; top: 65px; z-index: 15; background: var(--paper); padding: 12px 0; margin-bottom: 8px; display: grid; gap: 10px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-row .select { min-width: 158px; flex: 0 0 auto; }
.pill-row .select-button { white-space: nowrap; }
.pill-row .select-button .select-label { overflow: hidden; text-overflow: ellipsis; }
.clear-all { flex: 0 0 auto; align-self: center; padding: 8px 6px; border: 0; background: transparent; color: var(--muted); font-size: .82rem; font-weight: 500; cursor: pointer; }
.clear-all:hover { color: var(--ink); }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 2px 0 8px; }
.result-count { margin: 0; color: var(--muted); font-size: .8rem; }
.view-toggle { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.view-toggle button { width: 34px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.view-toggle button svg { width: 17px; height: 17px; }
.view-toggle button[aria-pressed="true"] { background: var(--surface-soft); color: var(--ink); }
.result-list { display: grid; }
.result-row { display: grid; grid-template-columns: 118px minmax(0, 1fr) auto; gap: 18px; padding: 20px 0; border-top: 1px solid var(--line); }
.result-row:first-child { border-top: 0; }
.result-thumb, .doc-thumb { position: relative; display: block; overflow: hidden; border: 1px solid var(--ink); border-radius: 6px; background: var(--surface-soft); }
.result-thumb { width: 118px; aspect-ratio: 3 / 4; }
.result-thumb img, .doc-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.doc-badge { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 3px 7px; border-radius: 4px; background: rgba(24, 23, 26, .88); color: #fff; font-size: .6rem; font-weight: 500; letter-spacing: .04em; }
.doc-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.doc-ph svg { width: 30px; height: 30px; }
.result-main { min-width: 0; }
.result-top { margin: 0; color: var(--muted); font-size: .74rem; }
.result-row h3 { margin: 5px 0 0; font-size: 1rem; line-height: 1.4; }
.result-row h3 a { color: inherit; text-decoration: none; transition: color 150ms ease; }
.result-row h3 a:hover { color: var(--purple); }
.result-abs { margin: 7px 0 0; color: #4f4b53; font-size: .8rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-by { margin: 7px 0 0; color: var(--muted); font-size: .74rem; }
.result-row .tags { margin-top: 9px; }
.result-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 12px; }
.result-stat { display: grid; justify-items: end; gap: 2px; text-align: right; }
.result-stat strong { font-size: 1.2rem; line-height: 1; }
.result-stat span { color: var(--muted); font-size: .66rem; }
.tool-btn, .save-btn { display: inline-grid; place-items: center; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; transition: color 150ms ease, background-color 150ms ease; }
.tool-btn svg, .save-btn svg { width: 19px; height: 19px; }
.tool-btn:hover, .save-btn:hover { color: var(--ink); background: var(--surface-soft); }
.save-btn[aria-pressed="true"] { color: var(--purple); }
.save-btn[aria-pressed="true"] svg { fill: currentColor; }
.doc-card { display: flex; flex-direction: column; padding: 10px; background: var(--surface); border: 1px solid transparent; border-radius: 12px; transition: border-color 150ms ease; }
.doc-card:hover { border-color: var(--ink); }
.doc-thumb { aspect-ratio: 4 / 3; margin-bottom: 10px; }
.doc-card h3 { margin: 0; min-height: calc(1.4em * 2); font-size: .85rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.doc-card h3 a { color: inherit; text-decoration: none; }
.doc-card h3 a:hover { color: var(--purple); }
.doc-by { margin: 6px 0 0; color: var(--muted); font-size: .74rem; }
.doc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 14px; color: var(--muted); font-size: .74rem; }
.cal-pop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: min(296px, calc(100vw - 48px)); padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(20, 15, 30, .16); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head strong { font-size: .86rem; }
.cal-nav { width: 30px; height: 30px; }
.cal-nav svg { width: 15px; height: 15px; }
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { padding: 4px 0; text-align: center; color: var(--faint); font-size: .64rem; }
.cal-day { aspect-ratio: 1; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-size: .74rem; cursor: pointer; }
.cal-day:hover:not(:disabled) { background: var(--surface-soft); }
.cal-day:disabled { color: var(--faint); opacity: .4; cursor: default; }
.cal-day.sel { background: var(--purple); color: #fff; }
.cal-day.in-range { background: var(--purple-soft); color: var(--purple); }
.cal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.withdraw-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 20px 0 8px; }
.withdraw-bar small { color: var(--muted); font-size: .78rem; }
.field { display: grid; gap: 7px; }
.field label { color: #4e4a52; font-size: .76rem; font-weight: 500; }
.input, .field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid rgba(35, 30, 40, .14); border-radius: 8px; color: var(--ink); background: var(--surface); outline: none; transition: border-color 150ms ease, box-shadow 150ms ease; }
select.input, .field select { padding-right: 36px; text-overflow: ellipsis; }
.select { position: relative; min-width: 0; }
.select-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; cursor: pointer; }
.select-button .select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-button svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--muted); stroke-width: 2; transition: transform 160ms var(--ease-out); }
.select.open .select-button { border-color: rgba(94, 23, 235, .65); box-shadow: 0 0 0 3px rgba(94, 23, 235, .10); }
.select.open .select-button svg { transform: rotate(180deg); }
.select-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; display: grid; gap: 2px; max-height: 264px; overflow: auto; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px rgba(20, 15, 30, .14); }
.select-option { padding: 10px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-size: .86rem; font-weight: 400; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-option:hover { background: var(--surface-soft); }
.select-option[aria-selected="true"] { font-weight: 500; }
.field textarea { min-height: 132px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(94, 23, 235, .65); box-shadow: 0 0 0 3px rgba(94, 23, 235, .10); }
.field small { color: var(--muted); font-size: .7rem; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.field-full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-note { padding: 14px 16px; border-radius: 10px; color: #5f5441; background: #fff7e3; font-size: .78rem; }

.papers-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.meta-item { padding-top: 14px; border-top: 1px solid var(--line); }
.meta-item small { display: block; color: var(--muted); font-size: .7rem; }
.meta-item strong { font-size: .82rem; }
.reader { margin-top: 24px; }
.reader-bar { position: sticky; top: 77px; z-index: 5; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 8px 0; background: var(--paper); }
.reader-bar .icon-button { width: 34px; height: 34px; color: var(--ink); }
.reader-bar .icon-button svg { width: 18px; height: 18px; }
.reader-bar .icon-button:disabled { opacity: .3; cursor: default; }
.chev-l svg { transform: rotate(90deg); }
.chev-r svg { transform: rotate(-90deg); }
.chev-u svg { transform: rotate(180deg); }
.reader-main { display: flex; gap: 16px; align-items: flex-start; }
.doc-rail { position: sticky; top: 136px; display: grid; gap: 4px; justify-items: center; align-content: start; flex: 0 0 auto; }
.doc-rail .icon-button { width: 32px; height: 32px; }
.doc-rail .icon-button svg { width: 17px; height: 17px; }
.rail-page { min-width: 32px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); text-align: center; font-size: .78rem; }
.rail-total { color: var(--muted); font-size: .74rem; }
.reader-spacer { flex: 1; }
.reader-status { color: var(--muted); font-size: .82rem; }
.reader-pages { display: grid; gap: 16px; justify-items: center; }
.reader-shell { width: 100%; display: grid; justify-items: center; scroll-margin-top: 140px; }
.reader-shell canvas { border: 1px solid var(--ink); border-radius: 6px; background: #fff; box-shadow: 0 12px 32px rgba(20, 15, 30, .14); }
.reader:fullscreen { overflow: auto; background: var(--paper); padding: 16px; }
@media (max-width: 720px) {
  .reader-bar { top: 69px; }
}
.info-dot { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; background: var(--purple-soft); color: var(--purple); font-size: .68rem; font-weight: 500; font-style: normal; cursor: help; vertical-align: 1px; }
.info-dot::after { left: 0; top: calc(100% + 8px); }
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; z-index: 40; width: max-content; max-width: 240px; padding: 10px 12px; border-radius: 8px; background: #1b191d; color: #fff; font-size: .72rem; font-weight: 400; line-height: 1.5; white-space: normal; opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 150ms ease, transform 160ms var(--ease-out); }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateY(0); }
.save-btn::after, .tool-btn::after { right: -4px; top: calc(100% + 8px); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 8px; border-radius: 7px; color: #625b6a; background: var(--surface-soft); font-size: .68rem; }
.dot { margin: 0 .3em; }

.review-card { display: grid; gap: 18px; }
.review-card .review-top { display: flex; justify-content: space-between; gap: 20px; }
.review-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 250px; max-width: 360px; padding: 13px 15px; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; color: white; background: rgba(27, 25, 29, .94); box-shadow: 0 12px 40px rgba(0,0,0,.2); font-size: .8rem; transform: translateY(0); opacity: 1; transition: transform 180ms var(--ease-out), opacity 150ms ease; backdrop-filter: blur(14px); }
.toast { @starting-style { transform: translateY(8px); opacity: 0; } }
.toast.leaving { transform: translateY(8px); opacity: 0; }
.skeleton { height: 120px; border-radius: 12px; background: #ece9e4; }

@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--purple-dark); }
  .button-secondary:hover { background: var(--surface-soft); }
  .button-danger:hover { background: #fbdde2; }
}

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --gutter: 2.25rem; }
  .topnav { padding: 0.625rem var(--gutter); }
  .top-submit { min-height: 38px; padding: 8px 11px; }
  .filters { top: 61px; }
  .top-submit-label { display: none; }
  .brand { font-size: 1.25rem; }
  #view { padding: 1.25rem var(--gutter) calc(3.75rem + env(safe-area-inset-bottom)); }
  .stats, .two-col, .form-grid, .filters, .meta-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .paper-row { grid-template-columns: 1fr auto; }
  .paper-row > .badge { grid-column: 1; }
  .paper-row > strong { grid-column: 2; grid-row: 1; }
  .doc-rail { top: 128px; }
  .menu-pop { position: fixed; top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; min-width: 0; }
  .result-row { grid-template-columns: 84px minmax(0, 1fr) auto; gap: 12px; padding: 16px 0; }
  .result-thumb { width: 84px; }
  .result-abs { -webkit-line-clamp: 3; }
  .toast-region { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
  .toast { transition-property: opacity, background-color, color !important; transform: none !important; }
  .button:active, .icon-button:active { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .topnav, .toast { backdrop-filter: none; background: var(--surface); }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(0,0,0,.35); }
  .topnav { background: var(--paper); }
}
