body {
    background-color: #fff4f4;
    color: #4c212c;
    -webkit-font-smoothing: antialiased;
}
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    display: inline-block;
    vertical-align: middle;
}
.glass-nav {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.seigaiha-pattern {
    background-image: radial-gradient(circle at 100% 150%, transparent 24%, #af2330 25%, #af2330 28%, transparent 29%, transparent 36%, #af2330 36%, #af2330 40%, transparent 41%, transparent),
                      radial-gradient(circle at 0 150%, transparent 24%, #af2330 25%, #af2330 28%, transparent 29%, transparent 36%, #af2330 36%, #af2330 40%, transparent 41%, transparent),
                      radial-gradient(circle at 50% 100%, transparent 24%, #af2330 25%, #af2330 28%, transparent 29%, transparent 36%, #af2330 36%, #af2330 40%, transparent 41%, transparent),
                      radial-gradient(circle at 100% 50%, transparent 24%, #af2330 25%, #af2330 28%, transparent 29%, transparent 36%, #af2330 36%, #af2330 40%, transparent 41%, transparent),
                      radial-gradient(circle at 0 50%, transparent 24%, #af2330 25%, #af2330 28%, transparent 29%, transparent 36%, #af2330 36%, #af2330 40%, transparent 41%, transparent);
    background-size: 60px 30px;
    opacity: 0.02;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #fff4f4; }
::-webkit-scrollbar-thumb { background: #dc9ca8; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a06773; }

/* Sidebar enhancements - layered on top of Tailwind utilities */
.sidebar {
    background: linear-gradient(180deg, #ffe1e5 0%, #fff4f4 55%, #ffffff 100%);
    box-shadow: 4px 0 28px rgba(78, 20, 30, 0.10);
    border-right: 1px solid rgba(175, 35, 48, 0.12);
}

.sidebar-nav-link {
    position: relative;
    transition: all 0.2s ease;
}

.sidebar-nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(175, 35, 48, 0.10), rgba(255, 117, 118, 0.04));
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity 0.2s ease, transform 0.25s ease;
    border-radius: 12px;
    z-index: 0;
}

.sidebar-nav-link:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.sidebar-nav-link:hover {
    color: #af2330;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(175, 35, 48, 0.06);
}

.sidebar-nav-link:active {
    transform: scale(0.98);
}

.sidebar-nav-link .material-symbols-outlined,
.sidebar-nav-link span:last-child {
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

.sidebar-nav-link:hover .material-symbols-outlined {
    transform: scale(1.1);
}

.sidebar-nav-link-active {
    color: #af2330;
    font-weight: 700;
    background: linear-gradient(90deg, rgba(175, 35, 48, 0.12), rgba(255, 117, 118, 0.05));
    border-right: 3px solid #af2330;
}

.sidebar-nav-link-active:hover {
    background: linear-gradient(90deg, rgba(175, 35, 48, 0.16), rgba(255, 117, 118, 0.08));
}

.btn-gradient {
    background: linear-gradient(135deg, #af2330 0%, #9e3655 100%);
    box-shadow: 0 4px 14px rgba(175, 35, 48, 0.22);
    transition: all 0.2s ease;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #c42a3a 0%, #b03f60 100%);
    box-shadow: 0 8px 24px rgba(175, 35, 48, 0.35);
    transform: translateY(-2px);
}

.btn-gradient:active {
    transform: translateY(0) scale(0.98);
}

/* Card elevations used by the video session template */
.card-elevation-1 {
    box-shadow: 0 1px 3px rgba(78, 20, 30, 0.06), 0 4px 12px rgba(78, 20, 30, 0.05);
    border: 1px solid rgba(175, 35, 48, 0.08);
}

.card-elevation-2 {
    box-shadow: 0 4px 12px rgba(78, 20, 30, 0.08), 0 8px 24px rgba(78, 20, 30, 0.06);
    border: 1px solid rgba(175, 35, 48, 0.10);
}

/* Subtitle overlay size presets */
.subtitle-size-xxs #subtitle-hanzi { font-size: 16px; }
.subtitle-size-xxs #subtitle-pinyin { font-size: 10px; }

.subtitle-size-xs #subtitle-hanzi { font-size: 20px; }
.subtitle-size-xs #subtitle-pinyin { font-size: 12px; }

.subtitle-size-sm #subtitle-hanzi { font-size: 24px; }
.subtitle-size-sm #subtitle-pinyin { font-size: 14px; }

.subtitle-size-md #subtitle-hanzi { font-size: 32px; }
.subtitle-size-md #subtitle-pinyin { font-size: 16px; }

.subtitle-size-lg #subtitle-hanzi { font-size: 40px; }
.subtitle-size-lg #subtitle-pinyin { font-size: 18px; }

.subtitle-size-xl #subtitle-hanzi { font-size: 48px; }
.subtitle-size-xl #subtitle-pinyin { font-size: 20px; }

/* Hide pinyin line when pinyin is disabled */
.subtitle-pinyin-hidden #subtitle-pinyin {
    display: none;
}

/* Script panel fixed height */
.script-panel-fixed {
    height: 600px;
    max-height: 60vh;
}

/* Read mode: script panel takes the tall reader height like the articles page */
.script-panel-reading {
    height: calc(100vh - 240px);
    max-height: none;
}

/* Note detail popup: gentle scale-in when the panel appears */
@keyframes note-detail-pop {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.note-detail-pop {
    animation: note-detail-pop 0.18s ease-out;
}

/* Glass panel used by floating toolbars and headers */
.glass-panel {
    background: rgba(255, 244, 244, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Narrow custom scrollbar for carousels and panels */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #dc9ca8;
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #a06773;
}

/* Script reader line interactions */
.script-line .pinyin {
    opacity: 0.7;
    transition: all 0.2s ease;
}
.script-line:hover .pinyin {
    opacity: 1;
    transform: translateY(0);
}

.main-with-sidebar {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

.header-with-sidebar {
    left: 0;
    transition: left 0.3s ease;
}

/* HSK level colors -------------------------------------------------------- */
.hsk-hsk1 { --hsk-color: #22c55e; --hsk-bg: #dcfce7; }
.hsk-hsk2 { --hsk-color: #0ea5e9; --hsk-bg: #e0f2fe; }
.hsk-hsk3 { --hsk-color: #f59e0b; --hsk-bg: #fef3c7; }
.hsk-hsk4 { --hsk-color: #f97316; --hsk-bg: #ffedd5; }
.hsk-hsk5 { --hsk-color: #8b5cf6; --hsk-bg: #ede9fe; }
.hsk-hsk6 { --hsk-color: #ec4899; --hsk-bg: #fce7f3; }
.hsk-beyond { --hsk-color: #64748b; --hsk-bg: #e2e8f0; }
.hsk-modern { --hsk-color: #14b8a6; --hsk-bg: #ccfbf1; }

.hsk1, .hsk2, .hsk3, .hsk4, .hsk5, .hsk6, .beyond, .modern { background-color: currentColor; }
.hsk1 { background-color: #22c55e; }
.hsk2 { background-color: #0ea5e9; }
.hsk3 { background-color: #f59e0b; }
.hsk4 { background-color: #f97316; }
.hsk5 { background-color: #8b5cf6; }
.hsk6 { background-color: #ec4899; }
.beyond { background-color: #64748b; }
.modern { background-color: #14b8a6; }

.hsk-token {
    display: inline;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    border-bottom: 3px solid transparent;
    padding-bottom: 1px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    cursor: help;
    border-radius: 2px;
}

.hsk-highlight-enabled.hl-hsk1 .hsk-token[data-level="HSK1"] { border-bottom-color: #22c55e; }
.hsk-highlight-enabled.hl-hsk2 .hsk-token[data-level="HSK2"] { border-bottom-color: #0ea5e9; }
.hsk-highlight-enabled.hl-hsk3 .hsk-token[data-level="HSK3"] { border-bottom-color: #f59e0b; }
.hsk-highlight-enabled.hl-hsk4 .hsk-token[data-level="HSK4"] { border-bottom-color: #f97316; }
.hsk-highlight-enabled.hl-hsk5 .hsk-token[data-level="HSK5"] { border-bottom-color: #8b5cf6; }
.hsk-highlight-enabled.hl-hsk6 .hsk-token[data-level="HSK6"] { border-bottom-color: #ec4899; }
.hsk-highlight-enabled.hl-beyond .hsk-token[data-level="BEYOND"] { border-bottom-color: #64748b; }

.hsk-token:hover {
    background-color: rgba(175, 35, 48, 0.06);
}

/* Idiom inline chip ------------------------------------------------------- */
.idiom-chip {
    background: linear-gradient(135deg, #c99dff 0%, #e9d5ff 100%);
    color: #25004b;
    border-radius: 6px;
    padding: 0 4px;
    cursor: help;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.idiom-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(113, 68, 170, 0.2);
}

/* Floating tooltip -------------------------------------------------------- */
.mando-tooltip {
    position: absolute;
    z-index: 100;
    max-width: 260px;
    padding: 8px 12px;
    background: rgba(76, 33, 44, 0.96);
    color: #fff4f4;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 8px 24px rgba(76, 33, 44, 0.25);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.mando-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.mando-tooltip .tooltip-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.mando-tooltip .tooltip-meta {
    opacity: 0.85;
    font-size: 12px;
}

/* Hierarchical notes: touch reveal for hover-only actions ------------------ */
.note-node.note-actions-visible .note-actions {
    opacity: 1;
}

.note-node.note-actions-visible .note-add-child-fab {
    opacity: 1;
}

/* Stats panel ------------------------------------------------------------ */
.stats-panel {
    position: fixed;
    top: 88px;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 100%;
    background: rgba(255, 244, 244, 0.98);
    backdrop-filter: blur(16px);
    border-left: 1px solid rgba(175, 35, 48, 0.12);
    box-shadow: -8px 0 32px rgba(76, 33, 44, 0.08);
    z-index: 45;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.stats-panel.open {
    transform: translateX(0);
}

.stats-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.stats-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 44;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.stats-panel-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 767px) {
    .stats-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 75vh;
        border-left: none;
        border-top: 1px solid rgba(175, 35, 48, 0.12);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .stats-panel.open {
        transform: translateY(0);
    }
}

/* HSK distribution mini bar ---------------------------------------------- */
.hsk-mini-bar {
    display: flex;
    height: 8px;
    border-radius: 9999px;
    overflow: hidden;
    background: rgba(175, 35, 48, 0.06);
}

.hsk-mini-bar > span {
    display: block;
    height: 100%;
}

.hsk-mini-bar .hsk1 { background: #22c55e; }
.hsk-mini-bar .hsk2 { background: #0ea5e9; }
.hsk-mini-bar .hsk3 { background: #f59e0b; }
.hsk-mini-bar .hsk4 { background: #f97316; }
.hsk-mini-bar .hsk5 { background: #8b5cf6; }
.hsk-mini-bar .hsk6 { background: #ec4899; }
.hsk-mini-bar .beyond { background: #64748b; }
.hsk-mini-bar .modern { background: #14b8a6; }

/* Hide scrollbar for horizontal shelves while keeping scroll functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

@media (min-width: 768px) {
    .header-with-sidebar {
        left: 280px;
    }

    .main-with-sidebar {
        margin-left: 280px;
    }

    body.sidebar-collapsed .header-with-sidebar {
        left: 0;
    }

    body.sidebar-collapsed .main-with-sidebar {
        margin-left: 0;
    }

    body.sidebar-collapsed #sidebar {
        transform: translateX(-100%);
    }
}

/* Culture reader tradition-based themes --------------------------------- */

.culture-reader,
body[data-reader-theme] {
    --reader-bg: var(--color-surface, #fff4f4);
    --reader-surface: var(--color-surface-container-lowest, #ffffff);
    --reader-accent: var(--color-primary, #af2330);
    --reader-accent-muted: var(--color-primary-container, #ff7576);
    --reader-text: var(--color-on-surface, #4c212c);
    --reader-text-muted: var(--color-on-surface-variant, #814c58);
    --reader-poem-text: var(--color-on-surface, #4c212c);
    --reader-border: var(--color-outline-variant, #dc9ca8);
    --reader-ink-wash: rgba(175, 35, 48, 0.04);
    --reader-font-poem: 'Ma Shan Zheng', 'Kaiti SC', 'Songti SC', serif;
    --reader-font-title: 'Ma Shan Zheng', 'Kaiti SC', 'Songti SC', serif;
    --reader-font-modern: 'Noto Serif SC', 'Noto Serif', serif;
    --reader-font-ui: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.culture-reader[data-tradition="CONFUCIAN"],
body[data-reader-theme="CONFUCIAN"] {
    --reader-bg: #faf1ea;
    --reader-surface: #fff9f5;
    --reader-accent: #a53f2d;
    --reader-accent-muted: #e6a88f;
    --reader-text: #1a1a1a;
    --reader-text-muted: #8a5a45;
    --reader-poem-text: #1a1a1a;
    --reader-border: #e6c8b5;
    --reader-ink-wash: rgba(165, 63, 45, 0.06);
}

.culture-reader[data-tradition="DAOIST"],
body[data-reader-theme="DAOIST"] {
    --reader-bg: #eef4ef;
    --reader-surface: #f7faf8;
    --reader-accent: #2d6a4f;
    --reader-accent-muted: #8fc6ad;
    --reader-text: #1a1a1a;
    --reader-text-muted: #5a6b5e;
    --reader-poem-text: #1a1a1a;
    --reader-border: #c5d5ca;
    --reader-ink-wash: rgba(45, 106, 79, 0.06);
}

.culture-reader[data-tradition="BUDDHIST"],
body[data-reader-theme="BUDDHIST"] {
    --reader-bg: #f4f1ea;
    --reader-surface: #faf8f3;
    --reader-accent: #6b5c7a;
    --reader-accent-muted: #b8afc7;
    --reader-text: #1a1a1a;
    --reader-text-muted: #6b5c7a;
    --reader-poem-text: #1a1a1a;
    --reader-border: #d9d2c4;
    --reader-ink-wash: rgba(107, 92, 122, 0.06);
}

.culture-reader[data-tradition="LITERARY"],
body[data-reader-theme="LITERARY"] {
    --reader-bg: #f7f4ed;
    --reader-surface: #fdfbf7;
    --reader-accent: #8b5a2b;
    --reader-accent-muted: #d4b894;
    --reader-text: #1a1a1a;
    --reader-text-muted: #7a6a4f;
    --reader-poem-text: #1a1a1a;
    --reader-border: #ddd4c2;
    --reader-ink-wash: rgba(139, 90, 43, 0.06);
}

.reader-title {
    font-family: var(--reader-font-title);
    font-size: clamp(3rem, 6vw, 5rem);
    line-height: 1.1;
    font-weight: 400;
    letter-spacing: 0.08em;
}

.reader-seal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 1.5px solid #b83a2f;
    color: #b83a2f;
    border-radius: 4px;
    font-family: var(--reader-font-title);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1;
    transform: rotate(-4deg);
    opacity: 0.85;
}

.culture-track-row {
    border: 1px solid transparent;
}

.culture-track-row:hover {
    background-color: rgba(175, 35, 48, 0.04);
    border-color: rgba(175, 35, 48, 0.08);
}

.culture-track-row:active {
    background-color: rgba(175, 35, 48, 0.08);
}

/* Distinguish the philosophy and modern-connection cards visually */
#reader-philosophy-section {
    border-left: 4px solid var(--reader-accent);
    background: linear-gradient(90deg, color-mix(in srgb, var(--reader-accent) 7%, var(--reader-surface)) 0%, var(--reader-surface) 60%);
}

#reader-modern-section {
    border-left: 4px solid var(--reader-accent-muted);
    background: linear-gradient(90deg, color-mix(in srgb, var(--reader-accent-muted) 12%, var(--reader-surface)) 0%, var(--reader-surface) 60%);
}

/* Apply tradition theme to the top bar and reader main area.
   The sidebar is intentionally NOT targeted so it keeps the default platform theme. */
body[data-reader-theme] .header-with-sidebar {
    background-color: color-mix(in srgb, var(--reader-bg) 95%, transparent);
    border-color: var(--reader-border);
}

body[data-reader-theme] .header-with-sidebar a,
body[data-reader-theme] .header-with-sidebar button {
    color: var(--reader-text);
}

body[data-reader-theme] .header-with-sidebar a:hover,
body[data-reader-theme] .header-with-sidebar button:hover {
    background-color: var(--reader-surface);
    border-color: var(--reader-border);
}

body[data-reader-theme] .header-with-sidebar .text-primary {
    color: var(--reader-accent);
}

body[data-reader-theme] .header-with-sidebar .ring-primary-container {
    --tw-ring-color: var(--reader-accent-muted);
}

/* Theme the display-mode toggle buttons in the top bar */
body[data-reader-theme] .header-with-sidebar .script-toggle {
    border: 1px solid var(--reader-border);
}

body[data-reader-theme] .header-with-sidebar .script-toggle.bg-primary-container {
    background-color: var(--reader-accent);
    color: var(--reader-surface);
    border-color: var(--reader-accent);
}

body[data-reader-theme] .header-with-sidebar .script-toggle.bg-surface-container-highest {
    background-color: var(--reader-surface);
    color: var(--reader-text-muted);
}

body[data-reader-theme] .header-with-sidebar .script-toggle.bg-surface-container-highest:hover {
    background-color: var(--reader-bg);
    color: var(--reader-text);
}

/* Theme the poem-layout toggle buttons in the top bar */
body[data-reader-theme] .header-with-sidebar .layout-toggle {
    border: 1px solid var(--reader-border);
}

body[data-reader-theme] .header-with-sidebar .layout-toggle.bg-primary-container {
    background-color: var(--reader-accent);
    color: var(--reader-surface);
    border-color: var(--reader-accent);
}

body[data-reader-theme] .header-with-sidebar .layout-toggle.bg-surface-container-highest {
    background-color: var(--reader-surface);
    color: var(--reader-text-muted);
}

body[data-reader-theme] .header-with-sidebar .layout-toggle.bg-surface-container-highest:hover {
    background-color: var(--reader-bg);
    color: var(--reader-text);
}

.culture-reader[data-poem-layout="horizontal"] #reader-poem-canvas {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.culture-reader[data-poem-layout="horizontal"] .culture-poem-line {
    padding: 1rem 0.75rem;
}

.culture-reader[data-poem-layout="horizontal"] .poem-line-content {
    display: flex;
    flex-wrap: wrap;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.6;
    letter-spacing: 0.05em;
}

.culture-reader[data-poem-layout="horizontal"] .poem-line-pinyin {
    display: block;
}

.culture-reader[data-poem-layout="vertical"] #reader-poem-canvas {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    align-items: flex-start;
    gap: 1.5rem;
    min-height: 420px;
    padding: 1rem 0;
}

.culture-reader[data-poem-layout="vertical"] .culture-poem-line {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 1rem 0.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.culture-reader[data-poem-layout="vertical"] .poem-line-content {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.7;
    letter-spacing: 0.12em;
}

.culture-reader[data-poem-layout="vertical"] .poem-line-pinyin {
    display: none;
}

.culture-reader[data-poem-layout="vertical"] .poem-line-listen {
    margin-top: 0.75rem;
    writing-mode: horizontal-tb;
}

/* Keep the poem pane sticky in both layouts */
.culture-reader[data-poem-layout="vertical"] #reader-poem-pane {
    position: sticky;
    top: 104px;
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-bottom: 0;
}

/* Display modes: zh (Chinese), py (Chinese + Pinyin), en (Chinese + Pinyin + English) */

/* Default / zh: hide pinyin and English */
.culture-reader .pinyin-layer,
.culture-reader .en-fallback {
    display: none !important;
}

/* py: show pinyin, hide English */
.culture-reader[data-display-mode="py"] .pinyin-layer {
    display: block !important;
}

/* en: show pinyin and English */
.culture-reader[data-display-mode="en"] .pinyin-layer,
.culture-reader[data-display-mode="en"] .en-fallback {
    display: block !important;
}

.culture-reader[data-display-mode="en"] .en-fallback {
    color: var(--reader-text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
    opacity: 0.85;
}

/* Inline HSK gloss word */
.hsk-gloss-word {
    border-bottom: 1px dashed #319795;
    cursor: help;
    transition: background-color 0.2s ease;
}

.hsk-gloss-word:hover,
.hsk-gloss-word:focus {
    background-color: rgba(49, 151, 149, 0.12);
}

/* Gloss tooltip */
.culture-gloss-tooltip {
    position: absolute;
    z-index: 100;
    background: #1a202c;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    max-width: 260px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.culture-gloss-tooltip .gloss-pinyin {
    color: #a5b4fc;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.culture-gloss-tooltip .gloss-zh {
    color: #ffffff;
}

.culture-gloss-tooltip .gloss-en {
    color: #a0aec0;
    font-size: 0.75rem;
    margin-top: 4px;
}

.culture-reader[data-display-mode="zh"] .culture-gloss-tooltip .gloss-en {
    display: none;
}

/* Culture reader ink-wash background & paper texture ---------------------- */

/* Tint the global seigaiha pattern with the active tradition accent */
body[data-reader-theme] .seigaiha-pattern {
    background-image:
        radial-gradient(circle at 100% 150%, transparent 24%, var(--reader-accent) 25%, var(--reader-accent) 28%, transparent 29%, transparent 36%, var(--reader-accent) 36%, var(--reader-accent) 40%, transparent 41%, transparent),
        radial-gradient(circle at 0 150%, transparent 24%, var(--reader-accent) 25%, var(--reader-accent) 28%, transparent 29%, transparent 36%, var(--reader-accent) 36%, var(--reader-accent) 40%, transparent 41%, transparent),
        radial-gradient(circle at 50% 100%, transparent 24%, var(--reader-accent) 25%, var(--reader-accent) 28%, transparent 29%, transparent 36%, var(--reader-accent) 36%, var(--reader-accent) 40%, transparent 41%, transparent),
        radial-gradient(circle at 100% 50%, transparent 24%, var(--reader-accent) 25%, var(--reader-accent) 28%, transparent 29%, transparent 36%, var(--reader-accent) 36%, var(--reader-accent) 40%, transparent 41%, transparent),
        radial-gradient(circle at 0 50%, transparent 24%, var(--reader-accent) 25%, var(--reader-accent) 28%, transparent 29%, transparent 36%, var(--reader-accent) 36%, var(--reader-accent) 40%, transparent 41%, transparent);
    opacity: 0.025;
}

/* Soft ink-wash gradient + rice-paper texture behind the reader content */
#reader-background {
    background:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E") repeat,
        radial-gradient(ellipse at 20% 20%, var(--reader-ink-wash) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 60%, var(--reader-ink-wash) 0%, transparent 45%),
        radial-gradient(ellipse at 40% 90%, var(--reader-ink-wash) 0%, transparent 40%);
    background-size: 200px 200px, cover, cover, cover;
}

#reader-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, var(--reader-bg) 0%, var(--reader-bg) 50%, color-mix(in srgb, var(--reader-bg) 90%, transparent) 100%);
    opacity: 0.92;
}
