        @font-face {
            font-family: 'Zed Display';
            src: url('https://hectormangas.com/assets/fonts/ZedDisplayLVariable.woff2') format('woff2');
            font-weight: 100 900;
            font-display: swap;
            font-style: normal;
        }

        @font-face {
            font-family: 'Zed Text';
            src: url('https://hectormangas.com/assets/fonts/ZedTextLVariable.woff2') format('woff');
            font-weight: 100 900;
            font-display: swap;
            font-style: normal;
        }

        @font-face {
            font-family: 'Greta Mono';
            src: url('https://hectormangas.com/assets/fonts/GretaMonoNormalLVariable.woff2') format('woff2');
            font-weight: 100 900;
            font-display: swap;
            font-style: normal;
        }

        @font-face {
            font-family: 'Lava';
            src: url('https://hectormangas.com/assets/fonts/LavaLVariable.woff2') format('woff2');
            font-weight: 100 900;
            font-display: swap;
            font-style: normal;
        }

        :root {
            /* Default Theme - Lower Contrast */
            --bg-color: #d9d9d9;
            /* Darker gray than f5f5f5 */
            --text-color: #222222;
            /* Softer black */
            --link-color: #5f5f5f;
            --word-spacing: 0px;
            --link-hover-color: #000000;
            --slider-color: #444444;
            /* Darker gray for sliders */

            --font-display: 'Zed Display', sans-serif;
            --font-body: 'Zed Text', sans-serif;
            --font-mono: 'Zed Text', sans-serif;
            --font-serif: 'Lava', serif;

            --current-font-body: var(--font-body);
            --current-font-header: var(--font-display);

            --line-height: 1.9;
            /* New Default */
            --font-size-base: 17.5px;
            /* New Default */
            --font-weight-base: 400;
            --font-weight-header: 700;

            --toc-width: 250px;
        }

        * {
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        html {
            scroll-behavior: smooth;
        }

        body {
            margin: 0 auto;
            padding: 0 1rem 1rem 1rem;
            background: var(--bg-color);
            color: var(--text-color);
            overflow-x: hidden;
            width: 100%;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            font-family: var(--current-font-body);
            font-size: var(--font-size-base);
            transition: background 0.3s, color 0.3s;
            /* Default UI spacing */
            line-height: 1.5;
            word-spacing: normal;
            letter-spacing: 0.02em;
        }

        /* --- VIEW TRANSITIONS --- */
        ::view-transition-old(root),
        ::view-transition-new(root) {
            animation-duration: 0.5s;
        }

        @keyframes fade-out {
            to {
                opacity: 0;
            }
        }

        @keyframes fade-in {
            from {
                opacity: 0;
            }
        }

        @keyframes fade-in-up {
            from {
                opacity: 0;
                transform: translateY(20px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Forward navigation (Card clicks) */
        html[data-transition-dir="forward"] ::view-transition-old(main-content) {
            animation: 0.6s ease-in-out both fade-out;
        }

        html[data-transition-dir="forward"] ::view-transition-new(main-content) {
            animation: 0.8s ease-in-out both fade-in, 0.8s ease-in-out both fade-in-up;
        }

        /* Updated Exit Animations: Fade only to keep the transition stationary as requested */
        html.exit-next #app-view,
        html.exit-prev #app-view {
            animation: 0.2s ease-in both fade-out;
        }

        html.exit-back #app-view {
            animation: 0.2s ease-in both fade-out;
        }

        /* Sequential Entry Animations (Within VT) */
        html[data-transition-dir="next"] ::view-transition-old(main-content),
        html[data-transition-dir="prev"] ::view-transition-old(main-content) {
            animation: none !important;
            opacity: 0 !important;
        }

        html[data-transition-dir="next"] ::view-transition-new(main-content),
        html[data-transition-dir="prev"] ::view-transition-new(main-content) {
            animation: 0.4s ease-out both fade-in;
        }

        /* Disable morphing/movement for the group in linear navigation to ensure stationary entry */
        html[data-transition-dir="next"] ::view-transition-group(main-content),
        html[data-transition-dir="prev"] ::view-transition-group(main-content) {
            animation: none !important;
            transform: none !important;
        }

        @keyframes slide-from-right-entry {
            from {
                transform: translateX(150px);
            }
        }

        @keyframes slide-from-left-entry {
            from {
                transform: translateX(-150px);
            }
        }

        /* Backward (Fade-only background) */
        html[data-transition-dir="back"] ::view-transition-old(main-content) {
            animation: none !important;
            opacity: 0 !important;
        }

        html[data-transition-dir="back"] ::view-transition-new(main-content) {
            animation: 0.4s ease-out both fade-in;
        }

        /* Disable View Transitions for global root to avoid double animation or header jump */
        ::view-transition-old(root),
        ::view-transition-new(root) {
            animation: none !important;
        }

        /* Linear & Back Navigation Title Suppression (Keep animations static/fade-only) */
        /* Selective navigation title suppression (Keep morphing enabled for back/breadcrumb) */
        html[data-transition-dir="next"] h1,
        html[data-transition-dir="next"] p,
        html[data-transition-dir="prev"] h1,
        html[data-transition-dir="prev"] p {
            view-transition-name: none !important;
        }

        /* Standard back-button title suppression removed to allow morphing */
        /* html[data-transition-dir="back"] h1... view-transition-name: none !important; */

        /* Shared Title Transitions - Smooth & Fluid */
        ::view-transition-group(title-home),
        ::view-transition-group(title-definitions),
        ::view-transition-group(title-hypotheses),
        ::view-transition-group(title-diagnosis),
        ::view-transition-group(title-societal),
        ::view-transition-group(title-cross-ortho),
        ::view-transition-group(title-df-fonts),
        ::view-transition-group(title-font-examples),
        ::view-transition-group(title-font-future),
        ::view-transition-group(title-interventions),
        ::view-transition-group(title-glossary),
        ::view-transition-group(title-about),
        ::view-transition-group(article-title-fade) {
            animation-duration: 0.8s;
            animation-timing-function: cubic-bezier(0.5, 0, 0.1, 1);
        }

        ::view-transition-old(title-home),
        ::view-transition-new(title-home),
        ::view-transition-old(title-definitions),
        ::view-transition-new(title-definitions),
        ::view-transition-old(title-hypotheses),
        ::view-transition-new(title-hypotheses),
        ::view-transition-old(title-diagnosis),
        ::view-transition-new(title-diagnosis),
        ::view-transition-old(title-societal),
        ::view-transition-new(title-societal),
        ::view-transition-old(title-cross-ortho),
        ::view-transition-new(title-cross-ortho),
        ::view-transition-old(title-df-fonts),
        ::view-transition-new(title-df-fonts),
        ::view-transition-old(title-interventions),
        ::view-transition-new(title-interventions),
        ::view-transition-old(title-glossary),
        ::view-transition-new(title-glossary),
        ::view-transition-old(title-about),
        ::view-transition-new(title-about),
        ::view-transition-old(article-title-fade),
        ::view-transition-new(article-title-fade) {
            height: 100%;
            width: auto;
            object-fit: contain;
        }

        body.no-animations,
        body.no-animations * {
            transition: none !important;
            animation: none !important;
        }

        /* Hide Images Mode */
        body.no-images main img {
            display: none;
        }

        body.no-images .lightbox {
            display: none !important;
        }



        /* Layout Grid */
        .page-container {
            display: grid;
            grid-template-columns: var(--toc-width) 1fr;
            gap: 3rem;
            max-width: 1600px;
            margin: 0 auto;
            width: 100%;
            position: relative;
            padding-top: 0;
        }

        /* Table of Contents */
        .toc-container {
            position: sticky;
            top: 6rem;
            /* Below header */
            height: fit-content;
            max-height: calc(100vh - 8rem);
            overflow-y: auto;
        }

        /* Hide TOC completely when empty (e.g. during loading) */
        .toc-container:has(#toc-list:empty) {
            display: none !important;
        }

        #toc {
            padding: 0;
            font-family: var(--font-mono);
            /* Make entire index mono */
        }

        #toc h2 {
            font-size: 0.9rem;
            margin-top: 0;
            margin-bottom: 1rem;
            text-transform: lowercase;
            /* Lowercase title */
            letter-spacing: 0.05em;
            color: var(--text-color);
            font-weight: bold;
            cursor: pointer;
            transition: color 0.3s;
            display: none;
            /* Hidden on desktop */
        }

        #toc ul {
            list-style: none;
            padding: 0;
            margin: 0;
            display: block;
            /* Always visible on desktop */
        }

        #toc li {
            margin-bottom: 0.8rem;
        }

        #toc a {
            text-decoration: none;
            color: var(--link-color);
            font-weight: normal;
            transition: color 0.2s;
            display: block;
            font-size: 0.95rem;
        }

        #toc a:hover {
            color: var(--text-color);
        }

        #toc a.active {
            color: var(--text-color);
            font-weight: bold;
        }

        /* Mobile TOC Styles */
        @media (max-width: 850px) {
            .page-container {
                grid-template-columns: 1fr;
                gap: 1rem;
            }

            .toc-container {
                position: sticky;
                top: 4rem;
                /* Below sticky header */
                width: 100%;
                background: var(--bg-color);
                border-bottom: 1px solid var(--link-color);
                margin-bottom: 1rem;
                padding-bottom: 0.5rem;
                padding-top: 0.5rem;
                z-index: 90;
            }

            #toc h2 {
                display: flex;
                /* Visible on mobile */
                justify-content: space-between;
                align-items: center;
                margin-bottom: 0;
                font-size: 1rem;
                color: var(--text-color);
            }

            #toc h2::after {
                content: '+';
                font-weight: bold;
                transition: transform 0.3s;
            }

            #toc.expanded h2::after {
                content: '-';
                /* Or rotate the plus */
                transform: rotate(180deg);
            }

            #toc ul {
                display: block;
                max-height: 0;
                overflow: hidden;
                margin-top: 0;
                transition: max-height 0.4s ease-in-out, margin-top 0.4s ease;
            }

            #toc.expanded ul {
                max-height: 60vh;
                margin-top: 1rem;
                overflow-y: auto;
            }
        }

        /* SPA Styles */
        .topic-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 1.5rem;
            margin-top: 2rem;
            width: 100%;
        }

        @media (min-width: 1200px) {
            .topic-grid {
                grid-template-columns: repeat(4, 1fr) !important;
                /* Force 4 boxes globally on desktop */
                gap: 2rem;
            }
        }

        .topic-card {
            background: #f0f0f0;
            border: none;
            border-radius: 2.5rem;
            padding: 2rem;
            color: var(--text-color);
            text-decoration: none !important;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: pointer;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            position: relative;
            min-height: 220px;
            overflow: hidden;
            border: 1px solid transparent;
        }

        .topic-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
            background: #ffffff;
            border-color: rgba(0, 0, 0, 0.05);
        }

        /* Typography for Cards */
        .card-question,
        .card-title,
        .card-subtitle,
        .card-label {
            font-family: 'Zed Text', sans-serif !important;
            margin: 0;
            line-height: 1.15;
            letter-spacing: 0 !important;
            word-spacing: 0 !important;
        }

        .card-title {
            font-weight: 700;
            /* Bold */
            font-size: 1.15rem;
            margin-bottom: 0;
            text-align: right;
            padding-right: 0.5rem;
            display: flex;
            align-items: center;
            line-height: 1.3;
        }

        @media (min-width: 768px) {
            .card-title {
                margin-top: 0.5rem;
            }
        }

        .card-footer {
            display: flex;
            align-items: center;
            /* Vertically center text with circle */
            justify-content: flex-end;
            gap: 0.5rem;
            width: 100%;
            margin-top: auto;
            /* Push to bottom */
        }

        .card-subtitle,
        .card-question {
            font-weight: 400;
            /* Regular */
            font-size: 1.15rem;
            opacity: 0.9;
            line-height: 1.4;
            /* Increased inter-line spacing */
            width: 100%;
            margin-bottom: 1.5rem;
        }

        /* Badge Logic */
        .card-badge {
            width: 40px;
            height: 40px;
            background: rgba(0, 0, 0, 0.08);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            overflow: hidden;
            flex-shrink: 0;
            position: relative;
            /* Not absolute anymore to allow centering with text */
        }

        .topic-card:hover .card-badge {
            background: var(--text-color);
            color: var(--bg-color);
        }

        .badge-number {
            font-family: 'Zed Text', sans-serif;
            font-weight: 700;
            font-size: 1rem;
            transition: transform 0.3s ease, opacity 0.2s ease;
        }

        .badge-arrow {
            position: absolute;
            opacity: 0;
            transform: translateX(-10px);
            transition: transform 0.3s ease, opacity 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .badge-arrow svg {
            width: 20px;
            height: 20px;
        }

        .topic-card:hover .badge-number {
            opacity: 0;
            transform: translateX(10px);
        }

        .topic-card:hover .badge-arrow {
            opacity: 1;
            transform: translateX(0);
        }

        /* Level 2 persistent arrow */
        .level-2 .badge-number {
            display: none;
        }

        .level-2 .badge-arrow {
            opacity: 1;
            transform: translateX(0);
        }

        .level-2 {
            justify-content: flex-start !important;
            gap: 0.5rem;
        }

        .level-2 .card-title {
            text-align: left;
            padding-right: 0;
            margin-bottom: 0.25rem;
        }

        .level-2 .card-subtitle {
            text-align: left;
            margin-bottom: 0;
        }

        @media (min-width: 769px) {

            .level-2 .card-title,
            .level-2 .card-subtitle {
                line-height: 1.45;
            }
        }

        .level-2 .card-badge {
            align-self: flex-end;
            margin-top: auto;
        }

        /* Level 2 persistent arrow cleanup */
        .level-2 .badge-number {
            display: none;
        }

        .level-2 .badge-arrow {
            opacity: 1;
            transform: translateX(0);
            position: static;
        }


        .subtopic-group {
            margin-top: 4rem;
        }

        /* MOBILE REFINEMENTS */
        @media (max-width: 768px) {
            .topic-card {
                min-height: auto !important;
                /* Fit content only */
                padding: 1.5rem 1.25rem !important;
                border-radius: 1.5rem !important;
                gap: 1rem !important;
            }

            /* Level 1 Mobile */
            .level-1 .card-question {
                font-size: 1.1rem !important;
                margin-bottom: 1rem !important;
            }

            /* Level 2 Mobile - Side-by-side Badge */
            .level-2 {
                display: grid !important;
                grid-template-areas:
                    "title title"
                    "subtitle badge";
                grid-template-columns: 1fr auto;
                align-items: center;
                gap: 0.75rem !important;
            }

            .level-2 .card-title {
                grid-area: title;
                margin-bottom: 0 !important;
                text-align: left !important;
            }

            .level-2 .card-subtitle {
                grid-area: subtitle;
                margin-bottom: 0 !important;
                font-size: 0.95rem !important;
                line-height: 1.3 !important;
            }

            .level-2 .card-badge {
                grid-area: badge;
                margin-top: 0 !important;
                width: 36px !important;
                height: 36px !important;
            }

            .level-2 .badge-arrow svg {
                width: 18px !important;
                height: 18px !important;
            }
        }

        .subtopic-group h2 {
            margin-top: 0 !important;
            /* Reset to let group handle spacing */
        }

        .subtopic-list {
            list-style: none;
            padding: 0;
            margin-top: 1rem;
        }

        .subtopic-list li {
            margin-bottom: 0.8rem;
        }

        .subtopic-list a {
            font-size: 1.1rem;
            text-decoration: none;
            border-bottom: 1px solid var(--link-color);
            padding-bottom: 0.1rem;
            display: inline-block;
            transition: all 0.2s;
            color: var(--link-color);
        }

        .subtopic-list a:hover {
            border-bottom-width: 2px;
            color: var(--text-color);
        }

        .breadcrumb {
            font-family: var(--font-mono);
            font-size: 0.85rem;
            margin-bottom: 2rem;
            color: var(--link-color);
            display: flex;
            gap: 0.5rem;
            align-items: center;
        }

        .breadcrumb a {
            text-decoration: none !important;
            color: var(--link-color);
        }

        .breadcrumb a:hover {
            border-bottom-color: transparent;
        }

        .breadcrumb-separator {
            opacity: 0.5;
        }

        .section-header {
            margin-bottom: 2rem;
            border-bottom: 1px solid var(--text-color);
            padding-bottom: 1rem;
        }

        .section-header h1 {
            margin-top: 0;
            margin-bottom: 0.5rem;
        }

        @media (min-width: 1200px) {
            .view-container {
                max-width: 1400px;
                /* Universally wide to allow children to expand */
                margin: 0;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                /* Left align per request */
                overflow: visible !important;
            }

            .view-container.wide {
                max-width: 1400px;
                /* Expanded for 4 boxes */
            }

            .article-content {
                width: 100%;
                max-width: 800px;
                /* Preserve reading width */
            }

            .view-title-box {
                width: 100%;
                max-width: 1400px;
            }
        }


        /* Content Styles */
        main {
            max-width: 1400px;
            /* Allow expansion for wide grids */
            padding-bottom: 2rem;
            margin: 0;
            /* Left align main container */
        }

        /* Reading limit */
        line-height: var(--line-height);
        word-spacing: var(--word-spacing);
        font-weight: var(--font-weight-base);
        margin: 0 auto;
        /* Center content */
        }

        main p,
        main li,
        #app-view p,
        #app-view li {
            font-size: 1.1rem;
            /* Consistent size with cards */
            line-height: 1.6;
        }

        main h1,
        main h2,
        main h3,
        main h4,
        main h5,
        main h6,
        .article-content h1,
        .article-content h2,
        .article-content h3,
        .article-content h4,
        .article-content h5,
        .article-content h6 {
            font-family: 'Zed Display', sans-serif !important;
            font-weight: 700;
            margin-top: 3.5rem;
            margin-bottom: 1.25rem;
            line-height: 1.1;
            font-style: normal;
            font-variation-settings: 'slnt' 0;
            /* Ensure upright */
            /* font-weight: var(--font-weight-header); - Explicitly set above */
            scroll-margin-top: 6rem;
            /* Prevent header overlap */
        }

        main h1 em,
        main h2 em,
        main h3 em,
        main h1 i,
        main h2 i,
        main h3 i,
        #app-view h1 em,
        #app-view h2 em,
        #app-view h3 em,
        #app-view h1 i,
        #app-view h2 i,
        #app-view h3 i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }

        main h1,
        #app-view h1 {
            font-size: 3rem;
            margin-top: 6rem;
            margin-bottom: 0.5rem;
            letter-spacing: -0.02em;
            color: var(--text-color);
        }

        /* Desktop Title Scaling for long titles (>40 chars) */
        @media (min-width: 851px) {
            #app-view .view-title-box p {
                max-width: calc(100vw - 6rem);
                overflow-wrap: break-word;
                word-wrap: break-word;


            }

            #app-view .view-title-box p.title-long-desktop {
                font-size: 2.2rem !important;
            }

            .view-title-box {
                margin-right: -400px;
                /* Expand background to the right to cover sidebar area */
                padding-right: 400px;
            }
        }

        main h1:first-child,
        #app-view h1:first-child {
            margin-top: 0;
        }

        main h2,
        #app-view h2 {
            font-size: 2em;
        }

        main h3,
        #app-view h3 {
            font-size: 1.5em;
        }

        main p,
        #app-view p {
            margin-bottom: 0.75em;
        }

        /* Table Styles */
        main table,
        #app-view table {
            width: 100%;
            border-collapse: collapse;
            margin: 2rem 0;
            font-size: 1rem;
            text-align: left;
        }

        main th,
        #app-view th,
        main td,
        #app-view td {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--text-color);
            vertical-align: top;
            opacity: 0.9;
        }

        main th,
        #app-view th {
            font-family: 'Zed Display', sans-serif;
            font-weight: 700;
            border-bottom: 2px solid var(--text-color);
            opacity: 1;
        }

        @media (max-width: 850px) {

            main table,
            #app-view table {
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
        }

        main a,
        #app-view a,
        .article-content a,
        .link {
            color: var(--text-color) !important;
            text-decoration: underline;
            text-decoration-color: var(--text-color);
            text-decoration-thickness: 1px;
            text-underline-offset: 2px;
        }

        main a:visited,
        #app-view a:visited,
        .link:visited {
            color: var(--text-color) !important;
        }

        main a:hover,
        #app-view a:hover,
        .link:hover {
            text-decoration: none;
        }

        /* Fix for inner words in snippets (inline-block blocks decoration propagation) */
        main a .word,
        #app-view a .word {
            text-decoration: underline;
            text-decoration-color: var(--text-color);
            text-decoration-thickness: 1px;
            text-underline-offset: 2px;
        }

        main a:hover .word,
        #app-view a:hover .word {
            text-decoration: none;
        }

        /* Definitions Feature */
        .definition-term {
            text-decoration: underline;
            text-decoration-style: dashed;
            text-decoration-color: var(--text-color);
            text-underline-offset: 4px;
            cursor: pointer;
            position: relative;
            display: inline;
            -webkit-box-decoration-break: clone;
            box-decoration-break: clone;
            transition: all 0.2s ease;
            border-radius: 4px;
        }

        .definition-term:hover {
            background-color: rgba(125, 125, 125, 0.1);
        }

        .definition-term.active {
            background-color: #3a2727 !important;
            color: #d9d9d9 !important;
            text-decoration: none !important;
            box-shadow: none !important;
            outline: none !important;
            border: none !important;
            box-shadow: 0 0 0 4px var(--text-color);

            border-radius: 4px;
            z-index: 1001;
        }

        .definition-popup {
            position: absolute;
            top: 100%;
            left: var(--popup-left, 50%);
            transform: var(--popup-transform, translateX(-50%)) translateY(24px);

            background: #f0f0f0;
            color: var(--text-color);
            border-radius: 12px;
            padding: 1.2rem;
            width: max-content;
            max-width: 320px;
            min-width: 200px;

            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
            z-index: 2000;

            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s ease, transform 0.2s ease, left 0.1s ease;
            pointer-events: none;

            font-size: 0.95rem;
            line-height: 1.5;
            text-align: left;
            font-weight: normal;
            font-family: var(--font-body);
            white-space: normal;
        }

        @media (min-width: 1200px) {
            .definition-term.active .definition-popup.desktop-bubble {
                position: absolute;
                top: 0 !important;
                left: var(--bubble-left, calc(100% + 150px));
                /* Dynamically set via JS to align with right of text column */
                right: auto;
                width: 380px;
                max-width: 450px;
                padding: 1.2rem;
                box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12);
                border-radius: 20px;
                border-top-left-radius: 1px !important;
                z-index: 3000;

                /* Subtle entry from left */
                animation: slideInSubtle 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
                transition: opacity 0.3s ease;
                /* Fade out only on close */
            }
        }

        @keyframes slideInSubtle {
            from {
                opacity: 0;
                transform: translateX(-15px);
            }

            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        .definition-term.active .definition-popup {
            opacity: 1;
            visibility: visible;
            transform: var(--popup-active-transform, translateX(-50%) translateY(8px));
            pointer-events: auto;
        }

        .definition-term.active .definition-popup.desktop-bubble {
            transform: none;
            /* Handled by animation */
        }

        /* Fix for words inside definitions in snippets */
        .definition-term .word {
            text-decoration: underline;
            text-decoration-style: dashed;
            text-decoration-color: var(--text-color);
            text-underline-offset: 4px;
        }

        .definition-popup .word {
            white-space: normal;
            /* Override pre-wrap from .word to ensure popup wraps correctly */
            text-decoration: none;
            /* No underline inside popup text */
        }

        /* Image Styles */
        main img,
        #app-view img {
            width: 100%;
            height: auto;
            border-radius: 8px;
            margin: 2rem 0;
            cursor: zoom-in;
            transition: transform 0.3s ease;
        }

        /* body:not(.no-animations) main img:hover removed */

        @media (max-width: 850px) {

            main img,
            #app-view img {
                cursor: default;
            }
        }

        /* --- MORPHING LIGHTBOX --- */
        .hidden-placeholder {
            opacity: 0;
            visibility: hidden;
        }

        .animating-image {
            position: fixed;
            z-index: 1001;
            transform-origin: top left;
            cursor: zoom-out;
            border-radius: 4px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
            will-change: transform, width, height, top, left;
            transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
        }

        /* Lightbox - Replaced by JS inline styles for simplicity */

        /* No Animations Override */
        body.no-animations .animating-image {
            transition: none !important;
        }

        body.no-animations .backdrop {
            transition: none !important;
        }

        body.no-animations .close-btn {
            transition: none !important;
        }

        /* Lightbox (Old - Removed) */
        .lightbox {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 2000;
            cursor: zoom-out;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .lightbox.active {
            display: flex;
            opacity: 1;
        }

        .lightbox img {
            max-width: 95%;
            max-height: 95%;
            object-fit: contain;
            transform: scale(0.9);
            transition: transform 0.3s ease;
        }

        .lightbox.active img {
            transform: scale(1);
        }

        /* Pull Quotes */
        blockquote {
            border-left: 4px solid var(--text-color);
            padding-left: 2rem;
            margin: 1.5rem 0;
            font-family: var(--current-font-body);
            font-size: 1.4em;
            font-style: normal;
            font-variation-settings: 'slnt' 0;
            line-height: 1.6;
            opacity: 0.9;
        }

        /* Interactive Snippets */
        .snippet-interaction {
            padding: 0;
            margin: 0.5rem 0;
            /* Reduced margin for collapsed state */
            background: transparent;
            border: none;
            position: relative;
            transition: margin 0.3s ease;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            /* Left align by default */
        }

        .snippet-interaction.active {
            margin: -0.3rem 0;
            /* Restored margin for expanded state */
        }

        /* Wrapper for height animation using the Grid trick */
        .expandable-wrapper {
            display: grid;
            grid-template-rows: 0fr;
            transition: grid-template-rows 0.2s cubic-bezier(0, 0, 0.2, 1);
            /* Faster Collapse with Ease-Out */
            margin-top: 0;
            padding: 0;
        }

        .expandable-wrapper.open {
            grid-template-rows: 1fr;
            margin-top: -0.5rem;
            transition: grid-template-rows 0.3s cubic-bezier(0.85, 0, 0.15, 1);
            /* Severe Ease-In-Ease-Out for Expansion */
            overflow: visible !important;
        }

        .expandable-content {
            overflow: hidden;
            opacity: 0;
            border-radius: 12px;
            box-sizing: border-box;
            transition: opacity 0.3s ease;
            margin-left: -1rem;
            margin-right: -1rem;
            padding: 0.5rem 1rem;
            width: calc(100% + 2rem);
            max-width: 1000px;
            /* User request: make snippet area wider on computers */
            text-align: left;
            /* Ensure left alignment for multi-line text */
        }

        .expandable-wrapper.open .expandable-content {
            opacity: 1;
            overflow: visible !important;
        }

        .expandable-content p {
            margin-bottom: 0.75em;
            /* Match body text spacing */
            margin-top: 0;
        }

        .expandable-content p:last-child {
            margin-bottom: 0;
        }

        .expandable-content.reveal-green .word {
            color: #669278;
            /* No important to allow overrides */
        }

        /* Stronger selector to ensure it wins word-by-word */
        .expandable-content .word.is-black {
            color: var(--text-color) !important;
            transition: color 0.4s ease-in-out;
        }

        /* Ensure active definitions override the above specifically */
        .definition-term.active,
        .definition-term.active .word,
        .definition-term.active .word.is-black {
            color: #d9d9d9 !important;
            text-decoration-color: #d9d9d9 !important;
        }


        .snippet {
            display: block;
        }

        .word {
            display: inline-block;
            opacity: 1;
            transform: none;
            white-space: pre-wrap;
            font-weight: inherit;
            transition: color 0.3s ease-in-out;
            /* Pre-defined for reliable delay logic */
        }

        strong,
        b {
            font-weight: 700 !important;
        }

        .animate-in {
            /* Now handled by instant reveal, but we keep the class for potential mobile logic */
        }

        .animate-out {
            /* Now handled by instant collapse */
        }

        @keyframes smoothReveal {
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes smoothHide {
            to {
                opacity: 0;
                transform: translateY(-10px);
            }
        }

        @keyframes invitePulse {
            0% {
                transform: scale(1);
                border-color: var(--text-color);
                color: var(--text-color);
                background-color: transparent;
                box-shadow: 0 0 0 0 transparent;
            }

            50% {
                transform: scale(1.05);
                border-color: var(--text-color);
                color: var(--text-color);
                background-color: var(--bg-color);
                box-shadow: 0 0 0 2px var(--text-color);
            }

            100% {
                transform: scale(1);
                border-color: var(--text-color);
                color: var(--text-color);
                background-color: transparent;
                box-shadow: 0 0 0 0 transparent;
            }
        }

        /* Pulse animation removed per request */
        .invite-animation {
            animation: none !important;
        }

        .read-more-btn {
            background: #669278;
            color: #ffffff;
            border: none;
            padding: 0.7rem 1.2rem;
            font-family: var(--font-body);
            font-weight: 400;
            font-size: 0.7rem;
            cursor: pointer;
            border-radius: 22px;
            transition: all 0.2s ease;
            display: flex;
            /* Changed from inline-flex to allow full-width control if needed */
            align-items: center;
            justify-content: space-between;
            /* Push text to left and icon to right */
            gap: 0.7rem;
            z-index: 10;
            outline: none !important;
            margin-bottom: 2rem;
            margin-top: -1.2rem;
            width: fit-content;
            /* Keep it compact */
            max-width: 100%;
        }

        .read-more-btn span {
            text-align: left !important;
            line-height: 1.3;
            flex-grow: 1;
            display: block;
        }



        .read-more-btn:hover {
            background: #57aa82;
            color: #ffffff;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .read-more-btn::after {
            content: '+';
            font-weight: bold;
            font-size: 1.1em;
            line-height: 1;
        }

        .read-more-btn.expanded::after {
            content: '-';
            /* Change to minus when expanded */
        }

        .read-more-btn.expanded {
            /* Keep margin consistent */
            margin-top: -0.7rem;

        }

        /* Fix for when animations are disabled */
        body.no-animations .word {
            opacity: 1 !important;
            transform: none !important;
            animation: none !important;
        }

        body.no-animations .invite-animation {
            display: none !important;
        }

        body.no-animations .paragraph-highlight {
            animation: none !important;
            background-color: transparent !important;
            box-shadow: none !important;
        }

        /* Accessibility Icon */
        .a11y-trigger {
            display: none !important;
            position: fixed;
            bottom: 2rem;
            right: 2rem;
            width: 50px;
            height: 50px;
            background: var(--bg-color);
            color: var(--text-color);
            border: 2px solid var(--text-color);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            z-index: 1000;
            font-size: 24px;
            transition: all 0.3s ease;
        }

        .a11y-trigger:hover {
            transform: scale(1.1);
        }

        /* Accessibility Menu */
        .a11y-menu {
            position: fixed;
            bottom: 5.5rem;
            right: 2rem;
            background: var(--bg-color);
            border: 2px solid var(--text-color);
            padding: 1.5rem;
            border-radius: 12px;
            width: 320px;
            display: none;
            flex-direction: column;
            gap: 1.5rem;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
            z-index: 1000;
            font-family: var(--font-mono);
            font-size: 14px;
            transition: all 0.3s ease;
            transform-origin: bottom right;
        }

        @keyframes popupFadeIn {
            from {
                opacity: 0;
                transform: translateY(10px) scale(0.98);
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        @keyframes popupFadeOut {
            from {
                opacity: 1;
                transform: translateY(0) scale(1);
            }

            to {
                opacity: 0;
                transform: translateY(10px) scale(0.98);
            }
        }

        /* Changed animation trigger class from body:not(.no-animations) to explicit classes */
        .a11y-menu.animate-open {
            animation: popupFadeIn 0.3s ease-out forwards;
        }

        .a11y-menu.animate-close {
            animation: popupFadeOut 0.3s ease-in forwards;
        }

        .a11y-menu h3 {
            margin: 0 0 1rem 0;
            font-size: 1rem;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            border-bottom: 1px solid var(--link-color);
            padding-bottom: 0.5rem;
            display: none;
            /* Hide title as per request for compactness */
        }



        .a11y-menu.open {
            display: flex;
        }

        /* Separate Mini Player Bar */
        #miniPlayerBar {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background: var(--bg-color);
            border-top: 1px solid var(--text-color);
            padding: 1rem 2rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            transform: translateY(100%);
            transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
            z-index: 999;
        }

        #miniPlayerBar.active {
            transform: translateY(0);
        }

        /* Article Grid Styles */
        .article-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 2rem;
            max-width: 1200px;
            margin: 0 auto;
            width: 100%;
            padding: 2rem 0;
        }

        .article-card {
            background: var(--bg-color);
            border: 2px solid var(--text-color);
            border-radius: 12px;
            padding: 2rem;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            text-decoration: none;
            color: var(--text-color);
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .article-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        }

        .article-card h3 {
            font-family: var(--current-font-header);
            font-size: 1.5rem;
            margin: 0;
            line-height: 1.2;
            font-variation-settings: 'slnt' 0;
        }

        .article-card h3 em,
        .article-card h3 i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }

        .article-card p {
            font-family: var(--current-font-body);
            font-size: 1rem;
            margin: 0;
            opacity: 0.8;
            flex-grow: 1;
        }

        .article-tags {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        .article-tag {
            font-family: var(--font-mono);
            font-size: 0.75rem;
            padding: 0.25rem 0.5rem;
            border: 1px solid var(--link-color);
            border-radius: 100px;
            text-transform: uppercase;
        }

        /* View Switching Classes */
        .view-section {
            display: none;
            width: 100%;
        }

        .view-section.active {
            display: block;
        }

        /* Hide TOC in Grid Mode */
        .toc-hidden .toc-container {
            display: none;
        }

        .toc-hidden .page-container {
            grid-template-columns: 1fr;
            /* Full width when no TOC */
        }

        .mini-player-bar {
            position: fixed;
            bottom: 2rem;
            left: 50%;
            transform: translateX(-50%) translateY(120px);
            width: 90%;
            max-width: 400px;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(0, 0, 0, 0.1);
            border-radius: 16px;
            z-index: 1500;
            opacity: 0;
            visibility: hidden;
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
            overflow: hidden;
            color: #222;
            /* Default text color for light mode */
        }

        /* Dark mode support for mini player */
        @media (prefers-color-scheme: dark) {
            .mini-player-bar {
                background: rgba(30, 30, 30, 0.95);
                border-color: rgba(255, 255, 255, 0.1);
                color: #fff;
                /* Force white text in dark mode */
            }

            .mini-player-bar .mini-player-btn {
                color: #fff;
            }

            .mini-player-bar .mini-player-speed-text {
                color: #fff;
            }

            .mini-player-bar .mini-player-progress-container {
                background: rgba(255, 255, 255, 0.2);
            }

            .mini-player-bar .mini-player-btn.secondary {
                background: rgba(255, 255, 255, 0.1);
            }

            .mini-player-bar .mini-player-btn.secondary:hover {
                background: rgba(255, 255, 255, 0.2);
            }
        }

        /* When theme is dark manually */
        body[data-theme="dark"] .mini-player-bar,
        body[data-theme="pure-black"] .mini-player-bar {
            background: rgba(30, 30, 30, 0.95);
            border-color: rgba(255, 255, 255, 0.1);
            color: #fff;
        }

        body[data-theme="dark"] .mini-player-bar .mini-player-btn,
        body[data-theme="pure-black"] .mini-player-bar .mini-player-btn {
            color: #fff;
        }

        body[data-theme="dark"] .mini-player-bar .mini-player-progress-container,
        body[data-theme="pure-black"] .mini-player-bar .mini-player-progress-container {
            background: rgba(255, 255, 255, 0.2);
        }

        body[data-theme="dark"] .mini-player-bar .mini-player-btn.secondary,
        body[data-theme="pure-black"] .mini-player-bar .mini-player-btn.secondary {
            background: rgba(255, 255, 255, 0.1);
        }

        .mini-player-bar.active {
            transform: translateX(-50%) translateY(0);
            opacity: 1;
            visibility: visible;
        }

        /* Progress Bar Area */
        .mini-player-progress-container {
            width: 100%;
            height: 8px;
            /* Increased height for visibility */
            background: rgba(0, 0, 0, 0.1);
            cursor: pointer;
            position: relative;
        }

        .mini-player-progress-fill {
            height: 100%;
            background: var(--link-color, #007AFF);
            width: 0%;
            transition: width 0.1s linear;
        }

        /* Hit area for scrubbing */
        .mini-player-progress-container::before {
            content: '';
            position: absolute;
            top: -10px;
            bottom: -10px;
            left: 0;
            right: 0;
            z-index: 2;
        }

        /* Controls Area */
        .mini-player-controls {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 20px;
            gap: 1rem;
        }

        .mini-player-speed-controls {
            display: flex;
            gap: 0.5rem;
            align-items: center;
        }

        .mini-player-speed-text {
            font-size: 0.85rem;
            font-weight: 600;
            font-variant-numeric: tabular-nums;
            min-width: 3ch;
            text-align: center;
        }

        /* Buttons */
        .mini-player-btn {
            background: transparent;
            border: none;
            cursor: pointer;
            font-family: inherit;
            transition: transform 0.1s ease, opacity 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            color: inherit;
            /* Inherit from container */
        }

        .mini-player-btn:active {
            transform: scale(0.95);
        }

        .mini-player-btn.primary {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: currentColor;
            /* Use text color (black or white) */
            color: var(--bg-color);
            /* Inverse color for icon */
            font-size: 1.2rem;
            padding-left: 4px;
            /* Optical center for play icon */
        }

        /* Fix icon color in primary button */
        @media (prefers-color-scheme: dark) {
            .mini-player-btn.primary {
                color: #000;
                /* Black icon on white button */
            }
        }

        body[data-theme="dark"] .mini-player-btn.primary,
        body[data-theme="pure-black"] .mini-player-btn.primary {
            color: #000;
        }

        /* Center play icon correctly */
        .mini-player-btn.primary span {
            display: block;
            line-height: 1;
        }

        .mini-player-btn.secondary {
            font-size: 0.75rem;
            font-weight: 600;
            opacity: 0.9;
            padding: 6px 10px;
            border-radius: 8px;
            background: rgba(0, 0, 0, 0.05);
        }

        .mini-player-btn.secondary:hover {
            opacity: 1;
            background: rgba(0, 0, 0, 0.1);
        }

        .mini-player-btn.close {
            font-size: 0.8rem;
            font-weight: 600;
            color: #ff3b30 !important;
            /* System Red - Force it */
            opacity: 0.9;
            background: rgba(255, 59, 48, 0.1);
            padding: 6px 12px;
            border-radius: 8px;
        }

        .mini-player-btn.close:hover {
            opacity: 1;
            background: rgba(255, 59, 48, 0.2);
        }

        /* Adjust trigger position when mini player is active */
        body.mini-mode .a11y-trigger {
            bottom: 7rem;
            /* Move up to avoid overlap */
            z-index: 1400;
            /* Ensure below player but visible */
        }

        .a11y-option {
            display: flex;
            flex-direction: column;
            gap: 0.8rem;
        }

        .a11y-option-row {
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
        }

        .a11y-option label {
            font-weight: bold;
            font-size: 0.85rem;
            text-transform: capitalize;
            /* Capitalize labels */
            letter-spacing: 0.05em;
            min-height: 1.2em;
            /* Reserve space for value preview */
        }

        .a11y-option-row label {
            flex: 0 0 40%;
        }

        .a11y-controls {
            display: flex;
            gap: 0.5rem;
            align-items: center;
        }

        .a11y-option-row .a11y-controls {
            flex: 1;
            justify-content: flex-end;
        }

        /* Collapsible Section */
        .text-options-wrapper {
            /* border-bottom removed from wrapper */
            margin-bottom: 1rem;
        }

        .a11y-section-toggle {
            display: flex;
            justify-content: space-between;
            align-items: center;
            cursor: pointer;
            padding: 0.5rem 0;
            border-bottom: 1px solid var(--link-color);
            /* Divider below button */
        }

        .a11y-section-toggle h3 {
            margin: 0;
            font-size: 0.9rem;
            text-transform: none;
            /* No uppercase */
            letter-spacing: 0.05em;
            border: none;
            padding: 0;
            display: block;
        }

        .a11y-section-content {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            margin-bottom: 1.5rem;
            animation: fadeIn 0.3s ease;
        }

        /* Margin above Font Size */
        .a11y-section-content .a11y-option:first-child {
            margin-top: 1rem;
        }

        /* Divider below Word Spacing */
        .a11y-section-content .a11y-option:last-child {
            border-bottom: 1px solid var(--link-color);
            padding-bottom: 1.5rem;
            margin-bottom: 0;
            /* Removed margin as requested */
        }



        /* Mini Player Close Button */
        .mini-close-btn {
            position: absolute;
            right: 1rem;
            top: 50%;
            transform: translateY(-50%);
            background: transparent;
            border: none;
            color: var(--text-color);
            font-size: 1.5rem;
            cursor: pointer;
            display: none;
            line-height: 1;
            padding: 0.5rem;
            z-index: 10;
        }



        /* Sliders */
        input[type=range] {
            width: 100%;
            -webkit-appearance: none;
            appearance: none;
            background: transparent;
            margin: 10px 0;
        }

        input[type=range]:focus {
            outline: none;
        }

        input[type=range]::-webkit-slider-runnable-track {
            width: 100%;
            height: 4px;
            /* Thinner track */
            cursor: pointer;
            background: var(--slider-color);
            /* Darker gray */
            border-radius: 2px;
            /* Ticks */
            background-image: repeating-linear-gradient(to right,
                    var(--bg-color),
                    var(--bg-color) 2px,
                    transparent 2px,
                    transparent calc(100% / 6)
                    /* 7 points = 6 intervals */
                );
            background-size: 100% 100%;
            /* Ensure it covers track */
        }

        input[type=range]::-webkit-slider-thumb {
            height: 16px;
            /* Slightly smaller thumb */
            width: 16px;
            border-radius: 50%;
            background: var(--slider-color);
            /* Filled gray */
            cursor: pointer;
            -webkit-appearance: none;
            margin-top: -6px;
            /* Center on track */
            border: 2px solid var(--bg-color);
            /* Contrast ring */
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        /* Firefox Slider Support */
        input[type=range]::-moz-range-track {
            width: 100%;
            height: 4px;
            cursor: pointer;
            background: var(--slider-color);
            border-radius: 2px;
        }

        input[type=range]::-moz-range-thumb {
            height: 16px;
            width: 16px;
            border: 2px solid var(--bg-color);
            border-radius: 50%;
            background: var(--slider-color);
            cursor: pointer;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        /* Buttons */
        .a11y-btn {
            flex: 1;
            padding: 0.5rem;
            border: 1px solid var(--text-color);
            background: transparent;
            color: var(--text-color);
            cursor: pointer;
            font-size: 0.8rem;
            border-radius: 4px;
            font-family: var(--font-mono);
            text-transform: capitalize;
            /* Capitalize controls */
        }

        .a11y-btn:hover,
        .a11y-btn.active {
            background: var(--text-color);
            color: var(--bg-color);
        }

        .reset-btn {
            position: absolute;
            top: 1rem;
            right: 1rem;
            width: auto;
            margin: 0;
            border: none;
            color: var(--link-color);
            font-size: 0.7rem;
            padding: 0;
            text-decoration: none;
            /* Removed underline */
        }

        .reset-btn:hover {
            background: transparent;
            color: var(--text-color);
            text-decoration: underline;
            /* Add on hover for affordance */
        }

        /* Theme Buttons */
        .theme-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: 1px solid #ccc;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            box-sizing: border-box;
        }

        .theme-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: conic-gradient(var(--t-bg) 0% 50%, var(--t-text) 50% 100%);
            transform: rotate(-45deg);
        }

        .theme-btn.active {
            border: 3px solid var(--link-color);
            transform: scale(1.1);
        }

        /* Play Controls */
        .play-controls {
            display: flex;
            gap: 0.5rem;
            align-items: center;
        }

        .play-main-btn {
            flex: 2;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }



        /* --- UNIFIED CSS ARCHITECTURE --- */
        .view-container {
            /* max-width: 1200px; REMOVED */
            /* margin: 0 auto; REMOVED */
            padding-bottom: 4rem;
            padding-left: 5rem;
            padding-right: 5rem;
        }



        .view-header {
            margin-bottom: 3rem;
            max-width: 800px;
        }

        .view-header h1 {
            font-family: var(--current-font-header);
            font-size: 3rem;
            margin: 0 0 1rem 0;
            line-height: 1.1;
            color: var(--text-color);
            font-variation-settings: 'slnt' 0;
        }

        .view-header h1 em,
        .view-header h1 i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }

        .view-header p {
            font-family: var(--current-font-body);
            font-size: 1.2rem;
            opacity: 0.8;
            margin: 0;
            line-height: 1.5;
            max-width: 700px;
        }

        /* --- COMPONENT STYLES --- */

        /* Topic Grid (Home) */
        .topic-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 1rem;
        }

        .topic-card {
            background: #f0f0f0;
            border: none;
            border-radius: 16px;
            padding: 1.5rem;
            color: var(--text-color);
            text-decoration: none;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            margin-bottom: 0px !important;
        }

        .topic-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            background: #ffffff;
            color: #222222 !important;
        }

        .topic-card:hover h3,
        .topic-card:hover p {
            color: #222222 !important;
            opacity: 1 !important;
        }



        .topic-card h3 {
            margin: 0;
            font-size: 1.5rem;
            font-family: var(--current-font-header);
            font-variation-settings: 'slnt' 0;
        }

        .topic-card h3 em,
        .topic-card h3 i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }

        /* Consolidated Item/Section Descriptions */
        .section-description,
        .topic-card p,
        .subtopic-item p,
        .card-subtitle,
        /* navigation card subtitle */
        .view-header-desc p {
            font-size: 1.1rem;
            line-height: 1.9;
            color: var(--text-color);
            opacity: 1;
            margin: 0;
        }

        /* Subtopic List (Topic View) */
        .subtopic-group {
            margin-bottom: 3rem;
        }

        .subtopic-group h2 {
            font-family: var(--current-font-header);
            font-size: 1.8rem;
            margin-bottom: 1.5rem;
            opacity: 0.9;
            font-variation-settings: 'slnt' 0;
        }

        .subtopic-group h2 em,
        .subtopic-group h2 i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }

        .subtopic-item {
            margin-bottom: 2rem;
            /* No borders, clean spacing */
        }

        .subtopic-item a {
            text-decoration: none;
            color: var(--text-color);
            display: inline-block;
        }

        .subtopic-item h3 {
            margin: 0 0 0.5rem 0;
            font-size: 1.4rem;
            font-family: var(--current-font-header);
            font-weight: 700;
            transition: opacity 0.2s;
            font-variation-settings: 'slnt' 0;
        }

        .subtopic-item h3 em,
        .subtopic-item h3 i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }

        .subtopic-item a:hover h3 {
            opacity: 0.6;
        }


        /* Breadcrumbs */
        .breadcrumb {
            font-family: var(--font-mono);
            font-size: 0.85rem;
            margin-bottom: 3rem;
            color: var(--link-color);
            display: flex;
            gap: 0.5rem;
            align-items: center;
            opacity: 0.6;
        }

        .breadcrumb a {
            text-decoration: none !important;
            color: inherit;
        }

        .breadcrumb a:hover {
            text-decoration: underline;
        }




        /* Dark mode adjustment for filled state */
        @media (prefers-color-scheme: dark) {
            /* keyframe needs to target correct var colors, which it does */
        }

        .next-label-top {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            font-family: var(--font-mono);
            opacity: 0.8;
            margin-bottom: 0.25rem;
        }

        .next-label-title {
            font-family: var(--current-font-header);
            font-size: 1.1rem;
            font-weight: 600;
            font-variation-settings: 'slnt' 0;
        }

        .next-label-title em,
        .next-label-title i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }


        /* Article Content Specifics */
        #markdown-content {
            font-size: 1.15rem;
            color: var(--text-color);
            max-width: 700px;
            /* Standardized narrower width */
            /* margin: 0 auto;  Removed auto margin here if we rely on container, 
               but wait, .view-container has padding. 
               If we want it left aligned but limited, max-width is enough.
               If we want it centered... usually articles are centered.
               But the Design seems to be left-aligned logic in recent edits?
               No, the user added "margin: 0 auto" in Step 802 to main body.
               But .view-header is left aligned.
               Let's keep it left aligned but limited width, OR match the header.
               .view-header has max-width 700px.
               So content should match.
            */
        }

        #markdown-content p,
        #markdown-content li {
            font-size: 1.05rem;
            line-height: 1.9;
            margin-bottom: 1.5rem;
            color: var(--text-color);
            opacity: 1;
            /* Standardized color, no opacity */
        }

        .view-header-desc {
            max-width: 800px;
            margin-bottom: 3rem;
        }

        .nav-link-back {
            margin-top: 0.25rem;
            font-size: 0.9rem;
            color: var(--link-color);
            text-decoration: none;
            border-bottom: 1px solid transparent;
        }

        .nav-link-back:hover {
            border-bottom-color: var(--link-color);
        }

        .nav-label {
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 0.25rem;
            font-family: var(--font-mono);
        }

        /* High Contrast Overrides (Yellow on Black) */
        body[data-theme="high-contrast"] .topic-card p,
        body[data-theme="high-contrast"] .article-card p,
        body[data-theme="high-contrast"] .breadcrumb,
        body[data-theme="high-contrast"] .subtopic-item p,
        body[data-theme="high-contrast"] .nav-item,
        body[data-theme="high-contrast"] .nav-separator,
        body[data-theme="high-contrast"] .crumb-link,
        body[data-theme="high-contrast"] .view-header p,
        body[data-theme="high-contrast"] .nav-btn.prev,
        body[data-theme="high-contrast"] .next-label-top,
        body[data-theme="high-contrast"] .nav-label,
        body[data-theme="high-contrast"] .view-header h3,
        body[data-theme="high-contrast"] .nav-left-info h3,
        body[data-theme="high-contrast"] .nav-breadcrumbs-bottom .crumb-link {
            opacity: 1 !important;
            color: #ffff00 !important;
        }

        body[data-theme="high-contrast"] .topic-card,
        body[data-theme="high-contrast"] .article-card {
            border-color: #ffff00 !important;
        }

        /* Fix Hover Text Visibility for Yellow on Black */
        body[data-theme="high-contrast"] .topic-card:hover p,
        body[data-theme="high-contrast"] .article-card:hover p {
            color: #000000 !important;
            opacity: 1 !important;
        }

        /* Pure Black Theme (UI "High Contrast" - Black on White) Overrides */
        /* Make gray text black/opaque */
        body[data-theme="pure-black"] .topic-card p,
        body[data-theme="pure-black"] .article-card p,
        body[data-theme="pure-black"] .breadcrumb,
        body[data-theme="pure-black"] .subtopic-item p,
        body[data-theme="pure-black"] .nav-item,
        body[data-theme="pure-black"] .nav-separator,
        body[data-theme="pure-black"] .crumb-link,
        body[data-theme="pure-black"] .view-header p,
        body[data-theme="pure-black"] .nav-btn.prev,
        body[data-theme="pure-black"] .next-label-top,
        body[data-theme="pure-black"] .nav-label,
        body[data-theme="pure-black"] .view-header h3,
        body[data-theme="pure-black"] .nav-left-info h3,
        body[data-theme="pure-black"] .nav-breadcrumbs-bottom .crumb-link {
            opacity: 1 !important;
            color: #000000 !important;
        }

        /* Fix Hover Text Visibility for Black on White */
        body[data-theme="pure-black"] .topic-card:hover p,
        body[data-theme="pure-black"] .article-card:hover p {
            color: #ffffff !important;
            opacity: 1 !important;
        }

        .nav-title {
            font-family: var(--current-font-header);
            font-size: 1.2rem;
            font-weight: bold;
            font-variation-settings: 'slnt' 0;
        }

        .nav-title em,
        .nav-title i {
            font-variation-settings: 'slnt' -15;
            font-style: italic;
        }

        .external-link-icon {
            display: inline-block;
            margin-left: 4px;
            margin-right: 2px;
            vertical-align: middle;
            opacity: 1;
            transition: opacity 0.2s;
            width: 0.85em;
        }

        a:hover .external-link-icon {
            opacity: 1;
        }

        #app-view .view-title-box {
            position: sticky;
            top: 0;
            z-index: 1000;
            padding: 1rem 0;
            background: rgba(217, 217, 217, 0.6);
            /* Matches page background */
            transition: all 0.3s ease;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            padding-bottom: 1.2rem !important;

        }

        #app-view .view-title-box::before {
            content: '';
            position: absolute;
            bottom: 100%;
            left: 0;
            right: 0;
            height: 2000px;
            background: rgba(217, 217, 217, 0.6);
            backdrop-filter: blur(20px) !important;
            -webkit-backdrop-filter: blur(20px);
            pointer-events: none;


        }

        #app-view .view-title-box::after {
            content: '';
            position: absolute;
            bottom: -15px;
            left: 0;
            right: 0;
            height: 15px;
            background: linear-gradient(to bottom, rgba(217, 217, 217, 0.4), transparent);
            pointer-events: none;

        }

        @media (min-width: 851px) {
            #app-view .view-title-box {
                position: sticky;
                top: 5.5rem;
                padding: 0.8rem 0 0.5rem 0;
                background: rgba(217, 217, 217, 0.6);
                box-shadow: none !important;
                /* Removed shadow per request */
            }
        }

        /* Tablet/Small Desktop Optimization */
        @media (min-width: 851px) and (max-width: 1150px) {
            #app-view .view-title-box {
                top: 5.8rem;
                /* Increased gap to prevent collapse with header */
                padding: 0.8rem 0 0.5rem 0;
                /* More breathing room */
            }
        }

        /* Navigation Button Polish */
        .article-nav-item {
            flex: 1;
            display: flex;
            align-items: center;
            transition: background 0.2s ease;
            cursor: pointer;
        }

        @media (min-width: 851px) {
            .article-nav-item:hover {
                background: #ffffff !important;
            }
        }

        .article-nav-link {
            text-decoration: none !important;
            color: inherit;
            display: flex;
            align-items: center;
            gap: 1rem;
            width: 100%;
        }

        #app-view .view-header-desc {
            margin-top: 1.5rem;
            font-size: 1.1rem;
            opacity: 0.8;
            line-height: 1.6;
            max-width: 800px;
        }

        #app-view .view-header p {
            font-size: 3rem;
            transition: font-size 0.3s ease;
        }


        body::before {
            content: '';
            position: sticky;
            top: 0;
            display: block;
            width: 100%;
            height: calc(6rem + 5px);
            /* Covers header area + fade */
            background: linear-gradient(to bottom, var(--bg-color) 6rem, transparent);
            z-index: 1050;
            /* Behind header (1100) but in front of content */
            margin-bottom: calc(-9rem - 35px);
            /* Pull content back up */
            pointer-events: none;
            opacity: 0.9;
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);

        }

        @media (max-width: 850px) {
            #app-view .view-header p {
                font-size: 1.8rem !important;
            }

            blockquote {
                padding-left: 0.3rem;
            }

            body::before {
                opacity: 0;
            }
        }

        @media (min-width: 851px) {
            #app-view .view-header {
                padding: 1rem 0;
            }

            #app-view .view-header.stuck {
                margin-left: -2rem;
                margin-right: -2rem;
                padding: 1rem 2rem;
            }
        }

        .read-more-btn,
        .read-more-btn.expanded {
            margin-top: 0.1rem !important;
        }

        /* Mobile specific adjustments */
        @media (max-width: 850px) {
            .article-nav {
                flex-direction: column-reverse !important;
                align-items: stretch !important;
                gap: 1rem !important;
                padding: 1rem !important;
            }

            .article-nav-item {
                padding: 0.6rem 1rem !important;
            }

            .article-nav-item:hover {
                background: transparent !important;
            }

            .article-nav .nav-divider {
                width: 100% !important;
                height: 2px !important;
                margin: 0 !important;
            }

            .article-nav>div {
                justify-content: flex-start !important;
            }

            .article-nav>div a {
                justify-content: flex-start !important;
            }



            main p,
            #app-view .article-content p,
            main li,
            #app-view .article-content li {
                font-size: 0.95rem !important;
                /* ~13px (3pt smaller than 16px) */
            }

            main h1,
            #app-view .article-content h1 {
                font-size: 1.9rem !important;
            }

            main h2,
            #app-view .article-content h2 {
                font-size: 1.45rem !important;
            }

            main h3,
            #app-view .article-content h3 {
                font-size: 1.25rem !important;
            }

            #app-view .view-header h1 {
                font-size: 1.9rem !important;
                margin-top: 1rem !important;
            }

            .topic-card p,
            .card-subtitle,
            /* Added to ensure 0.95rem on mobile */
            .view-header-desc p,
            .section-description,
            #markdown-content,
            #markdown-content p,
            #markdown-content li,
            .subtopic-item p {
                font-size: 0.95rem !important;
                /* Balanced: larger but not 'huge' */
                line-height: 1.8 !important;
                /* Slightly tighter for better mobile density */
                opacity: 1 !important;
                color: var(--text-color) !important;
            }

            .topic-card h3 {
                font-size: 1.2rem !important;
            }

            .view-title-box h1 {
                font-size: 1.1rem !important;
                /* Context subheader slightly reduced on mobile */
                line-height: 1.1 !important;
                margin-bottom: 0.2rem !important;
            }

            /* Home page title stays large */
            .view-title-box h1.is-home-title {
                font-size: 3.8rem !important;
                margin-bottom: 0rem !important;
            }

            /* Dynamic Page Titles on Mobile */
            .view-title-box p {
                font-size: 1.8rem !important;
                /* Default Page name */
                line-height: 1.1 !important;
            }

            .view-title-box p.title-long {
                font-size: 1.6rem !important;
            }

            .view-title-box p.title-xlong {
                font-size: 1.4rem !important;
            }

            .read-more-btn {
                font-size: 1.0rem !important;
                /* Match body text on mobile */
                padding: 0.7rem 1.2rem !important;
            }

            /* Grouped above */


            .subtopic-group h2,
            .subtopic-item h3 {
                font-size: 1.8rem !important;
                /* Match mobile page title */
                line-height: 1.2 !important;
                color: var(--text-color) !important;
                opacity: 1 !important;
                margin-top: 2rem !important;
                margin-bottom: 0.8rem !important;
            }

            #app-view .view-title-box {
                position: sticky !important;
                top: 4.6rem !important;
                z-index: 1000 !important;
                background: rgba(217, 217, 217, 0.6);
                padding: 1.2rem 0 0.75rem 0 !important;
                backdrop-filter: blur(20px);
                -webkit-backdrop-filter: blur(20px);
                margin-bottom: 5rem;
            }

            /* Grouped above */





            .main-header {
                position: sticky !important;
                top: 0.8rem !important;
                z-index: 1100 !important;
                margin-top: -0.2rem !important;
                margin-left: -0.2rem !important;
                margin-right: -0.2rem !important;
                width: calc(100% + 0.4rem) !important;
                margin-bottom: 1.5rem !important;
            }

            .page-container {
                padding-top: 0 !important;
            }
        }

        /* History System - Public View */
        .history-btn {
            background: none;
            border: none;
            color: var(--link-color);
            cursor: pointer;
            padding: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: color 0.2s, transform 0.2s;
            opacity: 0.7;
        }

        .history-btn:hover {
            color: var(--text-color);
            opacity: 1;
            transform: scale(1.1);
        }

        .history-sidebar {
            position: fixed;
            top: 0;
            right: -400px;
            width: 350px;
            height: 100vh;
            background: var(--bg-color);
            border-left: 1px solid var(--link-color);
            z-index: 2000;
            transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            flex-direction: column;
            padding: 2rem;
            box-shadow: -10px 0 30px rgba(0, 0, 0, 0.05);
        }

        .history-sidebar.active {
            right: 0;
        }

        .history-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .history-header h3 {
            margin: 0;
            font-family: var(--font-display);
            font-size: 1.5rem;
            text-transform: lowercase;
        }

        .close-history {
            background: none;
            border: none;
            font-size: 2rem;
            cursor: pointer;
            color: var(--link-color);
            line-height: 1;
        }

        .history-list {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .history-item {
            padding: 1.2rem;
            background: rgba(0, 0, 0, 0.03);
            border-radius: 1rem;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
        }

        .history-item:hover {
            background: rgba(0, 0, 0, 0.06);
            transform: translateX(-4px);
        }

        .history-item.active {
            background: var(--text-color);
            color: var(--bg-color);
        }

        .history-item-time {
            font-weight: bold;
            font-size: 1rem;
        }

        .history-item-ago {
            font-size: 0.85rem;
            opacity: 0.7;
        }

        .preview-indicator {
            display: none;
            background: #444;
            color: #fff;
            padding: 0.5rem 1rem;
            border-radius: 2rem;
            font-size: 0.85rem;
            font-family: var(--font-mono);
            margin-left: 1rem;
            align-items: center;
            gap: 0.5rem;
        }

        .preview-indicator.active {
            display: inline-flex;
        }

        .preview-actions {
            display: none;
            position: fixed;
            bottom: 2rem;
            left: 50%;
            transform: translateX(-50%);
            background: var(--text-color);
            color: var(--bg-color);
            padding: 1rem 2rem;
            border-radius: 3rem;
            z-index: 1500;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            align-items: center;
            gap: 1.5rem;
            animation: slideUp 0.3s ease-out;
        }

        .preview-actions.active {
            display: flex;
        }

        .preview-actions button {
            background: var(--bg-color);
            color: var(--text-color);
            border: none;
            padding: 0.6rem 1.2rem;
            border-radius: 2rem;
            font-weight: bold;
            cursor: pointer;
            font-family: var(--font-body);
        }

        @keyframes slideUp {
            from {
                transform: translate(-50%, 20px);
                opacity: 0;
            }

            to {
                transform: translate(-50%, 0);
                opacity: 1;
            }
        }

        /* Fix for backdrop-filter layer promotion bug:
           Elements with view-transition-name are promoted to their own layer, breaking backdrop-filter.
           This removes the transition names when not actively transitioning. */
        html:not([data-transition-dir]) #app-view,
        html:not([data-transition-dir]) #markdown-content,
        html:not([data-transition-dir]) .view-content,
        html:not([data-transition-dir]) .topic-grid,
        html:not([data-transition-dir]) .article-content,
        html:not([data-transition-dir]) p,
        html:not([data-transition-dir]) h1,
        html:not([data-transition-dir]) h2,
        html:not([data-transition-dir]) h3,
        html:not([data-transition-dir]) li,
        html:not([data-transition-dir]) span {
            view-transition-name: none !important;
        }

        /* Seamless header blur integration */
        .main-header,
        .header-gap-mask {
            backdrop-filter: blur(20px) !important;
            -webkit-backdrop-filter: blur(20px) !important;
            opacity: 1 !important;
            /* Ensure gap mask is visible */
            box-shadow: none !important;
            border: none !important;
        }

        @media (max-width: 850px) {
            .view-container {
                padding-left: 0;
                padding-right: 0;
            }
        }