@font-face {
    font-family: 'Avenir Next';
    src: url('/assets/fonts/AvenirNext-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Avenir Next';
    src: url('/assets/fonts/AvenirNext-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Avenir Next';
    src: url('/assets/fonts/AvenirNext-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Avenir Next';
    src: url('/assets/fonts/AvenirNext-Heavy.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --global-tabbar-h: 44px;
    --bg: #f0f0f0;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-strong: rgba(255, 255, 255, 0.94);
    --surface-border: rgba(29, 53, 87, 0.12);
    --ink: #12233d;
    --ink-soft: #536277;
    --accent: #e63946;
    --accent-strong: #c61f31;
    --blue: #1d3557;
    --cream: #f1faee;
    --shadow: 0 30px 80px rgba(17, 28, 46, 0.12);
    --shadow-soft: 0 18px 40px rgba(17, 28, 46, 0.08);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --content-width: 1500px;
    --header-height: 88px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    padding-top: var(--global-tabbar-h);
    min-height: 100vh;
    font-family: 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(29, 53, 87, 0.14), transparent 35%),
        radial-gradient(circle at top right, rgba(230, 57, 70, 0.12), transparent 32%),
        linear-gradient(180deg, #f7f7f7 0%, var(--bg) 100%);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.thesis-progress {
    position: fixed;
    inset: var(--global-tabbar-h) auto auto 0;
    width: 100%;
    height: 4px;
    z-index: 100;
    pointer-events: none;
    background: transparent;
}

.thesis-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--blue));
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.25);
}

.global-tabbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--global-tabbar-h);
    z-index: 300;
    display: flex;
    align-items: center;
    padding: 0 12px 0 8px;
    background: linear-gradient(180deg, #1e253c 0%, #141828 100%);
    border-bottom: 1px solid rgba(168, 218, 220, 0.1);
    box-shadow: 0 1px 0 rgba(168, 218, 220, 0.08), 0 4px 16px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.global-tabbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(168, 218, 220, 0.2) 35%, rgba(241, 250, 238, 0.15) 50%, rgba(168, 218, 220, 0.2) 65%, transparent 100%);
    pointer-events: none;
}

.tabbar-logo {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    margin-right: 6px;
    transition: opacity 0.15s;
    overflow: hidden;
}

.tabbar-logo:hover {
    opacity: 0.8;
    text-decoration: none;
}

.tabbar-logo img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
}

.tabbar-tabs {
    display: flex;
    align-items: stretch;
    height: 100%;
    gap: 0;
    min-width: 0;
}

.tabbar-tab {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-family: 'Avenir Next', 'Avenir', system-ui, sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(225, 235, 248, 0.6);
    text-decoration: none;
    letter-spacing: 0.01em;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.tabbar-tab:hover {
    color: #f1faee;
    background: rgba(69, 123, 157, 0.15);
    text-decoration: none;
}

.tabbar-tab.active {
    color: #f1faee;
    font-weight: 600;
}

.tabbar-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 8px;
    right: 8px;
    height: 2px;
    background: #e63946;
    border-radius: 2px 2px 0 0;
    box-shadow: 0 0 8px rgba(230, 57, 70, 0.6);
}

.tabbar-spacer {
    flex: 1;
}

.thesis-site-header {
    position: sticky;
    top: var(--global-tabbar-h);
    z-index: 60;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem clamp(1rem, 2vw, 2rem);
    min-height: var(--header-height);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    background: rgba(240, 240, 240, 0.74);
    border-bottom: 1px solid rgba(29, 53, 87, 0.08);
    transform: translateZ(0);
    will-change: transform;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-lockup img {
    width: 2.7rem;
    height: 2.7rem;
}

.reader-header-title {
    display: grid;
    gap: 0.1rem;
    text-align: center;
}

.reader-header-kicker {
    color: var(--ink-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.thesis-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.button {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.85rem 1.3rem;
    font: 700 0.95rem/1 'Avenir Next', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

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

.button-primary {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 12px 24px rgba(29, 53, 87, 0.18);
}

.button-secondary {
    background: #fff;
    color: var(--blue);
    border-color: rgba(29, 53, 87, 0.14);
}

.button-ghost {
    background: rgba(255, 255, 255, 0.58);
    color: var(--ink);
    border-color: rgba(29, 53, 87, 0.1);
}

.button-block {
    display: block;
    text-align: center;
}

.surface-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform: translateZ(0);
}

.section-eyebrow,
.eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

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

.text-link:hover {
    color: var(--accent-strong);
}

.thesis-home-main,
.reader-layout {
    width: min(calc(100% - 2rem), var(--content-width));
    margin: 0 auto;
}

.thesis-home-main {
    display: grid;
    gap: 1.4rem;
    padding: 1.25rem 0 2rem;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
    gap: clamp(1.5rem, 4vw, 4rem);
    align-items: center;
    padding: clamp(1.5rem, 4vw, 3rem);
    overflow: hidden;
}

.hero-copy h1 {
    margin: 0.3rem 0 0;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
}

.hero-subtitle {
    margin: 1rem 0 0;
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    color: var(--blue);
    font-weight: 600;
}

.hero-description,
.lead,
.feature-card p,
.chapter-card p,
.figure-gallery-copy p,
.reader-article p,
.thesis-quote,
.reader-footnotes li,
.thesis-table td,
.thesis-table th {
    color: var(--ink-soft);
    line-height: 1.74;
}

.hero-actions,
.hero-meta,
.feature-actions,
.chapter-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}

.hero-actions {
    margin-top: 1.5rem;
}

.hero-meta {
    margin-top: 1rem;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.hero-meta span {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.hero-mark {
    position: relative;
    min-height: 360px;
}

.hero-logo-stack {
    position: relative;
    min-height: 100%;
    display: grid;
    place-items: center;
}

.hero-primary-mark {
    width: min(24rem, 64vw);
    filter: drop-shadow(0 30px 50px rgba(29, 53, 87, 0.18));
    animation: heroSpinIn 1.2s cubic-bezier(0.18, 0.8, 0.2, 1) both;
}

.hero-logotype {
    width: min(26rem, 78vw);
    margin-top: -2rem;
    animation: heroFadeIn 1s ease 0.35s both;
}

@keyframes heroSpinIn {
    from {
        opacity: 0;
        transform: rotate(80deg) scale(0.55);
    }
    to {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thesis-abstract-card,
.chapter-map-card,
.figure-gallery-card {
    padding: clamp(1.3rem, 3vw, 2rem);
}

.lead {
    font-size: clamp(1.05rem, 1.5vw, 1.2rem);
    margin: 0.9rem 0 0;
}

.experience-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.2rem;
}

.feature-card {
    padding: 1.5rem;
}

.feature-card h2,
.chapter-map-card h2,
.figure-gallery-card h2,
.reader-article h1 {
    margin: 0.5rem 0 0;
    font-size: clamp(1.6rem, 2vw, 2rem);
    line-height: 1.1;
}

.feature-note {
    display: inline-block;
    margin-top: 1rem;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.account-inline-card,
.reader-save-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(230, 57, 70, 0.12);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(241, 250, 238, 0.88));
}

.account-inline-card h2,
.reader-save-banner strong {
    display: block;
    margin: 0.35rem 0 0;
    font-size: 1.08rem;
    line-height: 1.3;
}

.account-inline-card p,
.reader-save-banner p,
.reader-account-copy {
    margin: 0.4rem 0 0;
    color: var(--ink-soft);
}

.account-inline-actions,
.account-pane-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.section-heading-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.2rem;
}

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

.chapter-card {
    display: grid;
    gap: 0.6rem;
    align-content: start;
    min-height: 230px;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(29, 53, 87, 0.08);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.chapter-card:hover,
.figure-gallery-card:hover,
.rail-nav a:hover,
.drawer-nav a:hover,
.drawer-subnav a:hover,
.figure-rail-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(230, 57, 70, 0.22);
}

.chapter-card-number {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
}

.chapter-card h3 {
    margin: 0;
    font-size: 1.25rem;
}

.figure-gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.figure-gallery-card {
    display: grid;
    gap: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(29, 53, 87, 0.08);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.figure-gallery-card img {
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #fff;
}

.figure-gallery-copy {
    padding: 1rem;
    display: grid;
    gap: 0.35rem;
}

.figure-gallery-copy span {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
}

.reader-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 248px;
    gap: 1rem;
    align-items: start;
    padding: 1rem 0 2rem;
}

.reader-rail {
    position: sticky;
    top: calc(var(--global-tabbar-h) + var(--header-height) + 1rem);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.3rem;
    padding: 1.1rem;
    max-height: calc(100vh - var(--global-tabbar-h) - var(--header-height) - 2rem);
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.reader-rail-left,
.reader-rail-right {
    width: 100%;
}

.reader-rail-left {
    height: calc(100vh - var(--global-tabbar-h) - var(--header-height) - 2rem);
    padding: 0;
    overflow: hidden;
}

.rail-group {
    display: grid;
    gap: 0.8rem;
    min-width: 0;
    width: 100%;
}

.rail-nav,
.drawer-nav,
.drawer-subnav {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    width: 100%;
}

.rail-nav a,
.rail-nav .rail-chapter-link,
.rail-nav .drawer-nav-item,
.drawer-nav a,
.drawer-nav .drawer-nav-item,
.drawer-subnav a {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.7rem;
    align-items: start;
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    border: 1px solid rgba(29, 53, 87, 0.08);
    background: rgba(255, 255, 255, 0.66);
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    min-width: 0;
}

.rail-nav a span:last-child,
.rail-nav .rail-chapter-link span:last-child,
.rail-nav .drawer-nav-item span:last-child,
.drawer-nav a span:last-child,
.drawer-nav .drawer-nav-item span:last-child,
.drawer-subnav a span:last-child {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: normal;
}

.rail-nav a.is-active,
.drawer-nav a.is-active,
.drawer-subnav a.is-active {
    background: rgba(29, 53, 87, 0.08);
    border-color: rgba(29, 53, 87, 0.18);
}

.rail-nav .is-disabled,
.drawer-nav .is-disabled {
    color: rgba(29, 53, 87, 0.5);
    background: rgba(244, 246, 249, 0.9);
    border-color: rgba(29, 53, 87, 0.06);
    cursor: default;
}

.chapter-number {
    color: var(--accent);
    font-weight: 800;
    min-width: 2rem;
}

.reader-rail-left .rail-slider {
    flex: 1 1 auto;
    position: relative;
    width: 100%;
    min-width: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.reader-rail-left .rail-view {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: start;
    gap: 1rem;
    min-height: 0;
    height: 100%;
    padding: 1.1rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    opacity: 0;
    pointer-events: none;
    transform: translateX(8%);
    transition: transform 0.32s cubic-bezier(0.22, 0.9, 0.28, 1), opacity 0.24s ease;
}

.reader-rail-left .rail-view-root {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.reader-rail-left.is-detail-view .rail-view-root {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-8%);
}

.reader-rail-left.is-detail-view .rail-view-detail {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.rail-search-shell {
    position: relative;
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    width: 100%;
}

.rail-search-label {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 700;
}

.rail-search-input {
    width: 100%;
    border: 1px solid rgba(29, 53, 87, 0.1);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    font: 600 0.95rem/1.2 'Avenir Next', sans-serif;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.rail-search-input:focus {
    outline: none;
    border-color: rgba(230, 57, 70, 0.3);
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.08);
}

.rail-search-results {
    display: grid;
    gap: 0.5rem;
    max-height: 58vh;
    overflow: auto;
    padding-right: 0.15rem;
    width: 100%;
}

.rail-search-results[hidden] {
    display: none;
}

.search-result-card {
    display: grid;
    gap: 0.35rem;
    width: 100%;
    border: 1px solid rgba(29, 53, 87, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.85rem 0.95rem;
    text-align: left;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(230, 57, 70, 0.24);
}

.search-result-kicker {
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-result-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.search-result-preview {
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.45;
}

.search-hit {
    background: rgba(255, 214, 102, 0.74);
    color: var(--ink);
    border-radius: 0.35rem;
    padding: 0 0.15rem;
}

.rail-chapter-nav {
    align-content: start;
}

.rail-chapter-row {
    --chapter-progress: 0%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: stretch;
    min-width: 0;
    width: 100%;
}

.rail-chapter-link {
    position: relative;
    overflow: hidden;
    min-width: 0;
    width: 100%;
}

.rail-chapter-link.is-disabled {
    pointer-events: none;
}

.rail-chapter-link::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--chapter-progress);
    background: linear-gradient(90deg, rgba(255, 214, 102, 0.34), rgba(255, 214, 102, 0.12));
    transition: width 0.18s ease;
    pointer-events: none;
}

.rail-chapter-link > span {
    position: relative;
    z-index: 1;
}

.rail-detail-button {
    width: 2.7rem;
    border: 1px solid rgba(29, 53, 87, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--blue);
    font: 800 1.15rem/1 'Avenir Next', sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.rail-detail-button:hover {
    transform: translateY(-1px);
    border-color: rgba(230, 57, 70, 0.22);
    box-shadow: var(--shadow-soft);
}

.rail-chapter-row.is-disabled .chapter-number,
.drawer-nav .is-disabled .chapter-number {
    color: rgba(29, 53, 87, 0.38);
}

.rail-back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    min-height: 2.7rem;
    border: 1px solid rgba(230, 57, 70, 0.16);
    border-radius: 999px;
    padding: 0.7rem 1rem;
    background: rgba(255, 246, 222, 0.82);
    color: var(--accent-strong);
    box-shadow: 0 12px 22px rgba(230, 57, 70, 0.08);
    font: 800 0.95rem/1 'Avenir Next', sans-serif;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.rail-back-button:hover {
    transform: translateY(-1px);
    border-color: rgba(230, 57, 70, 0.24);
    box-shadow: 0 16px 28px rgba(230, 57, 70, 0.12);
}

.rail-detail-kicker {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rail-detail-title {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.1;
}

.rail-chapter-row.recently-viewed .rail-chapter-link,
.rail-chapter-row.recently-viewed .rail-detail-button {
    animation: warmRail 2.1s ease forwards;
}

.reader-article {
    padding: clamp(1.2rem, 3vw, 2.4rem);
}

.chapter-hero {
    display: grid;
    gap: 0.9rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(29, 53, 87, 0.08);
    margin-bottom: 1.5rem;
}

.reader-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.reader-section {
    display: grid;
    gap: 1rem;
}

.thesis-block {
    margin: 0;
    min-width: 0;
    max-width: 100%;
}

.thesis-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.1rem;
    padding-top: 0.7rem;
}

.thesis-heading-main {
    display: grid;
    gap: 0.2rem;
}

.thesis-heading-number {
    display: inline-block;
    margin-bottom: 0.35rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.thesis-heading h2,
.thesis-heading h3 {
    margin: 0;
    line-height: 1.14;
}

.thesis-heading h2 {
    font-size: clamp(1.45rem, 2vw, 2rem);
}

.thesis-heading h3 {
    font-size: clamp(1.15rem, 1.6vw, 1.45rem);
}

.note-scope-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.15rem;
    min-height: 2.15rem;
    padding: 0.35rem 0.62rem;
    border-radius: 999px;
    border: 1px solid rgba(78, 142, 199, 0.24);
    background: rgba(214, 237, 255, 0.82);
    color: #2d6f9f;
    font: 800 0.88rem/1 'Avenir Next', sans-serif;
    box-shadow: 0 10px 22px rgba(78, 142, 199, 0.12);
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.note-scope-indicator[hidden] {
    display: none !important;
}

.note-scope-indicator:hover,
.note-scope-indicator.is-active {
    transform: translateY(-1px);
    background: rgba(190, 227, 255, 0.96);
    box-shadow: 0 14px 26px rgba(78, 142, 199, 0.16);
}

.thesis-paragraph,
.thesis-list,
.thesis-quote,
.reader-footnotes ol {
    font-size: 1.03rem;
}

.thesis-list {
    padding-left: 1.2rem;
}

.thesis-list li + li {
    margin-top: 0.45rem;
}

.thesis-quote {
    padding: 1.2rem 1.4rem;
    border-left: 4px solid var(--accent);
    background: rgba(255, 255, 255, 0.62);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.thesis-chapter-abstract {
    display: grid;
    gap: 0.65rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(241, 250, 238, 0.84), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(230, 57, 70, 0.12);
}

.thesis-chapter-abstract p {
    margin: 0;
}

.thesis-figure,
.thesis-table,
.thesis-equation {
    display: grid;
    gap: 0.9rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.thesis-figure-media {
    display: grid;
    gap: 0.9rem;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.thesis-figure-item {
    display: grid;
    gap: 0.55rem;
    min-width: 0;
}

.thesis-figure-zoom {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    cursor: zoom-in;
    box-shadow: var(--shadow-soft);
}

.thesis-figure-zoom img {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: min(68vh, 980px);
    height: auto;
    margin: 0 auto;
    object-fit: contain;
}

.thesis-figure figcaption,
.thesis-table figcaption,
.thesis-equation figcaption,
.thesis-figure-item figcaption {
    color: var(--ink-soft);
    line-height: 1.6;
}

.thesis-figure figcaption .label,
.thesis-table figcaption .label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.thesis-table-wrap {
    overflow: auto;
}

.thesis-table table {
    width: 100%;
    border-collapse: collapse;
}

.thesis-table th,
.thesis-table td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid rgba(29, 53, 87, 0.08);
    text-align: left;
    vertical-align: top;
}

.thesis-equation {
    text-align: center;
}

.math-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.4rem;
}

.math-inline {
    white-space: nowrap;
}

.thesis-citation-group {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    flex-wrap: wrap;
    vertical-align: middle;
}

.thesis-citation,
.thesis-crossref,
.thesis-inline-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: rgba(29, 53, 87, 0.08);
    border: 1px solid rgba(29, 53, 87, 0.08);
    font-size: 0.88em;
    text-decoration: none;
}

.thesis-citation {
    color: var(--blue);
    font: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.thesis-citation:hover {
    transform: translateY(-1px);
    border-color: rgba(230, 57, 70, 0.2);
    background: rgba(255, 226, 158, 0.52);
}

.thesis-crossref {
    color: var(--accent);
    font-weight: 700;
}

.thesis-crossref-disabled {
    color: rgba(29, 53, 87, 0.48);
    background: rgba(29, 53, 87, 0.05);
    border-color: rgba(29, 53, 87, 0.05);
    cursor: default;
}

.smallcaps {
    font-variant: small-caps;
    letter-spacing: 0.04em;
}

.reader-footnotes {
    margin-top: 2rem;
    padding-top: 1.4rem;
    border-top: 1px solid rgba(29, 53, 87, 0.08);
}

.chapter-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

.chapter-pager {
    min-width: 220px;
    max-width: 48%;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(29, 53, 87, 0.08);
    text-decoration: none;
}

.chapter-pager span {
    display: block;
    color: var(--ink-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chapter-pager strong {
    display: block;
    margin-top: 0.25rem;
}

.figure-rail-list {
    display: grid;
    gap: 0.8rem;
    width: 100%;
}

.figure-rail-card {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    align-items: start;
    padding: 0.65rem;
    border-radius: 18px;
    border: 1px solid rgba(29, 53, 87, 0.08);
    background: rgba(255, 255, 255, 0.68);
    text-decoration: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.figure-rail-card img {
    width: 72px;
    height: 56px;
    object-fit: cover;
    border-radius: 12px;
    background: #fff;
}

.figure-rail-card div {
    min-width: 0;
}

.figure-rail-card span {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.reader-account-card {
    border-color: rgba(230, 57, 70, 0.12);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(241, 250, 238, 0.88));
}

.thesis-drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 80;
    width: min(92vw, 400px);
    height: 100vh;
    padding: 1rem;
    background: rgba(248, 248, 248, 0.96);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border-left: 1px solid rgba(29, 53, 87, 0.1);
    box-shadow: -20px 0 60px rgba(17, 28, 46, 0.14);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.28, 1);
    overflow: auto;
}

body.drawer-open .thesis-drawer {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.drawer-close {
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font: 700 0.9rem/1 'Avenir Next', sans-serif;
    cursor: pointer;
}

.drawer-subnav {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(29, 53, 87, 0.08);
}

.drawer-search-shell {
    margin-bottom: 1rem;
}

.thesis-scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    background: rgba(18, 35, 61, 0.16);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.24s ease, visibility 0.24s ease;
}

body.drawer-open .thesis-scrim {
    opacity: 1;
    visibility: visible;
}

.account-sheet {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(18, 35, 61, 0.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.account-sheet[hidden] {
    display: none;
}

.account-sheet-dialog {
    width: min(100%, 640px);
    max-height: min(88vh, 900px);
    display: grid;
    gap: 1.1rem;
    padding: 1.25rem;
    overflow: auto;
}

.account-sheet-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.account-sheet-head h2 {
    margin: 0.35rem 0 0;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    line-height: 1.12;
}

.account-sheet-body {
    display: grid;
    gap: 1rem;
}

.account-pane,
.account-notes-panel {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.account-pane[hidden],
.account-notes-panel[hidden] {
    display: none;
}

.account-pane-copy {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.6;
}

.account-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    padding: 0.55rem 0.85rem;
    border-radius: 999px;
    color: var(--blue);
    background: rgba(29, 53, 87, 0.08);
    border: 1px solid rgba(29, 53, 87, 0.08);
    font-size: 0.94rem;
    font-weight: 700;
}

.account-form {
    display: grid;
    gap: 0.7rem;
}

.account-form-label {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 700;
}

.account-form-input,
.account-form-textarea {
    width: 100%;
    border: 1px solid rgba(29, 53, 87, 0.12);
    border-radius: 18px;
    padding: 0.95rem 1rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.88);
    font: 600 1rem/1.35 'Avenir Next', sans-serif;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.account-form-textarea {
    resize: vertical;
    min-height: 132px;
}

.account-form-code {
    font-size: 1.3rem;
    letter-spacing: 0.2em;
    text-align: center;
}

.account-form-input:focus,
.account-form-textarea:focus {
    outline: none;
    border-color: rgba(230, 57, 70, 0.3);
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.08);
}

.account-target-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 2.8rem;
    padding: 0.65rem 0.85rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(29, 53, 87, 0.1);
    color: var(--blue);
    font-weight: 700;
}

.account-notes-list {
    display: grid;
    gap: 0.75rem;
}

.account-note-card {
    display: grid;
    gap: 0.45rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.account-note-target {
    color: var(--accent);
    font-size: 0.77rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.account-note-card p {
    margin: 0;
    color: var(--ink-soft);
}

.account-note-card blockquote {
    margin: 0;
    padding: 0.7rem 0.85rem;
    border-radius: 16px;
    background: rgba(201, 231, 255, 0.38);
    color: var(--blue);
    font-size: 0.95rem;
    line-height: 1.5;
}

.account-note-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.account-note-warning {
    color: #3f6f99;
    font-size: 0.86rem;
    line-height: 1.45;
}

.account-note-link {
    width: fit-content;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.account-feedback {
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: rgba(29, 53, 87, 0.08);
    color: var(--blue);
    line-height: 1.5;
}

.account-feedback.is-error {
    background: rgba(230, 57, 70, 0.1);
    color: var(--accent-strong);
}

.selection-actionbar {
    position: fixed;
    left: 50%;
    bottom: 1.15rem;
    z-index: 90;
    width: min(calc(100vw - 2rem), 720px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.95rem 1rem;
    border-radius: 24px;
    background: rgba(18, 35, 61, 0.94);
    color: #fff;
    box-shadow: 0 24px 54px rgba(8, 20, 37, 0.28);
    transform: translate(-50%, calc(100% + 1rem));
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.28, 1), opacity 0.22s ease;
}

.selection-actionbar.is-active {
    transform: translate(-50%, 0);
    opacity: 1;
}

.selection-actionbar-copy {
    display: grid;
    gap: 0.3rem;
}

.selection-actionbar-copy p {
    margin: 0;
    color: rgba(241, 248, 255, 0.86);
    line-height: 1.45;
}

.selection-actionbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: end;
}

.note-compose-sheet,
.note-manager {
    position: fixed;
    inset: 0;
    z-index: 82;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(18, 35, 61, 0.18);
    backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.note-compose-sheet[hidden],
.note-manager[hidden] {
    display: none;
}

.note-compose-sheet.is-active,
.note-manager.is-active {
    opacity: 1;
    pointer-events: auto;
}

.note-compose-dialog,
.note-manager-dialog {
    width: min(100%, 760px);
    max-height: min(88vh, 860px);
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
    overflow: auto;
}

.note-compose-head,
.note-manager-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.note-compose-head h2,
.note-manager-head h2 {
    margin: 0.3rem 0 0;
    font-size: clamp(1.35rem, 2.4vw, 1.9rem);
    line-height: 1.1;
}

.note-manager-head p,
.note-compose-context blockquote {
    margin: 0;
}

.note-compose-body,
.note-manager-list,
.note-manager-card-list {
    display: grid;
    gap: 0.85rem;
}

.note-compose-context {
    display: grid;
    gap: 0.7rem;
}

.note-compose-context blockquote {
    padding: 0.9rem 1rem;
    border-radius: 20px;
    background: rgba(201, 231, 255, 0.34);
    color: var(--blue);
    line-height: 1.58;
}

.note-compose-actions,
.note-manager-card-actions,
.note-inline-popover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.note-manager-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.note-manager-summary {
    margin: 0;
    color: var(--ink-soft);
}

.note-manager-empty {
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink-soft);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.note-manager-chapter-group {
    display: grid;
    gap: 0.85rem;
}

.note-manager-chapter-head {
    display: grid;
    gap: 0.2rem;
}

.note-manager-chapter-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.note-manager-card {
    display: grid;
    gap: 0.7rem;
    padding: 0.95rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(29, 53, 87, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.note-manager-card.is-highlighted {
    border-color: rgba(78, 142, 199, 0.34);
    background: rgba(221, 241, 255, 0.58);
}

.note-manager-card-kicker,
.note-inline-popover-kicker {
    color: #2d6f9f;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.note-manager-card p,
.note-manager-card blockquote,
.note-inline-popover-body p,
.note-inline-popover-body blockquote {
    margin: 0;
}

.note-manager-card blockquote,
.note-inline-popover-body blockquote {
    padding: 0.7rem 0.85rem;
    border-radius: 16px;
    background: rgba(201, 231, 255, 0.38);
    color: var(--blue);
    line-height: 1.52;
}

.note-manager-warning,
.note-inline-warning {
    color: #3f6f99;
    font-size: 0.86rem;
    line-height: 1.45;
}

.note-manager-textarea {
    width: 100%;
    min-height: 140px;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(29, 53, 87, 0.12);
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font: 600 1rem/1.45 'Avenir Next', sans-serif;
    resize: vertical;
}

.note-manager-textarea:focus {
    outline: none;
    border-color: rgba(78, 142, 199, 0.34);
    box-shadow: 0 0 0 4px rgba(78, 142, 199, 0.12);
}

.note-inline-anchor {
    display: inline;
    background: rgba(177, 220, 255, 0.68);
    box-shadow: inset 0 -0.45em 0 rgba(177, 220, 255, 0.86);
    border-radius: 0.32rem;
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.note-inline-anchor:hover,
.note-inline-anchor.is-active,
.note-inline-anchor:focus-visible {
    background: rgba(129, 198, 255, 0.84);
    box-shadow: inset 0 -0.55em 0 rgba(129, 198, 255, 0.98), 0 0 0 2px rgba(78, 142, 199, 0.16);
    outline: none;
}

.note-inline-popover {
    position: fixed;
    z-index: 88;
    width: min(calc(100vw - 1.5rem), 360px);
}

.note-inline-popover[hidden] {
    display: none;
}

.note-inline-popover-card {
    display: grid;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    border-radius: 22px;
    background: rgba(245, 250, 255, 0.98);
    border: 1px solid rgba(78, 142, 199, 0.18);
    box-shadow: 0 18px 36px rgba(29, 53, 87, 0.18);
}

.note-inline-popover-body {
    display: grid;
    gap: 0.7rem;
    color: var(--ink-soft);
    line-height: 1.52;
}

.thesis-lightbox {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(14, 22, 35, 0.84);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    transition: opacity 0.24s ease;
}

.thesis-lightbox[hidden] {
    display: none;
}

.thesis-lightbox figure {
    width: min(94vw, 1200px);
    margin: 0;
    display: grid;
    gap: 0.9rem;
    transform: translateY(28px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.28, 1);
}

.thesis-lightbox.is-active {
    opacity: 1;
}

.thesis-lightbox.is-active figure {
    transform: translateY(0) scale(1);
}

.lightbox-stage {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
}

.lightbox-image-shell {
    min-width: 0;
}

.thesis-lightbox img {
    width: 100%;
    max-height: 72vh;
    object-fit: contain;
    border-radius: 22px;
    background: #fff;
}

.lightbox-nav {
    border: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font: 800 1.5rem/1 'Avenir Next', sans-serif;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease;
}

.lightbox-nav:hover {
    transform: scale(1.04);
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-thumbs {
    display: flex;
    gap: 0.65rem;
    overflow: auto;
    padding-bottom: 0.2rem;
}

.lightbox-thumb {
    flex: 0 0 auto;
    width: 74px;
    height: 74px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    overflow: hidden;
}

.lightbox-thumb.is-active {
    border-color: rgba(255, 214, 102, 0.95);
    box-shadow: 0 0 0 4px rgba(255, 214, 102, 0.16);
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: none;
    border-radius: 0;
}

.lightbox-meta {
    display: grid;
    gap: 0.45rem;
}

.lightbox-counter {
    width: fit-content;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.thesis-lightbox figcaption {
    color: rgba(255, 255, 255, 0.84);
    text-align: left;
    line-height: 1.55;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 999px;
    padding: 0.8rem 1rem;
    font: 700 0.95rem/1 'Avenir Next', sans-serif;
    cursor: pointer;
}

.reference-explorer {
    position: fixed;
    inset: 0;
    z-index: 92;
    display: grid;
    place-items: center;
    padding: 1.15rem;
    background: rgba(18, 35, 61, 0.22);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.24s ease;
    overscroll-behavior: contain;
}

.reference-explorer[hidden] {
    display: none;
}

.reference-explorer-dialog {
    width: min(100%, 980px);
    max-height: min(88vh, 920px);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0.9rem;
    padding: 1rem;
    overflow: hidden;
    transform: translateY(30px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.22, 0.9, 0.28, 1);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(252, 252, 252, 0.94) 100%);
    border: 1px solid rgba(29, 53, 87, 0.1);
    box-shadow: 0 36px 90px rgba(17, 28, 46, 0.18);
}

.reference-explorer.is-active {
    opacity: 1;
}

.reference-explorer.is-active .reference-explorer-dialog {
    transform: translateY(0) scale(1);
}

.reference-explorer-head {
    display: grid;
    gap: 0.7rem;
    padding: 0.15rem 0.15rem 0;
}

.reference-explorer-grabber {
    justify-self: center;
    width: 3rem;
    height: 0.32rem;
    border-radius: 999px;
    background: rgba(29, 53, 87, 0.16);
}

.reference-explorer-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.reference-explorer-titleblock {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.reference-explorer-head h2 {
    margin: 0;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    line-height: 1.04;
}

.reference-explorer-titleblock p {
    margin: 0;
    max-width: 48rem;
    color: var(--ink-soft);
    font-size: 0.98rem;
    line-height: 1.45;
}

.reference-close-button,
.reference-back-button {
    border: 1px solid rgba(29, 53, 87, 0.1);
    border-radius: 999px;
    min-height: 2.75rem;
    padding: 0.72rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    color: var(--blue);
    font: 800 0.92rem/1 'Avenir Next', sans-serif;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 10px 22px rgba(17, 28, 46, 0.08);
}

.reference-close-button:hover,
.reference-back-button:hover {
    transform: translateY(-1px);
    border-color: rgba(230, 57, 70, 0.22);
    background: rgba(255, 246, 222, 0.92);
}

.reference-explorer-toolbar {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 24px;
    background: rgba(248, 249, 251, 0.92);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.reference-toolbar-section {
    display: grid;
    gap: 0.5rem;
}

.reference-toolbar-label {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reference-sortbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding: 0.3rem;
    border-radius: 18px;
    background: rgba(29, 53, 87, 0.06);
}

.reference-sortchip {
    flex: 1 1 0;
    min-width: 140px;
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 0.82rem 0.95rem;
    background: transparent;
    color: var(--ink-soft);
    font: 700 0.9rem/1 'Avenir Next', sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.reference-sortchip:hover,
.reference-sortchip.is-active {
    transform: translateY(-1px);
    border-color: rgba(230, 57, 70, 0.16);
    background: rgba(255, 255, 255, 0.96);
    color: var(--blue);
    box-shadow: 0 10px 18px rgba(17, 28, 46, 0.06);
}

.reference-summarybar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.reference-summary {
    margin: 0;
    display: inline-flex;
    align-items: center;
    min-height: 2.2rem;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    background: rgba(255, 226, 158, 0.56);
    color: var(--blue);
    font-size: 0.9rem;
    font-weight: 800;
}

.reference-toolbar-hint {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.reference-explorer-body {
    min-height: 0;
    overflow: hidden;
    padding-top: 0.1rem;
}

.reference-slider {
    display: flex;
    align-items: stretch;
    width: 200%;
    min-width: 200%;
    height: 100%;
    transition: transform 0.32s cubic-bezier(0.22, 0.9, 0.28, 1);
}

.reference-explorer.is-detail-view .reference-slider {
    transform: translateX(-50%);
}

.reference-explorer.is-detail-view .reference-explorer-toolbar {
    display: none;
}

.reference-explorer.is-detail-view .reference-explorer-head {
    padding-bottom: 0.25rem;
}

.reference-view {
    flex: 0 0 50%;
    width: 50%;
    min-width: 50%;
    max-width: 50%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding-right: 0.85rem;
}

.reference-view-detail {
    padding-right: 0;
    padding-left: 0.35rem;
}

.reference-view-label {
    margin: 0 0 0.8rem;
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reference-list,
.reference-occurrence-list {
    display: grid;
    align-content: start;
    gap: 0.52rem;
    grid-auto-rows: max-content;
    max-height: 100%;
    min-height: 0;
    overflow: auto;
    padding-right: 0.08rem;
}

.reference-card,
.reference-occurrence-card {
    align-self: start;
    display: grid;
    gap: 0.22rem;
    width: 100%;
    padding: 0.68rem 0.8rem;
    border: 1px solid rgba(29, 53, 87, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.reference-card:hover,
.reference-occurrence-card:hover {
    transform: translateY(-2px);
    border-color: rgba(230, 57, 70, 0.2);
    box-shadow: var(--shadow-soft);
}

.reference-card.is-active {
    background: rgba(255, 226, 158, 0.56);
    border-color: rgba(255, 194, 80, 0.44);
}

.reference-card-kicker,
.reference-occurrence-kicker,
.reference-detail-kicker {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.reference-card-title,
.reference-detail-title {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.3;
}

.reference-card-meta,
.reference-detail-meta,
.reference-occurrence-preview {
    color: var(--ink-soft);
    line-height: 1.55;
}

.reference-detail-shell {
    display: grid;
    gap: 0.9rem;
    margin-bottom: 1rem;
    padding: 1.15rem;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(27, 48, 79, 0.96) 0%, rgba(20, 35, 61, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 54px rgba(17, 28, 46, 0.18);
}

.reference-detail-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.reference-detail-meta {
    display: grid;
    gap: 0.35rem;
}

.reference-detail-kicker {
    color: rgba(255, 214, 102, 0.95);
}

.reference-detail-title {
    font-size: clamp(1.28rem, 2vw, 1.7rem);
    line-height: 1.18;
    color: #fff;
}

.reference-detail-authors {
    color: rgba(255, 255, 255, 0.88);
    font-size: 1rem;
    line-height: 1.55;
}

.reference-detail-publication {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    color: rgba(229, 235, 244, 0.82);
    font-size: 0.96rem;
    line-height: 1.5;
}

.reference-detail-count {
    display: inline-flex;
    align-items: center;
    color: rgba(255, 214, 102, 0.98);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.reference-occurrence-group {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    padding: 0.88rem;
    border-radius: 20px;
    background: rgba(243, 246, 250, 0.94);
    border: 1px solid rgba(29, 53, 87, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.reference-occurrence-group .reference-view-label {
    margin-bottom: 0.65rem;
    color: var(--blue);
}

.reference-empty {
    display: grid;
    gap: 0.4rem;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink-soft);
    border: 1px solid rgba(29, 53, 87, 0.08);
}

.reference-occurrence-card strong {
    font-size: 0.92rem;
    line-height: 1.24;
}

.reference-occurrence-kicker {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

.reference-occurrence-preview {
    font-size: 0.88rem;
    line-height: 1.34;
}

.is-desktop-safari .global-tabbar,
.is-desktop-safari .thesis-site-header,
.is-desktop-safari .surface-card,
.is-desktop-safari .thesis-drawer,
.is-desktop-safari .account-sheet,
.is-desktop-safari .reference-explorer,
.is-desktop-safari .note-compose-sheet,
.is-desktop-safari .note-manager,
.is-desktop-safari .thesis-lightbox {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.is-desktop-safari .global-tabbar {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.is-desktop-safari .thesis-site-header {
    background: rgba(244, 244, 244, 0.96);
}

.is-desktop-safari .surface-card {
    background: rgba(255, 255, 255, 0.94);
}

.is-desktop-safari .thesis-drawer {
    background: rgba(248, 248, 248, 0.98);
}

.is-desktop-safari .account-sheet,
.is-desktop-safari .reference-explorer,
.is-desktop-safari .note-compose-sheet,
.is-desktop-safari .note-manager {
    background: rgba(18, 35, 61, 0.18);
}

.is-desktop-safari .thesis-lightbox {
    background: rgba(18, 35, 61, 0.82);
}

.warm-focus {
    animation: warmFocus 2.8s ease;
}

@keyframes warmFocus {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 194, 80, 0.62);
        background-color: rgba(255, 235, 186, 0.95);
    }
    70% {
        box-shadow: 0 0 0 18px rgba(255, 194, 80, 0);
        background-color: rgba(255, 235, 186, 0.32);
    }
    100% {
        box-shadow: none;
        background-color: transparent;
    }
}

@keyframes warmRail {
    0% {
        background: rgba(255, 226, 158, 0.96);
        border-color: rgba(255, 194, 80, 0.48);
    }
    100% {
        background: rgba(255, 255, 255, 0.66);
        border-color: rgba(29, 53, 87, 0.08);
    }
}

.desktop-only {
    display: inline-flex;
}

.mobile-only {
    display: none;
}

@media (max-width: 1200px) {
    .reader-layout {
        grid-template-columns: minmax(0, 1fr) 280px;
    }

    .reader-rail-left {
        display: none;
    }
}

@media (max-width: 960px) {
    .experience-grid,
    .chapter-grid,
    .figure-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reader-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .reader-rail-right {
        display: none;
    }

    .account-inline-card,
    .reader-save-banner {
        grid-template-columns: minmax(0, 1fr);
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: inline-flex;
    }
}

@media (max-width: 760px) {
    .global-tabbar {
        padding-right: 0;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .global-tabbar::-webkit-scrollbar {
        display: none;
    }

    .tabbar-spacer {
        display: none;
    }

    .thesis-site-header {
        grid-template-columns: auto 1fr auto;
        gap: 0.6rem;
        padding-inline: 0.9rem;
    }

    .brand-lockup span,
    .reader-header-title strong {
        font-size: 0.95rem;
    }

    .reader-header-kicker {
        font-size: 0.72rem;
    }

    .hero-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-mark {
        min-height: 240px;
    }

    .experience-grid,
    .chapter-grid,
    .figure-gallery {
        grid-template-columns: minmax(0, 1fr);
    }

    .figure-gallery-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .chapter-pager {
        max-width: none;
        width: 100%;
    }

    .account-sheet {
        align-items: end;
        padding: 0;
    }

    .account-sheet-dialog {
        width: 100%;
        max-height: min(92vh, 820px);
        padding: 1rem;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .reference-explorer {
        align-items: end;
        padding: 0 0 0.25rem;
        background: rgba(18, 35, 61, 0.14);
    }

    .note-compose-sheet,
    .note-manager {
        align-items: end;
        padding: 0 0 0.25rem;
        background: rgba(18, 35, 61, 0.14);
    }

    .lightbox-stage {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.75rem;
    }

    .lightbox-nav {
        width: 100%;
        height: 2.8rem;
        order: 2;
    }

    .lightbox-nav-prev {
        margin-top: 0.1rem;
    }

    .lightbox-nav-next {
        margin-top: -0.2rem;
    }

    .reference-explorer-dialog {
        width: 100%;
        max-height: calc(100vh - 14px);
        padding: 1rem;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .note-compose-dialog,
    .note-manager-dialog {
        width: 100%;
        max-height: calc(100vh - 14px);
        padding: 1rem;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .reference-explorer-topbar {
        align-items: center;
    }

    .reference-explorer-titleblock p,
    .reference-toolbar-hint {
        font-size: 0.92rem;
    }

    .reference-view {
        padding-right: 0.45rem;
    }

    .reference-view-detail {
        padding-left: 0.2rem;
    }

    .selection-actionbar {
        width: calc(100vw - 1rem);
        bottom: 0.5rem;
        grid-template-columns: minmax(0, 1fr);
        border-radius: 22px;
    }

    .selection-actionbar-actions {
        justify-content: stretch;
    }

    .selection-actionbar-actions .button {
        flex: 1 1 0;
    }
}

@media (max-width: 560px) {
    :root {
        --header-height: 80px;
        --radius-xl: 26px;
    }

    .thesis-home-main,
    .reader-layout {
        width: min(calc(100% - 1rem), var(--content-width));
    }

    .reader-article,
    .feature-card,
    .chapter-map-card,
    .figure-gallery-card,
    .thesis-abstract-card {
        padding: 1rem;
    }

    .button {
        padding: 0.8rem 1rem;
    }

    .reference-sortbar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lightbox-thumb {
        width: 62px;
        height: 62px;
    }

    .reference-sortchip {
        min-width: 0;
        padding-inline: 0.6rem;
        font-size: 0.82rem;
    }

    .reference-close-button,
    .reference-back-button {
        min-height: 2.55rem;
        padding: 0.68rem 0.9rem;
    }

    .thesis-paragraph,
    .thesis-list,
    .thesis-quote,
    .reader-footnotes ol {
        font-size: 0.98rem;
    }

    .reference-sortbar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .reference-sortchip {
        justify-content: center;
    }
}
