* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #7C5A3A;
    --secondary-color: #C9A961;
    --bg-color: #F8F6F2;
    --paper-color: #FFFFFF;
    --text-color: #2C2416;
    --accent-color: #8B6F47;
    --border-color: #E8E0D4;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-heavy: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.06);
    --site-zoom: 1;
}

body {
    font-family: 'Lora', serif;
    background: radial-gradient(circle at top, #F5EEE3 0%, #E3D2BF 35%, #BBA891 100%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    zoom: var(--site-zoom, 1);
    transition: zoom 0.35s ease-out;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.22) 0, transparent 55%),
        radial-gradient(circle at bottom right, rgba(92, 64, 51, 0.55) 0, transparent 65%);
    mix-blend-mode: soft-light;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, rgba(124, 90, 58, 0.95) 0%, rgba(139, 111, 71, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: var(--shadow-heavy);
    margin-bottom: 40px;
    border: 1px solid rgba(201, 169, 97, 0.35);
    position: relative;
    overflow: hidden;
}

.logo-block {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    text-align: center;
}

.header-tagline {
    color: rgba(245,230,211,0.9);
    margin-top: 8px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.6px;
    font-size: 0.95em;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 10% 0, rgba(255, 255, 255, 0.16) 0, transparent 45%),
        radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.1) 0, transparent 55%);
    opacity: 0.6;
}

.header::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

.title {
    font-family: 'Playfair Display', serif;
    font-size: 3.4em;
    font-weight: 700;
    color: #F5E6D3;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    letter-spacing: 2px;
    line-height: 1.2;
    animation: titleGlow 12s ease-in-out infinite;
}

.subtitle {
    font-size: 1.2em;
    color: rgba(245, 230, 211, 0.95);
    font-style: normal;
    font-weight: 400;
    position: relative;
    z-index: 1;
    font-family: 'Lora', serif;
}

/* Верхняя навигация */
.top-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    position: relative;
}

.nav-btn {
    padding: 14px 28px;
    background: var(--paper-color);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    letter-spacing: 0.3px;
}

.nav-btn:hover {
    background: rgba(201, 169, 97, 0.1);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border-color: var(--secondary-color);
}

.theme-toggle {
    padding: 14px 20px;
    background: var(--paper-color);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    background: rgba(201, 169, 97, 0.1);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.theme-icon {
    display: block;
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--paper-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.zoom-label {
    font-size: 0.95em;
    font-weight: 500;
    color: var(--primary-color);
    cursor: default;
}

.zoom-slider {
    width: 80px;
    min-width: 60px;
    height: 8px;
    accent-color: var(--secondary-color);
}

.zoom-value {
    font-size: 0.85em;
    color: var(--accent-color);
    min-width: 36px;
}

.language-picker {
    margin-bottom: 28px;
    padding: 16px;
    background: rgba(201, 169, 97, 0.08);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.language-picker-label {
    display: block;
    font-size: 1em;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 12px;
    text-align: center;
}

.language-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 12px 24px;
    background: var(--paper-color);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: var(--shadow);
}

.lang-btn:hover {
    background: rgba(201, 169, 97, 0.12);
    border-color: var(--secondary-color);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border-color: var(--secondary-color);
}

.book-lang-label {
    font-size: 0.95em;
    color: var(--primary-color);
    margin-right: 8px;
}

.book-lang-select {
    max-width: 160px;
    margin-right: 12px;
}

.glossary-lang-block {
    margin-bottom: 20px;
    padding: 14px;
    background: rgba(201, 169, 97, 0.06);
    border-radius: 10px;
    border-left: 3px solid var(--secondary-color);
}

.glossary-lang-heading {
    display: block;
    font-size: 0.95em;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 6px;
    margin-top: 10px;
}

.glossary-lang-heading:first-child {
    margin-top: 0;
}

/* Секции контента */
.content-section {
    display: none;
    background: var(--paper-color);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    min-height: 500px;
}

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

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.2em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
    letter-spacing: 0.5px;
}

.hidden {
    display: none !important;
}

/* Книги */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.book-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--secondary-color);
}

.book-card-locked {
    opacity: 0.75;
    cursor: not-allowed;
    background: linear-gradient(135deg, rgba(248, 246, 242, 0.95) 0%, rgba(235, 230, 220, 0.95) 100%);
    border-style: dashed;
}

.book-card-locked:hover {
    transform: none;
    box-shadow: var(--shadow-soft);
    border-color: var(--border-color);
}

.book-card-lock {
    display: block;
    font-size: 2em;
    margin-bottom: 12px;
    opacity: 0.8;
}

.book-card-title-unknown {
    font-size: 1.1em !important;
    color: #888 !important;
    font-style: italic;
}

.book-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.book-subtitle {
    font-size: 0.95em;
    color: var(--accent-color);
    font-style: italic;
    margin-bottom: 15px;
}

.book-description {
    font-size: 0.92em;
    color: #555;
    line-height: 1.65;
    max-height: 420px;
    overflow-y: auto;
}

.book-description p {
    margin-bottom: 0.75em;
}

.book-description p:last-child {
    margin-bottom: 0;
}

.book-header {
    margin-bottom: 30px;
}

.book-title {
    font-family: 'Playfair Display', serif;
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin: 20px 0;
}

.hidden {
    display: none !important;
}

.book-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    margin-top: 16px;
    justify-content: center;
}

.chapter-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.chapter-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--paper-color);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-heavy);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
}

.chapter-result-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.95em;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.chapter-result-item:last-child {
    border-bottom: none;
}

.chapter-result-item:hover {
    background: rgba(201, 169, 97, 0.15);
}

.chapter-page {
    color: var(--accent-color);
    font-size: 0.9em;
}

.word-search {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 200px;
    max-width: 380px;
}

.word-search .search-input {
    width: 100%;
}

.word-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    padding: 16px;
    background: var(--paper-color);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-heavy);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}

.word-search-header {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.word-search-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.word-search-item {
    padding: 12px;
    background: rgba(201, 169, 97, 0.06);
    border-radius: 8px;
    border-left: 3px solid var(--secondary-color);
}

.word-search-context {
    margin-bottom: 8px;
    font-size: 0.95em;
    line-height: 1.5;
}

.word-search-empty {
    color: var(--text-color);
    margin: 0;
}

.btn-goto-page {
    padding: 6px 14px;
    font-size: 0.9em;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-goto-page:hover {
    background: var(--accent-color);
}

.editor-login-block,
.editor-logout-block {
    margin-bottom: 20px;
}

.editor-label {
    margin-right: 10px;
    font-size: 0.95em;
    color: var(--accent-color);
}

.btn-back {
    padding: 10px 20px;
    background: var(--paper-color);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.btn-back:hover {
    background: rgba(201, 169, 97, 0.1);
    border-color: var(--secondary-color);
}

.reader-controls.top-controls {
    margin-top: 0;
    margin-bottom: 30px;
}

.reader-controls.bottom-controls {
    margin-top: 30px;
    margin-bottom: 0;
}

/* Глоссарий */
.glossary-form-container {
    background: rgba(201, 169, 97, 0.05);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.glossary-form-container h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.glossary-grid .dictionary-item {
    margin-bottom: 0;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.btn-edit, .btn-delete {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-edit {
    background: rgba(201, 169, 97, 0.1);
    color: var(--primary-color);
    border-color: var(--secondary-color);
}

.btn-edit:hover {
    background: rgba(201, 169, 97, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-delete {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}

.btn-delete:hover {
    background: rgba(220, 53, 69, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--paper-color);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    background: rgba(201, 169, 97, 0.1);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.edit-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.glossary-detail-page {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-text {
    font-size: 1.1em;
    line-height: 1.9;
    color: var(--text-color);
}

.about-text p {
    margin-bottom: 1.5em;
}

.about-text a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.about-text a:hover {
    color: var(--accent-color);
}

.sidebar {
    background: var(--paper-color);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.sidebar-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
}

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

.sidebar-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4em;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
    letter-spacing: 0.5px;
}

.file-input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 15px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow);
}

.btn-primary, .btn-nav {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    letter-spacing: 0.3px;
}

.btn-primary:hover, .btn-nav:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 100%);
}

.btn-primary:active, .btn-nav:active {
    transform: translateY(0);
}

.btn-nav {
    width: auto;
    padding: 10px 20px;
    margin: 0 10px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

.glossary-form {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.input-line, .input-area {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    transition: all 0.25s ease;
}

.input-area {
    resize: vertical;
}

.input-line:focus, .input-area:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

.glossary-filters {
    display: grid;
    gap: 10px;
    margin: 12px 0 18px 0;
}

.dictionary-list {
    max-height: 400px;
    overflow-y: auto;
}

.book-editor-block {
    margin-bottom: 24px;
    padding: 20px;
    background: rgba(201, 169, 97, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.book-editor-block h3 {
    margin-bottom: 8px;
    color: var(--primary-color);
}

.book-editor-hint {
    font-size: 0.9em;
    color: #5c5346;
    margin-bottom: 16px;
    line-height: 1.5;
}

.book-editor-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.book-editor-actions {
    margin-bottom: 16px;
}

.book-chapters-editor {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.chapter-editor-block {
    padding: 16px;
    background: var(--paper-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chapter-editor-heading {
    font-size: 1.1em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.chapter-editor-langs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.chapter-editor-langs label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
}

.chapter-title-input {
    width: 140px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9em;
}

.chapter-content-label {
    display: block;
    font-size: 0.9em;
    margin-bottom: 6px;
    color: var(--accent-color);
}

.chapter-content-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9em;
    margin-bottom: 8px;
    resize: vertical;
}

.chapter-audio-editor {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chapter-audio-status {
    font-size: 0.9em;
    color: var(--accent-color);
}

.chapter-audio-input {
    font-size: 0.85em;
}

.chapter-title {
    margin-bottom: 16px;
    padding-bottom: 8px;
}

.chapter-audio-wrap {
    margin-bottom: 16px;
}

.chapter-audio-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.chapter-audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.site-texts-editor-block {
    margin-top: 28px;
    padding: 20px;
    background: rgba(201, 169, 97, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.site-texts-editor-block h3 {
    margin-bottom: 8px;
    color: var(--primary-color);
}

.site-texts-hint {
    font-size: 0.9em;
    color: #5c5346;
    margin-bottom: 16px;
}

.site-texts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 16px;
}

.site-text-row {
    display: grid;
    grid-template-columns: 160px 1fr 1fr 1fr;
    gap: 10px;
    align-items: center;
}

.site-text-key {
    font-size: 0.85em;
    color: var(--accent-color);
    word-break: break-all;
}

.site-text-input {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9em;
}

.file-label {
    cursor: pointer;
    display: inline-block;
}

.file-label .file-input.hidden {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.file-name {
    font-size: 0.9em;
    color: var(--accent-color);
    margin-left: 8px;
}

.glossary-related-label {
    display: block;
    font-size: 0.95em;
    margin-bottom: 6px;
    color: var(--primary-color);
}

.glossary-related-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.glossary-related-select {
    flex: 1;
    min-width: 140px;
}

.glossary-recommended {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.glossary-recommended-title {
    font-size: 1.1em;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.glossary-recommended-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.glossary-recommended-list li {
    margin-bottom: 8px;
}

.glossary-recommended-link {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1em;
    color: var(--secondary-color);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.glossary-recommended-link:hover {
    color: var(--primary-color);
}

.glossary-image-label {
    display: block;
    font-size: 0.95em;
    margin-bottom: 6px;
    color: var(--primary-color);
}

.glossary-image-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.glossary-image-row.edit {
    align-items: flex-start;
}

.glossary-image-row .file-input {
    max-width: 240px;
    margin-bottom: 0;
}

.glossary-image-preview {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: rgba(201, 169, 97, 0.1);
}

.glossary-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dictionary-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    margin-bottom: 12px;
    background: white;
    border-left: 4px solid var(--secondary-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
}

.dictionary-item-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(201, 169, 97, 0.15);
}

.dictionary-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dictionary-item-text {
    flex: 1;
    min-width: 0;
}

.dictionary-item:hover {
    transform: translateX(6px);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.08);
    background: #FFF8E7;
}

.dictionary-item-text strong {
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    font-size: 1.05em;
}

.dictionary-item strong {
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1.05em;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.8em;
    font-family: 'Inter', sans-serif;
    background: rgba(201, 169, 97, 0.16);
    color: var(--accent-color);
    border: 1px solid rgba(201, 169, 97, 0.25);
}

.badge.person {
    background: rgba(124, 90, 58, 0.14);
    color: #4d311d;
}

.badge.country {
    background: rgba(104, 147, 98, 0.15);
    color: #40613a;
    border-color: rgba(104, 147, 98, 0.25);
}

.badge.term {
    background: rgba(201, 169, 97, 0.16);
}

.badge.org {
    background: rgba(98, 125, 168, 0.15);
    color: #3d4e75;
    border-color: rgba(98, 125, 168, 0.25);
}

.badge.event {
    background: rgba(168, 98, 98, 0.15);
    color: #6a2e2e;
    border-color: rgba(168, 98, 98, 0.25);
}

.dictionary-item p,
.dictionary-item-text p {
    font-size: 0.95em;
    color: #4b4235;
    line-height: 1.5;
}

.glossary-detail__image .glossary-detail__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
}

.glossary-detail__image span {
    font-size: 0.9em;
    color: #7a6b5a;
}

/* Удалено .book-reader, теперь используется .content-section */

.reader-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    padding: 18px;
    background: rgba(201, 169, 97, 0.08);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* Стили для reader-controls уже определены выше */

.page-info {
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    font-weight: 500;
    color: var(--primary-color);
    margin: 0 20px;
    min-width: 150px;
    text-align: center;
    letter-spacing: 0.3px;
}

.book-content {
    position: relative;
    line-height: 1.9;
    font-size: 1.25em;
    color: var(--text-color);
    text-align: center;
    padding: 60px 80px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
    min-height: 500px;
    max-width: 900px;
    margin: 0 auto;
    font-family: 'Lora', serif;
    font-weight: 400;
    letter-spacing: 0.3px;
    transition: transform 0.4s ease, box-shadow 0.4s ease, background 0.4s ease;
    position: relative;
}

.book-content::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: linear-gradient(
        135deg,
        rgba(250, 244, 235, 0.75) 0%,
        rgba(250, 244, 235, 0.3) 45%,
        rgba(255, 255, 255, 0.1) 100%
    );
    opacity: 0.35;
    pointer-events: none;
}

.book-content:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.16);
}

/* Режим атмосферы: туман на первой главе */
.book-content p {
    margin-bottom: 1.8em;
    text-align: center;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.book-content h1,
.book-content h2,
.book-content h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    text-align: center;
    margin: 2.5em 0 1.2em 0;
    color: var(--primary-color);
    letter-spacing: 0.5px;
}

.book-content h1 {
    font-size: 2.4em;
    margin-top: 1.5em;
}

.book-content h2 {
    font-size: 2em;
    margin-top: 2em;
}

.book-content h3 {
    font-size: 1.6em;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--primary-color);
}

.welcome-emblem {
    display: block;
    width: 140px;
    height: auto;
    margin: 0 auto 24px;
    object-fit: contain;
}

.welcome-message h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8em;
    font-weight: 700;
    margin-bottom: 20px;
}

.welcome-message p {
    font-size: 1.3em;
    margin-bottom: 15px;
}

.welcome-message .hint {
    font-style: italic;
    color: #666;
    font-size: 1.1em;
}

.term-highlight {
    background: linear-gradient(120deg, rgba(201, 169, 97, 0.25) 0%, rgba(201, 169, 97, 0.15) 100%);
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    border-bottom: 2px solid rgba(201, 169, 97, 0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    color: var(--primary-color);
    position: relative;
    box-shadow: 0 0 0 0 rgba(201, 169, 97, 0.0);
}

.term-highlight:hover {
    background: linear-gradient(120deg, rgba(201, 169, 97, 0.4) 0%, rgba(201, 169, 97, 0.3) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(201, 169, 97, 0.45);
    border-bottom-color: var(--secondary-color);
}

.term-highlight:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.5);
}

.term-highlight::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.term-highlight:hover::after {
    opacity: 1;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--paper-color);
    padding: 45px;
    border-radius: 20px;
    max-width: 820px;
    width: 90%;
    box-shadow: var(--shadow-heavy);
    border: 1px solid var(--border-color);
    position: relative;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-fade-in {
    animation: pageFadeIn 0.45s ease-out;
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow:
            0 0 10px rgba(255, 255, 255, 0.16),
            0 0 22px rgba(201, 169, 97, 0.35);
    }
    50% {
        text-shadow:
            0 0 18px rgba(255, 255, 255, 0.22),
            0 0 32px rgba(201, 169, 97, 0.55);
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    color: var(--primary-color);
    cursor: pointer;
    transition: transform 0.2s ease;
    line-height: 1;
}

.close-modal:hover {
    transform: rotate(90deg);
    color: var(--accent-color);
}

.modal-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: 0.4px;
}

.modal-content p {
    font-size: 1.15em;
    line-height: 1.9;
    color: var(--text-color);
    font-family: 'Lora', serif;
}

.glossary-detail {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 22px;
    align-items: start;
}

.glossary-detail__image {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    border: 1px dashed rgba(201, 169, 97, 0.6);
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.15), rgba(255, 255, 255, 0.55));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a5a3b;
    font-family: 'Inter', sans-serif;
    text-align: center;
    padding: 12px;
    box-shadow: inset 0 1px 6px rgba(0,0,0,0.05);
}

.glossary-detail__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.glossary-detail__header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.glossary-detail__text {
    font-size: 1.05em;
    line-height: 1.8;
    color: var(--text-color);
    white-space: pre-wrap;
}

/* Скроллбар в стиле ренессанса */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(248, 246, 242, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(124, 90, 58, 0.6) 0%, rgba(139, 111, 71, 0.6) 100%);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(139, 111, 71, 0.8) 0%, rgba(124, 90, 58, 0.8) 100%);
    background-clip: padding-box;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        max-height: none;
    }
    
    .title {
        font-size: 2.5em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .header {
        padding: 20px 16px;
        margin-bottom: 24px;
    }
    
    .title {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .top-nav {
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .nav-btn,
    .theme-toggle {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .zoom-control {
        padding: 6px 10px;
        gap: 4px;
    }
    
    .zoom-slider {
        width: 60px;
        min-width: 50px;
    }
    
    .zoom-value {
        font-size: 0.8em;
        min-width: 32px;
    }
    
    .book-content {
        padding: 20px 16px;
        font-size: 1em;
        max-width: 100%;
    }
    
    .book-title {
        font-size: 1.5em;
        margin: 12px 0;
    }
    
    .book-search-row {
        flex-direction: column;
        gap: 12px;
        margin-top: 12px;
    }
    
    .chapter-search,
    .word-search {
        max-width: 100%;
        min-width: 0;
    }
    
    .reader-controls {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 0;
    }
    
    .btn-nav {
        padding: 10px 16px;
        font-size: 0.9em;
        margin: 4px;
    }
    
    .page-info {
        font-size: 0.9em;
        margin: 0 8px;
    }
    
    .book-reader {
        padding: 20px 12px;
    }
    
    .btn-back {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .chapter-audio-btn {
        padding: 10px 16px;
        font-size: 0.9em;
        width: 100%;
        max-width: 280px;
    }
    
    .book-editor-block {
        padding: 12px;
    }
    
    .book-chapters-editor {
        max-height: 60vh;
    }
    
    .chapter-editor-block {
        padding: 12px;
    }
    
    .chapter-editor-langs {
        flex-direction: column;
    }
    
    .chapter-editor-langs label {
        width: 100%;
    }
    
    .chapter-title-input {
        width: 100%;
        max-width: 100%;
    }
    
    .site-text-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .site-text-key {
        grid-column: 1;
    }
    
    .site-text-input {
        width: 100%;
    }
    
    .language-picker {
        padding: 12px;
    }
    
    .language-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .lang-btn {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .books-grid {
        gap: 16px;
    }
    
    .book-card {
        padding: 20px;
    }
    
    .glossary-detail {
        grid-template-columns: 1fr;
    }

    .glossary-detail__image {
        max-width: 260px;
        margin: 0 auto;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .glossary-form-container {
        padding: 16px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 10px 18px;
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.6em;
    }
    
    .top-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }
    
    .theme-toggle {
        flex: 1 1 100%;
    }
    
    .reader-controls {
        flex-direction: column;
    }
    
    .btn-nav {
        width: 100%;
        max-width: 200px;
    }
}

/* Кнопки редактирования и удаления */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.btn-edit, .btn-delete {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-edit {
    background: rgba(201, 169, 97, 0.1);
    color: var(--primary-color);
    border-color: var(--secondary-color);
}

.btn-edit:hover {
    background: rgba(201, 169, 97, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-delete {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}

.btn-delete:hover {
    background: rgba(220, 53, 69, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-heavy);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--paper-color);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    background: rgba(201, 169, 97, 0.1);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
}

.edit-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

/* Тёмная тема */
body.dark-theme {
    --primary-color: #C9A961;
    --secondary-color: #D4AF37;
    --bg-color: #1a1a1a;
    --paper-color: #2d2d2d;
    --text-color: #E8E0D4;
    --accent-color: #B8956A;
    --border-color: #4a4a4a;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-heavy: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.4);
    background: radial-gradient(circle at top, #1a1a1a 0%, #2d2d2d 35%, #1a1a1a 100%);
}

body.dark-theme::before {
    background:
        radial-gradient(circle at top left, rgba(201, 169, 97, 0.15) 0, transparent 55%),
        radial-gradient(circle at bottom right, rgba(92, 64, 51, 0.3) 0, transparent 65%);
}

body.dark-theme .book-content {
    background: #2d2d2d;
    color: var(--text-color);
}

body.dark-theme .book-content::before {
    background-image: linear-gradient(
        135deg,
        rgba(45, 45, 45, 0.75) 0%,
        rgba(45, 45, 45, 0.3) 45%,
        rgba(26, 26, 26, 0.1) 100%
    );
}

body.dark-theme .term-highlight {
    background: linear-gradient(120deg, rgba(201, 169, 97, 0.3) 0%, rgba(201, 169, 97, 0.2) 100%);
    border-bottom-color: rgba(201, 169, 97, 0.5);
}

body.dark-theme .term-highlight:hover {
    background: linear-gradient(120deg, rgba(201, 169, 97, 0.4) 0%, rgba(201, 169, 97, 0.3) 100%);
    box-shadow: 0 4px 10px rgba(201, 169, 97, 0.3);
}

body.dark-theme .book-card,
body.dark-theme .dictionary-item,
body.dark-theme .glossary-detail-page,
body.dark-theme .content-section,
body.dark-theme .glossary-form-container {
    background: #2d2d2d;
    border-color: #4a4a4a;
    color: var(--text-color);
}

body.dark-theme .book-card-locked {
    background: linear-gradient(135deg, rgba(45, 45, 45, 0.9) 0%, rgba(35, 35, 35, 0.9) 100%);
    border-color: #3a3a3a;
}

body.dark-theme .book-card-title-unknown {
    color: #888 !important;
}

body.dark-theme .input-line,
body.dark-theme .input-area,
body.dark-theme .search-input,
body.dark-theme .file-input {
    background: #1a1a1a;
    border-color: #4a4a4a;
    color: var(--text-color);
}

body.dark-theme .input-line:focus,
body.dark-theme .input-area:focus,
body.dark-theme .search-input:focus {
    border-color: var(--secondary-color);
    background: #252525;
}

body.dark-theme .glossary-detail__image {
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.2), rgba(45, 45, 45, 0.8));
    border-color: rgba(201, 169, 97, 0.4);
    color: var(--text-color);
}

body.dark-theme .zoom-control {
    background: #2d2d2d;
    border-color: #4a4a4a;
    color: var(--text-color);
}

body.dark-theme .zoom-label {
    color: var(--primary-color);
}

body.dark-theme .zoom-value {
    color: var(--secondary-color);
}

/* В тёмной теме текст превью глоссария (под заголовком карточки) — тот же цвет, что у аннотации */
body.dark-theme .dictionary-item-text p,
body.dark-theme .dictionary-item p {
    color: var(--text-color) !important;
}

body.dark-theme .book-description {
    color: var(--text-color);
}
