:root {
    --primary-color: #d63384;
    --secondary-color: #ffca28;
    --text-dark: #2c3e50;
    --text-light: #ecf0f1;
    --text-loading-color: #c71585;
}

body {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    transition: background 1s ease, transform 0.5s ease;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 20px;
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    overflow: hidden;
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://www.transparenttextures.com/patterns/flowers.png') repeat;
    opacity: 0.1;
    z-index: -1;
}

body.flipped {
    transform: rotate(180deg);
}

.container {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 2rem 2rem 1rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    animation: scaleIn 0.8s ease-out;
    position: relative; /* Базовый элемент для позиционирования */
    width: 900px;
    max-width: 90%;
    height: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    gap: 1rem;
    overflow: hidden;
    z-index: 1;
    margin-top: -100px;
}
#progress-container {
    width: 80%;
    max-width: 600px;
    margin: 0 auto 1.5rem auto; /* Отступ снизу от контейнера */
    display: none; /* Изначально скрыт, показывается через JS */
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: absolute; /* Абсолютное позиционирование */
    top: 50px; /* Смещение вверх над контейнером */
    left: 50%; /* Центрирование по горизонтали */
    transform: translateX(-50%); /* Корректировка для точного центрирования */
    z-index: 10; /* Чтобы был над контейнером */
}

#encouragement-text {
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.5s ease;
    margin: 0;
}

#progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

#progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.5s ease-in-out;
}

.progress-marks {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.mark {
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 5px rgba(214, 51, 132, 0.5);
}

.mark-25 { left: 25%; }
.mark-50 { left: 50%; }
.mark-75 { left: 75%; }
.mark-100 { left: 100%; }

h1#greeting {
    font-size: 3.5rem;
    margin: 0;
    color: var(--primary-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    display: inline-flex;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
}

h1#greeting span {
    display: inline-block;
}

h1#greeting.active span {
    animation: bloom 0.8s ease-in-out;
}

@keyframes bloom {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
    100% { transform: translateY(0) scale(1); }
}

.lead {
    font-family: 'Bad Script', cursive;
    font-size: 1.8rem;
    color: var(--text-dark);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 1rem;
    line-height: 1.8;
    animation: gentlePulse 4s ease-in-out infinite;
    text-align: center;
    word-wrap: break-word;
    max-width: 80%;
    overflow-wrap: break-word;
}

@keyframes gentlePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.95; }
    100% { transform: scale(1); opacity: 1; }
}

#dynamic-text {
    font-family: 'Caveat', cursive;
    font-size: 1.5rem;
    font-weight: 700;
    color: #d63384;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    transition: opacity 0.3s ease, height 0.3s ease;
    text-align: center;
    word-wrap: break-word;
    max-width: 80%;
    overflow-wrap: break-word;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dynamic-text.flipped,
.btn-warning.flipped {
    transform: rotate(180deg);
    transition: transform 0.5s ease;
}

.particle {
    position: absolute;
    font-size: 1.8rem;
    pointer-events: none;
    animation-timing-function: ease-out;
    z-index: -1;
    opacity: 0.9;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.btn-warning {
    background: linear-gradient(90deg, #d63384, #ffca28);
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(214, 51, 132, 0.4);
    position: relative;
    overflow: hidden;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem auto;
    width: fit-content;
    text-transform: uppercase;
}

.btn-warning::before {
    content: '🌸';
    position: absolute;
    left: -100%;
    transition: all 0.3s ease;
}

.btn-warning:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(214, 51, 132, 0.5);
}

.btn-warning:active {
    transform: scale(0.95);
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 6px 20px rgba(214, 51, 132, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 8px 25px rgba(214, 51, 132, 0.6); }
    100% { transform: scale(1); box-shadow: 0 6px 20px rgba(214, 51, 132, 0.4); }
}

.btn-warning:active::before {
    left: 0;
}

.btn-gradient {
    background: linear-gradient(90deg, #ff7eb3, #ff758c);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 117, 140, 0.3);
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 117, 140, 0.4);
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.8s ease;
    font-family: 'Caveat', cursive;
    text-align: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.loading-text-container {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    max-width: 90%;
    margin-top: 20px;
    animation: fadeIn 1s ease-in;
}

.loading-text {
    font-size: 1.5rem;
    line-height: 1.5;
    color: var(--text-loading-color);
    text-shadow: 1px 1px 5px rgba(255, 105, 180, 0.3);
    animation: textGlow 3s ease-in-out infinite;
    position: relative;
}

.loading-text p {
    margin: 0.8rem 0;
    position: relative;
    opacity: 0;
}

.fade-in-text {
    animation: fadeIn 1s ease-in forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.loading-text p:nth-child(1) { animation-delay: 0.5s; }
.loading-text p:nth-child(2) { animation-delay: 1s; }
.loading-text p:nth-child(3) { animation-delay: 1.5s; }
.loading-text p:nth-child(4) { animation-delay: 2s; }
.loading-text p:nth-child(5) { animation-delay: 2.5s; }

.loading-text p:nth-child(5) {
    font-size: 1.3rem;
}

@keyframes textGlow {
    0% { text-shadow: 1px 1px 5px rgba(255, 105, 180, 0.3); }
    50% { text-shadow: 1px 1px 10px rgba(255, 105, 180, 0.5); }
    100% { text-shadow: 1px 1px 5px rgba(255, 105, 180, 0.3); }
}

.flower-spinner {
    width: 80px;
    height: 80px;
    position: relative;
    animation: flowerSpin 2s linear infinite;
}

.flower-spinner::before {
    content: '🌸';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    animation: flowerBloom 2s ease-in-out infinite;
    text-shadow: 0 0 15px rgba(255, 105, 180, 0.8);
}

@keyframes flowerSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes flowerBloom {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.falling-petal {
    position: absolute;
    font-size: 1.5rem;
    pointer-events: none;
    animation: fall 5s linear infinite;
    color: #ff69b4;
}

.flower-rain {
    position: absolute;
    font-size: 2rem;
    pointer-events: none;
    animation: fallFlowerRain 5s linear forwards;
    color: #ff69b4;
    text-shadow: 0 0 5px rgba(255, 105, 180, 0.8);
}

@keyframes fall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes fallFlowerRain {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.bouquet {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 1001;
    animation: bouquetGrow 2s ease-out;
}

.bouquet img {
    max-width: 200px;
    height: auto;
}

@keyframes bouquetGrow {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.dancing-cat {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 1001;
    animation: dance 1s infinite;
}

@keyframes dance {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(10deg); }
    50% { transform: translate(-50%, -50%) rotate(0deg); }
    75% { transform: translate(-50%, -50%) rotate(-10deg); }
    100% { transform: translate(-50%, -50%) rotate(0deg); }
}

.secret-boss {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    opacity: 1;
    transition: opacity 0.5s ease;
    z-index: 2001;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.secret-boss img {
    max-width: 350px;
    height: auto;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.secret-boss p {
    margin: 0;
    font-family: 'Caveat', cursive;
    color: var(--primary-color);
}

.confetti {
    position: absolute;
    font-size: 1.5rem;
    opacity: 1;
    animation: fallConfetti 5s linear forwards;
}

@keyframes fallConfetti {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.notifications-container {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 300px;
    z-index: 2000;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.notification {
    background: linear-gradient(45deg, #ff9a9e, #fad0c4);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 1.2rem;
    color: #333;
    opacity: 1;
    transition: opacity 0.5s ease;
    border: 2px solid #333;
    white-space: normal;
    overflow-wrap: break-word;
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.block-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    max-width: 500px;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.block-message-text {
    font-size: 2rem;
    font-family: 'Caveat', cursive;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.block-message img {
    max-height: 500px;
    margin-top: 1rem;
    border-radius: 10px;
    transition: opacity 0.5s ease;
}

.music-player {
    padding: 1.5rem;
    max-width: 400px;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin: 10px auto;
    display: none;
}

.music-player audio {
    width: 100%;
    margin-top: 1rem;
    display: none;
}

.music-player #timeline {
    width: 100%;
    margin-top: 0.5rem;
}

.music-player div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.music-player button {
    margin-top: 0.5rem;
}

.test-buttons {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 10px;
    flex-wrap: wrap;
}

.test-buttons button {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
}

@media (max-width: 768px) {
    h1#greeting {
        font-size: 2rem;
        margin: 0.5rem 0;
    }
    .container {
        padding: 1rem;
        width: 90%;
        height: 80vh;
        max-height: 500px;
        justify-content: space-around;
        gap: 0.5rem;
        overflow: hidden;
        margin-top: -50px;
    }
    #progress-container {
        width: 90%;
        max-width: 300px;
        margin: 0 auto 1rem auto;
    }
    .btn-warning,
    .btn-gradient {
        width: 90%;
        max-width: 350px;
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }
    .lead {
        font-size: 1.2rem;
        padding: 0.3rem 0.8rem;
        max-width: 90%;
    }
    #dynamic-text {
        font-size: 1.2rem;
        max-width: 90%;
        min-height: 2.8rem;
    }
    #encouragement-text {
        font-size: 1rem;
    }
    .notifications-container {
        width: 250px;
        left: 10px;
        top: 10px;
    }
    .notification {
        font-size: 1rem;
        padding: 0.8rem 1.2rem;
        height: 50px;
        margin-bottom: 5px;
    }
    .block-message {
        padding: 1.5rem;
        max-width: 90%;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    .secret-boss {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
    .block-message-text {
        font-size: 1.5rem;
    }
    .block-message img {
        max-height: 300px;
    }
    .music-player {
        max-width: 90%;
        padding: 1rem;
        margin: 5px auto;
    }
    .music-player button {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
    .test-buttons {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        bottom: 10px;
    }
    .test-buttons button {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    .loading-text-container {
        padding: 1rem;
        max-width: 95%;
    }
    .loading-text {
        font-size: 1.2rem;
    }
    .flower-spinner {
        width: 60px;
        height: 60px;
    }
    .flower-spinner::before {
        font-size: 2.5rem;
    }
    .loading-text p:nth-child(5) {
        font-size: 1rem;
    }
    .flower-rain {
        font-size: 1.5rem;
    }
    .bouquet img {
        max-width: 150px;
    }
    .secret-boss img {
        max-width: 250px;
    }
}
