:root {
    --mishna: #1a5276;
    --question: #c0392b;
    --answer: #1e8449;
    --challenge: #8b0000;
    --drasha: #b9770e;
    --alternative: #2471a3;
    --source: #6c3483;
    --rule: #117a65;
    --gemara: #2c3e50;
    --aggada: #b9770e;
    --story: #b9770e;
    --opinion: #2471a3;
    --halacha: #117a65;
    --summary: #566573;
    --flow-line: #bdc3c7;
    --memorial-color: var(--mishna);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 110%; }

body {
    font-family: 'David', 'Noto Sans Hebrew', 'Segoe UI', Arial, sans-serif;
    background: #f7f9fc;
    color: #2c3e50;
    line-height: 2;
    padding: 12px 16px;
}

h1 {
    text-align: center;
    font-size: 1.7em;
    color: var(--mishna);
    margin-bottom: 4px;
    letter-spacing: 1px;
}
.subtitle {
    text-align: center;
    color: #7f8c8d;
    font-size: 1em;
    margin-bottom: 35px;
}

/* ── Legend ── */
.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88em;
}
.legend-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Generic block ── */
.block {
    position: relative;
    border-right: 5px solid;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 14px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    transition: transform .15s, box-shadow .15s;
}
.block:hover { transform: translateX(-3px); box-shadow: 0 0 0 3px rgba(44,62,80,.25); }

.block-tag {
    display: inline-block;
    padding: 2px 14px;
    border-radius: 20px;
    color: #fff;
    font-size: .78em;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: .5px;
}

/* ── Block header: tag + translation mode switcher ── */
.block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.block-header .block-tag {
    margin-bottom: 0;
}
.trans-switcher {
    display: inline-flex;
    gap: 4px;
    margin-right: auto;
}
.trans-mode-btn {
    font-family: inherit;
    font-size: .72em;
    padding: 2px 10px;
    border: 1.5px solid #bbb;
    border-radius: 12px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all .15s;
    line-height: 1.4;
}
.trans-mode-btn:hover {
    background: #f0f4f8;
    border-color: #7ba3c9;
}
.trans-mode-btn.active {
    background: #2c5f8a;
    color: #fff;
    border-color: #2c5f8a;
}

.block-text {
    font-size: 1.15em;
    line-height: 2.1;
}
.block-text .source-quote {
    background: #fef9e7;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}
.block-text .source-quote .aramit-word,
.block-explanation .source-quote .aramit-word {
    border-bottom: 1px dotted #c49b2a;
    cursor: help;
}

.aramit-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: #1f2933;
    color: #f8fafc;
    font-size: .86em;
    line-height: 1.4;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .25);
    opacity: 0;
    transform: translate(-9999px, -9999px);
    transition: opacity .12s ease-out;
    pointer-events: none;
    z-index: 9999;
    white-space: nowrap;
}

.aramit-tooltip.is-visible {
    opacity: 1;
}

.block-translation {
    display: block;
    margin-top: 6px;
    padding: 4px 10px;
    background: #eaf2f8;
    border-radius: 4px;
    font-size: .92em;
    color: #2c3e50;
    border-right: 3px solid #85c1e9;
}

.block-explanation {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    color: #555;
    font-size: .95em;
}

/* ── Specific colours ── */
.b-mishna        { border-color: var(--mishna); }
.b-mishna .block-tag { background: var(--mishna); }

.b-question      { border-color: var(--question); }
.b-question .block-tag { background: var(--question); }

.b-answer        { border-color: var(--answer); }
.b-answer .block-tag { background: var(--answer); }

.b-challenge     { border-color: var(--challenge); }
.b-challenge .block-tag { background: var(--challenge); }

.b-drasha        { border-color: var(--drasha); }
.b-drasha .block-tag { background: var(--drasha); }

.b-alternative   { border-color: var(--alternative); }
.b-alternative .block-tag { background: var(--alternative); }

.b-source        { border-color: var(--source); }
.b-source .block-tag { background: var(--source); }

.b-rule          { border-color: var(--rule); }
.b-rule .block-tag { background: var(--rule); }

.b-gemara        { border-color: var(--gemara); }
.b-gemara .block-tag { background: var(--gemara); }

.b-aggada        { border-color: var(--aggada); }
.b-aggada .block-tag { background: var(--aggada); }

.b-story         { border-color: var(--story); }
.b-story .block-tag { background: var(--story); }

.b-opinion       { border-color: var(--opinion); }
.b-opinion .block-tag { background: var(--opinion); }

.b-halacha       { border-color: var(--halacha); }
.b-halacha .block-tag { background: var(--halacha); }

.b-summary       { border-color: var(--summary); }
.b-summary .block-tag { background: var(--summary); }

/* ── Flow arrows ── */
.flow-arrow {
    text-align: center;
    font-size: 1.6em;
    color: var(--flow-line);
    margin: -8px 0;
    user-select: none;
}

/* ── Indentation for sub-levels ── */
.indent-1 { margin-right: 35px; }
.indent-2 { margin-right: 70px; }

/* ── Section divider ── */
.section-title {
    font-size: 1.25em;
    font-weight: 700;
    color: #34495e;
    margin: 24px 0 10px;
    padding-bottom: 4px;
    border-bottom: 3px double #bdc3c7;
}

/* ── Summary table ── */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0 40px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.summary-table th {
    background: #2c3e50;
    color: #fff;
    padding: 12px 16px;
    font-weight: 600;
}
.summary-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #ecf0f1;
}
.summary-table tr:last-child td { border-bottom: none; }
.summary-table tr:hover td { background: #f0f4f8; }

/* ── Flow diagram ── */
.flow-diagram {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    margin: 30px 0;
}
.flow-node {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    margin: 4px;
    font-size: .9em;
}
.flow-connector {
    display: block;
    text-align: center;
    font-size: 1.3em;
    color: #95a5a6;
    margin: 2px 0;
}

/* ── Mermaid diagrams ── */
.mermaid-wrap {
    background: #fff;
    border-radius: 12px;
    padding: 30px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    margin: 30px 0;
    text-align: center;
    overflow-x: auto;
}
.mermaid-wrap .mermaid { direction: ltr; }
.mermaid-wrap .mermaid svg { height: auto; }

.dir-arrow {
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
    margin: 0 .18em;
}

/* ── Navigation ── */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
}
.nav-links a {
    display: inline-block;
    padding: 8px 24px;
    background: var(--mishna);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: .95em;
    transition: background .2s;
    direction: rtl;
    unicode-bidi: isolate;
}
.nav-links a:hover { background: #154360; }
.nav-arrow {
    font-weight: bold;
    font-size: 1.1em;
}

/* ── "סיימתי" read-page button ── */
.read-page-btn {
    display: inline-block;
    padding: 10px 32px;
    font-size: 1.1em;
    font-weight: 700;
    border: 2px solid #2c6faa;
    border-radius: 24px;
    background: #fff;
    color: #2c6faa;
    cursor: pointer;
    transition: all .25s;
    letter-spacing: 1px;
}
.read-page-btn:hover {
    background: #e8f0f8;
}
.read-page-btn.read {
    background: #2c6faa;
    color: #fff;
    box-shadow: inset 0 2px 6px rgba(0,0,0,.15);
}
.read-page-btn.read:hover {
    background: #1a5a94;
}

/* ── Rashi left-column ── */
.block:has(.rashi-wrapper) {
    padding-left: 260px;
}
.rashi-wrapper {
    position: absolute;
    top: 20px;
    left: 26px;
    width: 220px;
    bottom: 20px;
    overflow-y: auto;
    border-right: 2px solid #d4a574;
    padding-right: 12px;
}
.rashi-label {
    font-size: .8em;
    font-weight: 700;
    color: #8b4513;
    margin-bottom: 6px;
}
.rashi-label::before { content: '📖 '; }
.rashi-content {
    font-size: .82em;
    line-height: 1.8;
    color: #5a3e1b;
    background: #fdf6ee;
    padding: 10px 12px;
    border: 1px solid #e0c9a6;
    border-radius: 8px;
}
.rashi-content strong { color: #8b4513; }

/* ── Steinsaltz commentary (hidden; content shown inline via toggle) ── */
.steinsaltz-wrapper {
    display: none;
}
.steinsaltz-label {
    font-size: .8em;
    font-weight: 700;
    color: #2c5f8a;
    margin-bottom: 6px;
}
.steinsaltz-label::before { content: '📘 '; }
.steinsaltz-content {
    font-size: .82em;
    line-height: 1.8;
    color: #2a3d52;
    background: #eef4fa;
    padding: 10px 12px;
    border: 1px solid #b8d0e8;
    border-radius: 8px;
}
.steinsaltz-content b { color: #1a3a5c; }
.steinsaltz-content small { color: #3a7abd; }

/* ── Settings overlay & panel ── */
.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
.settings-overlay.is-open { display: flex; }
.settings-panel {
    background: #fff;
    border-radius: 16px;
    padding: 24px 28px;
    min-width: 260px;
    max-width: 340px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,.25);
    direction: rtl;
    font-size: .95em;
}
.settings-title {
    font-size: 1.2em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: #1a2636;
}
.settings-group {
    margin-bottom: 14px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.settings-group:last-of-type { border-bottom: none; }
.settings-label {
    font-weight: 700;
    font-size: .92em;
    color: #34495e;
    margin-bottom: 6px;
}
.settings-option {
    display: block;
    padding: 6px 12px;
    margin: 3px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    color: #333;
}
.settings-option:hover { background: #f0f4f8; }
.settings-option.active {
    background: #e8f0fe;
    color: #1a5276;
    font-weight: 600;
}
.settings-option input[type="radio"] {
    accent-color: #1a5276;
    margin-left: 6px;
}
.settings-close {
    display: block;
    margin: 12px auto 0;
    padding: 8px 32px;
    border: none;
    border-radius: 10px;
    background: #1a2636;
    color: #fff;
    font-family: inherit;
    font-size: .95em;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.settings-close:hover { background: #2c3e50; }

/* ── Flat settings bar ── */
.settings-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px 18px;
    padding: 8px 12px;
    background: #f5f7fa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin: 10px 0;
    direction: rtl;
}
.sb-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sb-label {
    font-size: .82em;
    font-weight: 700;
    color: #34495e;
    margin-left: 2px;
}
.sb-btn {
    font-family: inherit;
    font-size: .78em;
    padding: 3px 10px;
    border: 1px solid #c0c8d0;
    border-radius: 12px;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all .15s;
}
.sb-btn:hover { background: #eef2f7; }
.sb-btn.sb-active {
    background: #2c5f8a;
    color: #fff;
    border-color: #2c5f8a;
}
@media (max-width: 700px) {
    .settings-bar { display: none; }
}
@media print {
    .settings-bar { display: none; }
}

/* ── Settings button (mobile only) ── */
.settings-btn {
    font-family: inherit;
    font-size: .82em;
    padding: 5px 16px;
    border: 1.5px solid #7ba3c9;
    border-radius: 16px;
    background: #fff;
    color: #2c5f8a;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    z-index: 1;
}
.settings-btn:hover {
    background: #2c5f8a;
    color: #fff;
}

/* ── Title row (h1 + print button) ── */
.page-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.page-banner {
    display: block;
    width: min(100%, 820px);
    margin: 0 auto 12px;
    height: auto;
}
.title-row {
    margin-bottom: 0;
}
.title-row h1 {
    margin-bottom: 0;
}
.memorial-line {
    text-align: center;
    color: var(--memorial-color);
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1.3;
}
.memorial-line-top {
    margin: -2px 0 10px;
    font-size: 1.02rem;
}
.memorial-line-bottom {
    margin: 30px 0 12px;
    font-size: 1.06rem;
}

/* ── Print button ── */
.print-btn {
    font-family: inherit;
    font-size: .82em;
    padding: 5px 16px;
    border: 1.5px solid #5a9e6f;
    border-radius: 16px;
    background: #fff;
    color: #2d6e3f;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    z-index: 1;
}
.print-btn:hover {
    background: #2d6e3f;
    color: #fff;
}
@media print {
    .print-btn { display: none; }
}
.steinsaltz-toggle-btn {
    font-family: inherit;
    font-size: .95em;
    padding: 6px 20px;
    border: 2px solid #7ba3c9;
    border-radius: 20px;
    background: #fff;
    color: #2c5f8a;
    cursor: pointer;
    transition: all .2s;
}
.steinsaltz-toggle-btn:hover {
    background: #eef4fa;
}
.steinsaltz-toggle-btn.active {
    background: #2c5f8a;
    color: #fff;
}

/* ── Steinsaltz inline mode (replaces source-quote) ── */
.source-quote.steinsaltz-inline {
    background: #f0f6fc;
    font-weight: normal;
    line-height: 2.2;
}
.source-quote.steinsaltz-inline b {
    font-weight: 700;
    background: #fef9e7;
    padding: 1px 4px;
    border-radius: 3px;
}

/* ── Book index page ── */
.book-index {
    max-width: 1100px;
    margin: 0 auto;
}
.book-index h1 {
    margin-bottom: 0;
}
.book-index-memorial {
    text-align: center;
    margin: -2px 0 16px;
    color: var(--memorial-color);
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.3;
}
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
    gap: 10px;
    margin: 30px 0;
}

.page-grid .daf-book {
    display: flex;
    gap: 0;
    overflow: hidden;
    min-width: 0;
    grid-column: span 2;
}

.page-grid .daf-book .daf-page {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    margin: 0;
    border-radius: 0;
}

/* Page a on the right (order 1 in RTL = rightmost), page b on the left */
.page-grid .daf-book .daf-page-a {
    order: 1;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    border-right-width: 2px;
    border-left-width: 1px;
}

.page-grid .daf-book .daf-page-b {
    order: 2;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    border-left-width: 2px;
    border-right-width: 1px;
}

.page-grid .daf-book .daf-page:hover {
    background: var(--mishna);
    color: #fff;
    border-color: var(--mishna);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    transform: none;
    z-index: 1;
}

.page-grid a {
    display: block;
    padding: 10px 8px;
    background: #fff;
    border: 2px solid #dce1e6;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.15em;
    transition: all .15s;
}
.page-grid a:hover {
    background: var(--mishna);
    color: #fff;
    border-color: var(--mishna);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
/* ── Disabled page links (no data file) ── */
.page-grid a.disabled {
    opacity: 0.35;
    color: #aaa;
    background: #f5f5f5;
    border-color: #e0e0e0;
    cursor: default;
    pointer-events: none;
}
/* ── Read page links ── */
.page-grid a.page-read {
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
}

.page-grid .daf-book a.page-read-partial {
    background: #fff3e0;
    border-color: #f0b46a;
    color: #ad6400;
}

.page-grid .daf-book a.page-read-complete {
    background: #e8f5e9;
    border-color: #81c784;
    color: #2e7d32;
}

/* ── Masechet reading progress bar ── */
.masechet-progress {
    max-width: 400px;
    margin: 8px auto 16px;
    text-align: center;
}
.masechet-progress .bar-track {
    height: 8px;
    background: #d6e2ee;
    border-radius: 4px;
    overflow: hidden;
}
.masechet-progress .bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .5s ease;
}
.masechet-progress .pct-label {
    font-size: .82em;
    font-weight: 600;
    margin-top: 4px;
    color: #5a7a96;
}
.masechet-progress.progress-complete .bar-fill { background: #27ae60; }
.masechet-progress.progress-high .bar-fill { background: #7dbb4a; }
.masechet-progress.progress-mid .bar-fill { background: #e8a838; }
.masechet-progress.progress-low .bar-fill { background: #e07a3a; }

/* ── Chapter (Perek) navigation on index page ── */
.perek-nav {
    margin: 24px 0 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.perek-nav a {
    display: inline-block;
    padding: 7px 16px;
    background: linear-gradient(135deg, #f7f1e5, #ede5d5);
    border: 1.5px solid #c8bfa8;
    border-radius: 20px;
    text-decoration: none;
    color: #4a3c2a;
    font-weight: 600;
    font-size: .92em;
    transition: all .2s;
    white-space: nowrap;
}
.perek-nav a:hover {
    background: var(--mishna);
    color: #fff;
    border-color: var(--mishna);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
}
.perek-group-header {
    grid-column: 1 / -1;
    padding: 10px 16px 6px;
    margin-top: 10px;
    border-bottom: 2px solid var(--mishna);
    font-size: 1.08em;
    font-weight: 700;
    color: var(--mishna);
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.perek-group-header .perek-num {
    background: var(--mishna);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .82em;
    flex-shrink: 0;
}

/* ── Chapter header inside daf page ── */
.perek-banner {
    background: linear-gradient(135deg, #1a5276 0%, #2471a3 100%);
    color: #fff;
    padding: 16px 24px;
    margin: 28px 0 18px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(26,82,118,.25);
}
.perek-banner .perek-banner-num {
    font-size: .88em;
    opacity: .85;
    margin-bottom: 2px;
}
.perek-banner .perek-banner-title {
    font-size: 1.35em;
    font-weight: 700;
    letter-spacing: 1px;
}


@media (max-width: 700px) {
    body { padding: 12px; }
    .indent-1, .indent-2 { margin-right: 16px; }
    .block { padding: 14px 16px; }
    .block:has(.rashi-wrapper) { padding-left: 16px; }
    .rashi-wrapper {
        position: static;
        width: auto;
        border-right: none;
        border-top: 2px solid #d4a574;
        padding-right: 0;
        padding-top: 12px;
        margin-top: 10px;
        overflow-y: visible;
    }
    .page-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
    .page-layout { flex-direction: column; }
    .source-panel { display: none !important; }
    .main-col { max-width: 100%; }
    body { padding-top: 0; }
    .page-controls {
        gap: 10px;
        margin-bottom: 10px;
    }
    .btn-label { display: none; }
    .print-btn, .settings-btn {
        padding: 9px 14px;
        font-size: .98em;
        border-radius: 18px;
    }
    .memorial-line-top,
    .memorial-line-bottom,
    .book-index-memorial {
        font-size: .94rem;
        padding-inline: 10px;
    }
}

/* ── Mobile sticky header ── */
.mobile-header {
    display: none;
}
@media (max-width: 700px) {
    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9000;
        background: #1a2636;
        color: #f0f0f0;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
        min-height: 58px;
        gap: 6px;
        box-shadow: 0 2px 8px rgba(0,0,0,.25);
        transform: translateY(-100%);
        transition: transform .25s ease, opacity .25s ease;
        opacity: 0;
        direction: rtl;
    }
    .mobile-header.is-visible {
        transform: translateY(0);
        opacity: 1;
    }
    .mobile-header-title {
        font-weight: 700;
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        text-align: center;
        min-width: 0;
    }
    .mobile-header a {
        color: #f0f0f0;
        text-decoration: none;
        font-size: 1rem;
        font-weight: 600;
        min-width: 40px;
        min-height: 40px;
        padding: 8px 10px;
        border-radius: 10px;
        background: rgba(255,255,255,.12);
        white-space: nowrap;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-header a:active { background: rgba(255,255,255,.25); }
    .mobile-header-settings {
        background: rgba(255,255,255,.12);
        color: #f0f0f0;
        border: none;
        font-size: 1.28em;
        min-width: 42px;
        min-height: 42px;
        padding: 8px 10px;
        border-radius: 10px;
        cursor: pointer;
        flex-shrink: 0;
    }
    .mobile-header-settings:active { background: rgba(255,255,255,.25); }
}

/* ── Source text side panel ── */
.page-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    max-width: 1800px;
    margin: 0 auto;
}
.main-col {
    flex: 1;
    min-width: 0;
}
.source-panel {
    width: 480px;
    flex-shrink: 0;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.source-panel-header {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 1em;
    color: #34495e;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    flex-shrink: 0;
}
.source-panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    direction: ltr;
}
.source-panel-body {
    direction: rtl;
    font-size: 1.05em;
    line-height: 2.2;
}
.source-line {
    display: inline;
    padding: 1px 4px;
    border-radius: 3px;
    transition: background .15s;
    cursor: default;
}
.source-line-faded {
    opacity: .4;
}
.source-section-title {
    display: block;
    margin-top: 14px;
    margin-bottom: 4px;
    font-weight: 700;
    font-size: .88em;
    color: #7f8c8d;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 2px;
}
.source-section-title:first-child { margin-top: 0; }

.faded-hole-block {
    opacity: .58;
    border-style: dashed;
    border-color: #c7b79b;
    background: linear-gradient(180deg, rgba(253, 248, 236, .95), rgba(247, 240, 224, .92));
}

.faded-hole-block .block-text {
    margin-top: 0;
}

.faded-hole-block .source-quote {
    display: inline-block;
    background: #f6eedf;
    font-weight: 500;
}
