:root {
    color-scheme: dark;
    --bg: #030712;
    --bg-2: #07111f;
    --surface: rgba(8, 17, 33, 0.74);
    --surface-2: rgba(255, 255, 255, 0.055);
    --surface-3: rgba(255, 255, 255, 0.085);
    --text: #f6f8ff;
    --muted: #b8c3d8;
    --muted-2: #8190ad;
    --line: rgba(255, 255, 255, 0.14);
    --line-strong: rgba(184, 218, 255, 0.32);
    --brand: #7addff;
    --brand-2: #bba1ff;
    --accent: #75ffc7;
    --warning: #ffe2a3;
    --paper: #8edcff;
    --text-file: #75ffc7;
    --data: #ffd880;
    --doc: #bba1ff;
    --slides: #ff97c3;
    --image: #e7efff;
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.28);
    --radius-xl: 38px;
    --radius-lg: 26px;
    --radius-md: 18px;
    --max: 1240px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 10% -10%, rgba(122, 221, 255, 0.28), transparent 32rem),
        radial-gradient(circle at 85% 0%, rgba(187, 161, 255, 0.26), transparent 34rem),
        radial-gradient(circle at 50% 100%, rgba(117, 255, 199, 0.12), transparent 28rem),
        linear-gradient(180deg, #02040d 0%, #06101e 48%, #030712 100%);
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 58px 58px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.95), transparent 82%);
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: linear-gradient(115deg, transparent 0 45%, rgba(255,255,255,0.04) 45.2% 45.6%, transparent 46%),
                linear-gradient(22deg, transparent 0 65%, rgba(122,221,255,0.055) 65.2% 65.55%, transparent 66%);
}

::selection {
    background: rgba(117, 255, 199, 0.3);
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
}

code,
pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.orb {
    position: absolute;
    width: 34rem;
    height: 34rem;
    border-radius: 999px;
    filter: blur(60px);
    opacity: 0.38;
}

.orb-a { left: -12rem; top: 12rem; background: #1bbfff; }
.orb-b { right: -10rem; top: 25rem; background: #9b7cff; }
.orb-c { left: 34%; bottom: -20rem; background: #00ffa8; opacity: 0.2; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    width: min(var(--max), calc(100% - 32px));
    margin: 16px auto 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(3, 7, 18, 0.62);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 999px;
    color: #06101e;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    font-size: 0.84rem;
    font-weight: 950;
    letter-spacing: -0.04em;
    box-shadow: 0 0 28px rgba(122, 221, 255, 0.28);
}

.brand strong,
.brand small {
    display: block;
    white-space: nowrap;
}

.brand strong {
    font-size: 0.98rem;
    letter-spacing: -0.015em;
}

.brand small {
    margin-top: 2px;
    color: var(--muted-2);
    font-size: 0.78rem;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}

.nav a {
    border-radius: 999px;
    padding: 0.72rem 0.92rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 750;
    text-decoration: none;
    transition: background 160ms ease, color 160ms ease;
}

.nav a:hover {
    color: var(--text);
    background: rgba(255,255,255,0.075);
}

.page-shell {
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 34px;
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(290px, 390px);
    gap: clamp(18px, 4vw, 44px);
    min-height: 620px;
    padding: clamp(32px, 7vw, 82px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
        radial-gradient(circle at 22% 26%, rgba(122,221,255,0.23), transparent 26rem),
        radial-gradient(circle at 80% 20%, rgba(187,161,255,0.20), transparent 29rem),
        rgba(7, 17, 31, 0.62);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.hero-grid {
    position: absolute;
    inset: 0;
    opacity: 0.76;
    background:
        linear-gradient(110deg, transparent 0 48%, rgba(255,255,255,0.10) 48.15% 48.55%, transparent 48.7%),
        radial-gradient(circle at 76% 70%, rgba(117,255,199,0.18), transparent 16rem);
}

.hero::before {
    content: "";
    position: absolute;
    inset: auto -12% -28% 20%;
    height: 38%;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(122,221,255,0.18), transparent 65%);
    filter: blur(6px);
}

.hero-copy,
.hero-panel {
    position: relative;
    z-index: 1;
}

.eyebrow,
.section-kicker {
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 840px;
    margin-bottom: 24px;
    font-size: clamp(3.4rem, 9vw, 8.2rem);
    line-height: 0.86;
    letter-spacing: -0.09em;
}

h2 {
    margin-bottom: 12px;
    font-size: clamp(2rem, 4vw, 3.8rem);
    line-height: 0.96;
    letter-spacing: -0.055em;
}

h3 {
    letter-spacing: -0.03em;
}

.hero-lead {
    max-width: 730px;
    color: var(--muted);
    font-size: clamp(1.07rem, 2vw, 1.36rem);
    line-height: 1.7;
}

.hero-actions,
.paper-actions,
.spotlight-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 11px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    min-height: 46px;
    padding: 0.86rem 1.1rem;
    color: var(--text);
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
    transition: transform 170ms ease, border-color 170ms ease, background 170ms ease, box-shadow 170ms ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button-primary {
    color: #06101e;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    box-shadow: 0 16px 34px rgba(122, 221, 255, 0.16);
}

.button-primary:hover {
    box-shadow: 0 20px 45px rgba(122, 221, 255, 0.24);
}

.button-ghost {
    border-color: var(--line);
    background: rgba(255,255,255,0.06);
}

.button-ghost:hover {
    border-color: var(--line-strong);
    background: rgba(255,255,255,0.095);
}

.button-muted {
    border-color: rgba(255,255,255,0.08);
    color: var(--muted-2);
    background: rgba(255,255,255,0.035);
    cursor: default;
}

.button-small {
    min-height: 38px;
    padding: 0.62rem 0.82rem;
    font-size: 0.88rem;
}

.hero-panel {
    align-self: end;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)),
        rgba(3, 7, 18, 0.54);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), var(--shadow-soft);
}

.status-line {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 42px;
    border: 1px solid rgba(117,255,199,0.28);
    border-radius: 999px;
    padding: 0.5rem 0.72rem;
    color: #cffff0;
    background: rgba(117,255,199,0.08);
    font-size: 0.82rem;
    font-weight: 800;
}

.status-line span {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(117, 255, 199, 0.5);
    animation: pulse 2.2s infinite;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 16px rgba(117,255,199,0); }
    100% { box-shadow: 0 0 0 0 rgba(117,255,199,0); }
}

.hero-metric strong {
    display: block;
    font-size: clamp(4rem, 8vw, 6.5rem);
    line-height: 0.85;
    letter-spacing: -0.09em;
}

.hero-metric span {
    display: block;
    max-width: 280px;
    margin-top: 14px;
    color: var(--muted);
    line-height: 1.55;
}

.hero-metric code {
    color: var(--accent);
}

.hero-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.hero-panel-grid div {
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 18px;
    padding: 14px;
    background: rgba(255,255,255,0.045);
}

.hero-panel-grid b,
.hero-panel-grid span {
    display: block;
}

.hero-panel-grid b {
    margin-bottom: 5px;
    font-size: 1.08rem;
}

.hero-panel-grid span {
    color: var(--muted-2);
    font-size: 0.8rem;
}

.glass,
.spotlight,
.featured,
.public-note,
.metadata-panel {
    margin-top: 22px;
}

.spotlight {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 22px;
    align-items: end;
    padding: clamp(22px, 4vw, 38px);
    border: 1px solid rgba(117,255,199,0.22);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(117,255,199,0.12), rgba(122,221,255,0.06)), rgba(7,17,31,0.62);
    box-shadow: var(--shadow-soft);
}

.spotlight p {
    max-width: 820px;
    color: var(--muted);
    line-height: 1.68;
}

.spotlight-meta,
.paper-meta {
    margin: 0;
}

.spotlight-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spotlight-meta div {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.55rem 0.8rem;
    background: rgba(255,255,255,0.05);
}

.spotlight-meta dt,
.spotlight-meta dd {
    display: inline;
    margin: 0;
}

.spotlight-meta dt {
    color: var(--muted-2);
    font-weight: 850;
}

.spotlight-meta dd::before {
    content: " · ";
    color: var(--muted-2);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 18px;
    margin-bottom: 18px;
}

.text-link {
    color: var(--accent);
    font-weight: 850;
    text-decoration: none;
}

.text-link:hover {
    text-decoration: underline;
}

.featured {
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(255,255,255,0.035);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.feature-card {
    position: relative;
    min-height: 280px;
    padding: 22px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 20% 0%, rgba(122,221,255,0.15), transparent 16rem),
        rgba(7,17,31,0.66);
}

.feature-card h3 {
    margin: 22px 0 12px;
    font-size: 1.35rem;
    line-height: 1.16;
}

.feature-card h3 a {
    text-decoration: none;
}

.feature-card h3 a:hover {
    color: var(--brand);
}

.feature-card p {
    color: var(--muted);
    line-height: 1.6;
}

.feature-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    color: var(--muted-2);
    font-size: 0.9rem;
}

.feature-foot a {
    color: var(--accent);
    font-weight: 850;
    text-decoration: none;
}

.public-note {
    display: grid;
    grid-template-columns: 1.45fr 1fr 1fr 1fr;
    gap: 14px;
}

.note-card {
    min-height: 230px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.035)),
        rgba(7,17,31,0.58);
}

.note-card-large {
    min-height: 260px;
}

.note-card p {
    color: var(--muted);
    line-height: 1.65;
}

.note-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: 28px;
    border: 1px solid var(--line);
    border-radius: 16px;
    color: #06101e;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    font-weight: 950;
}

.archive {
    padding: clamp(18px, 3vw, 30px);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(3, 7, 18, 0.48);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.archive-head h2 {
    margin-bottom: 0;
}

.result-count {
    margin: 0;
    color: var(--muted);
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 200px 190px auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.field {
    display: grid;
    gap: 7px;
}

.field span {
    color: var(--muted-2);
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

input,
select {
    width: 100%;
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 0 14px;
    color: var(--text);
    outline: none;
    background: rgba(0,0,0,0.28);
}

input:focus,
select:focus {
    border-color: rgba(122,221,255,0.72);
    box-shadow: 0 0 0 4px rgba(122,221,255,0.12);
}

.layout-toggle {
    min-height: 50px;
    border: 1px solid var(--line);
    border-radius: 17px;
    padding: 0 16px;
    color: var(--text);
    background: rgba(255,255,255,0.06);
    cursor: pointer;
    font-weight: 850;
}

.layout-toggle:hover,
.layout-toggle.is-active {
    border-color: rgba(117,255,199,0.45);
    background: rgba(117,255,199,0.10);
}

.tag-rail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 20px;
}

.tag-chip {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.55rem 0.78rem;
    color: var(--muted);
    background: rgba(255,255,255,0.055);
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.tag-chip span {
    color: var(--muted-2);
}

.tag-chip.is-active,
.tag-chip:hover {
    border-color: rgba(117,255,199,0.55);
    color: var(--text);
    background: rgba(117,255,199,0.11);
}

.paper-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.paper-grid.compact {
    grid-template-columns: 1fr;
}

.paper-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 430px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(155deg, rgba(255,255,255,0.095), rgba(255,255,255,0.035)),
        rgba(7, 17, 31, 0.68);
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.paper-grid.compact .paper-card {
    min-height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    gap: 18px 22px;
}

.paper-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    opacity: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(122,221,255,0.20), transparent 40%, rgba(117,255,199,0.16));
    transition: opacity 180ms ease;
}

.paper-card:hover {
    transform: translateY(-4px);
    border-color: rgba(122,221,255,0.38);
}

.paper-card:hover::before {
    opacity: 1;
}

.paper-card > * {
    position: relative;
    z-index: 1;
}

.paper-card-top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
}

.file-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    width: max-content;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 0.7rem;
    font-size: 0.75rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.file-badge-paper { background: rgba(142,220,255,0.15); color: #ccefff; }
.file-badge-text { background: rgba(117,255,199,0.12); color: #cdffed; }
.file-badge-data { background: rgba(255,216,128,0.13); color: #ffe9b8; }
.file-badge-document { background: rgba(187,161,255,0.14); color: #e0d7ff; }
.file-badge-slides { background: rgba(255,151,195,0.13); color: #ffd7e7; }
.file-badge-image { background: rgba(231,239,255,0.12); color: #f5f8ff; }
.status-badge { color: var(--accent); background: rgba(117,255,199,0.08); }

.paper-card h3 {
    margin-bottom: 12px;
    font-size: 1.34rem;
    line-height: 1.17;
}

.paper-card h3 a {
    text-decoration: none;
}

.paper-card h3 a:hover {
    color: var(--brand);
}

.paper-abstract {
    color: var(--muted);
    line-height: 1.6;
}

.paper-meta {
    display: grid;
    gap: 8px;
    margin: auto 0 14px;
}

.paper-meta div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px dashed rgba(255,255,255,0.12);
    padding-bottom: 7px;
}

.paper-meta dt {
    color: var(--muted-2);
    font-size: 0.75rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.paper-meta dd {
    max-width: 65%;
    margin: 0;
    color: var(--text);
    text-align: right;
}

.paper-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 13px;
}

.paper-tags span {
    border-radius: 999px;
    padding: 0.35rem 0.55rem;
    color: var(--muted);
    background: rgba(255,255,255,0.07);
    font-size: 0.78rem;
}

.paper-path {
    margin-bottom: 15px;
    overflow: hidden;
    color: var(--muted-2);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    border: 1px dashed rgba(255,255,255,0.22);
    border-radius: var(--radius-lg);
    padding: 42px;
    text-align: center;
    color: var(--muted);
    background: rgba(0,0,0,0.16);
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    border: 1px solid var(--line);
    border-radius: 24px;
    color: var(--accent);
    font-size: 2.35rem;
    background: rgba(117,255,199,0.08);
}

.empty-state h3 {
    color: var(--text);
}

.empty-compact {
    margin-top: 16px;
    padding: 28px;
}

.metadata-panel {
    display: grid;
    grid-template-columns: 0.82fr 1.18fr;
    gap: 18px;
    align-items: stretch;
    padding: clamp(22px, 4vw, 36px);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(255,255,255,0.04);
}

.metadata-panel p {
    color: var(--muted);
    line-height: 1.68;
}

.metadata-panel pre {
    margin: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    color: #d9f7ff;
    background: rgba(0,0,0,0.30);
    line-height: 1.55;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    width: min(var(--max), calc(100% - 32px));
    margin: 0 auto;
    padding: 10px 0 28px;
    color: var(--muted-2);
    font-size: 0.9rem;
}

.site-footer p {
    margin: 0;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 60;
}

.modal.is-open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.74);
    backdrop-filter: blur(16px);
}

.modal-panel {
    position: absolute;
    inset: 26px;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: #07111f;
    box-shadow: var(--shadow);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,0.06);
}

.modal-head span {
    display: block;
    margin-bottom: 3px;
    color: var(--muted-2);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.modal-head h2 {
    margin: 0;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.modal-close {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: rgba(255,255,255,0.08);
    font-size: 1.7rem;
    cursor: pointer;
}

#previewFrame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 80;
    max-width: min(420px, calc(100% - 36px));
    border: 1px solid rgba(117,255,199,0.32);
    border-radius: 18px;
    padding: 13px 16px;
    color: var(--text);
    background: rgba(7,17,31,0.92);
    box-shadow: var(--shadow-soft);
    transform: translateY(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 1100px) {
    .hero,
    .spotlight,
    .metadata-panel {
        grid-template-columns: 1fr;
    }

    .featured-grid,
    .public-note,
    .paper-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .note-card-large {
        grid-column: 1 / -1;
    }

    .toolbar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .topbar {
        position: relative;
        flex-direction: column;
        align-items: stretch;
        border-radius: 26px;
    }

    .nav {
        justify-content: flex-start;
    }

    .page-shell,
    .topbar,
    .site-footer {
        width: min(100% - 18px, var(--max));
    }

    .hero {
        min-height: auto;
        padding: 28px;
        border-radius: 28px;
    }

    h1 {
        font-size: clamp(3.1rem, 17vw, 5.2rem);
    }

    .featured-grid,
    .public-note,
    .paper-grid,
    .paper-grid.compact,
    .toolbar {
        grid-template-columns: 1fr;
    }

    .paper-grid.compact .paper-card {
        display: flex;
    }

    .section-head,
    .site-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .modal-panel {
        inset: 8px;
        border-radius: 18px;
    }
}

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

/* v3: public topic/folder navigation and cleaner public release surface */
.topic-hub {
    padding: clamp(24px, 4vw, 42px);
    border-radius: var(--radius-lg);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.topic-card {
    display: flex;
    min-height: 112px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 22px;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025)),
        radial-gradient(circle at 80% 8%, rgba(122,221,255,0.12), transparent 9rem);
    text-decoration: none;
    box-shadow: var(--shadow-soft);
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.topic-card:hover,
.topic-card.is-active {
    transform: translateY(-2px);
    border-color: rgba(122,221,255,0.42);
    background:
        linear-gradient(135deg, rgba(122,221,255,0.13), rgba(255,255,255,0.04)),
        radial-gradient(circle at 82% 8%, rgba(117,255,199,0.18), transparent 9rem);
}

.topic-card strong {
    font-size: 1.02rem;
    line-height: 1.25;
}

.topic-card span {
    color: var(--muted);
    font-size: 0.88rem;
}

.topic-context {
    margin: 8px 0 0;
    color: var(--muted);
}

.topic-context a,
.spotlight-meta a {
    color: var(--accent);
    text-decoration: none;
}

.topic-pill,
.folder-badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(122,221,255,0.26);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--accent);
    background: rgba(122,221,255,0.08);
    font-size: 0.78rem;
    font-weight: 800;
    text-decoration: none;
}

.folder-badge {
    color: var(--text);
    background: rgba(255,255,255,0.055);
}

.paper-card-top {
    align-items: center;
    flex-wrap: wrap;
}

.field select#topicSelect {
    min-width: 180px;
}

@media (max-width: 1100px) {
    .topic-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .topic-grid {
        grid-template-columns: 1fr;
    }
}
