/* ===== Базовые стили ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #e8e8f0;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(255, 119, 198, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(76, 190, 243, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

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

/* ===== Шапка ===== */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    padding: 70px 0 60px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: headerShine 8s ease-in-out infinite;
}

@keyframes headerShine {
    0%, 100% { transform: rotate(0deg) translateX(0); }
    50% { transform: rotate(15deg) translateX(50px); }
}

header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.25), transparent 45%);
    pointer-events: none;
}

header .container {
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 2.8em;
    line-height: 1.15;
    margin-bottom: 16px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    font-weight: 800;
    letter-spacing: -0.02em;
}

header .subtitle {
    font-size: 1.2em;
    opacity: 0.95;
    font-weight: 300;
    letter-spacing: 0.02em;
}

/* ===== Вкладки ===== */
.tabs {
    background: rgba(15, 12, 41, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tabs .container {
    display: flex;
    align-items: center;
    gap: 0;
}

.tabs .tab {
    align-self: stretch;
}

.tabs .theme-toggle {
    flex: 0 0 auto;
}

.lang-toggle {
    min-width: 54px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.tab {
    flex: 1;
    padding: 22px 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    transition: width 0.3s ease, left 0.3s ease;
    z-index: -1;
}

.tab:hover::before {
    width: 100%;
    left: 0;
}

.tab:hover {
    color: white;
}

.tab.active {
    color: white;
    border-bottom-color: #f093fb;
    background: rgba(240, 147, 251, 0.1);
}

.tab.active::before {
    width: 100%;
    left: 0;
}

/* ===== Контент вкладок ===== */
.tab-content {
    display: none;
    padding: 44px 0 20px;
    min-height: 60vh;
}

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

.tab-content h2 {
    color: #e8e8f0;
    margin-bottom: 16px;
    font-size: 1.7em;
}

.tab-note {
    color: #b8b8d0;
    margin-bottom: 14px;
}

.tab-note a {
    color: #a8b8ff;
}

/* ===== О проекте ===== */
.about-content {
    background: rgba(30, 28, 60, 0.95);
    backdrop-filter: blur(20px);
    padding: 40px 44px;
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.about-content h3 {
    color: #b8c8ff;
    margin: 26px 0 10px;
    font-size: 1.18em;
}

.about-content h3:first-child {
    margin-top: 0;
}

.about-content p {
    margin-bottom: 12px;
    line-height: 1.8;
}

.about-content ul {
    margin: 0 0 14px 22px;
    line-height: 1.8;
}

.about-content li {
    margin-bottom: 4px;
}

.about-content a {
    color: #a8b8ff;
}

/* ===== Сделанные схемы: постер + название ===== */
.novels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 32px;
    margin-top: 32px;
}

.novel-card {
    background: rgba(30, 28, 60, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
}

.novel-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(240, 147, 251, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.novel-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(102, 126, 234, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.novel-card:hover::after {
    opacity: 1;
}

.novel-card-image {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    background: linear-gradient(135deg, #1a1a2e, #302b63);
    transition: transform 0.4s ease;
}

.novel-card:hover .novel-card-image {
    transform: scale(1.05);
}

.novel-card-title {
    display: block;
    padding: 16px 18px 18px;
    font-size: 0.96em;
    font-weight: 700;
    line-height: 1.4;
    color: #e8e8f0;
    transition: all 0.3s ease;
    text-align: center;
}

.novel-card:hover .novel-card-title {
    color: #a8b8ff;
    transform: scale(1.02);
}

/* ===== Новеллы, не требующие схем ===== */
.no-schema-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 28px;
    max-width: 900px;
}

.no-schema-row {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 24px;
    align-items: center;
    background: rgba(30, 28, 60, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 18px;
    padding: 16px 24px 16px 16px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.no-schema-row:hover {
    transform: translateX(8px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.no-schema-poster {
    width: 92px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background: #eef1f7;
}

.no-schema-body h3 {
    color: #e8e8f0;
    font-size: 1.08em;
    line-height: 1.35;
    margin-bottom: 4px;
}

.no-schema-reason {
    color: #b8b8d0;
    font-size: 0.92em;
}

/* ===== В планах ===== */
.plan-list {
    background: rgba(30, 28, 60, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 
        0 15px 50px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 28px 36px 28px 56px;
    max-width: 900px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.plan-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f0f2f8;
}

.plan-list li:last-child {
    border-bottom: none;
}

/* ===== Подвал ===== */
footer {
    margin-top: auto;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: rgba(255, 255, 255, 0.8);
    padding: 40px 0;
    text-align: center;
    font-size: 0.94em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
}

footer p {
    margin-bottom: 6px;
}

footer a {
    color: #aeb8ff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ===== Кнопка смены темы ===== */
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95em;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.3s ease;
    margin-left: 12px;
}

.theme-toggle:hover {
    border-color: rgba(255, 255, 255, 0.35);
    color: white;
}

/* ===== Кнопки "Назад" ===== */
.back-link {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 18px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.back-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    transition: width 0.3s ease, left 0.3s ease;
    z-index: -1;
}

.back-link:hover::before {
    width: 100%;
    left: 0;
}

.back-link:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.25);
}

/* ===== Адаптивность ===== */
@media (max-width: 768px) {
    header {
        padding: 44px 0 38px;
    }

    header h1 {
        font-size: 1.75em;
    }

    header .subtitle {
        font-size: 1em;
    }

    .tabs .container {
        flex-wrap: wrap;
    }

    .tabs .lang-toggle {
        margin-left: auto;
    }

    .tab {
        flex: none;
        width: 50%;
        text-align: center;
        padding: 14px 10px;
        font-size: 0.92em;
    }

    .tab-content {
        padding-top: 32px;
    }

    .about-content {
        padding: 24px;
    }

    .novels-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 18px;
    }

    .no-schema-row {
        grid-template-columns: 74px minmax(0, 1fr);
        gap: 16px;
        padding: 12px;
    }

    .no-schema-poster {
        width: 74px;
    }
}

/* ===== Светлая тема: солнечная ===== */
html.light-theme body {
    background:
        radial-gradient(ellipse at 12% 8%, rgba(255, 236, 150, 0.85) 0%, transparent 45%),
        radial-gradient(ellipse at 88% 92%, rgba(249, 175, 60, 0.45) 0%, transparent 50%),
        linear-gradient(135deg, #fffaec 0%, #fff1c4 38%, #ffe0a0 72%, #fdcb6e 100%);
    color: #5d4e37;
}

html.light-theme body::before {
    background:
        radial-gradient(circle at 18% 14%, rgba(255, 247, 200, 0.95) 0%, transparent 38%),
        radial-gradient(circle at 78% 26%, rgba(255, 226, 140, 0.55) 0%, transparent 42%),
        radial-gradient(ellipse at 85% 88%, rgba(240, 160, 50, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 35% 95%, rgba(255, 214, 102, 0.45) 0%, transparent 48%);
}

html.light-theme header {
    background:
        radial-gradient(ellipse at 15% 0%, rgba(255, 226, 150, 0.55) 0%, transparent 55%),
        linear-gradient(135deg, #f79c1e 0%, #e07d09 42%, #c26a08 78%, #a85a09 100%);
    box-shadow: 0 10px 40px rgba(184, 94, 10, 0.3);
}

html.light-theme .tabs {
    background: linear-gradient(180deg, rgba(255, 253, 247, 0.99) 0%, rgba(255, 243, 216, 0.99) 100%);
    box-shadow: 0 2px 20px rgba(139, 94, 60, 0.14);
    border-bottom: 1px solid rgba(139, 94, 60, 0.2);
}

html.light-theme .tab {
    color: #7a5a3a;
}

html.light-theme .tab:hover {
    color: #b8650a;
    background: linear-gradient(180deg, rgba(240, 146, 42, 0.16) 0%, rgba(212, 117, 10, 0.04) 100%);
}

html.light-theme .tab.active {
    color: #8b3e0a;
    background: linear-gradient(180deg, rgba(247, 156, 30, 0.28) 0%, rgba(212, 117, 10, 0.10) 100%);
    border-bottom-color: #d4750a;
}

html.light-theme .tab::before {
    background: linear-gradient(135deg, rgba(212, 117, 10, 0.14), rgba(184, 94, 10, 0.14));
}

html.light-theme .tab.active::before {
    background: linear-gradient(135deg, rgba(212, 117, 10, 0.2), rgba(184, 94, 10, 0.2));
}

html.light-theme .tab-content h2 {
    color: #4a3728;
}

html.light-theme .tab-note {
    color: #6d5c4a;
}

html.light-theme .tab-note a {
    color: #b8650a;
}

html.light-theme .about-content {
    background: linear-gradient(160deg, #fffdf7 0%, #fff4dc 100%);
    box-shadow: 0 10px 40px rgba(139, 94, 60, 0.12);
    border-color: rgba(139, 94, 60, 0.22);
}

html.light-theme .about-content h3 {
    color: #8b5e3c;
}

html.light-theme .about-content a {
    color: #b8650a;
}

html.light-theme .novel-card {
    background: linear-gradient(160deg, #fffdf7 0%, #fff3d8 100%);
    box-shadow: 0 8px 30px rgba(139, 94, 60, 0.14);
    border-color: rgba(139, 94, 60, 0.22);
}

html.light-theme .novel-card:hover {
    background: linear-gradient(160deg, #fffdf5 0%, #ffeec4 100%);
    box-shadow: 0 20px 50px rgba(184, 94, 10, 0.24);
}

html.light-theme .novel-card-title {
    color: #4a3728;
}

html.light-theme .novel-card:hover .novel-card-title {
    color: #b8650a;
}

html.light-theme .no-schema-row {
    background: linear-gradient(160deg, #fffdf7 0%, #fff4dd 100%);
    box-shadow: 0 6px 24px rgba(139, 94, 60, 0.12);
    border-color: rgba(139, 94, 60, 0.22);
}

html.light-theme .no-schema-row:hover {
    background: linear-gradient(160deg, #fffdf5 0%, #ffeec6 100%);
    box-shadow: 0 10px 32px rgba(184, 94, 10, 0.22);
}

html.light-theme .no-schema-body h3 {
    color: #4a3728;
}

html.light-theme .no-schema-reason {
    color: #6d5c4a;
}

html.light-theme .plan-list {
    background: linear-gradient(160deg, #fffdf7 0%, #fff4dc 100%);
    box-shadow: 0 10px 40px rgba(139, 94, 60, 0.12);
    border-color: rgba(139, 94, 60, 0.22);
}

html.light-theme .theme-toggle {
    background: transparent;
    border-color: rgba(139, 94, 60, 0.4);
    color: #8b5e3c;
}

html.light-theme .theme-toggle:hover {
    border-color: rgba(139, 94, 60, 0.7);
    color: #6d4c2e;
}

html.light-theme .back-link {
    background: transparent;
    border-color: rgba(139, 94, 60, 0.35);
    color: #8b5e3c;
}

html.light-theme .back-link::before {
    background: linear-gradient(135deg, rgba(212, 117, 10, 0.15), rgba(184, 94, 10, 0.15));
}

html.light-theme .back-link:hover {
    background: rgba(212, 117, 10, 0.1);
    color: #6d4c2e;
}

html.light-theme footer {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(255, 214, 150, 0.25) 0%, transparent 60%),
        linear-gradient(135deg, #a97142 0%, #8b5e3c 45%, #5d4030 100%);
}

/* ===== Страница 404 ===== */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-container {
    text-align: center;
    padding: 60px 20px;
}

.error-code {
    font-size: clamp(5rem, 18vw, 11rem);
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(135deg, #667eea 0%, #b8c8ff 50%, #d4750a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

.error-title {
    font-size: 1.6em;
    font-weight: 700;
    color: #e8e8f0;
    margin-bottom: 10px;
}

.error-text {
    color: #a8a8c0;
    margin-bottom: 28px;
}

.error-link {
    display: inline-block;
    padding: 12px 28px;
    border: 1px solid rgba(184, 200, 255, 0.4);
    border-radius: 30px;
    color: #b8c8ff;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.error-link:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.7);
}

html.light-theme .error-title {
    color: #3a3a5a;
}

html.light-theme .error-text {
    color: #8a7a66;
}

html.light-theme .error-link {
    border-color: rgba(139, 94, 60, 0.4);
    color: #8b5e3c;
}

html.light-theme .error-link:hover {
    background: rgba(212, 117, 10, 0.12);
    border-color: rgba(212, 117, 10, 0.7);
}
