/* Import elegant serif fonts */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Noto+Serif:ital,wght@0,400;0,700;1,400&display=swap');

/* Base styles */
* {
    box-sizing: border-box;
}

:root {
    --font-serif: 'Crimson Pro', 'Noto Serif', 'Georgia', serif;
    --font-greek: 'Noto Serif', 'Times New Roman', serif;
    --color-parchment: #faf8f3;
    --color-ink: #2c2416;
    --color-gold: #c9a227;
    --color-burgundy: #722f37;
    --color-navy: #1a2639;
    --color-cream: #f5f1e8;
}

/* Dark mode: navy/gold theme inspired by the Odyssey spotlight */
[data-theme="dark"] {
    --color-parchment: #0d1520;
    --color-ink: #e8e2d6;
    --color-cream: #e8e2d6;
    --color-burgundy: #a84450;
}

body {
    font-family: var(--font-serif);
    line-height: 1.7;
    margin: 0;
    padding: 0;
    background-color: var(--color-parchment);
    color: var(--color-ink);
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Navigation */
.navbar {
    background-color: var(--color-navy);
    padding: 0 30px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--color-gold);
}

.navbar .logo {
    color: var(--color-cream);
    font-size: 1.6em;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.5px;
    font-family: var(--font-serif);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Word search bar */
.nav-search {
    position: relative;
    flex: 0 1 280px;
    margin: 0 20px;
}

.nav-search input {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-cream);
    font-size: 0.95em;
    font-family: var(--font-greek);
    outline: none;
    transition: all 0.2s;
}

.nav-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.nav-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-gold);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 5px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-results.hidden {
    display: none;
}

.search-section {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.search-section:last-child {
    border-bottom: none;
}

.search-section-title {
    padding: 5px 15px;
    font-size: 0.75em;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-result-item {
    padding: 8px 15px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-result-item:hover {
    background: #f5f5f5;
}

.search-fuzzy-notice {
    padding: 8px 15px;
    font-size: 0.85em;
    color: #666;
    background: #f8f4e8;
    border-bottom: 1px solid #e8e0c8;
    font-style: italic;
}

.search-fuzzy-notice strong {
    font-family: var(--font-greek);
    font-style: normal;
    color: var(--color-burgundy);
}

.search-form {
    font-family: var(--font-greek);
    font-weight: 600;
    color: var(--color-ink);
    margin-right: 8px;
}

.search-lemma {
    font-family: var(--font-greek);
    color: var(--color-burgundy);
    margin-right: 8px;
}

.search-parse {
    font-size: 0.85em;
    color: #666;
}

.search-def {
    display: block;
    font-size: 0.85em;
    color: #555;
    margin-top: 3px;
    line-height: 1.4;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #666;
}

#nav-auth-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links a, .nav-link {
    color: var(--color-cream);
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 1.05em;
}

.nav-links a:hover, .nav-link:hover {
    background: rgba(201, 162, 39, 0.2);
    color: var(--color-gold);
}

.nav-badge {
    display: inline-block;
    background: var(--color-burgundy);
    color: white;
    font-size: 0.75em;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 5px;
    font-weight: bold;
}

.nav-user-menu {
    position: relative;
    margin-left: 10px;
}

.nav-user-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(201, 162, 39, 0.15);
    border: 1px solid rgba(201, 162, 39, 0.3);
    color: var(--color-cream);
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-family: var(--font-serif);
    transition: all 0.2s;
}

.nav-user-btn:hover {
    background: rgba(201, 162, 39, 0.25);
    border-color: var(--color-gold);
}

.nav-user-email {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-arrow {
    font-size: 0.7em;
    transition: transform 0.2s;
}

.nav-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background: var(--color-cream);
    border-radius: 6px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.2);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.nav-dropdown.show {
    display: block;
}

.nav-dropdown a {
    display: block;
    padding: 12px 18px;
    color: var(--color-ink);
    text-decoration: none;
    transition: all 0.2s;
    font-family: var(--font-serif);
}

.nav-dropdown a:hover {
    background: rgba(201, 162, 39, 0.15);
    color: var(--color-burgundy);
}

.nav-dropdown-divider {
    height: 1px;
    background: rgba(201, 162, 39, 0.3);
    margin: 5px 0;
}

/* Features grid */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.feature {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.feature h3 {
    margin-top: 0;
    color: #2c3e50;
}

/* Controls */
.controls {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Display option labels with tooltip indicator */
.controls .option-label {
    border-bottom: 1px dotted #999;
    cursor: help;
}

.controls .option-label:hover {
    border-bottom-color: var(--color-burgundy);
}

/* Disabled display options */
.controls .option-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.controls .option-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.controls .option-disabled .option-label {
    border-bottom-style: dashed;
    border-bottom-color: #ccc;
}

.controls .option-premium .upgrade-link {
    color: var(--color-burgundy);
    font-size: 0.85em;
    margin-left: 8px;
    text-decoration: none;
    font-weight: 600;
}

.controls .option-premium .upgrade-link:hover {
    text-decoration: underline;
}

/* Text display */
.text-display {
    background: white;
    padding: 30px;
    border-radius: 8px;
    font-size: 1.4em;
    line-height: 2.5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Words */
.word {
    display: inline-block;
    vertical-align: top;
    text-align: center;
    padding: 4px 6px;
    margin: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.word:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.punct {
    margin: 0 2px;
}

/* Part of speech colors - left border indicator */
.word.noun      { border-left: 4px solid #e64a19; } /* Deep coral */
.word.verb      { border-left: 4px solid #f9a825; } /* Golden amber */
.word.participle { border-left: 4px solid #ff7043; } /* Deep orange */
.word.adj       { border-left: 4px solid #7cb342; } /* Fresh green */
.word.adv       { border-left: 4px solid #ab47bc; } /* Purple */
.word.pron      { border-left: 4px solid #ff8a65; } /* Tangerine */
.word.prep      { border-left: 4px solid #26c6da; } /* Cyan */
.word.conj      { border-left: 4px solid #c0ca33; } /* Lime */
.word.particle  { border-left: 4px solid #ffca28; } /* Yellow */
.word.article   { border-left: 4px solid #90a4ae; } /* Blue grey */

/* No colors mode - hide POS borders */
body.no-colors .word {
    border-left: none !important;
}

body.no-colors .word:hover {
    background-color: #f0f0f0;
}

/* Gloss (interlinear) */
.word .gloss {
    font-size: 0.5em;
    color: #666;
    display: none;
    max-width: 100px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.show-interlinear .word .gloss {
    display: block;
}

/* Transliteration display */
.word .translit {
    font-size: 0.5em;
    color: #0277bd;
    display: none;
    max-width: 100px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

body.show-translit .word .translit {
    display: block;
}

/* Contextual gloss display (interlinear) */
.word .context-gloss {
    font-size: 0.55em;
    color: #2e7d32;
    display: none;
    max-width: 120px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

body.show-context-gloss .word .context-gloss {
    display: block;
}

/* When both translit and context gloss are shown */
body.show-translit.show-context-gloss .word .translit {
    margin-bottom: 1px;
}

body.show-translit.show-context-gloss .word .context-gloss {
    font-size: 0.5em;
}

/* Grammar badges */
.word .grammar {
    display: none;
    font-size: 0.55em;
    color: #888;
    font-weight: normal;
    margin-left: 1px;
    vertical-align: super;
}

body.show-grammar .word .grammar {
    display: inline;
}

/* Popup */
#word-popup {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    min-width: 280px;
    max-width: 350px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10000;
    font-size: 0.9em;
}

#word-popup.hidden {
    display: none;
}

#word-popup .popup-header {
    font-size: 1.2em;
    margin-bottom: 10px;
    padding-bottom: 10px;
    padding-right: 30px;
    border-bottom: 1px solid #eee;
}

#word-popup .popup-header .form {
    font-weight: bold;
    font-size: 1.3em;
    cursor: help;
    border-bottom: 1px dotted #999;
}

#word-popup .popup-header .lemma {
    color: #666;
    margin-left: 10px;
    cursor: help;
    border-bottom: 1px dotted #999;
}

#word-popup .popup-header .form:hover,
#word-popup .popup-header .lemma:hover {
    color: var(--color-burgundy, #722f37);
}

#word-popup .morph {
    margin: 10px 0;
}

#word-popup .pos {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
}

#word-popup .defs {
    margin: 10px 0;
    padding-left: 20px;
}

#word-popup .defs li {
    margin: 5px 0;
}

/* Definition source indicator */
#word-popup .def-source {
    font-size: 0.75em;
    color: #666;
    font-style: italic;
    margin-bottom: 4px;
}

#word-popup .def-source a {
    color: inherit;
    text-decoration: underline;
}

#word-popup .def-source a:hover {
    color: #3498db;
}

#word-popup .def-source.lsj-source {
    color: #b26a00;
}

/* Popup transliteration */
#word-popup .translit {
    color: #888;
    font-size: 0.85em;
    margin-left: 8px;
    font-style: italic;
}

/* Popup contextual gloss */
#word-popup .context-gloss-line {
    background: #e8f5e9;
    padding: 6px 10px;
    border-radius: 4px;
    margin: 8px 0;
    font-size: 0.9em;
    color: #2e7d32;
}

/* Popup morphology tags */
#word-popup .morph-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
}

#word-popup .morph-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
    background: #f0f0f0;
    color: #555;
    cursor: default;
    position: relative;
}

/* Tooltip is handled by JavaScript in pages that need it */

/* POS tag colors - background only, matches word highlighting */
#word-popup .morph-tag.pos-tag { color: #333; }
#word-popup .morph-tag.pos-tag.noun { background-color: #ffccbc; }
#word-popup .morph-tag.pos-tag.verb { background-color: #ffe082; }
#word-popup .morph-tag.pos-tag.participle { background-color: #ffab91; }
#word-popup .morph-tag.pos-tag.adj { background-color: #c5e1a5; }
#word-popup .morph-tag.pos-tag.adv { background-color: #e1bee7; }
#word-popup .morph-tag.pos-tag.pron { background-color: #ffcc80; }
#word-popup .morph-tag.pos-tag.prep { background-color: #80deea; }
#word-popup .morph-tag.pos-tag.conj { background-color: #dce775; }
#word-popup .morph-tag.pos-tag.particle { background-color: #fff59d; }
#word-popup .morph-tag.pos-tag.article { background-color: #cfd8dc; }

/* Case tag colors - matching anki card styles */
#word-popup .morph-tag.case-nom { background: #e0f2f1; color: #00695c; font-weight: 600; }
#word-popup .morph-tag.case-gen { background: #ffebee; color: #c62828; font-weight: 600; }
#word-popup .morph-tag.case-dat { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
#word-popup .morph-tag.case-acc { background: #fff3e0; color: #e65100; font-weight: 600; }
#word-popup .morph-tag.case-voc { background: #f3e5f5; color: #7b1fa2; font-weight: 600; }

/* Tense tag colors - matching anki card styles */
#word-popup .morph-tag.tense-pres { background: #f1f8e9; color: #558b2f; font-weight: 600; }
#word-popup .morph-tag.tense-impf { background: #ede7f6; color: #5e35b1; font-weight: 600; }
#word-popup .morph-tag.tense-fut { background: #e0f7fa; color: #00838f; font-weight: 600; }
#word-popup .morph-tag.tense-aor { background: #ffebee; color: #c62828; font-weight: 600; }
#word-popup .morph-tag.tense-perf { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
#word-popup .morph-tag.tense-plup { background: #efebe9; color: #4e342e; font-weight: 600; }

/* Gender tag colors - matching anki card styles */
#word-popup .morph-tag.gender-masc { background: #e3f2fd; color: #1565c0; font-weight: 600; }
#word-popup .morph-tag.gender-fem { background: #fce4ec; color: #c2185b; font-weight: 600; }
#word-popup .morph-tag.gender-neut { background: #eceff1; color: #546e7a; font-weight: 600; }

/* Voice tag colors */
#word-popup .morph-tag.voice-act { background: #fff8e1; color: #f57f17; }
#word-popup .morph-tag.voice-mid { background: #e8eaf6; color: #3f51b5; }
#word-popup .morph-tag.voice-pass { background: #fce4ec; color: #ad1457; }
#word-popup .morph-tag.voice-mp { background: #f3e5f5; color: #7b1fa2; }

/* Mood tag colors */
#word-popup .morph-tag.mood-ind { background: #e3f2fd; color: #1976d2; }
#word-popup .morph-tag.mood-subj { background: #f3e5f5; color: #8e24aa; }
#word-popup .morph-tag.mood-opt { background: #e8f5e9; color: #43a047; }
#word-popup .morph-tag.mood-imp { background: #ffebee; color: #d32f2f; }
#word-popup .morph-tag.mood-inf { background: #fff3e0; color: #ef6c00; }
#word-popup .morph-tag.mood-part { background: #e0f2f1; color: #00897b; }

/* Number tag colors */
#word-popup .morph-tag.num-sg { background: #e1f5fe; color: #0277bd; }
#word-popup .morph-tag.num-dual { background: #fff8e1; color: #ff8f00; }
#word-popup .morph-tag.num-pl { background: #f1f8e9; color: #689f38; }

/* Person tag colors */
#word-popup .morph-tag.person-1st { background: #e8eaf6; color: #5c6bc0; }
#word-popup .morph-tag.person-2nd { background: #fce4ec; color: #ec407a; }
#word-popup .morph-tag.person-3rd { background: #e0f7fa; color: #00acc1; }

/* Degree tag colors */
#word-popup .morph-tag.degree-comp { background: #fff3e0; color: #ef6c00; }
#word-popup .morph-tag.degree-super { background: #fce4ec; color: #c2185b; }

/* Make morph tags show help cursor for hover */
#word-popup .morph-tag { cursor: default; }

/* More analyses toggle */
#word-popup .more-analyses-toggle {
    color: #3498db;
    font-size: 0.85em;
    margin-top: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 0;
    border-top: 1px solid #eee;
}

#word-popup .more-analyses-toggle:hover {
    color: #2980b9;
}

#word-popup .more-analyses-toggle .toggle-icon {
    font-size: 0.7em;
    transition: transform 0.2s;
}

#word-popup .alt-analyses-container {
    margin-top: 8px;
    border-left: 2px solid #eee;
    padding-left: 10px;
}

#word-popup .alt-analysis {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

#word-popup .alt-analysis:last-child {
    border-bottom: none;
}

#word-popup .alt-analysis-header .lemma {
    color: #666;
    font-size: 0.95em;
}

#word-popup .alt-analysis .morph-tags {
    margin: 5px 0;
}

#word-popup .alt-analysis .alt-def {
    margin: 5px 0 0 0;
    font-size: 0.9em;
    color: #555;
}

/* Compact alternative analyses */
#word-popup .alt-analysis-compact {
    padding: 4px 0;
    font-size: 0.85em;
    color: #555;
    border-bottom: 1px solid #f5f5f5;
    line-height: 1.5;
}

#word-popup .alt-analysis-compact:last-child {
    border-bottom: none;
}

#word-popup .alt-analysis-compact .alt-lemma {
    color: var(--color-burgundy);
    font-weight: 500;
    margin-right: 6px;
}

#word-popup .alt-analysis-compact .alt-morph-tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
}

#word-popup .alt-analysis-compact .alt-morph-tags .morph-tag {
    font-size: 0.75em;
    padding: 1px 5px;
}

#word-popup .alt-analysis-compact .alt-def-text {
    color: #444;
    display: block;
    margin-top: 2px;
    padding-left: 12px;
    font-size: 0.95em;
}

#word-popup .alt-analysis-compact .morph-tag {
    font-size: 0.85em;
    padding: 1px 5px;
}

/* Popup definitions section */
#word-popup .popup-definitions {
    margin: 10px 0;
}

#word-popup .def-section {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

#word-popup .def-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

#word-popup .def-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: help;
}

#word-popup .def-label a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

#word-popup .def-label a:hover {
    text-decoration: underline;
    color: #2980b9;
}

#word-popup .def-label .info-icon {
    font-size: 0.9em;
    opacity: 0.6;
}

#word-popup .def-content {
    font-size: 0.95em;
    color: #333;
    line-height: 1.5;
}

#word-popup .def-content.contextual-gloss {
    font-style: italic;
    color: var(--color-burgundy);
    font-size: 1.05em;
    font-weight: 500;
}

#word-popup .def-content.def-unavailable {
    color: #999;
    font-style: italic;
    font-size: 0.9em;
}

#word-popup .def-contextual {
    background: #faf5eb;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-bottom: 1px solid rgba(201, 162, 39, 0.3);
}

#word-popup .def-contextual .def-label {
    color: var(--color-burgundy);
}

#word-popup .def-list {
    margin: 0;
    padding-left: 18px;
    font-size: 0.9em;
}

#word-popup .def-list li {
    margin-bottom: 3px;
}

#word-popup .def-list li:last-child {
    margin-bottom: 0;
}

/* Legend */
.legend {
    margin-top: 30px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.legend h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.legend .word {
    margin: 5px;
    font-size: 0.9em;
}

/* Word lookup */
.lookup-box {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.lookup-box input {
    flex: 1;
    padding: 10px 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 4px;
}

.lookup-box button {
    padding: 10px 20px;
    background-color: var(--color-gold);
    color: var(--color-navy);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
}

.lookup-box button:hover {
    background-color: #d4af37;
}
[data-theme="dark"] .lookup-box button {
    color: #0d1520;
}

.lookup-result {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-top: 10px;
}

.lookup-result .error {
    color: #e74c3c;
}

.word-info h3 {
    margin-top: 0;
    font-size: 1.5em;
}

.word-info .analysis {
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    margin: 10px 0;
}

.word-info .lemma {
    font-weight: bold;
    font-size: 1.1em;
}

.word-info .morph {
    color: #666;
    font-size: 0.9em;
}

.word-info .def {
    margin-top: 5px;
    font-style: italic;
}

.word-info .definitions ul {
    padding-left: 20px;
}

.word-info .definitions li {
    margin: 5px 0;
}

/* Breadcrumb navigation */
.breadcrumb {
    font-size: 0.85em;
    color: #666;
}

.breadcrumb a {
    color: #3498db;
    text-decoration: none;
}

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

/* Reading header bar */
.reading-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* Book pagination */
.book-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    color: #666;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: #f0f0f0;
    border-color: #ccc;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 4px;
    max-width: 300px;
    overflow-x: auto;
}

.page-link {
    padding: 6px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 0.85em;
    white-space: nowrap;
    transition: all 0.2s;
}

.page-link:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.page-link.active {
    background: var(--color-gold);
    border-color: var(--color-gold);
    color: var(--color-navy);
    font-weight: 600;
}
[data-theme="dark"] .page-link.active {
    color: #0d1520;
}

/* Work info card */
.work-info-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 15px 20px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.work-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.work-info-title-section {
    flex: 1;
}

.work-info-title {
    margin: 0;
    font-size: 1.3em;
    color: #2c3e50;
}

.work-info-author {
    margin: 4px 0 0 0;
    color: #666;
    font-style: italic;
    font-size: 0.95em;
}

.meta-collapse-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    color: #666;
    font-size: 0.75em;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.meta-collapse-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.collapse-icon {
    display: inline-block;
    transition: transform 0.2s;
}

.work-info-card.collapsed .collapse-icon {
    transform: rotate(180deg);
}

.work-info-card.collapsed .collapse-label {
    display: none;
}

.work-info-card.collapsed .meta-collapse-btn::before {
    content: 'Show details';
}

.work-info-card.collapsed .edition-meta-row {
    display: none;
}

.work-info-card.collapsed .work-info-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Edition metadata columns */
.edition-meta-row {
    display: flex;
    gap: 20px;
}

.edition-meta-col {
    flex: 1;
    min-width: 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.meta-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.meta-col-type {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    flex-shrink: 0;
}

.meta-col-type.edition {
    background: #e3f2fd;
    color: #1565c0;
}

.meta-col-type.translation {
    background: #e8f5e9;
    color: #2e7d32;
}

.meta-col-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-col-desc {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meta-col-urn {
    font-size: 0.65em;
    color: #999;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Author list */
.author-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.author-card {
    display: block;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.author-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.author-name {
    font-weight: 600;
}

/* Work list */
.work-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.work-card {
    display: block;
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.work-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.work-title {
    font-weight: 600;
    font-size: 1.1em;
    display: block;
}

.work-lang {
    color: #666;
    font-size: 0.9em;
}

.author-byline {
    color: #666;
    margin-top: -10px;
    margin-bottom: 30px;
}

/* Edition list */
.edition-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 30px;
}

.edition-card {
    display: block;
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.edition-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.edition-label {
    font-weight: 600;
    display: block;
}

.edition-lang {
    color: #3498db;
    font-size: 0.9em;
    margin-left: 5px;
}

.edition-desc {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Reading view */
.reading-view {
    max-width: 900px;
}

.reading-header {
    margin-bottom: 20px;
}

.reading-header h1 {
    margin-bottom: 5px;
}

.edition-info {
    color: #666;
}

.book-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.book-link {
    padding: 8px 15px;
    background: #f0f0f0;
    border-radius: 4px;
    text-decoration: none;
    color: #2c3e50;
    font-size: 0.9em;
}

.book-link:hover {
    background: #e0e0e0;
}

.book-link.active {
    background: var(--color-gold);
    color: var(--color-navy);
    font-weight: 600;
}

.text-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.segment-chunk {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.segment-chunk:last-child {
    border-bottom: none;
}

.segment {
    margin-bottom: 12px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

.segment:last-child {
    margin-bottom: 0;
}

.reference {
    display: inline-block;
    color: #999;
    font-size: 0.8em;
    margin-right: 10px;
    min-width: 50px;
}

.greek-text {
    font-size: 1.3em;
    line-height: 2.2;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: block;
    width: 100%;
}

.translation-text {
    font-size: 1.1em;
    line-height: 1.8;
    margin: 0;
    color: #333;
}

/* Colored inflection - hidden by default */
.word .ending {
    /* No special styling by default - endings look like normal text */
}

/* When show-inflection mode is active */
body.show-inflection .word .ending {
    font-weight: 600;
    border-radius: 2px;
    padding: 0 1px;
}

/* Case colors for endings */
body.show-inflection .word .ending.nom { color: #00695c; } /* Teal - nominative */
body.show-inflection .word .ending.gen { color: #c62828; } /* Red - genitive */
body.show-inflection .word .ending.dat { color: #2e7d32; } /* Green - dative */
body.show-inflection .word .ending.acc { color: #f57c00; } /* Orange - accusative */
body.show-inflection .word .ending.voc { color: #7b1fa2; } /* Purple - vocative */

/* Tense colors for endings */
body.show-inflection .word .ending.pres { color: #558b2f; } /* Light green - present */
body.show-inflection .word .ending.impf { color: #5e35b1; } /* Deep purple - imperfect */
body.show-inflection .word .ending.fut { color: #00838f; } /* Cyan - future */
body.show-inflection .word .ending.aor { color: #c62828; } /* Red - aorist */
body.show-inflection .word .ending.perf { color: #2e7d32; } /* Green - perfect */
body.show-inflection .word .ending.plup { color: #4e342e; } /* Brown - pluperfect */

/* Whole-word coloring when no distinct ending exists */
body.show-inflection .word.infl-nom:not(:has(.ending)) .stem { color: #00695c; font-weight: 600; }
body.show-inflection .word.infl-gen:not(:has(.ending)) .stem { color: #c62828; font-weight: 600; }
body.show-inflection .word.infl-dat:not(:has(.ending)) .stem { color: #2e7d32; font-weight: 600; }
body.show-inflection .word.infl-acc:not(:has(.ending)) .stem { color: #f57c00; font-weight: 600; }
body.show-inflection .word.infl-voc:not(:has(.ending)) .stem { color: #7b1fa2; font-weight: 600; }
body.show-inflection .word.infl-pres:not(:has(.ending)) .stem { color: #558b2f; font-weight: 600; }
body.show-inflection .word.infl-impf:not(:has(.ending)) .stem { color: #5e35b1; font-weight: 600; }
body.show-inflection .word.infl-fut:not(:has(.ending)) .stem { color: #00838f; font-weight: 600; }
body.show-inflection .word.infl-aor:not(:has(.ending)) .stem { color: #c62828; font-weight: 600; }
body.show-inflection .word.infl-perf:not(:has(.ending)) .stem { color: #2e7d32; font-weight: 600; }
body.show-inflection .word.infl-plup:not(:has(.ending)) .stem { color: #4e342e; font-weight: 600; }

/* Inflection color samples in key */
.endings-key { display: none; }
body.show-inflection .endings-key { display: block; }

.ending-sample {
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 2px;
    margin-right: 4px;
}
.ending-sample.nom { color: #00695c; }
.ending-sample.gen { color: #c62828; }
.ending-sample.dat { color: #2e7d32; }
.ending-sample.acc { color: #f57c00; }
.ending-sample.voc { color: #7b1fa2; }
.ending-sample.pres { color: #558b2f; }
.ending-sample.impf { color: #5e35b1; }
.ending-sample.fut { color: #00838f; }
.ending-sample.aor { color: #c62828; }
.ending-sample.perf { color: #2e7d32; }
.ending-sample.plup { color: #4e342e; }

/* Popup close button */
.popup-close {
    position: absolute;
    right: 10px;
    top: 5px;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

.popup-close:hover {
    color: #333;
}

.popup-content {
    position: relative;
}

/* Loading indicator */
.loading-indicator {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 40px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
}

.loading-indicator.htmx-request {
    display: flex;
}

.loading-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 60px;
    color: #666;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.load-more {
    padding: 30px;
    text-align: center;
}

/* Key panel */
.key-panel {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85em;
    line-height: 2;
}

.key-section {
    margin-bottom: 8px;
}

.key-section:last-child {
    margin-bottom: 0;
}

.key-section strong {
    color: #2c3e50;
}

.key-section .word {
    font-size: 0.9em;
    padding: 2px 6px;
    margin: 0 2px;
}

.key-sep {
    color: #ccc;
    margin: 0 8px;
}

/* Reading layout with sidebar */
.reading-layout {
    display: flex;
    height: calc(100vh - 56px);
    width: 100%;
    overflow: hidden;
}

.sidebar {
    position: relative;
    width: 280px;
    min-width: 280px;
    height: 100%;
    overflow-y: auto;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    transition: width 0.3s ease, min-width 0.3s ease;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 40px;
    min-width: 40px;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    right: 5px;
    top: 10px;
    width: 30px;
    height: 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: #f0f0f0;
}

.toggle-icon {
    font-size: 12px;
    color: #666;
}

.sidebar-content {
    padding: 15px;
    padding-top: 50px;
}

.sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.sidebar-header h2 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: #2c3e50;
}

.sidebar-header .edition-info {
    margin: 0;
    font-size: 0.85em;
    color: #666;
}

.sidebar-header .author-byline {
    margin: 0;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

.sidebar-section {
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
}

.sidebar-section summary {
    margin: 0;
    padding: 10px 12px;
    font-size: 0.9em;
    font-weight: 600;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-section summary::-webkit-details-marker {
    display: none;
}

.sidebar-section summary::after {
    content: '\25BC';
    font-size: 0.7em;
    color: #999;
    transition: transform 0.2s;
}

.sidebar-section[open] summary::after {
    transform: rotate(180deg);
}

.sidebar-section summary:hover {
    background: #f8f9fa;
}

.sidebar-section-content {
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
}

.sidebar-section h3 {
    margin: 0 0 10px 0;
    font-size: 0.9em;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-section .book-nav {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.sidebar-section .book-link {
    font-size: 0.85em;
    padding: 6px 12px;
}

.sidebar-section .controls {
    flex-direction: column;
    gap: 10px;
    padding: 0;
    margin: 0;
    font-size: 0.9em;
    background: transparent;
}

.sidebar-section .key-panel {
    margin: 0;
    padding: 0;
    font-size: 0.8em;
    line-height: 1.8;
    background: transparent;
}

.sidebar-section .book-nav {
    margin: 0;
    padding: 0;
    background: transparent;
}

.key-group {
    margin-bottom: 12px;
}

.key-group:last-child {
    margin-bottom: 0;
}

.key-group strong {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
    font-size: 0.9em;
}

.key-items {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.key-items .word {
    font-size: 0.85em;
    padding: 2px 6px 2px 8px;
    background-color: #f5f5f5;
    border-radius: 3px;
}

.key-codes {
    font-size: 0.85em;
    color: #555;
    line-height: 1.6;
}

.key-codes div {
    margin-bottom: 3px;
}

/* Hoverable key items with tooltips */
.key-codes span[title],
.key-items .word[title] {
    cursor: help;
    border-bottom: 1px dotted #999;
}

.key-codes span[title]:hover,
.key-items .word[title]:hover {
    background-color: rgba(0,0,0,0.05);
}

.reading-main {
    flex: 1;
    padding: 20px;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Adjust text content in reading layout */
.reading-main .text-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsive sidebar */
@media (max-width: 900px) {
    .sidebar {
        width: 240px;
        min-width: 240px;
    }

    .reading-main {
        padding: 15px;
    }
}

@media (max-width: 700px) {
    .reading-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 56px);
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .sidebar.collapsed {
        width: 100%;
        min-width: 100%;
        max-height: none;
    }

    .reading-main {
        flex: 1;
        min-height: 50vh;
    }

    .sidebar-content {
        padding-top: 15px;
    }

    .sidebar-toggle {
        right: 10px;
        top: 10px;
    }
}

/* Work cards on author page */
.work-card-full {
    display: block;
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.work-card-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.work-card-header {
    margin-bottom: 10px;
}

.work-title-english {
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
}

.work-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.available-editions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.edition-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
}

.edition-badge.greek {
    background: #e3f2fd;
    color: #1565c0;
}

.edition-badge.translation {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Parallel reading layout */
.parallel-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.parallel-main {
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

.parallel-panels {
    display: flex;
    gap: 20px;
    height: calc(100vh - 140px);
}

.parallel-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.panel-header {
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.panel-type.edition {
    background: #e3f2fd;
    color: #1565c0;
}

.panel-type.translation {
    background: #e8f5e9;
    color: #2e7d32;
}

.panel-label {
    font-weight: 600;
    color: #2c3e50;
}

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

.panel-content .segment {
    margin-bottom: 15px;
}

.panel-content .greek-text {
    font-size: 1.1em;
    line-height: 2;
}

/* Responsive parallel view */
@media (max-width: 1000px) {
    .parallel-panels {
        flex-direction: column;
        height: auto;
    }

    .parallel-panel {
        min-height: 300px;
    }

    .panel-content {
        max-height: 400px;
    }
}

/* Translation selection in sidebar */
.translation-select {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.translation-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85em;
}

.translation-option:hover {
    background: #e9ecef;
}

.translation-option.current {
    background: #e3f2fd;
    border: 1px solid #90caf9;
}

.translation-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.translation-type {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
}

.translation-type.edition {
    background: #e3f2fd;
    color: #1565c0;
}

.translation-type.translation {
    background: #e8f5e9;
    color: #2e7d32;
}

.translation-label {
    flex: 1;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Text panels - always use internal scrolling */
.text-panels {
    display: flex;
    gap: 20px;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.text-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 0;
    overflow: hidden;
}

/* Multi-panel mode */
body.multi-panel .reading-main {
    max-width: none;
}

.panel-header {
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.panel-type {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
}

.panel-type.edition {
    background: #e3f2fd;
    color: #1565c0;
}

.panel-type.translation {
    background: #e8f5e9;
    color: #2e7d32;
}

.panel-label {
    flex: 1;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
}

.panel-close {
    background: none;
    border: none;
    font-size: 1.3em;
    color: #999;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.panel-close:hover {
    color: #333;
}

.panel-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
}

.panel-content .greek-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.panel-content .segment {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Responsive multi-panel */
@media (max-width: 900px) {
    body.multi-panel .text-panels {
        flex-direction: column;
        height: auto;
    }

    body.multi-panel .text-panel {
        min-height: 300px;
    }

    body.multi-panel .panel-content {
        max-height: 400px;
    }
}

/* Add to deck button */
#word-popup .add-deck-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

#word-popup .add-deck-btn {
    width: 100%;
    padding: 8px 15px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
}

#word-popup .add-deck-btn:hover {
    background: #219a52;
}

#word-popup .add-deck-btn.added {
    background: #95a5a6;
    cursor: default;
}

#word-popup .add-deck-prompt {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    font-size: 0.85em;
    color: #666;
    text-align: center;
}

#word-popup .add-deck-prompt a {
    color: #3498db;
    text-decoration: none;
}

#word-popup .add-deck-prompt a:hover {
    text-decoration: underline;
}

/* Upgrade prompt in word popup */
#word-popup .upgrade-prompt,
.upgrade-prompt {
    margin-top: 12px;
    padding: 12px;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 6px;
    text-align: center;
    font-size: 0.9em;
    color: #666;
}
.upgrade-prompt p {
    margin: 0 0 8px;
}
.upgrade-link {
    display: inline-block;
    padding: 4px 12px;
    background: var(--color-gold);
    color: var(--color-navy);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
}
.upgrade-link:hover {
    background: #d4af37;
    color: var(--color-navy);
}
[data-theme="dark"] .upgrade-prompt {
    background: rgba(201, 162, 39, 0.08);
    border-color: rgba(201, 162, 39, 0.2);
    color: #8898a8;
}
[data-theme="dark"] .upgrade-link {
    color: #0d1520;
}

/* In Deck display */
#word-popup .in-deck-container {
    margin-top: 12px;
    padding: 12px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 6px;
}

#word-popup .in-deck-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

#word-popup .in-deck-icon {
    color: #4caf50;
    font-weight: bold;
    font-size: 1.1em;
}

#word-popup .in-deck-label {
    font-weight: 600;
    color: #2e7d32;
}

#word-popup .in-deck-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85em;
    color: #666;
}

#word-popup .vocab-level {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#word-popup .vocab-level.new {
    background: rgba(255, 193, 7, 0.2);
    color: #f57c00;
}

#word-popup .vocab-level.learning {
    background: rgba(33, 150, 243, 0.2);
    color: #1976d2;
}

#word-popup .vocab-level.mature {
    background: rgba(76, 175, 80, 0.2);
    color: #388e3c;
}

#word-popup .in-deck-gloss {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-style: italic;
    color: var(--color-ink);
}

#word-popup .in-deck-gloss .gloss-text {
    flex: 1;
}

#word-popup .in-deck-gloss .edit-gloss-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    color: #666;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s;
}

#word-popup .in-deck-gloss .edit-gloss-btn:hover {
    background: rgba(0,0,0,0.1);
    color: var(--color-ink);
}

#word-popup .gloss-edit-form {
    margin-bottom: 8px;
}

#word-popup .gloss-edit-form input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: var(--font-serif);
    font-size: 0.95em;
    margin-bottom: 6px;
}

#word-popup .gloss-edit-form input:focus {
    outline: none;
    border-color: var(--color-gold);
}

#word-popup .gloss-edit-buttons {
    display: flex;
    gap: 6px;
}

#word-popup .gloss-edit-buttons button {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

#word-popup .gloss-edit-buttons .save-btn {
    background: var(--color-gold);
    color: white;
}

#word-popup .gloss-edit-buttons .save-btn:hover {
    background: #b8941f;
}

#word-popup .gloss-edit-buttons .cancel-btn {
    background: #e0e0e0;
    color: #666;
}

#word-popup .gloss-edit-buttons .cancel-btn:hover {
    background: #d0d0d0;
}

/* Active Legend Bar (above text) */
.active-legend {
    background: var(--color-cream, #f5f1e8);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.legend-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.legend-title {
    font-weight: 600;
    color: var(--color-ink, #2c2416);
    margin-right: 5px;
    font-size: 0.85em;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
    color: #555;
}

.legend-border {
    width: 4px;
    height: 16px;
    border-radius: 2px;
}

.legend-border.noun { background: #e64a19; }
.legend-border.verb { background: #f9a825; }
.legend-border.participle { background: #ff7043; }
.legend-border.adj { background: #7cb342; }
.legend-border.adv { background: #ab47bc; }
.legend-border.prep { background: #26c6da; }
.legend-border.conj { background: #c0ca33; }
.legend-border.pron { background: #ff8a65; }
.legend-border.particle { background: #ffca28; }
.legend-border.article { background: #90a4ae; }

.legend-bg {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.legend-bg.unknown { background: rgba(255, 193, 7, 0.4); }
.legend-bg.new { background: rgba(255, 152, 0, 0.35); border-bottom: 2px dashed rgba(255, 152, 0, 0.7); }
.legend-bg.learning { background: rgba(33, 150, 243, 0.35); }
.legend-bg.mature { background: rgba(76, 175, 80, 0.3); }

/* Inflection color legend */
.legend-text {
    font-weight: 700;
    font-size: 0.9em;
}

.legend-text.nom::before { content: "Aa"; color: #00695c; }
.legend-text.gen::before { content: "Aa"; color: #c62828; }
.legend-text.dat::before { content: "Aa"; color: #2e7d32; }
.legend-text.acc::before { content: "Aa"; color: #f57c00; }
.legend-text.voc::before { content: "Aa"; color: #7b1fa2; }
.legend-text.pres::before { content: "Aa"; color: #558b2f; }
.legend-text.impf::before { content: "Aa"; color: #5e35b1; }
.legend-text.fut::before { content: "Aa"; color: #00838f; }
.legend-text.aor::before { content: "Aa"; color: #c62828; }
.legend-text.perf::before { content: "Aa"; color: #2e7d32; }
.legend-text.plup::before { content: "Aa"; color: #4e342e; }

/* Bulk Add Section */
.bulk-add-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.bulk-add-btn {
    width: 100%;
    padding: 10px 15px;
    background: var(--color-burgundy, #722f37);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
}

.bulk-add-btn:hover {
    background: #8b3a42;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--color-parchment, #faf8f3);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-content h2 {
    margin: 0 0 10px 0;
    color: var(--color-ink, #2c2416);
}

.modal-desc {
    color: #666;
    margin-bottom: 20px;
}

.book-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.book-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.book-select-item:hover {
    border-color: var(--color-gold, #c9a227);
}

.book-select-item input:checked + span {
    font-weight: 600;
    color: var(--color-burgundy, #722f37);
}

.bulk-add-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-select-all {
    padding: 10px 20px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-select-all:hover {
    background: #e0e0e0;
}

.btn-bulk-add {
    padding: 10px 20px;
    background: var(--color-burgundy, #722f37);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
}

.btn-bulk-add:hover {
    background: #8b3a42;
}

.btn-bulk-add:disabled {
    background: #999;
    cursor: not-allowed;
}

.bulk-add-status {
    margin-top: 15px;
    text-align: center;
}

.status-loading {
    color: #666;
}

.status-success {
    color: #2e7d32;
}

/* Section Selection Mode */
.section-select-btn {
    width: 100%;
    padding: 8px 15px;
    margin-top: 8px;
    background: transparent;
    color: var(--color-burgundy, #722f37);
    border: 1px solid var(--color-burgundy, #722f37);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.2s;
}

.section-select-btn:hover {
    background: rgba(114, 47, 55, 0.1);
}

.section-select-btn.active {
    background: var(--color-burgundy, #722f37);
    color: white;
}

/* Segment selection in select mode */
body.section-select-mode .segment-chunk {
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

body.section-select-mode .segment-chunk:hover {
    background: rgba(114, 47, 55, 0.05);
}

body.section-select-mode .segment-chunk::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-burgundy, #722f37);
    border-radius: 4px;
    background: white;
    transition: all 0.2s;
}

body.section-select-mode .segment-chunk.selected::before {
    background: var(--color-burgundy, #722f37);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

body.section-select-mode .segment-chunk.selected {
    background: rgba(114, 47, 55, 0.08);
    border-left: 3px solid var(--color-burgundy, #722f37);
    margin-left: -3px;
}

/* Adjust text panel for checkbox space */
body.section-select-mode .panel-content {
    padding-left: 35px;
}

/* Floating action bar */
.section-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-navy, #1a2639);
    padding: 15px 30px;
    z-index: 1500;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.section-action-bar.hidden {
    display: none;
}

.section-action-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.section-count {
    color: var(--color-cream, #f5f1e8);
    font-size: 1em;
    font-weight: 500;
}

.section-action-btns {
    display: flex;
    gap: 12px;
}

.section-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    color: var(--color-cream, #f5f1e8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
}

.section-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.section-add-btn {
    padding: 10px 24px;
    background: var(--color-gold, #c9a227);
    color: var(--color-navy, #1a2639);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.2s;
}

.section-add-btn:hover {
    background: #d4ad30;
}

.section-add-btn:disabled {
    background: #888;
    color: #ccc;
    cursor: not-allowed;
}

.status-error {
    color: #c62828;
}

/* Vocabulary Coverage Display */
.coverage-display {
    padding: 5px 0;
}

.coverage-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.coverage-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-burgundy) 0%, var(--color-gold) 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.coverage-text {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-ink);
}

.coverage-text #coverage-percent {
    color: var(--color-burgundy);
    font-size: 1.2em;
}

.coverage-details {
    font-size: 0.85em;
    color: #666;
    margin-top: 4px;
}

/* Vocabulary Highlighting in Text */
body.show-vocab-highlight .word.vocab-unknown {
    background-color: rgba(255, 193, 7, 0.25);
    border-radius: 3px;
}

body.show-vocab-highlight .word.vocab-new {
    background-color: rgba(255, 152, 0, 0.2);
    border-radius: 3px;
    border-bottom: 2px dashed rgba(255, 152, 0, 0.5);
}

body.show-vocab-highlight .word.vocab-learning {
    background-color: rgba(33, 150, 243, 0.2);
    border-radius: 3px;
}

body.show-vocab-highlight .word.vocab-mature {
    background-color: rgba(76, 175, 80, 0.15);
    border-radius: 3px;
}

/* Search/review highlight - when viewing word in context */
.word.search-highlight {
    background-color: rgba(255, 235, 59, 0.6);
    border-radius: 3px;
    box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.8);
    animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.8); }
    50% { box-shadow: 0 0 0 4px rgba(255, 235, 59, 0.5); }
}

/* Vocabulary highlight key (in Key section) */
.vocab-key {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.vocab-key-items {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.vocab-key-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
}

.vocab-key-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.vocab-key-swatch.unknown {
    background-color: rgba(255, 193, 7, 0.4);
}

.vocab-key-swatch.new {
    background-color: rgba(255, 152, 0, 0.35);
    border-bottom: 2px dashed rgba(255, 152, 0, 0.7);
}

.vocab-key-swatch.learning {
    background-color: rgba(33, 150, 243, 0.35);
}

.vocab-key-swatch.mature {
    background-color: rgba(76, 175, 80, 0.3);
}

/* Focus/Fullscreen Reading Mode */
.header-bar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.fullscreen-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.fullscreen-btn:hover {
    background: #f5f5f5;
    border-color: var(--color-gold);
    color: var(--color-ink);
}

/* Focus Mode Bar */
.focus-mode-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 38, 57, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 30px;
    z-index: 2000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.focus-mode-bar.visible {
    transform: translateY(0);
}

.focus-mode-bar.hidden {
    display: none;
}

.focus-mode-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.focus-mode-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    color: var(--color-cream);
}

.focus-title-text {
    font-size: 1.1em;
    font-weight: 500;
}

.focus-title-ref {
    font-size: 0.9em;
    opacity: 0.7;
}

.focus-mode-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.focus-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    color: var(--color-cream);
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.2s;
}

.focus-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.focus-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.focus-exit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin-left: 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--color-cream);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.focus-exit-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Focus Mode Active State */
body.focus-mode {
    overflow-x: hidden;
}

body.focus-mode .navbar {
    display: none;
}

body.focus-mode .sidebar {
    display: none;
}

body.focus-mode .reading-header-bar {
    display: none;
}

body.focus-mode .work-info-card {
    display: none;
}

body.focus-mode .active-legend {
    display: none !important;
}

body.focus-mode .reading-layout {
    display: block;
    height: auto;
    overflow: visible;
}

body.focus-mode .reading-main {
    margin: 0;
    padding: 80px 20px 40px;
    max-width: 800px;
    margin: 0 auto;
    height: auto;
    overflow: visible;
}

body.focus-mode.multi-panel .reading-main {
    max-width: 1400px;
}

body.focus-mode .text-panels {
    display: flex;
    gap: 20px;
    overflow: visible;
}

body.focus-mode .text-panel {
    flex: 1;
    min-width: 0;
    overflow: visible;
}

@media (max-width: 900px) {
    body.focus-mode .text-panels {
        flex-direction: column;
    }
}

body.focus-mode .panel-header {
    display: none;
}

body.focus-mode .panel-content {
    padding: 0;
    font-size: 1.25em;
    line-height: 2;
    overflow: visible;
    max-height: none;
}

body.focus-mode .segment {
    margin-bottom: 1em;
}

body.focus-mode .reference {
    color: #999;
    font-size: 0.75em;
}

body.focus-mode .greek-text {
    margin: 0.3em 0;
}

body.focus-mode .word {
    padding: 2px 0;
}

/* Focus mode popup adjustments */
body.focus-mode .popup {
    z-index: 2100;
}

/* Show focus mode bar when active */
body.focus-mode .focus-mode-bar {
    display: block;
}

body.focus-mode .focus-mode-bar.visible {
    transform: translateY(0);
}

/* Hide section action bar in focus mode */
body.focus-mode .section-action-bar {
    display: none !important;
}

/* Smooth transition for entering/exiting focus mode */
.reading-layout,
.navbar,
.sidebar,
.reading-header-bar,
.work-info-card {
    transition: opacity 0.2s ease;
}

/* Vocabulary Deck Inline */
.vocab-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vocab-search-input {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.85em;
    width: 140px;
}

.vocab-summary {
    color: #888;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.btn-danger-sm {
    background: none;
    color: #c0392b;
    border: 1px solid #c0392b;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.btn-danger-sm:hover {
    background: #c0392b;
    color: white;
}

/* Expandable groups using <details> */
.vocab-group {
    border: 1px solid #e0dcd4;
    border-radius: 8px;
    margin-bottom: 8px;
}

.vocab-group[open] {
    border-color: #ccc;
}

.vocab-group-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.vocab-group-summary::-webkit-details-marker {
    display: none;
}

.vocab-group-summary::before {
    content: '\25B6';
    font-size: 0.7em;
    color: #999;
    transition: transform 0.15s;
}

.vocab-group[open] > .vocab-group-summary::before {
    transform: rotate(90deg);
}

.vocab-group-name {
    font-weight: 600;
    color: var(--color-ink, #2c2416);
}

.vocab-group-count {
    background: #e8e4dc;
    color: #666;
    font-size: 0.8em;
    padding: 1px 8px;
    border-radius: 10px;
}

.vocab-remove-group {
    margin-left: auto;
}

.vocab-group-items {
    border-top: 1px solid #e0dcd4;
    padding: 4px 0;
}

.vocab-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    border-bottom: 1px solid #f0ece4;
}

.vocab-card:last-child {
    border-bottom: none;
}

.vocab-card-lemma {
    font-family: var(--font-greek, 'Noto Serif', serif);
    font-weight: 600;
    min-width: 90px;
    cursor: pointer;
}

.vocab-card-lemma:hover {
    color: var(--color-burgundy, #8b2252);
}

.vocab-card-gloss {
    flex: 1;
    color: #555;
    font-size: 0.9em;
}

.vocab-card .delete-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1.2em;
    padding: 2px 6px;
    flex-shrink: 0;
}

.vocab-card .delete-btn:hover {
    color: #c0392b;
}

/* ========================================
   DARK MODE - Navy & Gold Theme
   ======================================== */

[data-theme="dark"] .text-panel,
[data-theme="dark"] .text-content,
[data-theme="dark"] .segment,
[data-theme="dark"] .card,
[data-theme="dark"] .dashboard-card,
[data-theme="dark"] .text-list-section,
[data-theme="dark"] .edition-card,
[data-theme="dark"] .auth-form,
[data-theme="dark"] .review-card {
    background: #131e2e;
    color: #e8e2d6;
    border-color: #263346;
}

[data-theme="dark"] #word-popup {
    background: #1a2a3e;
    border-color: #2d4560;
    color: #e8e2d6;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

[data-theme="dark"] #word-popup .popup-header {
    border-bottom-color: #2d4560;
}

[data-theme="dark"] #word-popup .popup-header .form {
    color: var(--color-gold);
}

[data-theme="dark"] #word-popup .popup-header .lemma {
    color: #b8a060;
}

[data-theme="dark"] #word-popup .defs {
    border-top-color: #2d4560;
}

[data-theme="dark"] #word-popup .morph,
[data-theme="dark"] #word-popup .pos,
[data-theme="dark"] #word-popup .freq-info,
[data-theme="dark"] .morph-tag {
    color: #b0a898;
}

[data-theme="dark"] #word-popup .morph-tag.pos-tag {
    color: #d0c8b8;
}

[data-theme="dark"] .def-item {
    border-left-color: #2d4560;
}

[data-theme="dark"] a {
    color: var(--color-gold);
}

[data-theme="dark"] a:hover {
    color: #dbb840;
}

/* Text reading area */
[data-theme="dark"] .text-display,
[data-theme="dark"] .translation-panel,
[data-theme="dark"] .text-area {
    background: #0d1520;
    color: #e8e2d6;
}

[data-theme="dark"] .greek-word {
    color: #e8e2d6;
}

[data-theme="dark"] .greek-word:hover {
    background: rgba(201, 162, 39, 0.15);
}

[data-theme="dark"] .greek-word.clicked,
[data-theme="dark"] .greek-word.selected {
    background: rgba(201, 162, 39, 0.25);
}

/* Navigation - already dark, just tweak */
[data-theme="dark"] .navbar {
    background-color: #0a1018;
    border-bottom-color: var(--color-gold);
}

/* Text controls / toolbar */
[data-theme="dark"] .text-controls,
[data-theme="dark"] .toolbar,
[data-theme="dark"] .display-options {
    background: #131e2e;
    border-color: #263346;
}

[data-theme="dark"] .text-controls label,
[data-theme="dark"] .display-options label {
    color: #b0a898;
}

/* Inputs, selects, buttons */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #1a2a3e;
    color: #e8e2d6;
    border-color: #2d4560;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--color-gold);
    outline-color: var(--color-gold);
}

[data-theme="dark"] input::placeholder {
    color: #607080;
}

[data-theme="dark"] button,
[data-theme="dark"] .btn {
    background: #1a2a3e;
    color: #e8e2d6;
    border-color: #2d4560;
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] button.primary,
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] button.primary:hover {
    background: var(--color-gold);
    color: #0d1520;
    border-color: var(--color-gold);
}

/* Tables */
[data-theme="dark"] table {
    border-color: #263346;
}

[data-theme="dark"] th {
    background: #1a2a3e;
    color: var(--color-gold);
    border-color: #263346;
}

[data-theme="dark"] td {
    border-color: #263346;
    color: #e8e2d6;
}

[data-theme="dark"] tr:hover td {
    background: rgba(201, 162, 39, 0.05);
}

/* Text list / browse pages */
[data-theme="dark"] .text-card,
[data-theme="dark"] .author-card,
[data-theme="dark"] .work-item {
    background: #131e2e;
    border-color: #263346;
    color: #e8e2d6;
}

[data-theme="dark"] .text-card:hover,
[data-theme="dark"] .author-card:hover {
    border-color: var(--color-gold);
    box-shadow: 0 2px 12px rgba(201, 162, 39, 0.15);
}

/* Search results */
[data-theme="dark"] .search-results,
[data-theme="dark"] .nav-search-results {
    background: #1a2a3e;
    border-color: #2d4560;
}

[data-theme="dark"] .search-result-item {
    border-bottom-color: #263346;
}

[data-theme="dark"] .search-result-item:hover {
    background: rgba(201, 162, 39, 0.1);
}

/* Dashboard specific */
[data-theme="dark"] .dashboard-section {
    background: #131e2e;
    border-color: #263346;
}

[data-theme="dark"] .reading-item {
    border-bottom-color: #263346;
}

/* Translation panel */
[data-theme="dark"] .translation-text {
    color: #c0b8a8;
}

/* Interlinear glosses */
[data-theme="dark"] .interlinear-gloss {
    color: #8898a8;
}

/* Flashcard review */
[data-theme="dark"] .flashcard {
    background: #131e2e;
    border-color: #263346;
    color: #e8e2d6;
}

[data-theme="dark"] .flashcard-front .greek-word {
    color: var(--color-gold);
}

/* Scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0d1520;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #2d4560;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #3d5570;
}

/* Vocab deck */
[data-theme="dark"] .vocab-group summary {
    background: #131e2e;
    color: #e8e2d6;
}

[data-theme="dark"] .vocab-card {
    background: #1a2a3e;
    border-color: #263346;
}

/* Misc overrides for hardcoded light grays */
[data-theme="dark"] .breadcrumb,
[data-theme="dark"] .meta-info,
[data-theme="dark"] .subtitle,
[data-theme="dark"] .text-meta {
    color: #8898a8;
}

[data-theme="dark"] hr,
[data-theme="dark"] .divider {
    border-color: #263346;
}

/* Sidebar */
[data-theme="dark"] .sidebar {
    background: #0f1a28;
    border-right-color: #263346;
}

[data-theme="dark"] .sidebar-toggle {
    background: #1a2a3e;
    border-color: #2d4560;
}

[data-theme="dark"] .sidebar-toggle:hover {
    background: #263346;
}

[data-theme="dark"] .toggle-icon {
    color: #b0a898;
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: #263346;
}

[data-theme="dark"] .sidebar-header h2 {
    color: #e8e2d6;
}

[data-theme="dark"] .sidebar-header .edition-info,
[data-theme="dark"] .sidebar-header .author-byline {
    color: #8898a8;
}

[data-theme="dark"] .sidebar-section {
    border-color: #263346;
    background: #131e2e;
}

[data-theme="dark"] .sidebar-section summary {
    color: #e8e2d6;
}

[data-theme="dark"] .sidebar-section summary::after {
    color: #607080;
}

[data-theme="dark"] .sidebar-section summary:hover {
    background: #1a2a3e;
}

[data-theme="dark"] .sidebar-section-content {
    border-top-color: #263346;
}

[data-theme="dark"] .sidebar-section h3 {
    color: #e8e2d6;
}

[data-theme="dark"] .book-nav {
    background: #1a1a2e;
}

[data-theme="dark"] .book-link {
    background: #2a2a3e;
    color: #b0a898;
}

[data-theme="dark"] .book-link:hover {
    background: #3a3a4e;
}

[data-theme="dark"] .book-link.active {
    background: #c9a84c;
    color: #1a1a2e;
}

[data-theme="dark"] .sidebar-section .book-link {
    color: #b0a898;
}

[data-theme="dark"] .sidebar-section .book-link:hover,
[data-theme="dark"] .sidebar-section .book-link.active {
    background: rgba(201, 162, 39, 0.15);
    color: var(--color-gold);
}

/* Main content area in reader */
[data-theme="dark"] .reading-content {
    background: #0d1520;
}

[data-theme="dark"] .reading-layout {
    background: #0d1520;
}

/* Read page: header bar, breadcrumbs, title, pagination, panels */
[data-theme="dark"] .reading-header-bar {
    background: #131e2e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .breadcrumb a {
    color: var(--color-gold);
}

[data-theme="dark"] .work-info-card {
    background: #131e2e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .work-info-title {
    color: #e8e2d6;
}

[data-theme="dark"] .work-info-author {
    color: #8898a8;
}

[data-theme="dark"] .work-info-header {
    border-bottom-color: #263346;
}

[data-theme="dark"] .meta-collapse-btn {
    color: #8898a8;
    border-color: #2d4560;
}

[data-theme="dark"] .meta-collapse-btn:hover {
    background: #1a2a3e;
    border-color: #3d5570;
}

[data-theme="dark"] .edition-meta-col {
    background: #1a2a3e;
}

[data-theme="dark"] .meta-col-label {
    color: #e8e2d6;
}

[data-theme="dark"] .meta-col-desc {
    color: #8898a8;
}

[data-theme="dark"] .meta-col-urn {
    color: #607080;
}

[data-theme="dark"] .meta-col-type.edition {
    background: #1a3050;
    color: #5ba0e0;
}

[data-theme="dark"] .meta-col-type.translation {
    background: #1a3020;
    color: #5bb060;
}

/* Pagination */
[data-theme="dark"] .page-btn {
    background: #1a2a3e;
    border-color: #2d4560;
    color: #b0a898;
}

[data-theme="dark"] .page-btn:hover:not(:disabled) {
    background: #263346;
    border-color: #3d5570;
}

[data-theme="dark"] .page-link {
    background: #1a2a3e;
    border-color: #2d4560;
    color: #b0a898;
}

[data-theme="dark"] .page-link:hover {
    background: #263346;
    border-color: #3d5570;
}

[data-theme="dark"] .page-link.active {
    background: var(--color-gold);
    border-color: var(--color-gold);
    color: #0d1520;
}

/* Panel headers */
[data-theme="dark"] .panel-header {
    background: #131e2e;
    border-bottom-color: #263346;
}

[data-theme="dark"] .panel-label {
    color: #e8e2d6;
}

[data-theme="dark"] .panel-type.edition {
    background: #1a3050;
    color: #5ba0e0;
}

[data-theme="dark"] .panel-type.translation {
    background: #1a3020;
    color: #5bb060;
}

/* Translation options in sidebar */
[data-theme="dark"] .translation-option {
    background: #1a2a3e;
}

[data-theme="dark"] .translation-option:hover {
    background: #263346;
}

[data-theme="dark"] .translation-option.current {
    background: rgba(201, 162, 39, 0.15);
    border-color: rgba(201, 162, 39, 0.4);
}

[data-theme="dark"] .translation-type.edition {
    background: #1a3050;
    color: #5ba0e0;
}

[data-theme="dark"] .translation-type.translation {
    background: #1a3020;
    color: #5bb060;
}

[data-theme="dark"] .translation-label {
    color: #e8e2d6;
}

/* Word hover in dark mode */
[data-theme="dark"] .word:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="dark"] body.no-colors .word:hover {
    background-color: rgba(201, 162, 39, 0.15);
}

/* Active legend bar */
[data-theme="dark"] .active-legend {
    background: #131e2e;
    border-color: #263346;
}

[data-theme="dark"] .legend-item {
    color: #b0a898;
}

/* Fullscreen button */
[data-theme="dark"] .fullscreen-btn {
    color: #b0a898;
    border-color: #2d4560;
}

[data-theme="dark"] .fullscreen-btn:hover {
    background: #1a2a3e;
    color: #e8e2d6;
}

/* Nav dropdown (account menu) */
[data-theme="dark"] .nav-dropdown {
    background: #131e2e;
    border-color: #2d4560;
}

[data-theme="dark"] .nav-dropdown a {
    color: #e8e2d6;
}

[data-theme="dark"] .nav-dropdown a:hover {
    background: rgba(201, 162, 39, 0.15);
    color: var(--color-gold);
}

[data-theme="dark"] .nav-dropdown-divider {
    background: #263346;
}

/* Word popup: contextual gloss and morph capsules */
[data-theme="dark"] #word-popup .context-gloss-line {
    background: #1a3020;
    color: #5bb060;
}

[data-theme="dark"] #word-popup .morph-tag {
    background: #1a2a3e;
    color: #b0a898;
}

[data-theme="dark"] #word-popup .morph-tag.pos-tag {
    color: #d0c8b8;
}

[data-theme="dark"] #word-popup .morph-tag.pos-tag.noun { background: #3a2010; color: #e0855a; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.verb { background: #3a3010; color: #e0b840; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.participle { background: #3a2515; color: #e09060; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.adj { background: #203010; color: #90c060; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.adv { background: #2a1a30; color: #c080d0; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.pron { background: #3a2810; color: #d0a060; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.prep { background: #102830; color: #60c0d0; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.conj { background: #2a3010; color: #b0c050; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.particle { background: #3a3510; color: #d0c050; }
[data-theme="dark"] #word-popup .morph-tag.pos-tag.article { background: #1a2530; color: #8898a8; }

[data-theme="dark"] #word-popup .morph-tag.case-nom { background: #0a2520; color: #40b0a0; }
[data-theme="dark"] #word-popup .morph-tag.case-gen { background: #2a1015; color: #d06070; }
[data-theme="dark"] #word-popup .morph-tag.case-dat { background: #0a2510; color: #40a050; }
[data-theme="dark"] #word-popup .morph-tag.case-acc { background: #2a1a0a; color: #d09040; }
[data-theme="dark"] #word-popup .morph-tag.case-voc { background: #200a25; color: #a060c0; }

[data-theme="dark"] #word-popup .morph-tag.tense-pres { background: #1a2a10; color: #80b050; }
[data-theme="dark"] #word-popup .morph-tag.tense-impf { background: #1a1530; color: #8070c0; }
[data-theme="dark"] #word-popup .morph-tag.tense-fut { background: #0a2530; color: #40a8b0; }
[data-theme="dark"] #word-popup .morph-tag.tense-aor { background: #2a1015; color: #d06070; }
[data-theme="dark"] #word-popup .morph-tag.tense-perf { background: #0a2510; color: #40a050; }
[data-theme="dark"] #word-popup .morph-tag.tense-plup { background: #1a1510; color: #907060; }

[data-theme="dark"] #word-popup .morph-tag.gender-masc { background: #0a1a30; color: #5080c0; }
[data-theme="dark"] #word-popup .morph-tag.gender-fem { background: #2a0a1a; color: #c05080; }
[data-theme="dark"] #word-popup .morph-tag.gender-neut { background: #1a2025; color: #8090a0; }

[data-theme="dark"] #word-popup .morph-tag.voice-act { background: #2a2510; color: #c0a030; }
[data-theme="dark"] #word-popup .morph-tag.voice-mid { background: #151a30; color: #7080c0; }
[data-theme="dark"] #word-popup .morph-tag.voice-pass { background: #2a0a1a; color: #c05080; }
[data-theme="dark"] #word-popup .morph-tag.voice-mp { background: #200a25; color: #a060c0; }

[data-theme="dark"] #word-popup .morph-tag.mood-ind { background: #0a1a30; color: #5080c0; }
[data-theme="dark"] #word-popup .morph-tag.mood-subj { background: #200a25; color: #a060c0; }
[data-theme="dark"] #word-popup .morph-tag.mood-opt { background: #0a2510; color: #40a050; }
[data-theme="dark"] #word-popup .morph-tag.mood-imp { background: #2a1015; color: #d06070; }
[data-theme="dark"] #word-popup .morph-tag.mood-inf { background: #2a1a0a; color: #d09040; }
[data-theme="dark"] #word-popup .morph-tag.mood-part { background: #0a2520; color: #40b0a0; }

[data-theme="dark"] #word-popup .morph-tag.num-sg { background: #0a1a2a; color: #4090c0; }
[data-theme="dark"] #word-popup .morph-tag.num-dual { background: #2a2510; color: #c0a030; }
[data-theme="dark"] #word-popup .morph-tag.num-pl { background: #1a2a10; color: #80b050; }

[data-theme="dark"] #word-popup .morph-tag.person-1st { background: #151a30; color: #7080c0; }
[data-theme="dark"] #word-popup .morph-tag.person-2nd { background: #2a0a1a; color: #c05080; }
[data-theme="dark"] #word-popup .morph-tag.person-3rd { background: #0a2530; color: #40a8b0; }

[data-theme="dark"] #word-popup .morph-tag.degree-comp { background: #2a1a0a; color: #d09040; }
[data-theme="dark"] #word-popup .morph-tag.degree-super { background: #2a0a1a; color: #c05080; }

[data-theme="dark"] #word-popup .more-analyses-toggle {
    color: var(--color-gold);
    border-top-color: #2d4560;
}

[data-theme="dark"] #word-popup .def-section {
    border-bottom-color: #3a3a4e;
}

[data-theme="dark"] #word-popup .def-label {
    color: #8898a8;
}

[data-theme="dark"] #word-popup .def-label a {
    color: #6ab0e0;
}

[data-theme="dark"] #word-popup .def-label a:hover {
    color: #8ac4f0;
}

[data-theme="dark"] #word-popup .def-content {
    color: #e8e2d6;
}

[data-theme="dark"] #word-popup .def-content.contextual-gloss {
    color: #d4a84c;
}

[data-theme="dark"] #word-popup .def-content.def-unavailable {
    color: #6a6a7a;
}

[data-theme="dark"] #word-popup .def-contextual {
    background: #2a2518;
    border-color: rgba(201, 162, 39, 0.3);
}

[data-theme="dark"] #word-popup .def-contextual .def-label {
    color: #d4a84c;
}

[data-theme="dark"] #word-popup .def-list {
    color: #e8e2d6;
}

[data-theme="dark"] #word-popup .def-source {
    color: #8898a8;
}

[data-theme="dark"] #word-popup .def-source.lsj-source {
    color: #b8a060;
}

/* Popup close button */
[data-theme="dark"] .popup-close {
    color: #8898a8;
}

[data-theme="dark"] .popup-close:hover {
    color: #e8e2d6;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--color-cream);
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.theme-toggle:hover {
    opacity: 1;
}

/* Dark mode: work/author pages + edition cards */
[data-theme="dark"] .work-card-full {
    background: #131e2e;
    color: #e8e2d6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
[data-theme="dark"] .work-card-full:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
[data-theme="dark"] .work-title-english {
    color: #e8e2d6;
}
[data-theme="dark"] .edition-badge.greek {
    background: #0a1a30;
    color: #5080c0;
}
[data-theme="dark"] .edition-badge.translation {
    background: #0a2510;
    color: #50a060;
}
[data-theme="dark"] .edition-label {
    color: #e8e2d6;
}
[data-theme="dark"] .edition-lang {
    color: #5ba0e0;
}
[data-theme="dark"] .edition-desc {
    color: #8898a8;
}
[data-theme="dark"] .author-byline {
    color: #8898a8;
}
[data-theme="dark"] .parallel-panel {
    background: #131e2e;
}
[data-theme="dark"] .parallel-panel-header {
    background: #0f1a28;
    border-bottom-color: #263346;
}

/* ===== Path Context Bar ===== */
.path-context-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1.5rem;
    background: var(--color-cream, #faf6ef);
    border-bottom: 1px solid #e0d6c2;
    font-size: 0.82rem;
    flex-wrap: wrap;
}
.path-context-name {
    color: var(--color-burgundy, #8b2252);
    text-decoration: none;
    font-weight: 600;
}
.path-context-name:hover { text-decoration: underline; }
.path-context-sep { color: #999; }
.path-context-stage { color: var(--color-ink, #2c2c2c); }
.path-context-works { display: flex; gap: 0.3rem; align-items: center; flex-wrap: wrap; }
.path-work-link {
    color: var(--color-ink-light, #666);
    text-decoration: none;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}
.path-work-link:hover { background: rgba(0,0,0,0.05); }
.path-work-link.path-work-current {
    background: var(--color-gold, #c9a84c);
    color: #fff;
    font-weight: 600;
}
.path-context-nav { margin-left: auto; display: flex; gap: 0.3rem; }
.path-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    border-radius: 4px;
    background: transparent;
    color: var(--color-ink, #2c2c2c);
    text-decoration: none;
    border: 1px solid #ddd;
    font-size: 0.9rem;
}
.path-nav-btn:hover { background: var(--color-gold, #c9a84c); color: #fff; border-color: var(--color-gold); }

[data-theme="dark"] .path-context-bar { background: #1a1a2e; border-color: #2a2a3e; }
[data-theme="dark"] .path-context-name { color: #d4a84c; }
[data-theme="dark"] .path-context-stage { color: #e8e2d6; }
[data-theme="dark"] .path-work-link { color: #aaa; }
[data-theme="dark"] .path-work-link:hover { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .path-work-link.path-work-current { background: #c9a84c; color: #1a1a2e; }
[data-theme="dark"] .path-nav-btn { color: #e8e2d6; border-color: #3a3a4e; }
[data-theme="dark"] .path-nav-btn:hover { background: #c9a84c; color: #1a1a2e; }

/* ===== Learning Companion Sidebar ===== */
.companion-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.companion-bar-fill {
    height: 100%;
    background: var(--color-gold, #c9a84c);
    border-radius: 4px;
    transition: width 0.3s;
}
.companion-stats {
    font-size: 0.85rem;
    color: var(--color-ink-light, #666);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}
.companion-deck-note {
    font-size: 0.78rem;
    color: var(--color-ink-light, #888);
    font-style: italic;
    margin-bottom: 0.8rem;
}
.companion-difficulty {
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}
.diff-easy { background: #d4edda; color: #155724; }
.diff-moderate { background: #fff3cd; color: #856404; }
.diff-indeck { background: #d6e9f8; color: #1a4a6e; }
.diff-hard { background: #f8d7da; color: #721c24; }
[data-theme="dark"] .diff-easy { background: #1a3a2a; color: #7dcea0; }
[data-theme="dark"] .diff-moderate { background: #3a3020; color: #d4a84c; }
[data-theme="dark"] .diff-indeck { background: #1a2a3a; color: #7db8e0; }
[data-theme="dark"] .diff-hard { background: #3a1a1a; color: #e88; }

.companion-unknown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.companion-unknown-header strong { font-size: 0.85rem; }
.btn-sm {
    padding: 3px 8px;
    font-size: 0.75rem;
    border: 1px solid var(--color-gold, #c9a84c);
    background: transparent;
    color: var(--color-gold, #c9a84c);
    border-radius: 3px;
    cursor: pointer;
}
.btn-sm:hover { background: var(--color-gold); color: #fff; }
.btn-sm:disabled { opacity: 0.5; }

.companion-word-list {
    max-height: 300px;
    overflow-y: auto;
}
.companion-word {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.85rem;
}
.companion-word:hover { background: rgba(0,0,0,0.05); }
.companion-word-form {
    font-family: var(--font-greek, serif);
    font-weight: 600;
    min-width: 80px;
}
.companion-word-gloss {
    color: var(--color-ink-light, #666);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.companion-word-freq {
    color: #999;
    font-size: 0.75rem;
    min-width: 25px;
    text-align: right;
}
.companion-empty {
    color: var(--color-ink-light, #666);
    font-style: italic;
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0;
}
.companion-more {
    color: #999;
    font-size: 0.8rem;
    text-align: center;
    padding: 0.3rem 0;
}

[data-theme="dark"] .companion-bar { background: #2a2a3e; }
[data-theme="dark"] .companion-stats { color: #aaa; }
[data-theme="dark"] .companion-word:hover { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .companion-word-gloss { color: #aaa; }
[data-theme="dark"] .companion-empty { color: #888; }
