/* --- Общие настройки --- */
body {
    background: #f6f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    font-family: 'Helvetica Neue', sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 0;
}

.container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* ✅ УБРАЛИ: transition: all 0.3s ease; */
    max-width: 90%;
    width: 100%;
    position: relative;
    z-index: 10;
    padding: 20px 0;
}

/* --- Стартовая кнопка --- */
button {
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:active {
    transform: scale(0.97);
}

#startButton {
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 24px;
    /* ✅ ДОБАВИЛИ: transition только для transform */
    transition: transform 0.3s ease;
}

/* --- Поле ввода с кнопкой отправки --- */
#inputWrapper {
    position: relative;
    margin-top: 20px;
    width: 100%;
    max-width: 450px;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#inputWrapper.show {
    display: block;
}

#inputWrapper input {
    width: 100%;
    padding: 12px 50px 12px 20px;
    font-size: 16px;
    border-radius: 25px;
    border: 2px solid #000;
    outline: none;
    box-sizing: border-box;
}

#inputWrapper input::placeholder {
    color: #666;
    font-style: normal;
    font-size: 14px;
    text-overflow: ellipsis;
}

#inputWrapper input:placeholder-shown {
    text-overflow: ellipsis;
}

@keyframes scrollPlaceholder {
    0%, 20% { text-indent: 0; }
    80%, 100% { text-indent: -50px; }
}

#inputWrapper input.long-placeholder::placeholder {
    animation: scrollPlaceholder 4s ease-in-out infinite;
}

#sendButton {
    position: absolute;
    top: 50%;
    right: 5px;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
}

#sendButton:after {
    content: "↑";
}

/* --- Результаты --- */
#userText {
    margin-top: 30px;
    font-size: 20px;
    font-weight: 400;
    color: #333;
    opacity: 0;
    transition: all 0.5s ease;
    max-width: 500px;
}

#reaction {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    opacity: 0;
    transition: all 0.5s ease;
    max-width: 500px;
    line-height: 1.5;
}

#userText.show,
#reaction.show {
    opacity: 1;
}

#reactionGif {
    margin-top: 30px;
    max-width: 400px;
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
    border-radius: 12px;
    display: none;
    opacity: 0;
    transition: all 0.5s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    z-index: 5;
}

#reactionGif.show {
    display: block;
    opacity: 1;
}

#reactionSound {
    display: none;
}

/* --- Нижние кнопки --- */
#footerButtons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
    opacity: 0;
    transition: all 0.5s ease;
    justify-content: center;
    flex-wrap: wrap;
}

#footerButtons.show {
    opacity: 1;
}

#footerButtons button {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 12px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    min-width: 80px;
}

#footerButtons button:hover {
    background: #333;
}

#homeButton {
    background: #000;
}

#homeButton:hover {
    background: #444;
}

/* --- КОНФЕТТИ И ЭФФЕКТЫ --- */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.emoji-burst {
    position: fixed;
    font-size: 30px;
    pointer-events: none;
    z-index: 100;
    animation: emojiFloat 3s ease-out forwards;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.3));
}

@keyframes emojiFloat {
    0% {
        transform: translateY(0) scale(0) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: translateY(-50px) scale(1.2) rotate(180deg);
    }
    100% {
        transform: translateY(-400px) scale(0.8) rotate(720deg);
        opacity: 0;
    }
}

.sparkle {
    position: fixed;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, gold 0%, orange 50%, transparent 100%);
    pointer-events: none;
    z-index: 100;
    border-radius: 50%;
    animation: sparkleAnim 1.5s ease-out forwards;
}

@keyframes sparkleAnim {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

.firework {
    position: fixed;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
}

@keyframes fireworkExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.attribution {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.5);
    padding: 2px 5px;
    border-radius: 3px;
    text-decoration: none;
}

.attribution:hover {
    color: white;
}

/* ✅ Анимация точек загрузки */
.loading-dots::after {
    content: '...';
    display: inline-block;
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ✅ МОБИЛЬНЫЕ УСТРОЙСТВА (iOS и Android) */
@media screen and (max-width: 768px) {
    #reactionGif {
        max-height: 45vh;
        max-width: 90vw;
    }
    
    #userText {
        font-size: 18px;
        margin-top: 20px;
    }
    
    #reaction {
        font-size: 16px;
        margin-top: 15px;
    }
    
    #footerButtons {
        margin-top: 15px;
        gap: 8px;
    }
    
    #footerButtons button {
        padding: 8px 16px;
        font-size: 13px;
        min-width: 70px;
    }
    
    .container {
        max-width: 95%;
    }
}

/* ✅ ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (iPhone SE, малые Android) */
@media screen and (max-width: 375px) {
    #reactionGif {
        max-height: 40vh;
    }
    
    #startButton {
        padding: 15px 30px;
        font-size: 20px;
    }
    
    #userText {
        font-size: 16px;
    }
    
    #reaction {
        font-size: 14px;
    }
}

/* ✅ ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ на мобильных */
@media screen and (max-height: 600px) and (orientation: landscape) {
    #reactionGif {
        max-height: 35vh;
    }
    
    body {
        padding: 10px 0;
    }
    
    .container {
        padding: 10px 0;
    }
    
    #userText {
        margin-top: 15px;
    }
    
    #reaction {
        margin-top: 10px;
    }
    
    #footerButtons {
        margin-top: 10px;
        margin-bottom: 10px;
    }
}