@import url('https://fonts.googleapis.com/css2?family=DotGothic16&family=Outfit:wght@400;500;600;700;800&display=swap');
/* DotGothic16's lowercase i reads like a capital I; take only the i glyph from Pixelify Sans */
@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans&text=i&display=swap');

/* =========================================
   Midnight Waterfall theme
   ========================================= */
:root {
    /* Square corners everywhere (Bootstrap components included) */
    --bs-border-radius: 0;
    --bs-border-radius-sm: 0;
    --bs-border-radius-lg: 0;
    --bs-border-radius-xl: 0;
    --bs-border-radius-xxl: 0;
    --bs-border-radius-2xl: 0;
    --bs-border-radius-pill: 0;
    --primary-blue: #0d1b34;
    --accent-blue: #62c5d5;
    --accent-gold: #d8b96f;
    --bg-light: #091426;
    --border-color: #2b405d;
    --text-main: #e5edf5;
    --text-muted: #a4b3c5;
    --fig-accent: #7aa8ff;
    --surface-dark: #10213b;
    --surface-raised: #142945;
    --helix-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23000'%3E%3Ccircle cx='19' cy='12' r='3.1'/%3E%3Ccircle cx='15.5' cy='18.06' r='3.1'/%3E%3Ccircle cx='8.5' cy='18.06' r='3.1'/%3E%3Ccircle cx='5' cy='12' r='3.1'/%3E%3Ccircle cx='8.5' cy='5.94' r='3.1'/%3E%3Ccircle cx='15.5' cy='5.94' r='3.1'/%3E%3C/g%3E%3C/svg%3E");
}

body {
    isolation: isolate;
    position: relative;
    background-color: var(--bg-light);
    background-image:
        linear-gradient(rgba(98, 197, 213, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(98, 197, 213, 0.035) 1px, transparent 1px),
        radial-gradient(ellipse at 50% 0%, rgba(98, 197, 213, 0.07), transparent 58%),
        linear-gradient(180deg, #0b1830 0%, #091426 60%, #0a1730 100%);
    background-size: 28px 28px, 28px 28px, auto, auto;
    background-attachment: fixed;
    color: var(--text-main);
    padding-top: 60px;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    font-size: 18px;
}

.content-container {
    max-width: 1080px;
}

main.content-container {
    padding-top: 80px;
    padding-bottom: 100px;
}

/* Side margins as a fixed share of the window on every sub-page (px-md-0 removes the padding,
   so without this the content touches the edges just above each breakpoint).
   Below the max-width the content is always 92% of the window, so it shrinks evenly. */
@media (min-width: 768px) {
    main.content-container,
    [role="main"].content-container {
        width: 92%;
    }
}

@media (min-width: 992px) {

    body[data-bs-spy="scroll"] main.content-container,
    main.content-container:has(.sidebar-toc) {
        max-width: 1200px;
    }

    body[data-bs-spy="scroll"] main.content-container>.row,
    main.content-container:has(.sidebar-toc)>.row {
        --bs-gutter-x: 2.25rem;
    }

    body[data-bs-spy="scroll"] main.content-container>.row>.col-lg-2,
    main.content-container:has(.sidebar-toc)>.row>.col-lg-2 {
        flex: 0 0 240px;
        width: 240px;
    }

    body[data-bs-spy="scroll"] main.content-container>.row>.col-lg-10,
    main.content-container:has(.sidebar-toc)>.row>.col-lg-10 {
        flex: 1 1 0%;
        width: calc(100% - 240px);
    }
}


.ambient-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* Particles drifting past the right edge must not widen the page (horizontal scroll on phones) */
.ambient-particles {
    overflow: clip;
}

body>header,
body>main,
#footer-placeholder {
    position: relative;
    z-index: 1;
}

.ambient-particles span {
    position: absolute;
    width: var(--sparkle-size, 24px);
    aspect-ratio: 1;
    background-color: #c9f5ff;
    clip-path: polygon(44% 0, 56% 0, 56% 19%, 69% 19%, 69% 31%,
            81% 31%, 81% 44%, 100% 44%, 100% 56%,
            81% 56%, 81% 69%, 69% 69%, 69% 81%,
            56% 81%, 56% 100%, 44% 100%, 44% 81%,
            31% 81%, 31% 69%, 19% 69%, 19% 56%,
            0 56%, 0 44%, 19% 44%, 19% 31%,
            31% 31%, 31% 19%, 44% 19%);
    filter: drop-shadow(0 0 5px rgba(138, 226, 255, 0.7));
    opacity: 0;
    animation: pixel-star-twinkle var(--twinkle-duration, 4s) ease-in-out var(--twinkle-delay, 0s) infinite;
}

.ambient-particles span:nth-child(1) {
    left: 5%;
    top: 8%;
    --sparkle-size: 30px;
    --twinkle-delay: -1.2s;
}

.ambient-particles span:nth-child(2) {
    left: 12%;
    top: 25%;
    --sparkle-size: 20px;
    --twinkle-duration: 3.6s;
    --twinkle-delay: -3.1s;
}

.ambient-particles span:nth-child(3) {
    left: 4%;
    top: 41%;
    --sparkle-size: 32px;
    --twinkle-duration: 5s;
    --twinkle-delay: -1.8s;
}

.ambient-particles span:nth-child(4) {
    left: 11%;
    top: 58%;
    --sparkle-size: 24px;
    --twinkle-duration: 4.2s;
    --twinkle-delay: -0.4s;
}

.ambient-particles span:nth-child(5) {
    left: 5%;
    top: 75%;
    --sparkle-size: 18px;
    --twinkle-duration: 3s;
    --twinkle-delay: -1.7s;
}

.ambient-particles span:nth-child(6) {
    left: 13%;
    top: 91%;
    --sparkle-size: 28px;
    --twinkle-duration: 3.1s;
    --twinkle-delay: -0.9s;
}

.ambient-particles span:nth-child(7) {
    left: 91%;
    top: 8%;
    --sparkle-size: 25px;
    --twinkle-duration: 4.2s;
    --twinkle-delay: -0.4s;
}

.ambient-particles span:nth-child(8) {
    left: 95%;
    top: 25%;
    --sparkle-size: 16px;
    --twinkle-duration: 3s;
    --twinkle-delay: -1.7s;
}

.ambient-particles span:nth-child(9) {
    left: 88%;
    top: 41%;
    --sparkle-size: 28px;
    --twinkle-duration: 3.1s;
    --twinkle-delay: -0.9s;
}

.ambient-particles span:nth-child(10) {
    left: 94%;
    top: 58%;
    --sparkle-size: 22px;
    --twinkle-duration: 4.6s;
    --twinkle-delay: -2.4s;
}

.ambient-particles span:nth-child(11) {
    left: 90%;
    top: 75%;
    --sparkle-size: 32px;
    --twinkle-duration: 5s;
    --twinkle-delay: -2.8s;
}

.ambient-particles span:nth-child(12) {
    left: 96%;
    top: 91%;
    --sparkle-size: 18px;
    --twinkle-duration: 3.4s;
    --twinkle-delay: -1.3s;
}

@keyframes pixel-star-twinkle {

    0%,
    100% {
        opacity: 0.08;
        transform: scale(0.72) rotate(0deg);
    }

    45%,
    55% {
        opacity: 0.85;
        transform: scale(1) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.08) rotate(0deg);
    }
}

p {
    line-height: 1.9;
    margin-bottom: 1.75rem;
}

/* Paragraph first-line indentation across all pages (~3.5–4 characters) */
main p {
    text-indent: 3.5ch;
}

main .text-center p,
main p.text-center,
main p[role="math"],
main p[role="math"]+p,
main .references-section p,
main .team-member-card p,
main p.small,
main p.fw-bold {
    text-indent: 0;
}

a {
    color: var(--accent-blue);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-gold);
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 3px;
}

/* 図・表・ムービーへのリンク：寒色の青（--fig-accent）＋点線の下線で、ページ・節へのリンク（水色・実線）や目次の現在地（金）と区別する。
   キャプションの「Figure N.」ラベルも同じ色に揃える */
main a[href*="#fig-"],
main a[href*="#figure-"],
main a[href*="#table-"],
main a[href*="#movie-"] {
    color: var(--fig-accent);
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

main a[href*="#fig-"]:hover,
main a[href*="#figure-"]:hover,
main a[href*="#table-"]:hover,
main a[href*="#movie-"]:hover {
    color: var(--accent-blue);
    text-decoration-style: solid;
}

/* 図・表・ムービーのキャプション先頭ラベル（Figure N. / Table N. / Movie N.） */
main figcaption strong,
main caption strong,
main .fig-group-caption > strong {
    color: var(--fig-accent);
    font-weight: 600;
    white-space: nowrap;
}

/* 図・ムービーのキャプション：全ページ共通（サイズ・色・図との間隔）。
   HTML 側の .text-secondary / .mt-3 より優先させるため :is() でクラス1つ分の詳細度を足している */
main figure figcaption:is(.text-secondary, *) {
    margin-top: 0.75rem !important;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-muted) !important;
}

/* Navigation */
.navbar {
    background-color: #0b1830 !important;
    border-bottom: 2px solid #314763;
    box-shadow: 0 2px 12px rgba(2, 9, 20, 0.28);
}

.navbar-brand {
    color: #e7edf4 !important;
    font-size: 1.4rem;
    letter-spacing: 0.04em;
}

.navbar-brand,
h1,
h2,
h3,
h4,
h5,
h6,
.navbar-nav .nav-link {
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    -webkit-text-stroke: 0.6px currentColor;
}

.navbar-toggler {
    border: 1px solid #7890aa;
    border-radius: 0;
}

.navbar-toggler-icon {
    filter: invert(1) grayscale(1) brightness(1.8);
}

.navbar-nav .nav-link {
    position: relative;
    color: #c2cfdd !important;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.035em;
    padding: 10px 13px !important;
    transition: color 0.2s ease;
}

/* Current page / hover: corner brackets like a measurement frame (same motif as the card corners),
   instead of an underline */
.navbar-nav .nav-link::before {
    --bracket: var(--accent-gold);
    content: "";
    position: absolute;
    inset: 3px 1px;
    background:
        linear-gradient(var(--bracket), var(--bracket)) top left / 9px 2px no-repeat,
        linear-gradient(var(--bracket), var(--bracket)) top left / 2px 9px no-repeat,
        linear-gradient(var(--bracket), var(--bracket)) top right / 9px 2px no-repeat,
        linear-gradient(var(--bracket), var(--bracket)) top right / 2px 9px no-repeat,
        linear-gradient(var(--bracket), var(--bracket)) bottom left / 9px 2px no-repeat,
        linear-gradient(var(--bracket), var(--bracket)) bottom left / 2px 9px no-repeat,
        linear-gradient(var(--bracket), var(--bracket)) bottom right / 9px 2px no-repeat,
        linear-gradient(var(--bracket), var(--bracket)) bottom right / 2px 9px no-repeat;
    opacity: 0;
    transform: scale(1.12);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.navbar-nav .nav-link:hover {
    color: #ffffff !important;
}

.navbar-nav .nav-link:hover::before {
    --bracket: var(--accent-blue);
    opacity: 0.7;
    transform: scale(1);
}

.navbar-nav .nav-link.active {
    color: var(--accent-gold) !important;
}

.navbar-nav .nav-link.active::before {
    --bracket: var(--accent-gold);
    opacity: 1;
    transform: scale(1);
}

/* Collapsed (phone) menu: full-width rows, so a gold side bar marks the current page instead */
@media (max-width: 991.98px) {
    .navbar-nav .nav-link::before {
        content: none;
    }

    .navbar-nav .nav-link.active {
        box-shadow: inset 2px 0 0 var(--accent-gold);
    }
}

@media (prefers-reduced-motion: reduce) {
    .navbar-nav .nav-link::before {
        transition: none;
    }
}

/* Footer */
.site-footer {
    background-color: #002244;
    color: #ffffff;
    padding: 60px 0 40px 0;
    border-top: 5px solid var(--accent-blue);
}

.footer-title {
    color: #ffffff;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.footer-menu-title {
    color: #a0aec0;
    font-size: 0.92rem;
    text-transform: uppercase;
}

.footer-text-muted {
    color: #a0aec0;
}

.footer-divider {
    border-color: rgba(255, 255, 255, 0.15);
}

.footer-link {
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--accent-gold) !important;
    text-decoration: none;
}

/* Headings */
.tracking-widest {
    letter-spacing: 0.12em;
}

.page-title {
    color: #e5edf5;
    font-size: clamp(2.7rem, calc(1.485rem + 1.62vw), 3.51rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Under the page title: two short rules with the six-helix mark between them */
.page-title-underline {
    position: relative;
    width: 132px;
    height: 18px;
    margin: 14px auto 0;
    background:
        linear-gradient(var(--accent-gold), var(--accent-gold)) left center / 46px 2px no-repeat,
        linear-gradient(var(--accent-gold), var(--accent-gold)) right center / 46px 2px no-repeat;
}

.page-title-underline::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 18px;
    height: 18px;
    transform: translateX(-50%);
    background-color: var(--accent-gold);
    -webkit-mask: var(--helix-mark) center / contain no-repeat;
    mask: var(--helix-mark) center / contain no-repeat;
}

/* ページタイトル下の補足（任意）：どのページでも同じ見た目で使える */
.page-subtitle {
    margin: 1rem 0 0;
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* h2.section-title also beats Bootstrap's .h3 (some pages mark chapters as h2.h3), so every chapter
   heading has the same size */
.section-title,
main h2.section-title {
    color: #e5edf5;
    font-size: clamp(2.16rem, calc(1.431rem + 0.972vw), 2.7rem);
    font-weight: 700;
    position: relative;
    padding-left: 1.45em;
    margin-bottom: 3.25rem;
}

/* Team mark: cross-section of a six-helix DNA bundle (six helices in a ring), in place of a plain bar */
.section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.16em;
    width: 0.92em;
    height: 0.92em;
    background-color: var(--accent-gold);
    -webkit-mask: var(--helix-mark) center / contain no-repeat;
    mask: var(--helix-mark) center / contain no-repeat;
}

/* Subheadings & Section Subtitles */
.section-subtitle {
    color: var(--accent-gold);
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    -webkit-text-stroke: 0.6px currentColor;
    line-height: 1.35;
}

/* Accent Color Utilities */
.text-accent-blue {
    color: var(--accent-blue) !important;
}

.text-accent-gold {
    color: var(--accent-gold) !important;
}

h3,
h4,
h5,
h6 {
    color: #e5edf5;
}

h3,
.h3 {
    font-size: clamp(1.89rem, calc(1.404rem + 0.648vw), 2.43rem);
}

h4,
.h4 {
    font-size: clamp(1.377rem, calc(1.377rem + 0.324vw), 1.89rem);
}

h5,
.h5 {
    font-size: 1.35rem;
}

h6,
.h6 {
    font-size: 1.08rem;
}

/* Darken sections that were previously hard-coded as white. */
.fade-in-section[style*="background-color: #ffffff"] {
    background-color: transparent !important;
}

.text-secondary {
    color: #c0ccda !important;
}

.text-muted {
    color: #a4b3c5 !important;
}

.bg-light .text-muted {
    color: #5d6d80 !important;
}

/* Anchor Scroll Margins */
section[id],
.fade-in-section[id],
.fade-in-section [id],
.simulation-subblock[id],
.content-box[id] {
    scroll-margin-top: 90px;
}

/* Sidebar */
.sidebar-toc {
    top: 100px;
    background-color: transparent !important;
    border: none !important;
    border-left: 1px solid var(--border-color) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding-left: 8px !important;
    /* Long tables of contents scroll on their own instead of running off the bottom of the window */
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
    flex-wrap: nowrap;
    padding-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.sidebar-toc .nav-link {
    color: #aebdce;
    font-size: 0.9rem;
    line-height: 1.45;
    padding: 5px 0 5px 10px;
    border-left: 2px solid transparent;
    border-radius: 0;
    margin-bottom: 2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.sidebar-toc-subnav {
    margin-top: 4px;
    margin-bottom: 8px;
    margin-left: 12px;
    padding-left: 8px;
    border-left: 1px solid var(--border-color);
}

.sidebar-toc-subnav .nav-link {
    font-size: 0.84rem;
}

/* Collapsible third level (built by main.js from the page's headings): chapters and 1.1-level items
   always show; only the 1.1 item being read / clicked unfolds its own topics */
/* Third level and deeper: small indent steps, no extra guide lines, compact rows */
.sidebar-toc-subnav .sidebar-toc-subnav {
    margin-left: 6px;
    padding-left: 0;
    border-left: none;
}

.sidebar-toc-subnav .sidebar-toc-subnav .nav-link {
    font-size: 0.8rem;
    line-height: 1.4;
    padding: 4px 0 4px 8px;
    margin-bottom: 1px;
}


.toc-collapsible :is(.toc-sub3, .toc-sub4, .toc-sub5) {
    max-height: 0;
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease, visibility 0s linear 0.3s;
}

.toc-collapsible :is(.toc-sub3, .toc-sub4, .toc-sub5).is-open {
    max-height: 40rem;
    margin-top: 4px;
    margin-bottom: 8px;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin 0.3s ease, visibility 0s;
}

@media (prefers-reduced-motion: reduce) {
    .toc-collapsible :is(.toc-sub3, .toc-sub4, .toc-sub5) {
        transition: none;
    }
}

.sidebar-toc .nav-link:hover {
    background-color: rgba(98, 197, 213, 0.08);
    color: var(--accent-blue);
}

.sidebar-toc .nav-link.active {
    background-color: transparent;
    color: var(--accent-gold);
    border-left-color: var(--accent-gold);
}

/* The item being read: bold with a soft highlight. Its parent chapters stay quieter. */
.sidebar-toc .nav-link.active:not(:has(+ .sidebar-toc-subnav)) {
    font-weight: 700;
    background-color: rgba(216, 185, 111, 0.12);
}

.sidebar-toc .nav-link.active:has(+ .sidebar-toc-subnav) {
    border-left-color: rgba(216, 185, 111, 0.55);
}

/* Content panels */
.content-box {
    background-color: var(--surface-dark);
    border: 1px solid #314763;
    border-radius: 0;
    padding: 44px;
    background-image:
        linear-gradient(var(--accent-gold), var(--accent-gold)),
        linear-gradient(var(--accent-gold), var(--accent-gold)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-gold), var(--accent-gold)),
        linear-gradient(var(--accent-gold), var(--accent-gold));
    background-repeat: no-repeat;
    background-position: top 3px left 3px, top 3px left 3px, top 3px left 3px, top 3px left 3px,
        bottom 3px right 3px, bottom 3px right 3px, bottom 3px right 3px, bottom 3px right 3px;
    background-size: 10px 1px, 1px 10px, 5px 1px, 1px 5px, 10px 1px, 1px 10px, 5px 1px, 1px 5px;
    box-shadow: 0 3px 10px rgba(2, 9, 20, 0.16);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.content-box:hover {
    border-color: #526d88;
    box-shadow: 0 5px 14px rgba(2, 9, 20, 0.22);
    transform: translateY(-2px);
}

.content-box.bg-light {
    background-color: #eef4f7 !important;
}

@media (max-width: 575.98px) {
    .content-box {
        padding: 24px 20px;
    }
}

/* Rupture result mark (○ observed / ✕ not observed) */
.simulation-result-mark {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.simulation-result-mark svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* バツ: 膜破裂なし（ネガティブ） */
.simulation-result-mark-negative {
    color: #ff5c82;
    background-color: rgba(255, 51, 102, 0.12);
    border: 1px solid rgba(255, 92, 130, 0.45);
}

/* マル: 膜破裂あり（ポジティブ） */
.simulation-result-mark-positive {
    color: #00e5ff;
    background-color: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

.content-box:hover .simulation-result-mark {
    transform: scale(1.06);
}

.simulation-model-viewer {
    display: block;
    width: 100%;
    height: min(70vh, 640px);
    min-height: 360px;
    background-color: #ffffff;
}

.simulation-colorbar-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: min(70vh, 640px);
    min-height: 360px;
    background-color: #ffffff;
    padding: 1.5rem;
    box-sizing: border-box;
}

.simulation-colorbar {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

#approach .ratio.content-box {
    background: #ffffff !important;
}

.learn-more-btn {
    border: 1px solid var(--accent-gold);
    border-radius: 0;
    color: var(--accent-gold);
    background-color: transparent;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.learn-more-btn:hover,
.learn-more-btn:focus-visible {
    border-color: var(--accent-gold);
    color: var(--primary-blue);
    background-color: var(--accent-gold);
    transform: translateY(-2px);
}

/* Custom Accordion Menu - Midnight Waterfall Theme */

/* Simulation Section Spacing Utility */
.simulation-subblock {
    margin-bottom: 3.5rem;
    padding-top: 0.5rem;
}

/* ===== Shared spacing (all pages) =====
   Bootstrap spacing utilities in the markup (mb-5, pt-4, mb-3 ...) are !important and too tight for
   long-form pages, so the shared building blocks get roomier spacing here, in one place. */
/* Chapters (h2 sections) are clearly separated: a wide, uniform gap between one chapter and the next */
main section.fade-in-section {
    margin-bottom: 12rem !important;
    padding-top: 3rem !important;
}

/* The gap comes from the section itself, not from whatever element happens to end it, so every
   chapter break is the same size */
main section.fade-in-section > :last-child {
    margin-bottom: 0 !important;
}

main .section-subtitle {
    margin-bottom: 1.75rem !important;
}

/* Spacing hierarchy: chapter (240px) > 1.1-level group (128px) > blocks inside a group (≤ ~80px) */
main .simulation-subblock:not(.mb-0) {
    margin-bottom: 3.5rem !important;
}

/* A block that opens with a heading: the block's own spacing already separates it */
main .simulation-subblock > :is(h3, h4, h5, .wet-subhead, .wet-exp-title):first-child {
    margin-top: 0 !important;
}

main p.mb-2 {
    margin-bottom: 1.4rem !important;
}

@media (max-width: 575.98px) {
    main section.fade-in-section {
        margin-bottom: 7rem !important;
    }
}

/* Row gutters reach past main's / the footer's edges (no side padding on desktop), which caused a slight
   horizontal scroll on narrower screens; clip it without creating a scroll container (sticky still works) */
main.content-container,
.site-footer {
    overflow-x: clip;
}

/* ===== Heading scale (all pages) =====
   Sizes step down one level at a time (desktop / phone):
   chapter h2  : large white, thick gold bar   ~37 / 35px   (.section-title)
   group  1.1  : white, thin blue bar           27 / 23px   (first h3 of a .subsection)
   topic       : blue                           22 / 19px   (h4.section-subtitle, .wet-exp-title)
   minor       : white bold                     19 / 17px   (.wet-subhead, h5 in simulation blocks)
   label       : gold capitals with a rule      18 / 16px   (.wet-label, .exp-label) */
main .col-lg-10 .subsection > h3:first-child {
    padding-left: 14px;
    border-left: 3px solid var(--accent-gold);
    line-height: 1.35;
}

main .col-lg-10 h4.section-subtitle,
main .col-lg-10 h3.section-subtitle,
main .wet-exp-title {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--accent-gold);
}

main .wet-subhead,
.simulation-page .simulation-subblock h5.section-subtitle {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--text-main);
    -webkit-text-stroke: 0;
}

/* Second-level groups (1.1, 1.2, 2.1 ...): one uniform gap between groups on every page —
   narrower than the gap between chapters, wider than anything inside a group */
main .col-lg-10 .subsection {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

main .col-lg-10 .subsection + .subsection {
    margin-top: 8rem !important;
}

/* The first group after a chapter's intro text starts as far below it as it would below the heading */
main .col-lg-10 :is(p, ul, ol) + .subsection {
    margin-top: 3.25rem !important;
}

main .col-lg-10 .subsection > :last-child {
    margin-bottom: 0 !important;
}

@media (max-width: 575.98px) {
    /* phones keep the same order: chapter 160px > group ~112px > blocks ~70px */
    main .col-lg-10 .subsection + .subsection {
        margin-top: 7rem !important;
    }

    main .simulation-subblock:not(.mb-0) {
        margin-bottom: 2.5rem !important;
    }
}

/* Headings that follow body content get clear space above, so each topic starts visibly */
main :is(p, ul, ol, .table-responsive, .wet-table-wide, .math-display, figure, .row) + :is(h3, h4, h5) {
    margin-top: 3rem;
}

/* Stacked panels breathe */
main .content-box.mb-4 {
    margin-bottom: 2.5rem !important;
}

/* "cause → effect" arrow inside headings: a slim gold arrow instead of an emoji */
.heading-arrow {
    margin: 0 0.5em;
    font-size: 0.75em;
    vertical-align: 0.1em;
    color: var(--accent-gold);
}

/* Short grouped lists (e.g. source files by model): a light frame instead of separate sub-headings */
main .content-box.source-group {
    padding: 28px 32px;
}

main .content-box.source-group.mb-4 {
    margin-bottom: 1.5rem !important;
}

/* ===== miRNA Princess: back-to-top mascot (button built by main.js on every page) ===== */
.princess-top {
    --s: 96px;
    position: fixed;
    right: 20px;
    bottom: 16px;
    z-index: 1030;
    width: var(--s);
    height: var(--s);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    opacity: 0;
    transform: translateY(24px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.princess-top.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.princess-top:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.princess-sprite {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--princess-idle, url("img/mascot/princess_idle.png")) center / var(--princess-idle-size, contain) no-repeat;
    filter: drop-shadow(0 4px 6px rgba(2, 9, 20, 0.35));
    animation: princess-float 2.6s ease-in-out infinite;
}

/* hover / keyboard focus: she walks in place */
.princess-top:hover .princess-sprite,
.princess-top:focus-visible .princess-sprite {
    background-image: url("img/mascot/princess_walk.png");
    background-size: calc(var(--s) * 8) var(--s);
    background-position: 0 0;
    animation: princess-walk 0.8s steps(8) infinite;
}

/* click: one backflip, then the page scrolls to the top */
.princess-top.is-flipping .princess-sprite {
    background-image: url("img/mascot/princess_backflip.png");
    background-size: calc(var(--s) * 10) var(--s);
    background-position: 0 0;
    animation: princess-flip 0.9s steps(10) 1 forwards;
}

/* little "TOP" tag above her head on hover */
.princess-bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% - 6px);
    padding: 2px 8px;
    border: 1px solid var(--accent-gold);
    background-color: var(--surface-dark);
    color: var(--accent-gold);
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
    transform: translate(-50%, 4px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.princess-top:hover .princess-bubble,
.princess-top:focus-visible .princess-bubble {
    opacity: 1;
    transform: translate(-50%, 0);
}

@keyframes princess-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes princess-walk {
    from { background-position: 0 0; }
    to { background-position: calc(var(--s) * -8) 0; }
}

@keyframes princess-flip {
    from { background-position: 0 0; }
    to { background-position: calc(var(--s) * -10) 0; }
}

@media (max-width: 575.98px) {
    .princess-top {
        --s: 72px;
        right: 10px;
        bottom: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .princess-sprite,
    .princess-top:hover .princess-sprite,
    .princess-top:focus-visible .princess-sprite {
        animation: none;
        background-image: url("img/mascot/princess_idle.png");
        background-size: contain;
        background-position: center;
    }

    .princess-top {
        transition: none;
    }
}

@media print {
    .princess-top {
        display: none;
    }
}

/* HOME abstract: "Results" / "Conclusion" / "Future" lead-ins so judges find them at a glance */
.home-step-result {
    text-indent: 0 !important;
}

.home-result-label {
    display: inline-block;
    margin-right: 0.5em;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-blue);
}

/* Two figures side by side: same frame height even when the images differ in aspect ratio */
.figure-pair img {
    aspect-ratio: 3 / 2;
    object-fit: contain;
    background-color: #ffffff;
}

.simulation-page .radius-comparison-image {
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: #ffffff;
}

/* Tables: room around and inside cells */
main .table-responsive {
    margin-top: 1.75rem;
    margin-bottom: 2.5rem;
}

/* A table followed directly by its footnote keeps the note close */
main .table-responsive:has(+ p.small) {
    margin-bottom: 0.75rem;
}

main .table th,
main .table td {
    padding: 9px 11px;
    line-height: 1.6;
}

/* Simulation environment: real system vs. model (interactive) */
.sim-env {
    --part-bundle: #3b6998;
    --part-linker: #3d7a74;
    --part-chol: #6e5494;
    --part-membrane: #9a6b32;
    background-color: var(--surface-dark);
    border: 1px solid #314763;
    border-radius: 0;
    padding: 26px 28px;
    background-image:
        linear-gradient(var(--accent-gold), var(--accent-gold)),
        linear-gradient(var(--accent-gold), var(--accent-gold)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-blue), var(--accent-blue)),
        linear-gradient(var(--accent-gold), var(--accent-gold)),
        linear-gradient(var(--accent-gold), var(--accent-gold));
    background-repeat: no-repeat;
    background-position: top 3px left 3px, top 3px left 3px, top 3px left 3px, top 3px left 3px,
        bottom 3px right 3px, bottom 3px right 3px, bottom 3px right 3px, bottom 3px right 3px;
    background-size: 10px 1px, 1px 10px, 5px 1px, 1px 5px, 10px 1px, 1px 10px, 5px 1px, 1px 5px;
    box-shadow: 0 3px 10px rgba(2, 9, 20, 0.16);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sim-env:hover {
    border-color: #526d88;
    box-shadow: 0 5px 14px rgba(2, 9, 20, 0.22);
}

.sim-env-panels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 18px;
}

.sim-env-panel {
    margin: 0;
    background: transparent;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sim-env-panel-label {
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.01em;
    margin-bottom: 10px;
}

.sim-env-panel-label span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.88rem;
}

/* top-aligned so the real and model images share the same framing */
.sim-env-canvas {
    position: relative;
    background: #ffffff;
    border-radius: 0;
    padding: 8px;
}

.sim-env-canvas img {
    display: block;
    width: 100%;
    height: auto;
}

.sim-env-arrow {
    align-self: center;
    margin-top: 28px;
    width: 0;
    height: 0;
    border-top: 22px solid transparent;
    border-bottom: 22px solid transparent;
    border-left: 34px solid rgba(180, 189, 214, 0.75);
}

/* Minimal target dots on diagrams & color indicators in the component bar */
.sim-env-marker,
.sim-env-num {
    --c: var(--part-bundle);
    width: 12px;
    height: 12px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: var(--c);
    color: transparent;
    font-size: 0;
    line-height: 0;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28), 0 1px 3px rgba(0, 0, 0, 0.25);
}

.sim-env-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 2;
    transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

/* Clean, understated label on active dot */
.sim-env-marker.sim-env-beacon::after {
    content: attr(data-label);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 7px);
    transform: translateX(-50%);
    padding: 2px 7px;
    background: rgba(15, 23, 42, 0.9);
    color: #f8fafc;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.sim-env-num {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    box-shadow: none;
}

[data-part="linker"].sim-env-marker,
[data-part="linker"] .sim-env-num {
    --c: var(--part-linker);
}

[data-part="chol"].sim-env-marker,
[data-part="chol"] .sim-env-num {
    --c: var(--part-chol);
}

[data-part="membrane"].sim-env-marker,
[data-part="membrane"] .sim-env-num {
    --c: var(--part-membrane);
}

.sim-env.has-active .sim-env-marker {
    opacity: 0.22;
}

.sim-env.has-active .sim-env-marker.is-active {
    opacity: 1;
    z-index: 4;
    transform: translate(-50%, -50%) scale(1.12);
    box-shadow: 0 0 0 2.5px #ffffff, 0 0 0 4px var(--c), 0 2px 6px rgba(0, 0, 0, 0.25);
}

.sim-env.has-active .sim-env-marker.sim-env-beacon.is-active::after {
    opacity: 1;
}

.sim-env-legend {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #c0ccda;
    font-size: 0.78rem;
}

.sim-env-legend-title {
    font-weight: 600;
}

.sim-env-legend-bar {
    display: block;
    height: 10px;
    border-radius: 0;
}

.sim-env-legend-strain {
    background: linear-gradient(90deg, #30123b, #4662d7, #36aaf9, #1ae4b6, #72fe5e, #c8ef34, #faba39, #f66b19, #ca2a04);
}

.sim-env-legend-curvature {
    background: linear-gradient(90deg, #0000b6, #000dff, #0069ff, #00c5ff, #30ffc7, #7aff7d, #c1ff36, #ffde00, #ff8900, #ff3400, #bf0000);
}

.sim-env-legend-ends {
    display: flex;
    justify-content: space-between;
    color: #a4b3c5;
}

/* Minimal Component Bar above the panels */
.sim-env-parts {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sim-env-part {
    --c: var(--part-bundle);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    background-color: rgba(15, 29, 54, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0;
    cursor: pointer;
    transition: opacity 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.sim-env-part[data-part="linker"] {
    --c: var(--part-linker);
}

.sim-env-part[data-part="chol"] {
    --c: var(--part-chol);
}

.sim-env-part[data-part="membrane"] {
    --c: var(--part-membrane);
}

.sim-env-part:focus {
    outline: none;
}

.sim-env.has-active .sim-env-part {
    opacity: 0.5;
}

.sim-env.has-active .sim-env-part.is-active,
.sim-env-part:focus-visible {
    opacity: 1;
    background-color: rgba(30, 48, 80, 0.85);
    border-color: rgba(226, 232, 240, 0.55);
}

.sim-env-part-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    letter-spacing: 0.01em;
}

.sim-env-part dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    margin: 0;
    font-size: 0.875rem;
}

.sim-env-part dt {
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-top: 2px;
}

.sim-env-part dd {
    color: var(--text-muted);
    margin: 0;
}

@media (max-width: 767.98px) {
    .sim-env-panels {
        grid-template-columns: 1fr;
    }

    .sim-env-arrow {
        justify-self: center;
        border-left: 22px solid transparent;
        border-right: 22px solid transparent;
        border-top: 28px solid rgba(180, 189, 214, 0.75);
        border-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sim-env-marker {
        transition: none;
    }
}

/* ELSI Utilities */
.elsi-icon-badge {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 0;
    background: rgba(98, 197, 213, 0.12);
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
    font-size: 1.2rem;
    transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.content-box:hover .elsi-icon-badge {
    transform: scale(1.08);
    background: rgba(98, 197, 213, 0.22);
    box-shadow: 0 0 12px rgba(98, 197, 213, 0.35);
}

.elsi-icon-badge-gold {
    background: rgba(216, 185, 111, 0.12);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.content-box:hover .elsi-icon-badge-gold {
    transform: scale(1.08);
    background: rgba(216, 185, 111, 0.22);
    box-shadow: 0 0 12px rgba(216, 185, 111, 0.35);
}

.elsi-icon-badge-teal {
    background: rgba(78, 205, 196, 0.12);
    border-color: #4ecdc4;
    color: #4ecdc4;
}

.content-box:hover .elsi-icon-badge-teal {
    transform: scale(1.08);
    background: rgba(78, 205, 196, 0.22);
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.35);
}

/* Reference List Styles */

/* Scroll reveal */
.fade-in-section {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }

    .ambient-particles span {
        animation: none;
        opacity: 0.28;
    }
}

/* Text Highlight */
.concept-highlight {
    color: var(--accent-gold, #d8b96f);
    font-weight: 700;
}

/* ===== Skim-friendly blocks (all pages) =====
   point-box  : short item in a box with a big number (not a TOC heading)
   lead-callout: one-line takeaway shown before the details
   key-line   : highlighter on the key sentence of a paragraph */
.point-stack {
    display: grid;
    gap: 1.5rem;
}

.point-box {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.75rem;
    align-items: start;
    padding: 32px 36px;
}

.point-box-num {
    font-family: inherit;
    font-weight: 700;
    color: var(--accent-gold);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.point-box-num {
    font-size: 2.6rem;
    min-width: 2.2ch;
    opacity: 0.9;
}

main .point-box-title {
    margin: 0 0 0.75rem;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--text-main);
}

main .lead-callout {
    margin: 0 0 1.25rem;
    padding: 1rem 1.25rem;
    background: color-mix(in srgb, var(--accent-gold) 9%, transparent);
    color: var(--text-main);
    font-size: 1.05rem;
    line-height: 1.75;
}

mark.key-line {
    padding: 0 0.1em;
    background: linear-gradient(transparent 60%, color-mix(in srgb, var(--accent-gold) 30%, transparent) 60%);
    color: var(--text-main);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

@media (max-width: 575.98px) {
    .point-box {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 24px 20px;
    }

    .point-box-num {
        font-size: 2rem;
    }
}

/* Approach animation: one video, step text follows playback */
.approach-player {
    padding: 20px;
}

.approach-player:hover {
    transform: none;
}

.approach-video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    /* shrink on short screens so the header, video, tabs and the longest step text fit in one view
       (380px = header + tabs + text area + padding) */
    max-height: max(220px, min(60vh, calc(100vh - 380px)));
    margin-inline: auto;
    /* when the cap narrows the frame (it keeps 16:9), keep it centred */
    background: #fff;
    border: 1px solid #314763;
    overflow: hidden;
}

.approach-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.approach-toggle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: rgba(13, 27, 52, 0.78);
    color: var(--text-main);
    opacity: 0.7;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.approach-toggle:hover,
.approach-toggle:focus-visible {
    opacity: 1;
    border-color: var(--accent-blue);
}

/* pause icon by default, play icon when paused */
.approach-toggle-icon {
    width: 10px;
    height: 12px;
    border-left: 3px solid currentColor;
    border-right: 3px solid currentColor;
}

.approach-player.is-paused .approach-toggle-icon {
    width: 0;
    height: 0;
    border-right: 0;
    border-left: 11px solid currentColor;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    margin-left: 3px;
}

/* tabs under the video: progress of each step, click to jump */
.approach-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px;
}

.approach-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    padding: 0 0 8px;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--text-muted);
    text-align: left;
    opacity: 0.6;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.approach-tab:hover {
    opacity: 0.9;
}

.approach-tab.is-active {
    opacity: 1;
    color: var(--text-main);
}

.approach-tab:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.approach-tab-bar {
    display: block;
    width: 100%;
    height: 3px;
    margin-bottom: 8px;
    background: #263b57;
    overflow: hidden;
}

.approach-tab-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent-blue);
}

/* a step already played keeps a full, dimmer bar */
.approach-tab.is-done .approach-tab-bar span {
    width: 100%;
    background: #3e6b80;
}

.approach-tab-num {
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 0.95rem;
    color: var(--accent-blue);
}

.approach-tab-label {
    font-size: 0.8rem;
    line-height: 1.3;
}

/* one text area: every panel sits in the same grid cell, so the area keeps the longest step's height
   and nothing below it jumps when the step changes */
.approach-panels {
    --tab-gap: 8px;
    /* same as .approach-tabs gap */
    position: relative;
    display: grid;
    margin-top: 10px;
    padding: 16px 18px;
    border: 1px solid #263b57;
    background: rgba(9, 20, 38, 0.45);
}

/* the text area says which step it belongs to by pointing at the active tab:
   a lit segment of its top edge sits under that tab, with a notch pointing up into it, and slides along
   when the step changes (--step is 0, 1 or 2, set by main.js) */
.approach-panels::before,
.approach-panels::after {
    content: "";
    position: absolute;
    transition: left 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.approach-panels::before {
    top: -1px;
    left: calc((100% + 2px + var(--tab-gap)) * var(--step, 0) / 3 - 1px);
    width: calc((100% + 2px - 2 * var(--tab-gap)) / 3);
    height: 2px;
    background: var(--accent-blue);
}

.approach-panels::after {
    top: -7px;
    left: calc((100% + 2px + var(--tab-gap)) * var(--step, 0) / 3 - 1px + (100% + 2px - 2 * var(--tab-gap)) / 6 - 6px);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--accent-blue);
}

.approach-panel {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.approach-panel.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease 0.1s, visibility 0s;
}

.approach-panel p {
    font-size: 0.95rem;
    line-height: 1.7;
}

@media (max-width: 575.98px) {
    .approach-player {
        padding: 12px;
    }

    .approach-tabs {
        gap: 6px;
    }

    .approach-tab-label {
        font-size: 0.72rem;
    }

    .approach-panels {
        --tab-gap: 6px;
        padding: 12px 14px;
    }

    .approach-panel p {
        font-size: 0.9rem;
    }
}

/* =============================================================================
   Cover (index.html). Still by default; hero/hero-scroll.js adds .hero--live once its 3D scene is up,
   which turns the header into a tall scroll track with the scene pinned to the viewport.
   ========================================================================== */
.hero {
    position: relative;
    margin-top: -60px;
    /* run under the fixed navbar */
    height: 80vh;
    min-height: 500px;
}

.hero-stage {
    position: absolute;
    inset: 0;
}

.hero-text {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding: 0 7vw;
    text-align: right;
    pointer-events: none;
}

.hero-title-Lockup {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 960px;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.75rem;
    font-family: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(0.7rem, 0.9vw, 0.82rem);
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--accent-gold);
    text-shadow: 0 2px 20px rgba(4, 12, 26, 0.9);
}

.hero-kicker::before {
    content: "";
    display: inline-block;
    width: 32px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold));
}

.hero-text h1.hero-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 960px;
    margin: 0 0 1.35rem;
    font-family: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
    -webkit-text-stroke: 0;
}

.hero-title-main {
    display: block;
    font-size: clamp(2.8rem, 5.8vw, 5.2rem);
    font-weight: 800;
    line-height: 1.04;
    letter-spacing: -0.015em;
    background: linear-gradient(135deg, #ffffff 0%, #eaf3fb 52%, #9fc4dd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 6px 32px rgba(4, 12, 26, 0.92));
}

.hero-title-divider {
    display: block;
    width: min(260px, 38vw);
    height: 1px;
    margin: 1.05rem 0 1.1rem;
    background: linear-gradient(90deg, rgba(98, 197, 213, 0), rgba(98, 197, 213, 0.65) 55%, var(--accent-gold) 100%);
}

.hero-title-sub {
    display: block;
    font-size: clamp(1.1rem, 1.95vw, 1.72rem);
    font-weight: 500;
    line-height: 1.42;
    letter-spacing: 0.03em;
    color: #e4eef7;
    text-shadow: 0 2px 32px rgba(4, 12, 26, 0.95);
}

.hero-text p.hero-lead {
    max-width: 680px;
    font-family: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
    color: var(--accent-blue);
    font-size: clamp(0.86rem, 1.05vw, 1.02rem);
    font-weight: 400;
    letter-spacing: 0.035em;
    text-shadow: 0 2px 30px rgba(4, 12, 26, 0.95);
}

/* Staggered entrance when the 3D bundle finishes assembling */
.hero--live .hero-kicker,
.hero--live .hero-title-main,
.hero--live .hero-title-divider,
.hero--live .hero-title-sub,
.hero--live .hero-lead {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(6px);
    transition:
        opacity 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero--live .hero-title-divider {
    transform: scaleX(0.2);
    transform-origin: right center;
    filter: none;
}

.hero--live .hero-text.is-revealed .hero-kicker {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    transition-delay: 0.02s;
}

.hero--live .hero-text.is-revealed .hero-title-main {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0) drop-shadow(0 6px 32px rgba(4, 12, 26, 0.92));
    transition-delay: 0.10s;
}

.hero--live .hero-text.is-revealed .hero-title-divider {
    opacity: 1;
    transform: scaleX(1);
    transition-delay: 0.22s;
}

.hero--live .hero-text.is-revealed .hero-title-sub {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    transition-delay: 0.28s;
}

.hero--live .hero-text.is-revealed .hero-lead {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    transition-delay: 0.38s;
}

/* Scroll cue: its own layer, centred at the foot of the screen, and kept on through the whole cover
   (not only the title) so it is clear the film goes on through the membrane. The script sets its opacity
   and adds .is-deep once the title has gone, .is-nudge when the reader has stopped scrolling mid-way. */
.hero-scroll {
    display: none;
    position: fixed;
    left: 50%;
    bottom: max(3.5vh, 18px);
    z-index: 4;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 22px 12px;
    border: 1px solid rgba(98, 197, 213, 0.35);
    border-radius: 999px;
    background: rgba(7, 17, 32, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 0 0 rgba(98, 197, 213, 0);
    color: var(--accent-blue);
    font-family: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 0.3s linear, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.hero-scroll-label {
    position: relative;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    font-weight: 600;
    letter-spacing: 0.3em;
    margin-right: -0.3em;  /* letter-spacing leaves a gap after the last letter */
    white-space: nowrap;
    text-shadow: 0 2px 14px rgba(4, 12, 26, 0.9);
}

.hero-scroll-more,
.hero-scroll.is-deep .hero-scroll-first {
    display: none;
}

.hero-scroll.is-deep .hero-scroll-more {
    display: inline;
}

/* drawn as a mouse rather than a capsule (a plain oval read as a "0"): a body slightly narrower at the
   top, the seam between the buttons and the wheel turning in gold */
.hero-scroll-mouse {
    display: block;
    width: 24px;
    height: 36px;
    overflow: visible;
}

.hero-scroll-body,
.hero-scroll-seam {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
}

.hero-scroll-body {
    stroke-width: 1.6;
    fill: rgba(98, 197, 213, 0.08);
}

.hero-scroll-seam {
    stroke-width: 1.1;
    opacity: 0.55;
}

.hero-scroll-wheel {
    fill: var(--accent-gold);
    transform-box: fill-box;
    transform-origin: center;
    animation: hero-scroll-wheel 1.6s ease-in-out infinite;
}

/* touch screens have no mouse: the arrows say it alone */
@media (hover: none) and (pointer: coarse) {
    .hero-scroll-mouse {
        display: none;
    }
}

.hero-scroll-chevrons {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: -2px;
}

.hero-scroll-chevrons i {
    display: block;
    width: 12px;
    height: 12px;
    margin-top: -5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    animation: hero-scroll-chevron 1.6s ease-in-out infinite;
}

.hero-scroll-chevrons i:nth-child(2) {
    animation-delay: 0.2s;
}

@keyframes hero-scroll-wheel {
    0% { transform: translateY(0); opacity: 1; }
    70% { transform: translateY(5px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}

@keyframes hero-scroll-chevron {
    0%, 100% { opacity: 0.25; transform: translateY(-3px) rotate(45deg); }
    50% { opacity: 1; transform: translateY(3px) rotate(45deg); }
}

/* the reader has stopped part-way: call louder */
.hero-scroll.is-nudge {
    border-color: rgba(98, 197, 213, 0.85);
    animation: hero-scroll-nudge 1.6s ease-in-out infinite;
}

@keyframes hero-scroll-nudge {
    0%, 100% { transform: translateX(-50%) translateY(0) scale(1.08); box-shadow: 0 0 0 0 rgba(98, 197, 213, 0.45); }
    50% { transform: translateX(-50%) translateY(-8px) scale(1.08); box-shadow: 0 0 0 12px rgba(98, 197, 213, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .hero-scroll-wheel,
    .hero-scroll-chevrons i,
    .hero-scroll.is-nudge {
        animation: none;
    }
}

/* live: the scroll bar is the clock */
.hero.hero--live {
    height: 400vh;
    /* 3 screens of scroll for the whole cover; the last one is shared with the page, which rises over the stage */
    margin-bottom: -100vh;
    min-height: 0;
}

/* while it plays, the cover is in front of the page that rises into its last screen (the page is seen
   through the opening in the membrane); it takes no clicks, so the page underneath stays usable */
.hero.hero--live:not(.hero--done) {
    z-index: 2;
    pointer-events: none;
}

.hero--live .hero-stage {
    position: sticky;
    top: 0;
    height: 100vh;
}

.hero--live .hero-stage canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

/* a scrim so the words stay readable over the structure, without washing it out */
.hero--live .hero-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(ellipse 70% 55% at 50% 48%, rgba(7, 17, 32, 0.82), rgba(7, 17, 32, 0.35) 55%, rgba(7, 17, 32, 0) 78%);
    transition: opacity 0.4s linear;
}

.hero--live.gone .hero-stage::after {
    opacity: 0;
}

/* the script fades the title in when the bundle is built and out as the scroll begins */
.hero--live .hero-text {
    position: fixed;
    opacity: 0;
}

.hero--live .hero-scroll {
    display: flex;
    opacity: 0;
}

/* sealed: the camera has gone through the hole and the cover has closed behind it */
.hero.hero--done {
    min-height: 0;
}

.hero--done .hero-stage,
.hero--done .hero-text {
    display: none;
}

/* ...leaving a still title band at the top of the page */
.hero.hero--done.hero--titled {
    margin-bottom: 0;
    height: auto;
    padding: calc(60px + 12vh) 0 10vh;
}

.hero--done.hero--titled .hero-text {
    display: flex;
    position: relative;
    inset: auto;
    opacity: 1;
}

.hero--done.hero--titled .hero-kicker,
.hero--done.hero--titled .hero-title-main,
.hero--done.hero--titled .hero-title-divider,
.hero--done.hero--titled .hero-title-sub,
.hero--done.hero--titled .hero-lead {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
}

.hero--done.hero--titled .hero-scroll {
    display: none;
}

/* ===== Simulation page readability (presentation only, whole page) ===== */
/* Blocks inside a group are separated by space only (no divider lines), like everywhere else */
.simulation-page #guv-env {
    padding-top: 0.5rem !important;
}

/* Long sentence-style sub-headings: readable sans instead of the pixel font */
.simulation-page .simulation-subblock h5.section-subtitle {
    margin-top: 2.5rem;
}

/* Captions inside cards: no paragraph indent, aligned with the title */
.simulation-page main figure p,
:is(.experiment-page, .design-page) main figure p {
    text-indent: 0;
}

/* Notes in small type read as notes */
.simulation-page .simulation-subblock>p.small {
    padding: 10px 14px;
    border-left: 2px solid rgba(148, 163, 184, 0.35);
    background-color: rgba(20, 41, 69, 0.45);
    color: var(--text-muted) !important;
    text-indent: 0;
}

/* ----- "More about ..." accordions ----- */

.math-display {
    margin: 1rem 0;
    overflow-x: auto;
    text-align: center;
}

/* Appendix / Simulation equations: set apart from the prose, slightly larger, high contrast */
.appendix-page .math-display,
.simulation-page .math-display {
    margin: 1.75rem 0 2.1rem;
    padding: 0.6rem 1.5rem;
    border-left: 3px solid var(--accent-blue);
    border-radius: 0;
    background-color: rgba(98, 197, 213, 0.07);
    color: var(--text-main);
}

.appendix-page .math-display mjx-container[display="true"],
.simulation-page .math-display mjx-container[display="true"] {
    margin: 0.65em 0 !important;
    font-size: 112% !important;
}

/* Inline math in muted prose: full-contrast so symbols stay legible */
.appendix-page mjx-container:not([display="true"]),
.simulation-page mjx-container:not([display="true"]) {
    color: var(--text-main);
}

html[data-theme="light"] .appendix-page .math-display,
html[data-theme="light"] .simulation-page .math-display {
    background-color: rgba(29, 129, 147, 0.07);
    border-left-color: #1d8193;
}

/* Equations stand apart from the prose */

@media (max-width: 767.98px) {

    main .col-lg-10 h4.section-subtitle,
    main .col-lg-10 h3.section-subtitle,
    main .wet-exp-title {
        font-size: 1.2rem;
    }

    main .wet-subhead,
    .simulation-page .simulation-subblock h5.section-subtitle {
        font-size: 1.08rem;
    }
}

/* ===== Home ===== */
.hero-text .hero-cta {
    margin-top: 22px;
    padding: 10px 22px;
    pointer-events: auto;
    background-color: rgba(9, 20, 38, 0.6);
    letter-spacing: 0.04em;
}

.home-media {
    position: relative;
    margin: 0;
    overflow: hidden;
    border: 1px solid #314763;
    background-color: #ffffff;
    aspect-ratio: 16 / 9;
}

.home-media video,
.home-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.home-media-placeholder {
    display: grid;
    place-items: center;
    background-color: var(--surface-dark);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* What We Did: alternating figure / text rows joined by a timeline */
.home-story {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-step {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    padding: 36px 0;
}

.home-step+.home-step {
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.home-step:nth-child(even) .home-step-media {
    order: 2;
}

.home-step-num {
    display: block;
    color: var(--accent-gold);
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 2.4rem;
    line-height: 1;
    letter-spacing: 0.04em;
}

.home-step-title {
    margin: 8px 0 14px;
    color: var(--accent-blue);
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 1.6rem;
    -webkit-text-stroke: 0.6px currentColor;
}

.home-step-body p {
    margin-bottom: 18px;
}

.home-step-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.home-step-link:hover,
.home-step-link:focus-visible {
    color: var(--primary-blue);
    background-color: var(--accent-gold);
}

@media (max-width: 991.98px) {
    .home-step {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 28px 0;
    }

    .home-step:nth-child(even) .home-step-media {
        order: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-step-link {
        transition: none;
    }
}

/* ===== 2D results: vesicle-size matrices, notes and heatmaps (presentation only) ===== */
/* Each vesicle size is one unframed matrix: rows = rigidity, columns = linker length */
.sim-matrix {
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* 3x3 CSS Grid on desktop: [Corner / Row headers] + [Short linker col] + [Long linker col] */
@media (min-width: 768px) {
    .sim-matrix-grid {
        display: grid !important;
        grid-template-columns: 200px minmax(0, 1fr) minmax(0, 1fr);
        gap: 14px;
        margin: 0 !important;
        align-items: stretch;
    }

    .sim-matrix-grid > * {
        width: auto !important;
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* Top-left corner axis indicator cell */
.sim-matrix-corner {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 70px;
    padding: 10px 12px;
    background:
        linear-gradient(to top right,
            transparent calc(50% - 1px),
            rgba(148, 163, 184, 0.25) 50%,
            transparent calc(50% + 1px)),
        rgba(15, 31, 58, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.02em;
}

.sim-matrix-corner-col {
    align-self: flex-end;
    text-align: right;
    color: #cbd5e1;
}

.sim-matrix-corner-row {
    align-self: flex-start;
    text-align: left;
    color: #cbd5e1;
}

/* Column headers (Short linker / Long linker) */
.sim-matrix-colhead {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 16px;
    background: rgba(15, 31, 58, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0;
    text-align: center;
}

.sim-matrix-colhead-title {
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sim-matrix-colhead-sub {
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Row headers (High rigidity / Low rigidity) */
.sim-matrix-rowhead {
    padding: 14px 12px !important;
    background: rgba(15, 31, 58, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0;
}

.sim-matrix-rowhead > span {
    color: #ffffff !important;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    text-align: center;
    line-height: 1.45;
}

/* Cells: unified quadrant cards inside the 2x2 matrix */
.sim-matrix .sim-matrix-cell {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 14px 16px 14px !important;
    background: rgba(15, 31, 58, 0.75);
    background-image: none !important;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(2, 9, 20, 0.2);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sim-matrix .sim-matrix-cell:hover {
    transform: none;
    border-color: rgba(148, 163, 184, 0.28);
    box-shadow: 0 2px 10px rgba(2, 9, 20, 0.2);
}

.sim-matrix .sim-matrix-cell::before,
.sim-matrix .sim-matrix-cell::after {
    display: none;
}

/* Cell header bar: condition title on the left, result badge on the right */
.sim-matrix-cell-head {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-height: 36px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.sim-matrix-col {
    display: none;
}

.sim-matrix-cell .simulation-result-mark {
    position: static;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    box-shadow: none;
}

.sim-matrix-cell .simulation-result-mark svg {
    width: 18px;
    height: 18px;
}

.sim-matrix-media {
    background-color: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0;
}

.sim-matrix-media > img,
.sim-matrix-media > video {
    padding: 6px;
}

.sim-matrix-cell p {
    margin-top: auto;
    text-indent: 0;
    font-size: 1rem;
    line-height: 1.6;
}

/* Notes (caveats, editing hints) read as notes, not results */

/* Heatmaps: white plot frame, captions aligned */
.sim-heatmap {
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.sim-heatmap .ratio {
    background-color: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.sim-heatmap .ratio > img {
    padding: 6px;
}

main table caption,
main .exp-seq-table caption {
    padding-bottom: 0.75rem;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-muted) !important;
}

main table caption strong {
    color: var(--fig-accent);
    font-weight: 600;
    white-space: nowrap;
}

.appendix-page #source-code-inventory a[href^="code/"] {
    overflow-wrap: anywhere;
}

.simulation-page mjx-assistive-mml,
.appendix-page mjx-assistive-mml {
    width: 1px !important;
    height: 1px !important;
}

/* References: a quiet end-of-page block (thin rule, small label, dimmed list), not a chapter */
main .references-section {
    margin-top: 3rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border-color);
    opacity: 0.8;
}

main .references-title {
    margin: 0 0 1.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}

main .references-section .references-list {
    font-size: 0.85rem;
}

/* Reference lists (all pages): one academic style — [n] Authors. Title. Journal vol, pages (year). DOI */
.references-list {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text-muted);
}

.references-list i {
    color: var(--text-main);
}

.references-list b {
    font-weight: 700;
    color: var(--text-main);
}

.references-list a {
    overflow-wrap: anywhere;
}

/* DOI shown as a short link label instead of the full URL */
.references-list .ref-doi {
    margin-left: 0.25em;
    font-size: max(0.95em, 12.5px);
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* [n] hangs in the margin so wrapped lines align with the author names */
.references-list p {
    padding-left: 2.6em;
    text-indent: -2.6em !important;
}

/* a citation link scrolled into view clears the fixed header */
.references-list p[id] {
    scroll-margin-top: 110px;
}

.references-list p {
    margin-bottom: 0.75rem;
    text-indent: 0;
}

@media (max-width: 767.98px) {
    .site-footer .row {
        --bs-gutter-x: 1.5rem;
    }

    .sim-matrix {
        padding: 0 !important;
    }

    .sim-matrix-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin: 0 !important;
    }

    .sim-matrix-grid > * {
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
    }

    .sim-matrix-corner {
        display: none;
    }

    .sim-matrix-rowhead {
        grid-column: 1 / -1;
        justify-content: flex-start !important;
        padding: 8px 12px !important;
    }

    .sim-matrix-rowhead > span {
        font-size: 1.05rem;
        text-align: left;
    }

    .sim-matrix .sim-matrix-cell {
        padding: 10px 10px 12px !important;
    }

    .sim-matrix-cell-head {
        min-height: 28px;
        padding-bottom: 6px;
        margin-bottom: 8px;
    }

    .sim-matrix-cell .simulation-result-mark {
        width: 24px;
        height: 24px;
    }

    .sim-matrix-cell .simulation-result-mark svg {
        width: 14px;
        height: 14px;
    }
}

/* ===== Appendix: Wet Lab protocols ===== */
/* Experiment titles: readable sans, ID shown as a small tag */
.wet-exp-title {
    margin: 0 0 1.75rem;
}

.wet-exp-id {
    display: block;
    margin-bottom: 4px;
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--accent-blue);
}

.wet-subhead {
    margin: 2.5rem 0 1rem;
    line-height: 1.5;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    -webkit-text-stroke: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Materials / Methods / Results / Discussion (wet protocols and Experiment page share one label style) */
.wet-label,
.exp-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2.75rem 0 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-blue);
}

@media (max-width: 767.98px) {
    .wet-label,
    .exp-label {
        font-size: 1rem;
    }
}

.wet-label::after,
.exp-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: rgba(148, 163, 184, 0.18);
}

/* Procedure text is not prose: no first-line indent */
.wet-steps p,
.wet-label {
    text-indent: 0;
}

/* Numbered procedure */
.wet-steps {
    padding-left: 1.6rem;
    margin-bottom: 0;
}

.wet-steps > li {
    margin-bottom: 1.6rem;
    line-height: 1.8;
    padding-left: 0.25rem;
}

.wet-steps > li::marker {
    color: var(--accent-blue);
    font-weight: 700;
}

.wet-conditions {
    margin: 0.25rem 0 0.5rem;
    padding-left: 1.1rem;
    list-style: disc;
}

.wet-conditions li {
    margin-bottom: 2px;
}

.wet-conditions li::marker {
    color: var(--accent-blue);
}

/* Tables: small recipe tables tile, wide ones span */
.wet-table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1rem 2rem;
    margin: 1.25rem 0 1.75rem;
}

.wet-table-wide {
    margin: 1.25rem 0 1.75rem;
}

.wet-table-grid .table-responsive,
.wet-table-wide .table-responsive {
    margin: 0;
}

.wet-table {
    --bs-table-bg: rgba(20, 41, 69, 0.6);
    --bs-table-border-color: rgba(148, 163, 184, 0.22);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.wet-table caption {
    padding-top: 0;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-main) !important;
}

main .wet-table th,
main .wet-table td {
    padding: 10px 14px;
}

.wet-table thead th {
    --bs-table-bg: rgba(98, 197, 213, 0.12);
    color: #d7f3f8;
    font-weight: 600;
}

.wet-table tbody th {
    font-weight: 500;
    min-width: 8.5rem;
}

.wet-table thead th[colspan] {
    text-align: center;
}

.wet-table tbody td {
    white-space: nowrap;
}

.wet-table .wet-total th,
.wet-table .wet-total td {
    border-top: 1px solid rgba(98, 197, 213, 0.45);
    font-weight: 600;
}

/* Same table style for tables whose cells hold sentences (e.g. parameter/provenance tables): let them wrap */
.wet-table-prose tbody td {
    white-space: normal;
    min-width: 6.5rem;
}

.wet-table td.font-monospace {
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    white-space: normal;
    word-break: break-word;
}

.wet-placeholder {
    margin: 1.25rem 0 2rem;
}

/* Wet lab result figures: one or more panels + caption */
.wet-figure {
    margin: 1.25rem 0 2rem;
}

.wet-fig-panels {
    display: grid;
    gap: 8px;
}

.wet-fig-panels-1 {
    max-width: 560px;
    margin: 0 auto;
}

.wet-fig-panels-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wet-fig-panels-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wet-fig-panels img {
    display: block;
    width: 100%;
    height: auto;
    border-color: #314763 !important;
    background-color: #fff;
}

/* Consecutive single-panel figures sit two per row */
.wet-figure-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin: 1.25rem 0 2rem;
}

.wet-figure-grid .wet-figure {
    margin: 0;
}

@media (max-width: 767.98px) {
    .wet-table-grid,
    .wet-figure-grid {
        grid-template-columns: 1fr;
    }

    .wet-steps {
        padding-left: 1.3rem;
    }
}

/* Keep the pixel font for page titles, navigation, and footer only.
   Font Awesome icons and MathJax output are left out: they need their own fonts to show. */
main :not(h1):not(.page-title):not(.fa-solid):not(.fa-regular):not(.fa-brands):not(mjx-container *) {
    font-family: inherit !important;
    -webkit-text-stroke: 0 !important;
}

/* ===== Experiment page figures ===== */
:is(.experiment-page, .design-page) main figure img.border,
:is(.experiment-page, .design-page) main .row img.border {
    border-color: #314763 !important;
}

.exp-panel-label {
    margin-top: 6px;
    text-align: center;
    text-indent: 0;
}

/* Sequence tables (text instead of images) */
.exp-seq-table {
    --bs-table-bg: rgba(20, 41, 69, 0.6);
    --bs-table-border-color: rgba(148, 163, 184, 0.22);
    font-size: 0.86rem;
}

.exp-seq-table caption {
    padding-top: 0;
}

.exp-seq-table thead th {
    --bs-table-bg: rgba(98, 197, 213, 0.12);
    color: #d7f3f8;
    font-weight: 600;
    white-space: nowrap;
}

.exp-seq-table tbody th,
.exp-seq-table tbody td:nth-child(2) {
    white-space: nowrap;
}

.exp-seq-table .exp-seq-domains {
    white-space: nowrap;
    color: #d7f3f8;
}

.exp-seq-table .exp-seq-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

.exp-seq-link {
    text-indent: 0;
}

/* Side-by-side images: same box size, whole image visible */
img.exp-fit {
    object-fit: contain;
}

img.exp-fit-light {
    background-color: #fff;
}

img.exp-fit-dark {
    background-color: #000;
}

img.exp-fit-4x3 {
    aspect-ratio: 4 / 3;
}

img.exp-fit-1x1 {
    aspect-ratio: 1 / 1;
}

img.exp-fit-hairpin {
    aspect-ratio: 1 / 1;
}

/* One framed box per set of figure panels */
.exp-panel-group {
    height: 100%;
    padding: 12px;
    border: 1px solid #314763;
    border-radius: 0;
    background-color: rgba(255, 255, 255, 0.03);
}

.exp-panel-group img {
    display: block;
    border-radius: 0;
}

/* ===== Experiment page: readability ===== */
/* Overview / Results / Discussion: compact labels instead of separators */
.exp-block {
    margin-top: 2rem;
}

.exp-label {
    margin: 0 0 1.25rem;
}

.exp-subsection p.small {
    font-size: 0.88rem;
}

/* Figures */
.exp-subsection > figure,
.exp-subsection > .row,
.exp-block > figure,
.exp-block > .row {
    margin-top: 1.25rem;
}

/* Results: scheme -> result, linked by an arrow */
.exp-flow-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.exp-flow-arrow svg {
    display: block;
    width: 44px;
    height: auto;
}

/* Scheme figures: box shrinks to the image so the caption starts at the image's left edge */
figure.exp-scheme {
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

figure.exp-scheme figcaption {
    width: 0;
    min-width: 100%;
}

/* Result image next to a scheme: natural aspect ratio, no letterbox */
.exp-flow img.exp-fit {
    aspect-ratio: auto;
    width: auto !important;
    max-width: 100%;
    max-height: 420px;
    margin: 0 auto;
    display: block;
    background-color: transparent;
}

/* Agarose gel (Fig. 6): drop the empty area below the bands */
.exp-flow img.exp-crop-gel {
    aspect-ratio: 490 / 560;
    object-fit: cover;
    object-position: top;
}

.exp-flow-arrow-down {
    margin: 1.25rem 0;
}

.exp-flow-arrow-down svg {
    transform: rotate(90deg);
}

@media (max-width: 991.98px) {
    .exp-flow .exp-flow-arrow svg {
        transform: rotate(90deg);
    }
}

.exp-subsection .seed-structure-layout,
.exp-subsection .seed-structure-layout figure {
    margin-top: 0;
}

.seed-structure-layout .exp-seq-table {
    margin-bottom: 0;
}

.seed-structure-layout .table-responsive {
    margin-bottom: 0.25rem !important;
}

.seed-structure-layout .exp-seq-table caption {
    padding-bottom: 0;
}

.seed-structure-layout {
    margin-bottom: 2.5rem;
}

/* Placeholders: compact, clearly "to do" */
.exp-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 160px;
    padding: 20px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    background-color: rgba(20, 41, 69, 0.35);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: center;
}

.exp-placeholder span {
    font-size: 0.85rem;
    color: #d7f3f8;
}

.exp-placeholder-square {
    max-width: none;
    min-height: 140px;
}

/* =========================================
   Theme toggle (header) + Light theme
   html[data-theme="light"] is set by main.js; the default (no attribute) is the dark theme above.
   ========================================= */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #7890aa;
    border-radius: 0;
    background-color: transparent;
    color: #c2cfdd;
    font-size: 1rem;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
    background-color: rgba(98, 197, 213, 0.08);
}

/* phones: keep logo, theme button and menu button on one row */
@media (max-width: 400px) {
    .navbar-brand {
        margin-right: 8px;
    }

    .theme-toggle {
        width: 34px;
        height: 34px;
        margin-right: 6px !important;
    }

    .navbar-toggler {
        padding: 0.25rem 0.5rem;
    }
}

/* show the icon of the mode you would switch to */
.theme-toggle .theme-toggle-icon-dark,
html[data-theme="light"] .theme-toggle .theme-toggle-icon-light {
    display: none;
}

html[data-theme="light"] .theme-toggle .theme-toggle-icon-dark {
    display: inline-block;
}

html[data-theme="light"] {
    color-scheme: light;
    --accent-blue: #1d8193;
    --accent-gold: #9a7425;
    --fig-accent: #2456c8;
    --bg-light: #f5f7fa;
    --border-color: #d3dce6;
    --text-main: #1c2b3e;
    --text-muted: #5b6b7f;
    --surface-dark: #ffffff;
    --surface-raised: #eef3f8;
    --light-subtle-bg: #f2f5f9;
    --light-strong-text: #165a68;
}

html[data-theme="light"] body {
    background-image:
        linear-gradient(rgba(29, 129, 147, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29, 129, 147, 0.05) 1px, transparent 1px),
        radial-gradient(ellipse at 50% 0%, rgba(29, 129, 147, 0.06), transparent 58%),
        linear-gradient(180deg, #f8fafc 0%, #f5f7fa 60%, #f1f4f8 100%);
}

html[data-theme="light"] .ambient-particles span {
    background-color: #9fd6e2;
    filter: none;
}

/* Navigation */
html[data-theme="light"] .navbar {
    background-color: #ffffff !important;
    border-bottom-color: var(--border-color);
    box-shadow: 0 2px 12px rgba(20, 40, 70, 0.08);
}

html[data-theme="light"] .navbar-brand {
    color: var(--text-main) !important;
}

html[data-theme="light"] .navbar-toggler,
html[data-theme="light"] .theme-toggle {
    border-color: #8a9bb0;
    color: #3c4d63;
}

html[data-theme="light"] .theme-toggle:hover {
    color: var(--accent-gold);
    border-color: var(--accent-gold);
    background-color: rgba(29, 129, 147, 0.08);
}

html[data-theme="light"] .navbar-toggler-icon {
    filter: none;
}

html[data-theme="light"] .navbar-nav .nav-link {
    color: #3c4d63 !important;
}

html[data-theme="light"] .navbar-nav .nav-link:hover {
    color: var(--text-main) !important;
}

html[data-theme="light"] .navbar-nav .nav-link.active {
    color: var(--accent-gold) !important;
}

/* Headings & text */
html[data-theme="light"] .page-title,
html[data-theme="light"] .section-title,
html[data-theme="light"] main h3,
html[data-theme="light"] main h4,
html[data-theme="light"] main h5,
html[data-theme="light"] main h6 {
    color: var(--text-main);
}

html[data-theme="light"] main .section-subtitle,
html[data-theme="light"] .wet-exp-title {
    color: var(--accent-gold);
}

html[data-theme="light"] .wet-subhead,
html[data-theme="light"] .simulation-page .simulation-subblock h5.section-subtitle {
    color: var(--light-strong-text);
}

html[data-theme="light"] .text-secondary {
    color: #4a5a6e !important;
}

html[data-theme="light"] .text-muted {
    color: var(--text-muted) !important;
}

html[data-theme="light"] .sidebar-toc .nav-link {
    color: #55667b;
}

html[data-theme="light"] .references-list,
html[data-theme="light"] main [style*="color: #d0d0d0"] {
    color: #4a5a6e !important;
}

/* Panels */
html[data-theme="light"] .content-box,
html[data-theme="light"] .sim-env {
    border-color: var(--border-color);
    box-shadow: 0 3px 10px rgba(20, 40, 70, 0.06);
}

html[data-theme="light"] .content-box:hover,
html[data-theme="light"] .sim-env:hover {
    border-color: #9fb2c7;
    box-shadow: 0 5px 14px rgba(20, 40, 70, 0.1);
}

html[data-theme="light"] .simulation-result-mark-negative {
    color: #d23a60;
    background-color: rgba(210, 58, 96, 0.08);
    border-color: rgba(210, 58, 96, 0.4);
}

html[data-theme="light"] .simulation-result-mark-positive {
    color: #0b8597;
    background-color: rgba(11, 133, 151, 0.08);
    border-color: rgba(11, 133, 151, 0.45);
    box-shadow: none;
}

html[data-theme="light"] .sim-live-mark {
    color: #d23a60;
}

html[data-theme="light"] .sim-live-mark.is-pos {
    color: #0b8597;
    text-shadow: none;
}

html[data-theme="light"] .elsi-icon-badge-teal {
    border-color: #2a9d95;
    color: #2a9d95;
}

/* Simulation environment comparison */
html[data-theme="light"] .sim-env-panel-label {
    color: var(--text-main);
}

html[data-theme="light"] .sim-env-legend {
    color: #4a5a6e;
}

html[data-theme="light"] .sim-env-legend-ends {
    color: var(--text-muted);
}

html[data-theme="light"] .sim-env-part {
    background-color: var(--light-subtle-bg);
    border-color: rgba(100, 116, 139, 0.3);
}

html[data-theme="light"] .sim-env-part:focus-visible {
    background-color: #e6edf4;
    border-color: rgba(30, 50, 80, 0.4);
}

html[data-theme="light"] .sim-env-arrow {
    border-left-color: rgba(110, 125, 150, 0.55);
}

@media (max-width: 767.98px) {
    html[data-theme="light"] .sim-env-arrow {
        border-left-color: transparent;
        border-top-color: rgba(110, 125, 150, 0.55);
    }
}

/* Approach player */
html[data-theme="light"] .approach-video-frame,
html[data-theme="light"] .home-media,
html[data-theme="light"] :is(.experiment-page, .design-page) main .row img.border {
    border-color: var(--border-color) !important;
}

html[data-theme="light"] .approach-tab-bar {
    background: #d8e0ea;
}

html[data-theme="light"] .approach-tab.is-done .approach-tab-bar span {
    background: #7fa9bb;
}

html[data-theme="light"] .approach-panels {
    border-color: #d8e0ea;
    background: #ffffff;
}

/* Notes, placeholders */
html[data-theme="light"] .simulation-page .simulation-subblock>p.small,
html[data-theme="light"] .exp-placeholder {
    background-color: var(--light-subtle-bg);
}

html[data-theme="light"] .exp-seq-table .exp-seq-domains,
html[data-theme="light"] .exp-placeholder span {
    color: var(--light-strong-text);
}

/* Simulation matrix */
html[data-theme="light"] .sim-matrix-corner {
    background:
        linear-gradient(to top right,
            transparent calc(50% - 1px),
            rgba(100, 116, 139, 0.35) 50%,
            transparent calc(50% + 1px)),
        var(--light-subtle-bg);
}

html[data-theme="light"] .sim-matrix-colhead,
html[data-theme="light"] .sim-matrix-rowhead,
html[data-theme="light"] .sim-matrix .sim-matrix-cell {
    background: var(--light-subtle-bg);
}

html[data-theme="light"] .sim-matrix .sim-matrix-cell,
html[data-theme="light"] .sim-matrix .sim-matrix-cell:hover {
    box-shadow: 0 2px 10px rgba(20, 40, 70, 0.06);
}

html[data-theme="light"] .sim-matrix-corner-col,
html[data-theme="light"] .sim-matrix-corner-row,
html[data-theme="light"] .sim-matrix-colhead-sub {
    color: #4a5a6e;
}

html[data-theme="light"] .sim-matrix-colhead-title {
    color: var(--text-main);
}

html[data-theme="light"] .sim-matrix-rowhead>span {
    color: var(--text-main) !important;
}

/* Tables (pages use Bootstrap .table-dark) */
html[data-theme="light"] .table-dark,
html[data-theme="light"] .wet-table,
html[data-theme="light"] .exp-seq-table {
    --bs-table-color: var(--text-main);
    --bs-table-bg: #ffffff;
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: #f4f7fa;
    --bs-table-striped-color: var(--text-main);
    --bs-table-active-bg: #e9eef4;
    --bs-table-active-color: var(--text-main);
    --bs-table-hover-bg: #eef3f8;
    --bs-table-hover-color: var(--text-main);
    color: var(--text-main);
    border-color: var(--border-color);
}

html[data-theme="light"] .wet-table thead th,
html[data-theme="light"] .exp-seq-table thead th {
    --bs-table-bg: rgba(29, 129, 147, 0.1);
    color: var(--light-strong-text);
}

/* Home cover, light theme: the 3D scene (.hero--live) keeps its own dark background, but the still title
   (reduced motion / no WebGL) and the title band left after the cover ends (.hero--done) sit on the page
   background, so they need dark text */
html[data-theme="light"] .hero:is(:not(.hero--live), .hero--done) .hero-title-main {
    background: linear-gradient(135deg, #0d1b34 0%, #1c3a5e 52%, #1d8193 100%);
    -webkit-background-clip: text;
    background-clip: text;
    filter: none;
}

html[data-theme="light"] .hero:is(:not(.hero--live), .hero--done) .hero-title-sub {
    color: #3c4d63;
    text-shadow: none;
}

html[data-theme="light"] .hero:is(:not(.hero--live), .hero--done) .hero-kicker,
html[data-theme="light"] .hero:is(:not(.hero--live), .hero--done) .hero-text p.hero-lead {
    text-shadow: none;
}

html[data-theme="light"] .hero:is(:not(.hero--live), .hero--done) .hero-cta {
    background-color: #ffffff;
}

html[data-theme="light"] .hero:is(:not(.hero--live), .hero--done) .hero-cta:hover,
html[data-theme="light"] .hero:is(:not(.hero--live), .hero--done) .hero-cta:focus-visible {
    background-color: var(--accent-gold);
    color: #ffffff;
}


/* ===== Appendix CTA button (Overview sections) ===== */
.appendix-cta {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    padding: 1.4rem 1.75rem;
    border: 1px solid #314763;
    border-radius: 0;
    background:
        linear-gradient(90deg, rgba(98, 197, 213, 0.10), rgba(216, 185, 111, 0.06) 60%, rgba(13, 27, 52, 0.2));
    color: var(--text-muted);
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

/* gold corner brackets, matching the nav highlight */
.appendix-cta::before,
.appendix-cta::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent-gold);
    transition: width 0.25s ease, height 0.25s ease;
    pointer-events: none;
}

.appendix-cta::before {
    top: -1px;
    left: -1px;
    border-right: 0;
    border-bottom: 0;
    border-top-left-radius: 0;
}

.appendix-cta::after {
    right: -1px;
    bottom: -1px;
    border-left: 0;
    border-top: 0;
    border-bottom-right-radius: 0;
}

.appendix-cta:hover,
.appendix-cta:focus-visible {
    border-color: var(--accent-blue);
    color: var(--text-muted);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(98, 197, 213, 0.15);
}

.appendix-cta:hover::before,
.appendix-cta:hover::after,
.appendix-cta:focus-visible::before,
.appendix-cta:focus-visible::after {
    width: 34px;
    height: 34px;
}

.appendix-cta-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: 1px solid rgba(98, 197, 213, 0.5);
    border-radius: 0;
    color: var(--accent-blue);
}

.appendix-cta-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.appendix-cta-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--accent-gold);
}

.appendix-cta-sub {
    font-size: 0.95rem;
    line-height: 1.5;
}

.appendix-cta-arrow {
    flex: 0 0 auto;
    font-size: 1.8rem;
    color: var(--accent-gold);
    transition: transform 0.25s ease;
}

.appendix-cta:hover .appendix-cta-arrow,
.appendix-cta:focus-visible .appendix-cta-arrow {
    transform: translateX(6px);
}

@media (max-width: 575.98px) {
    .appendix-cta {
        gap: 0.9rem;
        padding: 1.1rem 1.1rem;
    }

    .appendix-cta-icon {
        width: 42px;
        height: 42px;
    }

    .appendix-cta-title {
        font-size: 1.3rem;
    }

    .appendix-cta-sub {
        font-size: 0.85rem;
    }
}

html[data-theme="light"] .appendix-cta {
    border-color: var(--border-color);
    background: linear-gradient(90deg, rgba(29, 129, 147, 0.08), rgba(154, 116, 37, 0.05) 60%, #ffffff);
    box-shadow: 0 3px 10px rgba(20, 40, 70, 0.06);
}

html[data-theme="light"] .appendix-cta:hover,
html[data-theme="light"] .appendix-cta:focus-visible {
    border-color: var(--accent-blue);
    box-shadow: 0 8px 20px rgba(20, 40, 70, 0.12);
}

html[data-theme="light"] .appendix-cta-icon {
    border-color: rgba(29, 129, 147, 0.45);
}


/* =========================================
   Interactive 2D simulator (sim2d.js)
   ========================================= */
.content-box.sim-live,
.content-box.sim-live:hover {
    transform: none;
}

.sim-live {
    padding: 24px;
}

.sim-live-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    border: 1px solid var(--border-color);
}

.sim-live-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* status line under the canvas */
.sim-live-status {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.85rem;
    line-height: 1.4;
}

.sim-live-status::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    transform: rotate(45deg);
}

.sim-live-status.is-running::before {
    background: var(--accent-blue);
    animation: sim-live-pulse 1s ease-in-out infinite;
}

.sim-live-status.is-event {
    border-color: rgba(0, 229, 255, 0.45);
}

.sim-live-status.is-event::before {
    background: #00e5ff;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

.sim-live-status.is-safe {
    border-color: rgba(255, 92, 130, 0.45);
}

.sim-live-status.is-safe::before {
    background: #ff5c82;
}

@keyframes sim-live-pulse {
    50% {
        opacity: 0.25;
    }
}

/* control column */
.sim-live-controls {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    height: 100%;
}

@media (min-width: 992px) {
    .sim-live-controls {
        padding-left: 1.5rem;
        border-left: 1px solid var(--border-color);
    }
}

.sim-live-group {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.sim-live-kicker {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    float: none;
    width: auto;
    margin: 0 0 0.55rem;
    padding: 0;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    line-height: 1.2;
    text-transform: uppercase;
}

.sim-live-kicker i,
.sim-live-kicker sub {
    letter-spacing: 0;
    text-transform: none;
}

.sim-live-kicker i {
    font-size: 1.1em;
}

.sim-live-kicker > span {
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: none;
    opacity: 0.7;
}

/* preset matrix */
.sim-live-presets {
    display: grid;
    grid-template-columns: 3rem repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.sim-live-presets-head {
    padding-bottom: 2px;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.15;
    text-align: center;
}

.sim-live-presets-head small {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.75;
}

.sim-live-presets-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.sim-live-presets-row small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.sim-live-chip {
    display: grid;
    place-items: center;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.sim-live-chip:hover,
.sim-live-chip:focus-visible {
    border-color: var(--accent-blue);
    background-color: rgba(98, 197, 213, 0.08);
    outline: none;
}

.sim-live-chip.is-active {
    border-color: var(--accent-gold);
    background-color: rgba(216, 185, 111, 0.14);
    box-shadow: inset 0 0 0 1px var(--accent-gold);
}

/* ✓ / ✗ marks echo the result marks used in Figures 2–3 */
.sim-live-mark {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    color: #ff5c82;
}

.sim-live-mark::before {
    content: "\2717";
}

.sim-live-mark.is-pos {
    color: #00e5ff;
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.35);
}

.sim-live-mark.is-pos::before {
    content: "\2713";
}

.sim-live-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1rem;
    margin: 0.55rem 0 0;
    text-indent: 0;
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* radius segmented control */
.sim-live-segment {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--border-color);
}

.sim-live-segment button {
    padding: 0.45rem 0;
    border: 0;
    border-right: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.sim-live-segment button:last-child {
    border-right: 0;
}

.sim-live-segment button:hover,
.sim-live-segment button:focus-visible {
    background-color: rgba(98, 197, 213, 0.08);
    color: var(--text-main);
    outline: none;
}

.sim-live-segment button[aria-pressed="true"] {
    background-color: var(--accent-blue);
    color: var(--primary-blue);
}

/* sliders */
.sim-live-param-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}

.sim-live-param-head .sim-live-kicker {
    display: block;
    min-width: 0;
    margin: 0;
}

.sim-live-kicker sub {
    font-size: 0.75em;
}

.sim-live-value {
    color: var(--accent-gold);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.sim-live-value output {
    color: inherit;
}

.sim-live-value small {
    margin-left: 0.3rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
}

.sim-live-range {
    --fill: 50%;
    display: block;
    width: 100%;
    height: 24px;
    margin: 0;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.sim-live-range:focus {
    outline: none;
}

.sim-live-range::-webkit-slider-runnable-track {
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue) 0 var(--fill), var(--border-color) var(--fill) 100%);
}

.sim-live-range::-webkit-slider-thumb {
    width: 13px;
    height: 13px;
    margin-top: -5px;
    border: 2px solid var(--accent-blue);
    background: var(--surface-dark);
    transform: rotate(45deg);
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.sim-live-range:hover::-webkit-slider-thumb,
.sim-live-range:focus-visible::-webkit-slider-thumb {
    background: var(--accent-blue);
    box-shadow: 0 0 0 5px rgba(98, 197, 213, 0.18);
}

.sim-live-range::-moz-range-track {
    height: 3px;
    background: var(--border-color);
}

.sim-live-range::-moz-range-progress {
    height: 3px;
    background: var(--accent-blue);
}

.sim-live-range::-moz-range-thumb {
    width: 9px;
    height: 9px;
    border: 2px solid var(--accent-blue);
    border-radius: 0;
    background: var(--surface-dark);
    transform: rotate(45deg);
}

.sim-live-range:hover::-moz-range-thumb,
.sim-live-range:focus-visible::-moz-range-thumb {
    background: var(--accent-blue);
    box-shadow: 0 0 0 5px rgba(98, 197, 213, 0.18);
}

.sim-live-scale {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.64rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.75;
}

/* actions */
.sim-live-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
}

.sim-live-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    height: 42px;
    padding: 0 1.1rem;
    border: 1px solid;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.sim-live-btn-primary {
    flex: 1 1 8rem;
    border-color: var(--accent-blue);
    background-color: var(--accent-blue);
    color: var(--primary-blue);
}

.sim-live-btn-primary:hover,
.sim-live-btn-primary:focus-visible {
    border-color: var(--accent-gold);
    background-color: var(--accent-gold);
    color: var(--primary-blue);
    outline: none;
}

.sim-live-btn-primary[aria-pressed="true"] {
    background-color: transparent;
    color: var(--accent-blue);
}

.sim-live-btn-icon {
    width: 42px;
    padding: 0;
    border-color: var(--border-color);
    background: transparent;
    color: var(--text-main);
}

.sim-live-btn-icon:hover,
.sim-live-btn-icon:focus-visible {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    outline: none;
}

.sim-live-seed {
    display: flex;
    align-items: stretch;
    height: 42px;
    border: 1px solid var(--border-color);
}

.sim-live-seed label {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0 0.6rem;
    border-right: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.sim-live-seed input {
    width: 4.2rem;
    border: 0;
    background: transparent;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.sim-live-seed input::-webkit-outer-spin-button,
.sim-live-seed input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.sim-live-seed input:focus {
    outline: none;
    background-color: rgba(98, 197, 213, 0.08);
}

.sim-live-seed button {
    width: 38px;
    border: 0;
    border-left: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.sim-live-seed button:hover,
.sim-live-seed button:focus-visible {
    color: var(--accent-blue);
    outline: none;
}

/* readout */
.sim-live-readout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    margin-top: auto;
    border: 1px solid var(--border-color);
    background: var(--border-color);
}

.sim-live-stat {
    padding: 0.7rem 0.85rem 0.85rem;
    background: var(--surface-dark);
}

.sim-live-stat .sim-live-kicker {
    margin-bottom: 0.25rem;
    font-size: 0.64rem;
}

.sim-live-stat-value {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.sim-live-meter {
    position: relative;
    height: 3px;
    background: var(--surface-raised);
}

.sim-live-meter span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--accent-blue);
    transition: width 0.12s linear;
}

/* threshold tick at 150 pN */
.sim-live-meter-tension::after {
    content: "";
    position: absolute;
    top: -3px;
    right: 0;
    bottom: -3px;
    width: 2px;
    background: #ff5c82;
}

@media (max-width: 575.98px) {
    .sim-live {
        padding: 16px;
    }

    .sim-live-presets {
        grid-template-columns: 2.6rem repeat(4, minmax(0, 1fr));
    }
}

html[data-theme="light"] .sim-live-segment button[aria-pressed="true"],
html[data-theme="light"] .sim-live-btn-primary,
html[data-theme="light"] .sim-live-btn-primary:hover,
html[data-theme="light"] .sim-live-btn-primary:focus-visible {
    color: #ffffff;
}

html[data-theme="light"] .sim-live-btn-primary[aria-pressed="true"] {
    color: var(--accent-blue);
}

html[data-theme="light"] .sim-live-chip.is-active {
    background-color: rgba(154, 116, 37, 0.1);
}

/* ===== TEAM: miRNA Princess card → secret page ===== */
.princess-secret {
    position: relative;
    cursor: pointer;
}

.princess-secret:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 3px;
}

/* her backdrop: pastel pink with polka dots, a soft glow behind her and a gold frame */
.princess-secret-bg {
    overflow: hidden;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.75) 2px, transparent 2.5px) 0 0 / 18px 18px,
        radial-gradient(ellipse 55% 50% at 50% 58%, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
        linear-gradient(160deg, #ffe4f2 0%, #ffc9e3 55%, #f5b3e0 100%);
    box-shadow: inset 0 0 0 3px rgba(246, 210, 122, 0.85), inset 0 0 0 6px rgba(255, 255, 255, 0.6);
}

/* little hearts and sparkles floating in the corners */
.princess-secret-deco {
    z-index: 0;
    pointer-events: none;
}

.princess-secret-deco::before,
.princess-secret-deco::after {
    position: absolute;
    z-index: 0;
    font-family: inherit;
    line-height: 1;
    pointer-events: none;
    animation: princess-card-twinkle 2.4s ease-in-out infinite;
}

.princess-secret-deco::before {
    content: "♥  ✦";
    left: 10%;
    bottom: 12%;
    color: #ff7fb6;
    font-size: 1.1rem;
    letter-spacing: 0.3em;
}

.princess-secret-deco::after {
    content: "✦  ♥";
    top: 26%;
    right: 9%;
    color: #e9b949;
    font-size: 1rem;
    letter-spacing: 0.3em;
    animation-delay: 1.2s;
}

@keyframes princess-card-twinkle {
    0%, 100% { opacity: 0.45; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

.princess-secret-bg > img {
    z-index: 1;
    object-fit: contain !important;
    transition: transform 0.25s ease;
}

.princess-secret:hover .princess-secret-bg > img,
.princess-secret:focus-visible .princess-secret-bg > img {
    transform: scale(1.06);
}

/* "tap me!" — it's a secret, so it only pops up (and bounces) while the cursor is on her */
.princess-secret-bubble {
    position: absolute;
    z-index: 2;
    left: 50%;
    top: -12px; /* pokes out over the top edge of the picture */
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 6px 16px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff8fc8, #e2457f);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
    box-shadow: 0 3px 0 #a52a5c, 0 0 16px rgba(255, 95, 168, 0.65);
    transform: translate(-50%, 6px) scale(0.85);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
}

/* speech-bubble tail pointing at her */
.princess-secret-bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    border: 7px solid transparent;
    border-top-color: #e2457f;
    transform: translateX(-50%);
}

.princess-secret:hover .princess-secret-bubble,
.princess-secret:focus-visible .princess-secret-bubble {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0) scale(1);
    animation: princess-tapme-bounce 0.9s ease-in-out 0.2s infinite;
}

@keyframes princess-tapme-bounce {
    0%, 100% { transform: translate(-50%, 0) scale(1); }
    50% { transform: translate(-50%, -6px) scale(1.06); }
}

@media (max-width: 575.98px) {
    .princess-secret-bubble {
        top: -10px;
        padding: 4px 12px;
        font-size: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .princess-secret-bubble,
    .princess-secret-deco::before,
    .princess-secret-deco::after {
        animation: none;
    }
}

/* =====================================================================
   Secret page (princess.html): "The Secret Royal Chamber"
   This one page deliberately has its own royal look (pink × gold × night plum).
   Everything is scoped under body.princess-page.
   ===================================================================== */
body.princess-page,
html[data-theme="light"] body.princess-page {
    --royal-gold: #f6d27a;
    --royal-gold-deep: #c8952f;
    --royal-pink: #ff8fc8;
    --royal-rose: #e2457f;
    --royal-plum: #1c0b2e;
    --royal-cream: #fff4e6;
    background-color: var(--royal-plum);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 143, 200, 0.28), transparent 70%),
        radial-gradient(ellipse 60% 40% at 15% 70%, rgba(162, 92, 255, 0.18), transparent 70%),
        radial-gradient(ellipse 60% 40% at 85% 90%, rgba(255, 95, 168, 0.16), transparent 70%),
        linear-gradient(180deg, #2a0f3f 0%, #1c0b2e 55%, #12071f 100%);
    background-size: auto;
    background-attachment: fixed;
    color: var(--royal-cream);
}

/* twinkling star field behind everything */
.princess-page .royal-sky {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        radial-gradient(1.5px 1.5px at 8% 12%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 22% 38%, #ffd6ec 50%, transparent 51%),
        radial-gradient(2px 2px at 35% 8%, var(--royal-gold) 50%, transparent 51%),
        radial-gradient(1px 1px at 48% 55%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 63% 22%, #ffd6ec 50%, transparent 51%),
        radial-gradient(2px 2px at 77% 47%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 88% 15%, var(--royal-gold) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 93% 68%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 12% 82%, #ffd6ec 50%, transparent 51%),
        radial-gradient(2px 2px at 54% 88%, var(--royal-gold) 50%, transparent 51%),
        radial-gradient(1px 1px at 70% 76%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 30% 66%, #fff 50%, transparent 51%);
    animation: royal-twinkle 4s ease-in-out infinite alternate;
}

@keyframes royal-twinkle {
    from { opacity: 0.45; }
    to { opacity: 1; }
}

.princess-room {
    position: relative;
    padding-bottom: 4rem;
    color: var(--royal-cream);
    font-family: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
}

/* ---------- Title ---------- */
.royal-hero {
    padding: 1.5rem 0 2.5rem;
}

.royal-crown {
    display: inline-block;
    font-size: 2.6rem;
    color: var(--royal-gold);
    filter: drop-shadow(0 0 12px rgba(246, 210, 122, 0.7));
    animation: royal-bob 2.8s ease-in-out infinite;
}

@keyframes royal-bob {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-6px) rotate(4deg); }
}

.royal-title {
    margin: 0.4rem 0 0;
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: clamp(2.6rem, 7vw, 4.6rem);
    letter-spacing: 0.08em;
    line-height: 1.1;
    background: linear-gradient(180deg, #fff6d8 0%, var(--royal-gold) 45%, var(--royal-gold-deep) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 18px rgba(255, 143, 200, 0.55)) drop-shadow(0 3px 0 rgba(90, 20, 60, 0.8));
}

/* pink ribbon banner with notched ends */
.royal-ribbon {
    display: inline-block;
    position: relative;
    margin: 1.2rem 0 0;
    padding: 0 2.2rem;
    background: linear-gradient(180deg, var(--royal-pink), var(--royal-rose));
    color: #fff;
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 1.05rem;
    letter-spacing: 0.14em;
    line-height: 2.3;
    box-shadow: 0 4px 0 #a52a5c, 0 0 24px rgba(255, 95, 168, 0.45);
}

.royal-ribbon::before,
.royal-ribbon::after {
    content: "";
    position: absolute;
    top: 8px;
    width: 26px;
    height: 100%;
    background: #b8336a;
    z-index: -1;
}

.royal-ribbon::before {
    left: -18px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 35% 50%);
}

.royal-ribbon::after {
    right: -18px;
    clip-path: polygon(0 0, 100% 0, 65% 50%, 100% 100%, 0 100%);
}

.royal-ribbon span::before,
.royal-ribbon span::after {
    content: "✦";
    margin: 0 0.6rem;
    color: var(--royal-gold);
}

.royal-lead {
    margin: 1.4rem 0 0;
    color: #f3d9ec;
    font-size: 1rem;
}

/* ---------- Theater stage ---------- */
.royal-stage-wrap {
    margin-bottom: 3.5rem;
}

.royal-stage {
    --pr-size: 320px; /* 2× the 160px pixel art, so her face reads clearly */
    --floor-h: 120px;
    position: relative;
    height: 520px;
    overflow: hidden;
    isolation: isolate;
    border: 6px solid transparent;
    border-radius: 48% 48% 10px 10px / 70px 70px 10px 10px;
    background:
        linear-gradient(#2a0d3d, #2a0d3d) padding-box,
        linear-gradient(135deg, #fff1c1, var(--royal-gold) 30%, var(--royal-gold-deep) 55%, #fff1c1 75%, var(--royal-gold-deep)) border-box;
    box-shadow:
        0 0 0 3px rgba(42, 13, 61, 0.9),
        0 0 0 6px rgba(246, 210, 122, 0.35),
        0 0 60px rgba(255, 95, 168, 0.35),
        0 30px 60px rgba(0, 0, 0, 0.5);
}

/* back wall: deep velvet with a soft pink glow behind her */
.stage-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 45% 55% at 50% 62%, rgba(255, 143, 200, 0.35), transparent 70%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 46px),
        linear-gradient(180deg, #3d1052 0%, #2a0d3d 70%);
}

/* spotlight cone from above */
.stage-beam {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 50%;
    width: 520px;
    height: 100%;
    transform: translateX(-50%);
    clip-path: polygon(44% 0, 56% 0, 82% 100%, 18% 100%);
    background: linear-gradient(180deg, rgba(255, 244, 214, 0.38), rgba(255, 214, 236, 0.08) 85%, transparent);
    mix-blend-mode: screen;
    animation: royal-beam 5s ease-in-out infinite alternate;
}

@keyframes royal-beam {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

/* checkered floor in perspective */
.stage-floor {
    position: absolute;
    z-index: 1;
    left: -30%;
    right: -30%;
    bottom: 0;
    height: var(--floor-h);
    transform-origin: 50% 100%;
    transform: perspective(260px) rotateX(48deg);
    background:
        linear-gradient(180deg, rgba(42, 13, 61, 0.85), transparent 60%),
        repeating-conic-gradient(#f9cfe2 0 25%, #e07aa9 0 50%) 0 0 / 56px 56px;
    border-top: 3px solid var(--royal-gold);
}

/* glowing pool of light where she stands */
.stage-glow {
    position: absolute;
    z-index: 2;
    left: 50%;
    bottom: calc(var(--floor-h) * 0.38);
    width: calc(var(--pr-size) * 1.1);
    height: 40px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(255, 246, 214, 0.75), rgba(255, 143, 200, 0.35) 55%, transparent 72%);
    filter: blur(2px);
}

/* drifting sparkles */
.stage-sparkles span {
    position: absolute;
    z-index: 2;
    width: 14px;
    height: 14px;
    background: var(--royal-gold);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    opacity: 0;
    animation: royal-sparkle 3.2s ease-in-out infinite;
}

.stage-sparkles span:nth-child(1) { left: 26%; top: 30%; animation-delay: 0s; }
.stage-sparkles span:nth-child(2) { left: 70%; top: 24%; animation-delay: 0.6s; background: #fff; }
.stage-sparkles span:nth-child(3) { left: 36%; top: 52%; animation-delay: 1.2s; width: 10px; height: 10px; }
.stage-sparkles span:nth-child(4) { left: 62%; top: 58%; animation-delay: 1.8s; background: var(--royal-pink); }
.stage-sparkles span:nth-child(5) { left: 47%; top: 20%; animation-delay: 2.4s; width: 10px; height: 10px; background: #fff; }
.stage-sparkles span:nth-child(6) { left: 30%; top: 70%; animation-delay: 0.9s; background: var(--royal-pink); width: 10px; height: 10px; }
.stage-sparkles span:nth-child(7) { left: 74%; top: 44%; animation-delay: 1.5s; }
.stage-sparkles span:nth-child(8) { left: 55%; top: 36%; animation-delay: 2.1s; width: 8px; height: 8px; background: #fff; }
.stage-sparkles span:nth-child(9) { left: 40%; top: 38%; animation-delay: 2.7s; width: 8px; height: 8px; }
.stage-sparkles span:nth-child(10) { left: 66%; top: 72%; animation-delay: 0.3s; width: 10px; height: 10px; background: #fff; }

@keyframes royal-sparkle {
    0%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); }
    50% { opacity: 1; transform: scale(1) rotate(45deg); }
}

/* velvet curtains: closed on load, then they part and tie back */
.stage-curtain {
    position: absolute;
    z-index: 5;
    top: 0;
    bottom: 0;
    width: 20%;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, 0.25), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.25)),
        repeating-linear-gradient(90deg, #7d1442 0, #c22f6c 14px, #e0538a 20px, #c22f6c 26px, #7d1442 40px);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: royal-curtain-open 1.6s cubic-bezier(0.6, 0, 0.25, 1) 0.4s both;
}

.stage-curtain-left {
    left: 0;
    border-bottom-right-radius: 100% 55%;
}

.stage-curtain-right {
    right: 0;
    border-bottom-left-radius: 100% 55%;
}

@keyframes royal-curtain-open {
    from { width: 51%; border-radius: 0; }
    to { width: 20%; }
}

/* scalloped valance across the top, with gold fringe */
.stage-valance {
    position: absolute;
    z-index: 6;
    top: 0;
    left: 0;
    right: 0;
    height: 74px;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 0, #c22f6c 0 34px, var(--royal-gold) 34px 38px, transparent 38px) 0 30px / 72px 40px repeat-x,
        linear-gradient(180deg, #9a1f55, #c22f6c) 0 0 / 100% 32px no-repeat;
    filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.35));
}

/* the princess, standing centre stage on the glow */
.princess-page .princess-spot {
    position: absolute;
    z-index: 3;
    left: calc(50% - var(--pr-size) / 2);
    bottom: calc(var(--floor-h) * 0.38 - var(--pr-size) * 0.14);
    width: var(--pr-size);
    height: var(--pr-size);
}

.princess-page .princess-actor {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.princess-page .princess-actor:focus-visible {
    outline: 2px dashed var(--royal-gold);
    outline-offset: 4px;
    border-radius: 12px;
}

.princess-page .princess-idle-sprite {
    display: block;
    width: 100%;
    height: 100%;
    background: url("img/mascot/princess_idle.gif") center / contain no-repeat; /* idle motion GIF */
    image-rendering: pixelated;
    filter: drop-shadow(0 0 10px rgba(255, 214, 236, 0.55));
}

.princess-page .princess-react {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 10px rgba(255, 214, 236, 0.55));
}

.princess-page .princess-react.is-small-canvas {
    padding: 10%;
}

.princess-page .royal-stage.is-reacting .princess-idle-sprite {
    visibility: hidden;
}

/* cute speech bubble with a tail */
.princess-page .princess-say {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: calc(100% - var(--pr-size) * 0.08);
    padding: 6px 16px;
    border: 2px solid var(--royal-pink);
    border-radius: 18px;
    background: var(--royal-cream);
    color: #b8336a;
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 1rem;
    white-space: nowrap;
    box-shadow: 0 4px 0 rgba(184, 51, 106, 0.35), 0 0 18px rgba(255, 143, 200, 0.5);
    transform: translate(-50%, 8px) scale(0.85);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
    pointer-events: none;
}

.princess-page .princess-say::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    width: 14px;
    height: 14px;
    background: var(--royal-cream);
    border-right: 2px solid var(--royal-pink);
    border-bottom: 2px solid var(--royal-pink);
    transform: translate(-50%, -7px) rotate(45deg);
}

.princess-page .princess-say.is-shown {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.princess-page .princess-heart {
    position: absolute;
    z-index: 7;
    color: var(--royal-pink);
    font-size: 1.5rem;
    filter: drop-shadow(0 0 6px rgba(255, 143, 200, 0.8));
    pointer-events: none;
    animation: princess-heart-rise 1.1s ease-out forwards;
}

@keyframes princess-heart-rise {
    from { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
    to { opacity: 0; transform: translate(-50%, -80px) scale(1.3); }
}

/* confetti (5-tap combo and heart milestones) */
.royal-confetti {
    position: absolute;
    z-index: 7;
    top: -16px;
    width: 9px;
    height: 14px;
    pointer-events: none;
    animation: royal-confetti-fall var(--fall, 2.4s) cubic-bezier(0.3, 0.6, 0.6, 1) forwards;
}

@keyframes royal-confetti-fall {
    from { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    to { transform: translate(var(--drift, 0px), 500px) rotate(var(--spin, 540deg)); opacity: 0.2; }
}

/* ---------- Affection meter ---------- */
.royal-affection {
    max-width: 520px;
    margin: 1.6rem auto 0;
    text-align: center;
}

.royal-affection-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--royal-gold);
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    letter-spacing: 0.1em;
}

.royal-affection-label .fa-heart {
    color: var(--royal-pink);
    filter: drop-shadow(0 0 6px rgba(255, 143, 200, 0.8));
}

.royal-affection-label strong {
    min-width: 2ch;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 400;
}

.royal-affection-bar {
    height: 14px;
    margin-top: 0.5rem;
    padding: 2px;
    border: 2px solid var(--royal-gold);
    border-radius: 999px;
    background: rgba(28, 11, 46, 0.8);
    box-shadow: 0 0 14px rgba(246, 210, 122, 0.25);
}

.royal-affection-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--royal-pink), #ffd1e8, var(--royal-pink));
    box-shadow: 0 0 10px rgba(255, 143, 200, 0.8);
    transition: width 0.4s ease;
}

.royal-affection-next {
    margin: 0.5rem 0 0;
    color: #d9b8d0;
    font-size: 0.85rem;
}

.royal-hint {
    margin: 0.8rem 0 0;
    text-align: center;
    color: rgba(243, 217, 236, 0.55);
    font-size: 0.85rem;
    font-style: italic;
}

/* ---------- Royal profile card ---------- */
.royal-card {
    position: relative;
    max-width: 760px;
    margin: 0 auto 3rem;
    padding: 2.6rem 2.4rem 2rem;
    border: 2px solid transparent;
    border-radius: 18px;
    background:
        linear-gradient(160deg, rgba(61, 16, 82, 0.95), rgba(34, 10, 52, 0.95)) padding-box,
        linear-gradient(135deg, #fff1c1, var(--royal-gold-deep), var(--royal-pink), var(--royal-gold)) border-box;
    box-shadow: 0 0 40px rgba(255, 95, 168, 0.2), 0 20px 40px rgba(0, 0, 0, 0.4);
}

.royal-card-title {
    position: absolute;
    top: 0;
    left: 50%;
    margin: 0;
    padding: 0.35rem 1.6rem;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    background: linear-gradient(180deg, var(--royal-pink), var(--royal-rose));
    color: #fff;
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 1.05rem;
    letter-spacing: 0.12em;
    white-space: nowrap;
    box-shadow: 0 3px 0 #a52a5c;
}

.royal-card-title .fa-crown {
    color: var(--royal-gold);
}

.royal-profile {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem 2rem;
    margin: 0;
}

.royal-profile div:last-child {
    grid-column: 1 / -1;
}

.royal-profile dt {
    color: var(--royal-gold);
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.royal-profile dt::before {
    content: "♥ ";
    color: var(--royal-pink);
}

.royal-profile dd {
    margin: 0.2rem 0 0;
    color: var(--royal-cream);
    font-size: 1.05rem;
}

/* ---------- Back button ---------- */
.royal-back-btn {
    display: inline-block;
    padding: 0.7rem 2rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #fff1c1, var(--royal-gold) 50%, var(--royal-gold-deep));
    color: #5a1a3c;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-decoration: none;
    box-shadow: 0 4px 0 #8a6220, 0 0 20px rgba(246, 210, 122, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.royal-back-btn:hover,
.royal-back-btn:focus-visible {
    color: #5a1a3c;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #8a6220, 0 0 28px rgba(246, 210, 122, 0.6);
}

/* ---------- Phones ---------- */
@media (max-width: 575.98px) {
    .royal-stage {
        --pr-size: 240px;
        --floor-h: 90px;
        height: 400px;
        border-radius: 40% 40% 10px 10px / 50px 50px 10px 10px;
    }

    .stage-curtain {
        width: 13%;
    }

    @keyframes royal-curtain-open {
        from { width: 51%; border-radius: 0; }
        to { width: 13%; }
    }

    .stage-beam {
        width: 340px;
    }

    .royal-ribbon {
        padding: 0 1.2rem;
        font-size: 0.9rem;
    }

    .royal-card {
        padding: 2.4rem 1.4rem 1.6rem;
    }

    .royal-profile {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .princess-page .royal-sky,
    .royal-crown,
    .stage-beam,
    .stage-sparkles span,
    .stage-curtain {
        animation: none;
    }

    .princess-page .princess-idle-sprite {
        background-image: url("img/mascot/princess_idle.png");
    }

    .stage-sparkles span {
        opacity: 0.6;
    }
}

/* ---------- Royal guestbook (princess.html) ---------- */
.royal-guestbook {
    padding-top: 2.8rem;
}

.guestbook-session {
    margin: 0 0 0.8rem;
    text-align: center;
    color: #f3d9ec;
}

.guestbook-session strong {
    color: #fff;
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    font-size: 1.3rem;
    font-weight: 400;
}

.guestbook-session .fa-heart {
    color: var(--royal-pink);
}

.guestbook-row {
    display: flex;
    gap: 0.6rem;
}

.guestbook-input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 1rem;
    border: 2px solid rgba(246, 210, 122, 0.6);
    border-radius: 999px;
    background: rgba(28, 11, 46, 0.85);
    color: var(--royal-cream);
    font-size: 1rem;
}

.guestbook-input::placeholder {
    color: rgba(243, 217, 236, 0.5);
}

.guestbook-input:focus {
    outline: none;
    border-color: var(--royal-pink);
    box-shadow: 0 0 0 3px rgba(255, 143, 200, 0.3);
}

.guestbook-submit {
    flex: none;
    padding: 0.6rem 1.4rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--royal-pink), var(--royal-rose));
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 3px 0 #a52a5c;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.guestbook-submit:hover:not(:disabled),
.guestbook-submit:focus-visible {
    transform: translateY(-2px);
}

.guestbook-submit:focus-visible {
    outline: 2px solid var(--royal-gold);
    outline-offset: 2px;
}

.guestbook-submit:disabled {
    opacity: 0.45;
    cursor: default;
}

.guestbook-note {
    margin: 0.7rem 0 0;
    text-align: center;
    color: #f3d9ec;
    font-size: 0.9rem;
}

.guestbook-note.is-error {
    color: #ffb3c7;
}

.guestbook-fine {
    margin: 0.2rem 0 0;
    text-align: center;
    color: rgba(243, 217, 236, 0.5);
    font-size: 0.78rem;
}

.guestbook-list {
    max-height: 320px;
    margin: 1.4rem 0 0;
    padding: 0.4rem 0.8rem;
    overflow-y: auto;
    list-style: none;
    border-top: 1px dashed rgba(246, 210, 122, 0.4);
}

.guestbook-list:empty {
    display: none;
}

.guestbook-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 0.9rem;
    padding: 0.55rem 0.2rem;
    border-bottom: 1px solid rgba(246, 210, 122, 0.15);
}

.guestbook-list li.is-mine {
    background: rgba(255, 143, 200, 0.12);
    border-radius: 8px;
}

.guestbook-time {
    color: rgba(243, 217, 236, 0.6);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.guestbook-name {
    overflow: hidden;
    color: var(--royal-cream);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guestbook-hearts {
    color: var(--royal-pink);
    font-family: 'Pixelify Sans', 'DotGothic16', monospace;
    white-space: nowrap;
}

.guestbook-empty {
    margin: 1.2rem 0 0;
    text-align: center;
    color: rgba(243, 217, 236, 0.6);
    font-size: 0.9rem;
}

@media (max-width: 575.98px) {
    .guestbook-row {
        flex-direction: column;
    }

    .guestbook-list li {
        grid-template-columns: 1fr auto;
        gap: 0.1rem 0.8rem;
    }

    .guestbook-time {
        grid-column: 1 / -1;
    }
}

/* everyone's total taps (under "Your hearts") */
.royal-total {
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(246, 210, 122, 0.35);
}

.royal-total .fa-crown {
    color: var(--royal-gold);
    filter: drop-shadow(0 0 6px rgba(246, 210, 122, 0.7));
}

.royal-total .royal-affection-label strong {
    color: var(--royal-gold);
    font-variant-numeric: tabular-nums;
}

/* ===== Milestone chart (all pages): achievements per axis, then future works =====
   ms-frame.is-now = this project (solid), .is-future = next stage (dashed)
   ms-node.is-done ✓ / .is-model ◐ / .is-no ✗ / .is-goal = end point */
.milestone {
    display: flex;
    flex-direction: column;
}

.ms-frame {
    position: relative;
    padding: 1.5rem 2rem 2rem;
    border: 1px solid var(--border-color);
    background: transparent;
}

.ms-frame.is-future {
    border: 2px dashed var(--accent-blue);
    background: color-mix(in srgb, var(--accent-blue) 5%, var(--surface-dark));
}

main .ms-frame-label {
    margin: 0 0 1.5rem;
    text-indent: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent-gold);
}

.ms-frame.is-future .ms-frame-label {
    color: var(--accent-blue);
}

.ms-frame-label span {
    margin-left: 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}


.ms-axis-head {
    margin-bottom: 1.25rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.ms-axis-step {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-gold);
}

main .ms-axis-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--text-main);
}

.ms-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.6rem;
}

.ms-node {
    position: relative;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
}

/* down arrow between consecutive nodes */
.ms-node + .ms-node::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -1.6rem;
    height: 1.6rem;
    border-left: 2px solid var(--text-muted);
}

.ms-node + .ms-node::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -0.55rem;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateX(-50%) rotate(45deg);
}

.ms-check {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.1rem;
    border: 2px solid var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-muted);
}

.ms-node.is-done .ms-check,
.ms-check.is-done {
    border-color: color-mix(in srgb, var(--accent-gold) 60%, transparent);
    color: var(--accent-gold);
}

.ms-node.is-model .ms-check,
.ms-check.is-model {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.ms-node.is-no .ms-check,
.ms-check.is-no {
    border-color: var(--text-muted);
    color: var(--text-main);
}

.ms-node.is-done {
    border-color: color-mix(in srgb, var(--accent-gold) 55%, var(--border-color));
}

.ms-node.is-no {
    border-style: dashed;
}

.ms-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.ms-kind {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ms-text {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text-main);
}

.ms-node.is-no .ms-text {
    color: var(--text-muted);
}

/* the whole node is a link to the matching section of the results page */
main a.ms-link,
main a.ms-link:hover {
    color: inherit;
    text-decoration: none;
}

a.ms-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.ms-link .ms-kind {
    color: var(--accent-blue);
}

/* Link cue: a quiet arrow in the top-right corner of each linked card (on the short category row).
   The "View data" text stays hidden and fades in beside the arrow on hover / keyboard focus. */
.ms-go {
    position: absolute;
    top: 0.95rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 0;            /* hides the literal "View data" text node */
    color: var(--text-muted);
    pointer-events: none;
}

.ms-go::before {
    content: "View data";
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--accent-blue);
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.ms-go i {
    font-size: 0.95rem;
    opacity: 0.6;
    transition: transform 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.ms-link:hover .ms-go::before,
.ms-link:focus-visible .ms-go::before {
    opacity: 1;
    transform: none;
}

.ms-link:hover .ms-go i,
.ms-link:focus-visible .ms-go i {
    color: var(--accent-blue);
    opacity: 1;
    transform: translateX(3px);
}

/* the hover label would cover the text on narrow cards; touch screens get the arrow only */
@media (hover: none), (max-width: 575.98px) {
    .ms-go::before {
        display: none;
    }
}

main .ms-hint {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1rem;
    text-indent: 0;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.ms-node:has(.ms-link) {
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ms-node:has(.ms-link:hover),
.ms-node:has(.ms-link:focus-visible) {
    border-color: var(--accent-blue);
    background: color-mix(in srgb, var(--accent-blue) 8%, var(--surface-dark));
}

.ms-link:focus-visible {
    outline: none;
}

.ms-node:has(.ms-link:focus-visible) {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.ms-link:hover .ms-kind,
.ms-link:focus-visible .ms-kind {
    color: var(--accent-blue);
}

.ms-future-list {
    max-width: 30rem;
    margin: 0 auto;
}

.ms-node.is-goal {
    justify-content: center;
    text-align: center;
    padding: 1.1rem 1.25rem;
    border: 2px solid var(--accent-blue);
    background: color-mix(in srgb, var(--accent-blue) 12%, var(--surface-dark));
}

.ms-node.is-goal .ms-kind,
.ms-node.is-goal .ms-kind a {
    color: var(--accent-blue);
}

.ms-node.is-goal .ms-text {
    font-size: 1.05rem;
    font-weight: 700;
}

.ms-legend {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ms-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ms-legend .ms-check {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    font-size: 0.7rem;
}

@media (max-width: 767.98px) {
    .ms-frame {
        padding: 1.25rem 1rem 1.25rem;
    }

}


/* ===== Milestone claims (all pages): one lane per step, read top to bottom =====
   each box states one result (ms-claim) with links to its data (ms-evidence); the arrow above a box
   means "the result above made this possible", and its label (data-via) says how */
.ms-claim-lanes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
    align-items: start;
}

.ms-chain {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.ms-claim {
    position: relative;
    padding: 1rem 1.1rem;
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
}


.ms-claim.is-no {
    border-style: dashed;
}

/* arrow from the previous box: line and head both sit in the gap, clear of the box borders */
.ms-claim[data-via]::before {
    content: "";
    position: absolute;
    left: 1.85rem;
    top: -2.5rem;
    height: 1.6rem;
    border-left: 2px solid var(--text-muted);
}

.ms-claim[data-via]::after {
    content: "";
    position: absolute;
    left: calc(1.85rem - 0.32rem + 1px);
    top: -1.25rem;
    width: 0.64rem;
    height: 0.64rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg);
}

.ms-claim-main {
    position: relative;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
}

.ms-claim.is-done .ms-check {
    border-color: color-mix(in srgb, var(--accent-gold) 60%, transparent);
    color: var(--accent-gold);
}

.ms-claim.is-model .ms-check {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.ms-claim.is-no .ms-check {
    border-color: var(--text-muted);
    color: var(--text-main);
}

main .ms-claim-text {
    margin: 0;
    text-indent: 0;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text-main);
}

.ms-claim.is-no .ms-claim-text {
    color: var(--text-muted);
}

.ms-evidence {
    list-style: none;
    margin: 0.75rem 0 0 2.35rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.1rem;
}

.ms-evidence a {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0;
    border: 0;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--accent-blue);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.ms-evidence a i {
    font-size: 0.85em;
}

.ms-evidence a:hover,
.ms-evidence a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 767.98px) {
    .ms-claim-lanes {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* ===== Goal callout (all pages): the one statement a page is built around =====
   flat and compact: a gold label column on the left, the statement on the right */
.goal-callout {
    display: grid;
    grid-template-columns: auto 1fr;
    border: 1px solid var(--accent-gold);
    background: var(--surface-dark);
}

.goal-callout-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 8.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--accent-gold);
    color: var(--bg-light);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.goal-callout-head i {
    font-size: 1.6rem;
}

.goal-callout-body {
    padding: 1.5rem 2rem;
}

main .goal-callout-title {
    margin: 0 0 0.6rem;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--accent-gold);
    text-wrap: balance;
}

main .goal-callout-text {
    margin: 0;
    text-indent: 0;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-muted);
    text-wrap: pretty;
}

@media (max-width: 575.98px) {
    .goal-callout {
        grid-template-columns: 1fr;
    }

    .goal-callout-head {
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.6rem 1.25rem;
    }

    .goal-callout-head i {
        font-size: 1.1rem;
    }

    .goal-callout-body {
        padding: 1.1rem 1.25rem 1.25rem;
    }

    main .goal-callout-title {
        font-size: 1.2rem;
    }
}

/* Header menu between 992px and 1279px: nine items plus the logo do not fit at the full size,
   so tighten the spacing and type a little instead of letting the last items run off the edge */
@media (min-width: 992px) and (max-width: 1279.98px) {
    nav.navbar .navbar-nav .nav-link {
        padding-left: 0.45rem;
        padding-right: 0.45rem;
        font-size: 0.875rem;
    }
}

@media (min-width: 992px) and (max-width: 1099.98px) {
    nav.navbar .navbar-nav .nav-link {
        padding-left: 0.3rem;
        padding-right: 0.3rem;
        font-size: 0.8rem;
    }
}

/* Schematic of cholesterol direction on DNA bundles (Design page): drawn on white like the other
   structure figures, with the colours fixed inside the SVG */
.chol-fig {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
}

/* Cholesterol modification marked inside a sequence-domain table */
.seq-chol {
    font-weight: 700;
    color: #ff8086;
}

html[data-theme="light"] .seq-chol {
    color: #c4262c;
}

/* Keep subscripts/superscripts legible inside small table/caption text */
sub,
sup {
    font-size: max(0.75em, 12px);
}

/* ===== Moved from in-page <style> blocks ===== */

/* (simulation.html) */
/* Heatmap images with HTML axis labels overlaid on the image axes. */
.heatmap-plot {
    position: relative;
    background: #fff;
    line-height: 1;
}

.heatmap-plot>img {
    display: block;
    width: 100%;
    height: auto;
}

.heatmap-axis-y,
.heatmap-axis-x {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #000;
    font-size: clamp(0.78rem, 1.2vw, 1rem);
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
}

.heatmap-axis-y {
    inset: 24% auto 22% 0;
    width: 3.5%;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.heatmap-axis-x {
    inset: auto 16% 0 14%;
    height: 4.5%;
}

/* (team.html) */
.team-member-card {
    transition: transform 0.3s ease;
}

.team-member-card:hover {
    transform: translateY(-5px);
}

/* GUV figures (Experiment B 2.3): stacked panels (a) field (b) magnified (c) profile */
.experiment-page .exp-stack-panel {
    position: relative;
}

.experiment-page .exp-stack-panel + .exp-stack-panel {
    margin-top: 0.75rem;
}

.experiment-page .exp-stack-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    min-width: 1.5rem;
    padding: 0.05rem 0.4rem;
    border-radius: 4px;
    background: rgba(10, 22, 40, 0.78);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

/* Keep panels the same height in the + / − columns */
.experiment-page img.exp-stack-zoom {
    aspect-ratio: 16 / 10;
    object-fit: contain;
    background-color: #000;
}

.experiment-page img.exp-profile-graph {
    aspect-ratio: 1200 / 745;
    object-fit: contain;
    background-color: #fff;
}

/* GUV figures: one set = large (a) beside stacked (b)/(c); sets stacked vertically */
.experiment-page .exp-stack-sets {
    max-width: 880px;
    margin-left: auto;
    margin-right: auto;
}

.experiment-page .exp-set + .exp-set {
    margin-top: 2.5rem;
}

/* Right column of a GUV set: (b) stays compact and centred, (c) uses the full width */
.experiment-page .exp-set-side .exp-stack-panel:first-child {
    width: 82%;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 767.98px) {
    .experiment-page .exp-set-side .exp-stack-panel:first-child {
        width: 100%;
    }
}

/* Divider above a figure group that follows discussion text (e.g. the 200 mM NaCl set) */
.experiment-page .exp-block-divided {
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid #314763;
}

html[data-theme="light"] .experiment-page .exp-block-divided {
    border-top-color: #c9d1dc;
}

/* Condition headings in 2.3: square "CONDITION n" tag + rule, no gradients */
.experiment-page .exp-condition {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 0 1.5rem;
    padding: 0 0 0.6rem;
    border-bottom: 1px solid #314763;
    font-size: 1.3rem;
}

.experiment-page .exp-condition::before {
    content: attr(data-cond);
    padding: 0.2rem 0.55rem;
    border-radius: 0;
    background-color: var(--accent-gold);
    color: #0b1a2e;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.4;
    text-transform: uppercase;
}

html[data-theme="light"] .experiment-page .exp-condition {
    border-bottom-color: #c9d1dc;
}

/* 1.3 AFM figures: overview | magnified | profile composites, stacked (a)/(b) */
.experiment-page .exp-afm-set {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.experiment-page .exp-afm-set + .exp-afm-set {
    margin-top: 2.5rem;
}

.experiment-page img.exp-afm-panel {
    background-color: #fff;
}
