* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.5s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 🌸 Светлая тема (сакура) */
body.light-theme {
    color: #2d2d2d;
    background: linear-gradient(145deg, #fff1f5, #ffe4e9, #ffd9e2);
    background-attachment: fixed;
}

body.light-theme .sakura-container {
    display: block;
    z-index: 1;
}

.sakura-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.sakura-flower {
    position: absolute;
    width: var(--size);
    height: var(--size);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><path fill="%23ffb7c5" d="M50 20 Q 40 5 30 20 Q 15 20 25 35 Q 10 45 25 55 Q 15 70 30 65 Q 40 80 50 65 Q 60 80 70 65 Q 85 70 75 55 Q 90 45 75 35 Q 85 20 70 20 Q 60 5 50 20Z"/><circle cx="50" cy="40" r="8" fill="%23ffe0e5"/><circle cx="35" cy="35" r="3" fill="%23ffffff" opacity="0.8"/><circle cx="65" cy="35" r="3" fill="%23ffffff" opacity="0.8"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: var(--opacity);
    animation: float var(--float-duration) infinite ease-in-out;
    filter: drop-shadow(0 5px 10px rgba(255, 140, 170, 0.2));
    transform: rotate(var(--rotation));
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(20px) rotate(5deg) scale(1.05); }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}

.sakura-petal {
    position: absolute;
    width: var(--petal-size);
    height: var(--petal-size);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><path fill="%23ffa5b9" d="M25 5 Q 30 15 40 15 Q 35 25 40 35 Q 30 30 25 40 Q 20 30 10 35 Q 15 25 10 15 Q 20 15 25 5Z" opacity="0.8"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: var(--petal-opacity);
    animation: petalFloat var(--petal-float) infinite alternate ease-in-out;
}

@keyframes petalFloat {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    100% { transform: translateY(30px) rotate(10deg) scale(1.1); }
}

/* 🌙 Тёмная тема (звёздное небо) */
body.dark-theme {
    color: #f0e9e1;
    background: radial-gradient(ellipse at 30% 40%, #0a0f1e, #030514);
    background-attachment: fixed;
}

body.dark-theme .stars-container {
    display: block;
    z-index: 1;
}

.stars-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.5);
    width: 2px;
    height: 2px;
    opacity: 0;
    animation: twinkle var(--duration) infinite ease-in-out;
}

.star.medium {
    width: 3px;
    height: 3px;
    box-shadow: 0 0 8px 3px rgba(255, 255, 200, 0.6);
}

.star.large {
    width: 4px;
    height: 4px;
    box-shadow: 0 0 12px 4px rgba(255, 255, 180, 0.8);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* Переключатель тем */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 60px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    gap: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.theme-option {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 40px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95rem;
}

.light-theme .theme-option {
    color: #3a3a3a;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

.theme-option.active {
    background: white;
    color: #1a1a2e !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-shadow: none;
}

.light-theme .theme-option.active {
    background: #ffb7c5;
    color: #691c3a !important;
}

/* Шапка */
.header {
    background-color: rgba(255, 245, 245, 0.9);
    backdrop-filter: blur(5px);
    padding: 1rem 2rem;
    border-bottom: 2px solid #ff9aae;
    box-shadow: 0 2px 15px rgba(160, 80, 100, 0.15);
    transition: all 0.5s ease;
    position: relative;
    z-index: 10;
}

.dark-theme .header {
    background-color: rgba(10, 15, 30, 0.8);
    border-bottom: 2px solid #4a3f6e;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.5);
}

.nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-block;
    padding: 0.7rem 3rem;
    text-decoration: none;
    color: #691c3a;
    font-weight: 600;
    font-size: 1.2rem;
    border: 2px solid #ffb7c5;
    border-radius: 40px;
    background-color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s;
    text-align: center;
    min-width: 180px;
}

.dark-theme .nav-link {
    color: #e0c9ff;
    border-color: #6b4f9c;
    background-color: rgba(20, 10, 40, 0.6);
}

.nav-link.active {
    background-color: #ffb7c5;
    color: white;
    border-color: #ff7a9e;
    box-shadow: 0 0 15px #ffb7c5;
}

.dark-theme .nav-link.active {
    background-color: #6b4f9c;
    border-color: #9d7ad9;
    box-shadow: 0 0 20px #9d7ad9;
    color: #ffffff;
}

.nav-link:hover {
    background-color: #ffd0d9;
    transform: translateY(-2px);
}

.dark-theme .nav-link:hover {
    background-color: #5a3f8a;
    border-color: #b394ff;
}

.japanese-accent {
    text-align: center;
    font-size: 0.9rem;
    color: #b34e71;
    margin-top: 0.5rem;
}

.dark-theme .japanese-accent {
    color: #b79ad9;
}

.japanese-accent span {
    background-color: rgba(255, 255, 255, 0.5);
    padding: 0.2rem 1rem;
    border-radius: 30px;
}

.dark-theme .japanese-accent span {
    background-color: rgba(30, 20, 50, 0.7);
    color: #e0c9ff;
}

/* Основной контент */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 5;
}

/* Страница со статьёй */
.main-content--article {
    align-items: center;
}

/* Заголовок страницы проектов */
.page-title {
    text-align: center;
    font-size: 2rem;
    color: #691c3a;
    margin-bottom: 2rem;
    font-weight: 400;
    border-bottom: 2px dashed #ffb7c5;
    padding-bottom: 0.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.dark-theme .page-title {
    color: #e0c9ff;
    border-bottom: 2px dashed #6b4f9c;
}

/* Контейнер для скролла */
.scroll-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 2rem;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: #ff9aae #ffe0e5;
    height: 70vh;
    min-height: 500px;
    align-items: center;
    scroll-padding: 0 50%;
}

.dark-theme .scroll-container {
    scrollbar-color: #6b4f9c #2a1f3a;
}

.scroll-container::-webkit-scrollbar {
    height: 10px;
}

.scroll-container::-webkit-scrollbar-track {
    background: #ffe0e5;
    border-radius: 10px;
}

.dark-theme .scroll-container::-webkit-scrollbar-track {
    background: #2a1f3a;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: #ff9aae;
    border-radius: 10px;
}

.dark-theme .scroll-container::-webkit-scrollbar-thumb {
    background: #6b4f9c;
}

/* Карточки проектов */
.inner-page {
    flex: 0 0 80%;
    max-width: 600px;
    scroll-snap-align: center;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 40px;
    padding: 3rem 2rem;
    box-shadow: 0 15px 30px rgba(160, 80, 100, 0.25);
    border: 1px solid white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s;
    margin: 0 auto;
    min-height: 400px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.inner-page:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(160, 80, 100, 0.35);
}

.dark-theme .inner-page {
    background-color: rgba(20, 15, 35, 0.7);
    border: 1px solid #5a4a8a;
    box-shadow: 0 15px 40px rgba(90, 70, 150, 0.4);
}

.dark-theme a.inner-page:hover {
    box-shadow: 0 20px 50px rgba(90, 70, 150, 0.55);
}

.inner-page::before {
    content: "✧";
    font-size: 2.5rem;
    color: #ffb7c5;
    opacity: 0.7;
    margin-bottom: 1rem;
}

.dark-theme .inner-page::before {
    color: #9d7ad9;
}

.inner-page h3 {
    font-size: 2.5rem;
    color: #b34e71;
    margin-bottom: 1.5rem;
    border-left: 5px solid #ffb7c5;
    padding-left: 1.5rem;
}

.dark-theme .inner-page h3 {
    color: #d4b5ff;
    border-left: 5px solid #6b4f9c;
}

.inner-page p {
    color: #4a2a33;
    text-align: center;
    max-width: 400px;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.dark-theme .inner-page p {
    color: #c4b5d9;
}

.project-tag {
    margin-top: 1rem;
    color: #c08a9c;
    font-size: 1.3rem;
}

.dark-theme .project-tag {
    color: #b79ad9;
}

/* Индикаторы скролла */
.indicators {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0 1rem;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ffb7c5;
    opacity: 0.3;
    transition: all 0.3s;
}

.dark-theme .indicator {
    background-color: #9d7ad9;
}

.indicator.active {
    opacity: 1;
    width: 30px;
    border-radius: 10px;
    background-color: #ff7a9e;
}

.dark-theme .indicator.active {
    background-color: #c49bff;
}

.scroll-hint {
    text-align: center;
    color: #691c3a;
    font-size: 1rem;
    margin-top: 1rem;
}

.dark-theme .scroll-hint {
    color: #b79ad9;
}

/* Страница со статьёй */
.page-content {
    width: 100%;
    max-width: 900px;
    background-color: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(3px);
    border-radius: 50px;
    padding: 3rem 2.5rem;
    box-shadow: 0 10px 30px rgba(255, 140, 170, 0.2);
    border: 1px solid #ffd9e2;
    position: relative;
    z-index: 5;
}

.dark-theme .page-content {
    background-color: rgba(20, 15, 40, 0.5);
    backdrop-filter: blur(5px);
    border: 1px solid #5a4a8a;
    box-shadow: 0 10px 40px rgba(90, 70, 150, 0.3);
}

.page-content h1 {
    font-size: clamp(1.8rem, 5vw, 2.4rem);
    color: #691c3a;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.8);
    line-height: 1.3;
    margin-bottom: 2rem;
    text-align: center;
}

.dark-theme .page-content h1 {
    color: #e0c9ff;
    text-shadow: 0 0 20px #9d7ad9, 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.page-content h2 {
    font-size: 1.4rem;
    color: #a13d5f;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed #ffb7c5;
}

.dark-theme .page-content h2 {
    color: #c9a9ff;
    border-bottom-color: #6b4f9c;
}

.page-content p {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
    color: #2d2d2d;
}

.dark-theme .page-content p {
    color: #e0d9f0;
}

.page-content strong {
    color: #a13d5f;
}

.dark-theme .page-content strong {
    color: #c9a9ff;
}

.sources {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed #ffb7c5;
    font-size: 0.95rem;
}

.dark-theme .sources {
    border-top-color: #6b4f9c;
}

.sources h3 {
    color: #a13d5f;
    margin-bottom: 0.8rem;
}

.dark-theme .sources h3 {
    color: #c9a9ff;
}

.sources ol {
    padding-left: 1.5rem;
    color: #5a5a5a;
}

.dark-theme .sources ol {
    color: #b0a0c9;
}

.sources a {
    color: #b34e71;
    word-break: break-all;
}

.dark-theme .sources a {
    color: #b79ad9;
}

/* Подвал */
.footer {
    background-color: rgba(255, 245, 245, 0.9);
    backdrop-filter: blur(5px);
    padding: 1.5rem 2rem;
    border-top: 2px solid #ff9aae;
    margin-top: auto;
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.dark-theme .footer {
    background-color: rgba(10, 15, 30, 0.8);
    border-top: 2px solid #4a3f6e;
}

.footer-link {
    text-decoration: none;
    color: #a13d5f;
    font-weight: 600;
    padding: 0.5rem 2rem;
    border-radius: 40px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 2px solid #ffb7c5;
    transition: all 0.3s;
    font-size: 1.1rem;
    min-width: 150px;
    text-align: center;
}

.dark-theme .footer-link {
    color: #e0c9ff;
    background-color: rgba(30, 20, 50, 0.6);
    border-color: #6b4f9c;
}

.footer-link:hover {
    background-color: #ffb7c5;
    color: white;
}

.dark-theme .footer-link:hover {
    background-color: #6b4f9c;
    border-color: #9d7ad9;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal:target {
    display: flex;
}

.modal-window {
    width: 90%;
    max-width: 900px;
    height: 66vh;
    background: rgba(255, 250, 250, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    border: 2px solid #ffb7c5;
    box-shadow: 0 20px 40px rgba(140, 70, 90, 0.3);
    padding: 2rem;
    position: relative;
    animation: fadeIn 0.3s;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.dark-theme .modal-window {
    background: rgba(20, 15, 35, 0.95);
    border: 2px solid #6b4f9c;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    color: #e0c9ff;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed #ffb7c5;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.dark-theme .modal-header {
    border-bottom: 2px dashed #6b4f9c;
}

.modal-header h2 {
    color: #691c3a;
    font-size: 2rem;
}

.dark-theme .modal-header h2 {
    color: #e0c9ff;
}

.close-btn {
    text-decoration: none;
    font-size: 2.5rem;
    line-height: 1;
    color: #a13d5f;
    background: rgba(255, 255, 255, 0.5);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #ff9aae;
    transition: all 0.3s;
}

.dark-theme .close-btn {
    color: #e0c9ff;
    background: rgba(30, 20, 50, 0.5);
    border-color: #6b4f9c;
}

.close-btn:hover {
    background: #ff9aae;
    color: white;
    transform: rotate(90deg);
}

.dark-theme .close-btn:hover {
    background: #6b4f9c;
    border-color: #9d7ad9;
}

.modal-content {
    flex: 1;
    color: #2d2d2d;
    font-size: 1.2rem;
    line-height: 1.8;
}

.dark-theme .modal-content {
    color: #e0c9ff;
}

.modal .close-outside {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    text-decoration: none;
    z-index: -1;
}

/* Адаптивность */
@media (max-width: 768px) {
    .nav {
        gap: 1rem;
    }
    .nav-link {
        padding: 0.5rem 1.5rem;
        min-width: 140px;
        font-size: 1rem;
    }
    .inner-page {
        flex: 0 0 85%;
        padding: 2rem 1rem;
    }
    .inner-page h3 {
        font-size: 2rem;
    }
    .footer {
        gap: 1rem;
    }
    .footer-link {
        padding: 0.4rem 1rem;
        min-width: 120px;
    }
    .page-content {
        padding: 2rem 1.5rem;
        border-radius: 30px;
    }
}

/* Одна кнопка в шапке по центру */
.nav--single {
    justify-content: center;
}

/* Баннер приветствия */
.welcome-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 1.1rem;
    color: #a13d5f;
    padding: 0.5rem 0;
}

.dark-theme .welcome-banner {
    color: #c9a9ff;
}

.welcome-sep {
    opacity: 0.4;
    font-size: 0.8rem;
}

/* Подзаголовок под японским заголовком */
.page-subtitle {
    display: block;
    font-size: 0.95rem;
    color: #b34e71;
    font-weight: 300;
    letter-spacing: 2px;
    margin-top: 0.4rem;
    border: none;
}

.dark-theme .page-subtitle {
    color: #b79ad9;
}

/* Дерево сакуры — SVG */
.tree-box {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.tree-box svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Заголовок релакса */
.relax-title {
    text-align: center;
    font-size: 1.8rem;
    color: #a13d5f;
    margin-top: 1rem;
    font-weight: 300;
    letter-spacing: 4px;
}

.relax-subtitle {
    display: block;
    font-size: 0.95rem;
    color: #b34e71;
    margin-top: 0.3rem;
    letter-spacing: 3px;
    opacity: 0.7;
}

.main-content--relax {
    justify-content: flex-start;
    padding-top: 1rem;
}
.keyboard-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 60px;
    padding: 8px 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    text-decoration: none;
    font-size: 0.95rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    transition: all 0.2s;
    display: inline-block;
}

.light-theme .keyboard-link {
    color: #3a3a3a;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

.keyboard-link:hover {
    background: #ffb7c5;
    color: #fff !important;
    text-shadow: none;
    transform: translateY(-2px);
}

.dark-theme .keyboard-link:hover {
    background: #6b4f9c;
}

/* Ссылки сказок внутри карточки */
.story-links {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    flex-direction: row !important;
    gap: 0.4rem;
    margin: 0.5rem 0;
    width: 100%;
}

.story-links a {
    text-decoration: none;
    color: #691c3a;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    transition: all 0.2s;
    font-size: 0.85rem;
    text-align: center;
    border: 1px solid transparent;
    flex: 0 1 auto;
}

.story-links a:hover {
    background: #ffd0d9;
    border-color: #ffb7c5;
}

.dark-theme .story-links a {
    color: #e0c9ff;
}

.dark-theme .story-links a:hover {
    background: #5a3f8a;
    border-color: #9d7ad9;
}

.story-links a small {
    opacity: 0.6;
    font-weight: 400;
}

.inner-page--stories {
    min-height: auto !important;
    padding: 1.5rem 1rem !important;
}

.inner-page--stories h3 {
    margin-bottom: 0.5rem !important;
}

.inner-page--stories p {
    margin-bottom: 0.3rem !important;
}