* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hero {
    min-height: 100vh;
    background:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.7), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40% 70%, rgba(255,255,255,0.5), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 60% 20%, rgba(255,255,255,0.6), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 80% 40%, rgba(255,255,255,0.4), rgba(0,0,0,0)),
        linear-gradient(135deg, #000000 0%, #0a0a12 25%, #111 50%, #0a0a12 75%, #000000 100%);
    background-size: 200px 200px, 250px 250px, 170px 170px, 220px 220px, 100% 100%;
    background-repeat: repeat, repeat, repeat, repeat, no-repeat;
    background-attachment: fixed;
    position: relative;
    overflow-y: auto;
    animation: shimmer 60s linear infinite;
    transition: opacity 0.8s ease;
}

.hero.fade {
    opacity: 0;
}

.poet-image {
    position: fixed;
    bottom: 10%;
    right: 10%;
    width: auto;
    height: 45vh;
    filter: drop-shadow(0 0 20px rgba(255,255,255,0.1));
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
    animation-delay: 0.8s;
    cursor: pointer;
}

.poet-image:hover {
    filter: drop-shadow(0 0 25px rgba(255,255,255,0.7));
}

/* ===== МЕНЮ — 21 стихотворение в 2 частях ===== */
.books-menu {
    position: relative;
    width: 55%;
    padding: 2rem 0 2rem 3%;
}

.books-menu ul {
    list-style: none;
}

.books-menu li {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
    margin: 0.6rem 0;
    padding-left: 0.5rem;
}

/* Задержки появления (21 стих + 2 заголовка = 23) */
.books-menu li:nth-child(1)  { animation-delay: 0.05s; }
.books-menu li:nth-child(2)  { animation-delay: 0.1s; }
.books-menu li:nth-child(3)  { animation-delay: 0.15s; }
.books-menu li:nth-child(4)  { animation-delay: 0.2s; }
.books-menu li:nth-child(5)  { animation-delay: 0.25s; }
.books-menu li:nth-child(6)  { animation-delay: 0.3s; }
.books-menu li:nth-child(7)  { animation-delay: 0.35s; }
.books-menu li:nth-child(8)  { animation-delay: 0.4s; }
.books-menu li:nth-child(9)  { animation-delay: 0.45s; }
.books-menu li:nth-child(10) { animation-delay: 0.5s; }
.books-menu li:nth-child(11) { animation-delay: 0.55s; }
.books-menu li:nth-child(12) { animation-delay: 0.6s; }
.books-menu li:nth-child(13) { animation-delay: 0.65s; }
.books-menu li:nth-child(14) { animation-delay: 0.7s; }
.books-menu li:nth-child(15) { animation-delay: 0.75s; }
.books-menu li:nth-child(16) { animation-delay: 0.8s; }
.books-menu li:nth-child(17) { animation-delay: 0.85s; }
.books-menu li:nth-child(18) { animation-delay: 0.9s; }
.books-menu li:nth-child(19) { animation-delay: 0.95s; }
.books-menu li:nth-child(20) { animation-delay: 1.0s; }
.books-menu li:nth-child(21) { animation-delay: 1.05s; }
.books-menu li:nth-child(22) { animation-delay: 1.1s; }
.books-menu li:nth-child(23) { animation-delay: 1.15s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.books-menu a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    padding: 0.4rem 0;
    display: inline-block;
    position: relative;
    transition: all 0.5s ease;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.books-menu a:hover {
    color: white;
    letter-spacing: 2.5px;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.6),
        0 0 20px rgba(255, 255, 255, 0.4),
        0 0 30px rgba(255, 255, 255, 0.2);
}

/* Заголовки частей */
.section-header {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    letter-spacing: 2px;
    margin-top: 1.5rem !important;
    margin-bottom: 0.3rem !important;
    pointer-events: none;
}

@keyframes shimmer {
    0%   { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 200px 200px, 250px 250px, 170px 170px, 220px 220px, 0 0; }
}

/* ===== КНОПКА НАЗАД ===== */
.back-home {
    position: fixed;
    top: 2rem;
    right: 2rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    transition: all 0.3s ease;
    z-index: 50;
}

.back-home:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ===== МОДАЛКА СТИХОТВОРЕНИЯ ===== */
.poem-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background:
        radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.7), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 40% 70%, rgba(255,255,255,0.5), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 60% 20%, rgba(255,255,255,0.6), rgba(0,0,0,0)),
        radial-gradient(2px 2px at 80% 40%, rgba(255,255,255,0.4), rgba(0,0,0,0)),
        linear-gradient(135deg, #000000 0%, #0a0a12 25%, #111 50%, #0a0a12 75%, #000000 100%);
    background-size: 200px 200px, 250px 250px, 170px 170px, 220px 220px, 100% 100%;
    background-repeat: repeat, repeat, repeat, repeat, no-repeat;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.poem-modal.active {
    display: flex;
    animation: fadeIn 0.5s ease-out forwards, shimmer 60s linear infinite;
}

.poem-content {
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    box-sizing: border-box;
    color: #fff;
    text-align: left;
    position: relative;
    margin: 0 auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.3) rgba(0, 0, 0, 0.1);
}

.poem-content::-webkit-scrollbar { width: 8px; }
.poem-content::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: 4px; }
.poem-content::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.3); border-radius: 4px; }

.poem-title {
    font-size: 1.6rem;
    margin-bottom: 3rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: left;
    letter-spacing: 2px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1s ease;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.poem-modal.active .poem-title {
    opacity: 1;
    transform: translateY(0);
}

.poem-text {
    font-size: 1.4rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 1);
    text-shadow:
        0 0 15px rgba(255, 255, 255, 0.3),
        0 0 30px rgba(255, 255, 255, 0.2);
    text-align: left;
    margin-left: 20px;
}

/* ===== СТРОКИ СТИХА ===== */
.poem-line {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.poem-text p:nth-child(1)  { animation-delay: 0.1s; }
.poem-text p:nth-child(2)  { animation-delay: 0.15s; }
.poem-text p:nth-child(3)  { animation-delay: 0.2s; }
.poem-text p:nth-child(4)  { animation-delay: 0.25s; }
.poem-text p:nth-child(5)  { animation-delay: 0.3s; }
.poem-text p:nth-child(6)  { animation-delay: 0.35s; }
.poem-text p:nth-child(7)  { animation-delay: 0.4s; }
.poem-text p:nth-child(8)  { animation-delay: 0.45s; }
.poem-text p:nth-child(9)  { animation-delay: 0.5s; }
.poem-text p:nth-child(10) { animation-delay: 0.55s; }
.poem-text p:nth-child(11) { animation-delay: 0.6s; }
.poem-text p:nth-child(12) { animation-delay: 0.65s; }
.poem-text p:nth-child(13) { animation-delay: 0.7s; }
.poem-text p:nth-child(14) { animation-delay: 0.75s; }
.poem-text p:nth-child(15) { animation-delay: 0.8s; }
.poem-text p:nth-child(16) { animation-delay: 0.85s; }
.poem-text p:nth-child(17) { animation-delay: 0.9s; }
.poem-text p:nth-child(18) { animation-delay: 0.95s; }
.poem-text p:nth-child(19) { animation-delay: 1.0s; }
.poem-text p:nth-child(20) { animation-delay: 1.05s; }
.poem-text p:nth-child(21) { animation-delay: 1.1s; }
.poem-text p:nth-child(22) { animation-delay: 1.15s; }
.poem-text p:nth-child(23) { animation-delay: 1.2s; }
.poem-text p:nth-child(24) { animation-delay: 1.25s; }
.poem-text p:nth-child(25) { animation-delay: 1.3s; }
.poem-text p:nth-child(26) { animation-delay: 1.35s; }
.poem-text p:nth-child(27) { animation-delay: 1.4s; }
.poem-text p:nth-child(28) { animation-delay: 1.45s; }
.poem-text p:nth-child(29) { animation-delay: 1.5s; }
.poem-text p:nth-child(30) { animation-delay: 1.55s; }
.poem-text p:nth-child(31) { animation-delay: 1.6s; }
.poem-text p:nth-child(32) { animation-delay: 1.65s; }
.poem-text p:nth-child(33) { animation-delay: 1.7s; }
.poem-text p:nth-child(34) { animation-delay: 1.75s; }
.poem-text p:nth-child(35) { animation-delay: 1.8s; }
.poem-text p:nth-child(36) { animation-delay: 1.85s; }
.poem-text p:nth-child(37) { animation-delay: 1.9s; }
.poem-text p:nth-child(38) { animation-delay: 1.95s; }
.poem-text p:nth-child(39) { animation-delay: 2.0s; }
.poem-text p:nth-child(40) { animation-delay: 2.05s; }
.poem-text p:nth-child(41) { animation-delay: 2.1s; }
.poem-text p:nth-child(42) { animation-delay: 2.15s; }
.poem-text p:nth-child(43) { animation-delay: 2.2s; }
.poem-text p:nth-child(44) { animation-delay: 2.25s; }
.poem-text p:nth-child(45) { animation-delay: 2.3s; }
.poem-text p:nth-child(46) { animation-delay: 2.35s; }
.poem-text p:nth-child(47) { animation-delay: 2.4s; }
.poem-text p:nth-child(48) { animation-delay: 2.45s; }
.poem-text p:nth-child(49) { animation-delay: 2.5s; }
.poem-text p:nth-child(50) { animation-delay: 2.55s; }

/* Заглушка для ненаписанных стихотворений */
.poem-unavailable {
    opacity: 1 !important;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    animation: none !important;
}

/* ===== КНОПКА ЗАКРЫТИЯ ===== */
.close-poem {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.5s ease;
    background: transparent;
    font-size: 1.5rem;
}

.close-poem:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ===== НАВИГАЦИЯ СТРЕЛКАМИ ===== */
.poem-navigation {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-bottom: 2rem;
    padding: 0 2rem;
}

.nav-prev, .nav-next {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 2rem;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
}

.nav-prev:hover, .nav-next:hover {
    color: white;
    text-shadow:
        0 0 10px rgba(255, 255, 255, 0.6),
        0 0 20px rgba(255, 255, 255, 0.4);
    transform: scale(1.2);
}

/* ===== КВАНТОВЫЙ ОВЕРЛЕЙ ===== */
#flashOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    transition: opacity 0.3s ease-in-out;
}

#flashOverlay.active {
    opacity: 1;
}

/* ===== МОБИЛЬНАЯ АДАПТАЦИЯ ===== */
@media screen and (max-width: 420px) {
    .books-menu {
        width: 100%;
        padding: 1rem;
    }

    .books-menu a {
        font-size: 0.8rem;
    }

    .poet-image {
        position: relative;
        display: block;
        margin: 2rem auto;
        left: 0;
        bottom: auto;
        transform: none;
        height: 30vh;
        animation-delay: 0.6s;
        cursor: pointer;
    }

    .poet-image:hover {
        filter: drop-shadow(0 0 25px rgba(255,255,255,0.7));
    }

    .poem-text {
        margin-left: 10px;
        font-size: 1.1rem;
    }
}
