/* =========================================================
   Detailed Summary — v2 Premium Redesign
   Fonts: loaded via layout (Inter / system)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Merriweather:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    /* Accent palette */
    --c1: #e11d48;
    --c1-bg: #fff1f2;
    --c1-glow: rgba(225, 29, 72, .15);
    --c2: #2563eb;
    --c2-bg: #eff6ff;
    --c2-glow: rgba(37, 99, 235, .15);
    --c3: #059669;
    --c3-bg: #ecfdf5;
    --c3-glow: rgba(5, 150, 105, .15);
    --c4: #d97706;
    --c4-bg: #fffbeb;
    --c4-glow: rgba(217, 119, 6, .15);
    --c5: #7c3aed;
    --c5-bg: #f5f3ff;
    --c5-glow: rgba(124, 58, 237, .15);
    --c6: #0891b2;
    --c6-bg: #ecfeff;
    --c6-glow: rgba(8, 145, 178, .15);

    /* Surface */
    --bg: #f8f9fc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --subtle: #94a3b8;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --nav-h: 72px;
    --shadow-sm: 0 1px 4px rgba(15, 23, 42, .06);
    --shadow: 0 4px 24px rgba(15, 23, 42, .08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);
    --transition: .2s cubic-bezier(.4, 0, .2, 1);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    font-family: 'Inter', system-ui, sans-serif;
}

/* ─── Reading Progress ─────────────────────────────────────── */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #2563eb, #7c3aed, #e11d48);
    z-index: 9999;
    transition: width .12s linear;
    border-radius: 0 3px 3px 0;
}

/* ─── Page wrapper ──────────────────────────────────────────── */
.ds-page {
    min-height: 100vh;
    padding-bottom: 80px;
}

/* ─── Breadcrumb ───────────────────────────────────────────── */
.ds-breadcrumb {
    padding: 18px 0 14px;
    font-size: .8rem;
    color: var(--muted);
    letter-spacing: .01em;
}

.ds-breadcrumb a {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition);
}

.ds-breadcrumb a:hover {
    color: var(--c2);
}

.ds-breadcrumb .sep {
    margin: 0 8px;
    color: var(--border);
}

.ds-breadcrumb .current {
    color: var(--text);
    font-weight: 500;
}

/* ─── Container ────────────────────────────────────────────── */
.ds-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ═══════════════════════════════════════════════════════════
   INDEX PAGE (TOC)
   ═══════════════════════════════════════════════════════════ */

/* ─── Hero Header ──────────────────────────────────────────── */
.ds-hero {
    position: relative;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 60%, #0f172a 100%);
    border-radius: var(--radius-lg);
    padding: 56px 48px 52px;
    margin-bottom: 40px;
    overflow: hidden;
    text-align: center;
}

.ds-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99, 102, 241, .25), transparent);
    pointer-events: none;
}

.ds-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .15), transparent);
}

.ds-work-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 16px;
    border-radius: 100px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, .15);
    backdrop-filter: blur(8px);
}

.ds-work-type-badge.drama {
    background: rgba(225, 29, 72, .2);
    color: #fda4af;
}

.ds-work-type-badge.novel {
    background: rgba(5, 150, 105, .2);
    color: #6ee7b7;
}

.ds-work-type-badge.story {
    background: rgba(37, 99, 235, .2);
    color: #93c5fd;
}

.ds-work-type-badge.poetry {
    background: rgba(124, 58, 237, .2);
    color: #c4b5fd;
}

.ds-work-type-badge.other {
    background: rgba(255, 255, 255, .1);
    color: #cbd5e1;
}

.ds-hero-title {
    font-family: 'Merriweather', Georgia, serif;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
    line-height: 1.3;
}

.ds-hero-excerpt {
    font-size: 1.02rem;
    color: #94a3b8;
    max-width: 560px;
    margin: 0 auto 24px;
    line-height: 1.7;
}

.ds-hero-meta {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: .82rem;
    color: #64748b;
}

.ds-hero-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    padding: 5px 12px;
    border-radius: 100px;
    color: #94a3b8;
}

.ds-hero-meta-item svg {
    width: 14px;
    height: 14px;
    opacity: .7;
}

.premium-badge {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff;
    padding: 4px 12px;
    border-radius: 100px;
    font-weight: 700;
    font-size: .75rem;
    letter-spacing: .05em;
}

/* ─── Progress bar strip ───────────────────────────────────── */
.ds-toc-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    padding: 14px 18px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.ds-toc-progress-label {
    font-size: .82rem;
    color: var(--muted);
    white-space: nowrap;
}

.ds-toc-progress-bar-bg {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.ds-toc-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #2563eb, #7c3aed);
    transition: width .5s ease;
}

.ds-toc-progress-count {
    font-size: .82rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ─── Section Cards Grid ───────────────────────────────────── */
.ds-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    max-width: 100%;
}

.ds-section-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.ds-section-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 2px 0 0 2px;
}

.ds-section-card.c1::before {
    background: var(--c1);
}

.ds-section-card.c2::before {
    background: var(--c2);
}

.ds-section-card.c3::before {
    background: var(--c3);
}

.ds-section-card.c4::before {
    background: var(--c4);
}

.ds-section-card.c5::before {
    background: var(--c5);
}

.ds-section-card.c6::before {
    background: var(--c6);
}

.ds-section-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: transparent;
}

.ds-section-card.c1:hover {
    box-shadow: 0 8px 30px var(--c1-glow);
}

.ds-section-card.c2:hover {
    box-shadow: 0 8px 30px var(--c2-glow);
}

.ds-section-card.c3:hover {
    box-shadow: 0 8px 30px var(--c3-glow);
}

.ds-section-card.c4:hover {
    box-shadow: 0 8px 30px var(--c4-glow);
}

.ds-section-card.c5:hover {
    box-shadow: 0 8px 30px var(--c5-glow);
}

.ds-section-card.c6:hover {
    box-shadow: 0 8px 30px var(--c6-glow);
}

/* ─── Section Number Badge ─────────────────────────────────── */
.ds-section-number {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -.02em;
}

.ds-section-card.c1 .ds-section-number {
    background: var(--c1);
}

.ds-section-card.c2 .ds-section-number {
    background: var(--c2);
}

.ds-section-card.c3 .ds-section-number {
    background: var(--c3);
}

.ds-section-card.c4 .ds-section-number {
    background: var(--c4);
}

.ds-section-card.c5 .ds-section-number {
    background: var(--c5);
}

.ds-section-card.c6 .ds-section-number {
    background: var(--c6);
}

.ds-section-info {
    flex: 1;
    min-width: 0;
}

.ds-section-title {
    font-size: .97rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-section-subtitle {
    font-size: .82rem;
    color: var(--muted);
    margin: 3px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Completed checkmark on card */
.ds-section-card.ds-done .ds-section-check {
    display: flex;
}

.ds-section-check {
    display: none;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dcfce7;
    flex-shrink: 0;
}

.ds-section-check svg {
    width: 11px;
    height: 11px;
    color: #16a34a;
}

.ds-section-arrow {
    color: var(--border);
    transition: color var(--transition), transform var(--transition);
    flex-shrink: 0;
}

.ds-section-arrow svg {
    width: 16px;
    height: 16px;
}

.ds-section-card:hover .ds-section-arrow {
    color: var(--muted);
    transform: translateX(3px);
}

/* ═══════════════════════════════════════════════════════════
   SECTION PAGE
   ═══════════════════════════════════════════════════════════ */

/* ─── Two-column layout ────────────────────────────────────── */
.ds-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 28px;
    align-items: start;
}

@media (max-width: 900px) {
    .ds-layout {
        grid-template-columns: 1fr;
    }

    .ds-toc {
        display: none;
    }
}

/* ─── Sidebar TOC ──────────────────────────────────────────── */
.ds-toc {
    position: sticky;
    top: calc(var(--nav-h) + 20px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - var(--nav-h) - 48px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.ds-toc::-webkit-scrollbar {
    width: 4px;
}

.ds-toc::-webkit-scrollbar-track {
    background: transparent;
}

.ds-toc::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.ds-toc-header {
    font-weight: 700;
    font-size: .78rem;
    color: var(--subtle);
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    letter-spacing: .08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 7px;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
}

.ds-toc-header svg {
    width: 13px;
    height: 13px;
}

.ds-toc-list {
    list-style: none;
    padding: 8px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ds-toc-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--muted);
    font-size: .83rem;
    transition: all var(--transition);
}

.ds-toc-item:hover {
    background: var(--bg);
    color: var(--text);
}

.ds-toc-list li.active .ds-toc-item {
    color: var(--text);
    font-weight: 600;
    background: var(--bg);
}

.ds-toc-num {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.ds-toc-item.c1 .ds-toc-num {
    background: var(--c1);
}

.ds-toc-item.c2 .ds-toc-num {
    background: var(--c2);
}

.ds-toc-item.c3 .ds-toc-num {
    background: var(--c3);
}

.ds-toc-item.c4 .ds-toc-num {
    background: var(--c4);
}

.ds-toc-item.c5 .ds-toc-num {
    background: var(--c5);
}

.ds-toc-item.c6 .ds-toc-num {
    background: var(--c6);
}

/* Active accent line in TOC */
.ds-toc-list li.active.c1 .ds-toc-item {
    border-left: 2px solid var(--c1);
}

.ds-toc-list li.active.c2 .ds-toc-item {
    border-left: 2px solid var(--c2);
}

.ds-toc-list li.active.c3 .ds-toc-item {
    border-left: 2px solid var(--c3);
}

.ds-toc-list li.active.c4 .ds-toc-item {
    border-left: 2px solid var(--c4);
}

.ds-toc-list li.active.c5 .ds-toc-item {
    border-left: 2px solid var(--c5);
}

.ds-toc-list li.active.c6 .ds-toc-item {
    border-left: 2px solid var(--c6);
}

.ds-toc-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Completed tick in sidebar */
.ds-toc-item.ds-completed .ds-toc-num {
    opacity: .6;
}

.ds-toc-item.ds-completed::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
}

/* ─── Section header (big) ─────────────────────────────────── */
.ds-section-header {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 28px 28px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.ds-section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, currentColor, transparent);
    opacity: .1;
}

.ds-section-header.c1 {
    background: var(--c1-bg);
}

.ds-section-header.c2 {
    background: var(--c2-bg);
}

.ds-section-header.c3 {
    background: var(--c3-bg);
}

.ds-section-header.c4 {
    background: var(--c4-bg);
}

.ds-section-header.c5 {
    background: var(--c5-bg);
}

.ds-section-header.c6 {
    background: var(--c6-bg);
}

.ds-section-num-big {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}

.ds-section-header.c1 .ds-section-num-big {
    background: var(--c1);
}

.ds-section-header.c2 .ds-section-num-big {
    background: var(--c2);
}

.ds-section-header.c3 .ds-section-num-big {
    background: var(--c3);
}

.ds-section-header.c4 .ds-section-num-big {
    background: var(--c4);
}

.ds-section-header.c5 .ds-section-num-big {
    background: var(--c5);
}

.ds-section-header.c6 .ds-section-num-big {
    background: var(--c6);
}

.ds-section-header-body {
    flex: 1;
    min-width: 0;
}

.ds-section-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.ds-section-title-big {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
    line-height: 1.35;
}

.ds-section-subtitle-big {
    font-size: .9rem;
    color: var(--muted);
    margin: 0;
}

.btn-print {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, .7);
    border: 1px solid rgba(0, 0, 0, .1);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 500;
    transition: all var(--transition);
    backdrop-filter: blur(4px);
}

.btn-print svg {
    width: 13px;
    height: 13px;
}

.btn-print:hover {
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ─── Tabs ─────────────────────────────────────────────────── */
.ds-tabs {
    display: flex;
    gap: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    width: fit-content;
}

.ds-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border: none;
    background: none;
    font-size: .88rem;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    border-radius: 10px;
    transition: all var(--transition);
}

.ds-tab svg {
    width: 14px;
    height: 14px;
    opacity: .7;
}

.ds-tab:hover {
    color: var(--text);
    background: rgba(0, 0, 0, .04);
}

.ds-tab.active {
    background: var(--surface);
    color: var(--c2);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.ds-tab.active svg {
    opacity: 1;
}

/* ─── Tab panels ───────────────────────────────────────────── */
.ds-tab-panels {
    padding: 4px 0 0;
}

.ds-tab-panel {
    display: none;
}

.ds-tab-panel.active {
    display: block;
    animation: fadeUp .2s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.ds-text-content {
    font-size: 1.02rem;
    line-height: 1.95;
    color: #1e293b;
    max-width: 740px;
    font-family: 'Merriweather', Georgia, serif;
}

.ds-text-content p {
    margin: 0 0 1.2em;
}

.ds-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--subtle);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.ds-empty-state svg {
    width: 36px;
    height: 36px;
    margin-bottom: 12px;
    opacity: .5;
}

.ds-empty-state p {
    margin: 0;
    font-size: .9rem;
}

/* ─── Premium Lock ─────────────────────────────────────────── */
.ds-premium-lock {
    position: relative;
    min-height: 220px;
    border-radius: var(--radius);
    overflow: hidden;
}

.ds-premium-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(8px);
    text-align: center;
    padding: 32px;
}

.ds-premium-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(217, 119, 6, .3);
}

.ds-premium-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

.ds-premium-overlay h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
}

.ds-premium-overlay p {
    color: var(--muted);
    margin: 0 0 20px;
    font-size: .9rem;
}

.btn-premium {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    font-size: .9rem;
    box-shadow: 0 4px 14px rgba(217, 119, 6, .35);
    transition: all var(--transition);
}

.btn-premium:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, .45);
}

/* ─── Prev / Next Navigation ───────────────────────────────── */
.ds-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.ds-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.ds-nav-btn:hover {
    border-color: var(--c2);
    box-shadow: 0 4px 20px var(--c2-glow);
    transform: translateY(-2px);
}

.ds-nav-btn.next {
    justify-content: flex-end;
    text-align: right;
}

.ds-nav-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition);
}

.ds-nav-btn-icon svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

.ds-nav-btn:hover .ds-nav-btn-icon {
    background: var(--c2-bg);
}

.ds-nav-btn:hover .ds-nav-btn-icon svg {
    color: var(--c2);
}

.ds-nav-btn small {
    display: block;
    font-size: .74rem;
    color: var(--subtle);
    font-weight: 500;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.ds-nav-btn strong {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
}

.ds-nav-label {
    flex: 1;
    min-width: 0;
}

/* ─── Print ────────────────────────────────────────────────── */
@media print {

    .ds-breadcrumb,
    .ds-toc,
    .ds-tabs,
    .ds-nav,
    .btn-print,
    .reading-progress-bar,
    [class*="audio"] {
        display: none !important;
    }

    .ds-layout {
        grid-template-columns: 1fr !important;
    }

    .ds-tab-panel {
        display: block !important;
        margin-bottom: 24px;
    }

    .ds-section-header {
        break-inside: avoid;
    }

    body {
        background: #fff !important;
    }
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
    .ds-hero {
        padding: 36px 24px 32px;
    }

    .ds-hero-title {
        font-size: 1.5rem;
    }

    .ds-sections-grid {
        grid-template-columns: 1fr;
    }

    .ds-tabs {
        width: 100%;
    }

    .ds-tab {
        flex: 1;
        justify-content: center;
    }

    .ds-nav {
        grid-template-columns: 1fr;
    }

    .ds-section-header {
        padding: 20px;
    }
}

/* RichEditor content styles */
.ds-text-content h2,
.ds-text-content h3 {
    font-weight: 700;
    margin: 1.2em 0 0.4em;
    color: var(--text);
}

.ds-text-content h2 {
    font-size: 1.4rem;
}

.ds-text-content h3 {
    font-size: 1.2rem;
}

.ds-text-content blockquote {
    border-left: 3px solid var(--c1);
    background: var(--c1-bg);
    padding: .75rem 1rem;
    margin: .75rem 0;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: var(--muted);
}

.ds-text-content strong,
.ds-text-content b {
    font-weight: 700;
}

.ds-text-content ul,
.ds-text-content ol {
    padding-left: 1.5rem;
    margin: .75rem 0;
}

.ds-text-content li {
    margin-bottom: .4rem;
}

.ds-text-content pre,
.ds-text-content code {
    background: var(--bg);
    padding: .2em .4em;
    border-radius: 4px;
    font-family: monospace;
}

/* ─── Dark Mode Overrides ───────────────────────────────────── */
[data-theme='dark'] {
    --bg: #0f172a;
    /* Darker background */
    --surface: #1e293b;
    /* Card background */
    --border: #334155;
    /* Border color */
    --text: #f8fafc;
    /* Bright text */
    --muted: #cbd5e1;
    /* Muted text */
    --subtle: #94a3b8;
    /* Subtle text */

    --c1-bg: rgba(225, 29, 72, .15);
    --c2-bg: rgba(37, 99, 235, .15);
    --c3-bg: rgba(5, 150, 105, .15);
    --c4-bg: rgba(217, 119, 6, .15);
    --c5-bg: rgba(124, 58, 237, .15);
    --c6-bg: rgba(8, 145, 178, .15);

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .4);
    --shadow: 0 4px 24px rgba(0, 0, 0, .5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
}

/* Dark mode typography and contrast fixes */
[data-theme='dark'] .ds-text-content,
[data-theme='dark'] .ds-text-content p,
[data-theme='dark'] .ds-text-content span,
[data-theme='dark'] .ds-text-content div {
    color: var(--text) !important;
}

[data-theme='dark'] .ds-section-title-big {
    color: var(--text) !important;
}

/* Base card dark mode alignment with topic hub UI */
[data-theme='dark'] .card,
[data-theme='dark'] .ds-section-header {
    background-color: var(--surface) !important;
    /* #1e293b */
    border-color: var(--border) !important;
}

/* Fix 'Jump to Section' dropdown for dark mode */
[data-theme='dark'] .ds-page .btn-outline-dark.dropdown-toggle {
    border-color: var(--border) !important;
    background-color: var(--surface) !important;
    color: var(--text) !important;
}

[data-theme='dark'] .ds-page .btn-outline-dark.dropdown-toggle:hover {
    background-color: var(--bg) !important;
}

[data-theme='dark'] .ds-hero {
    background: linear-gradient(135deg, #020617 0%, #1e1b4b 60%, #020617 100%);
}

[data-theme='dark'] .ds-section-check {
    background: rgba(22, 163, 74, .2);
}

[data-theme='dark'] .ds-section-check svg {
    color: #4ade80;
}

/* ── New sidebar TOC styles (Bootstrap left nav integration) ── */
.ds-toc-sidebar-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.ds-toc-num-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    font-size: .65rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.ds-toc-num-badge.c1 {
    background: var(--c1);
}

.ds-toc-num-badge.c2 {
    background: var(--c2);
}

.ds-toc-num-badge.c3 {
    background: var(--c3);
}

.ds-toc-num-badge.c4 {
    background: var(--c4);
}

.ds-toc-num-badge.c5 {
    background: var(--c5);
}

.ds-toc-num-badge.c6 {
    background: var(--c6);
}

.ds-toc-sidebar-item.ds-completed::after {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #16a34a;
    flex-shrink: 0;
    margin-left: auto;
}

/* Section header title override: match topic pages */
.ds-section-title-big.fw-bold {
    font-family: 'Bitter', 'Merriweather', Georgia, serif;
}

/* Mobile Alignment Fix for sticky dropdown */
@media (max-width: 860px) {
    .topic-details-page .d-lg-none.mb-4:has(.dropdown) {
        position: sticky;
        top: 0 !important;
        z-index: 1020;
        margin-top: 0 !important;
        background: var(--bg);
        padding-top: 8px;
        padding-bottom: 8px;
        margin-bottom: 16px !important;
    }
}