/* Стили для Магического Шара (Final Mesmerizing Edition) */

.tool-wrapper {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 2rem 0;
    perspective: 1000px;
}

/* --- ПОЛЕ ВВОДА И КНОПКА --- */
.input-section {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#user-question {
    width: 100%;
    max-width: 320px;
    padding: 12px 20px;
    font-size: 1.1rem;
    border: 2px solid var(--base-color-depressed);
    border-radius: 30px;
    background: var(--bg-color);
    color: var(--text-color);
    text-align: center;
    transition: all 0.3s ease;
    outline: none;
    font-family: 'Roboto', sans-serif;
}

#user-question:focus {
    border-color: #1e5ad4;
    box-shadow: 0 0 15px rgba(30, 90, 212, 0.2);
}

#ask-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 30px;
    min-width: 200px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* --- ШАР --- */
.magic-ball-container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.ball {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle at 35% 35%, #444 0%, #111 40%, #000 85%);
    box-shadow: inset -10px -10px 30px rgba(255,255,255,0.05), inset 10px 10px 40px rgba(0,0,0,0.8), 0 30px 60px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.reflection {
    position: absolute;
    top: 10%;
    left: 15%;
    width: 30%;
    height: 18%;
    background: radial-gradient(ellipse, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 60%);
    border-radius: 50%;
    transform: rotate(-45deg);
    filter: blur(3px);
    pointer-events: none;
}

/* --- ОКОШКО С ЖИДКОСТЬЮ --- */
.inner-window {
    width: 50%;
    height: 50%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    z-index: 2;
    
    /* ЦВЕТ: Сделали центр более насыщенным синим, чтобы туман был виден */
    background: radial-gradient(circle at 50% 50%, 
        #002855 0%,   /* Глубокий океан */
        #00081a 60%,  /* Темная вода */
        #000 100%
    );
    
    border: 4px solid #151515;
    box-shadow: inset 0 0 30px #000, 0 0 0 2px #222;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === ЭФФЕКТ ТУМАНА (ТУРБУЛЕНТНОСТЬ) === */
.mist {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    opacity: 0.35; /* Чуть виднее */
    
    /* Шум */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
    
    /* Вращение по часовой */
    animation: mist-spin 40s linear infinite;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
}

/* Второй слой для хаоса */
.mist-2 {
    opacity: 0.25;
    /* Вращение ПРОТИВ часовой и с другой скоростью */
    animation: mist-spin-reverse 30s linear infinite;
    /* Чуть меняем масштаб, чтобы узор не совпадал */
    transform: scale(1.2);
}

@keyframes mist-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes mist-spin-reverse {
    from { transform: rotate(360deg) scale(1.2); }
    to { transform: rotate(0deg) scale(1.2); }
}

/* БЛИК СТЕКЛА (ЛИНЗА) */
.window-glare {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%;
    /* Более сложный блик: сверху светлый, снизу темный */
    background: linear-gradient(150deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 30%, transparent 50%);
    pointer-events: none;
    z-index: 5;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

/* --- ТРЕУГОЛЬНИК --- */
.triangle-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; 
    transform: scale(0.6) rotate(10deg);
    filter: blur(15px);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
}

.triangle {
    width: 0; height: 0;
    border-left: 65px solid transparent;
    border-right: 65px solid transparent;
    border-top: 105px solid #1041a3; 
    position: relative;
    
    margin-top: 35px; 
    
    /* === НЕОНОВОЕ СВЕЧЕНИЕ === */
    /* Это создает эффект электрического края */
    filter: drop-shadow(0 0 8px rgba(0, 150, 255, 0.8));
}

#answer-text {
    position: absolute;
    top: -95px; 
    left: 50%;  
    transform: translateX(-50%); 
    width: 90px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    color: #ffffff;
    
    /* Усиленное свечение текста */
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    
    font-family: 'Roboto', 'Lato', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    line-height: 1.3;
    text-transform: none; 
    word-wrap: break-word;
}

/* --- СОСТОЯНИЯ --- */
.ball.idle .inner-window {
    background: radial-gradient(circle, #0a0a0a 20%, #000 90%);
}
/* В покое туман скрываем, чтобы не отвлекал от восьмерки */
.ball.idle .mist { opacity: 0; }

.ball.idle .triangle-wrapper {
    opacity: 1; filter: blur(0); transform: scale(1) rotate(0);
}
.ball.idle .triangle { border-top-color: transparent; margin-top: 0; filter: none; }

.ball.idle #answer-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -130px);
    font-size: 8rem;
    color: #1a1a1a;
    text-shadow: 1px 1px 1px rgba(255,255,255,0.05);
    width: auto;
    font-weight: 700;
}

.reveal .triangle-wrapper {
    opacity: 1; transform: scale(1) rotate(0deg); filter: blur(0.5px);
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(3px, -2px) rotate(2deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
.reveal .triangle { animation: float 5s ease-in-out infinite; }

@keyframes shake-hard {
    0% { transform: translate(0, 0) rotate(0deg); }
    15% { transform: translate(-8px, -8px) rotate(-5deg); }
    30% { transform: translate(8px, 8px) rotate(5deg); }
    45% { transform: translate(-6px, 6px) rotate(-3deg); }
    60% { transform: translate(6px, -6px) rotate(3deg); }
    75% { transform: translate(-3px, 3px) rotate(-1deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
.shaking { animation: shake-hard 0.5s ease-in-out; }

.shadow {
    width: 60%; height: 30px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.6), transparent 70%);
    border-radius: 50%; margin: -30px auto 0; z-index: -1;
}

/* ========================================= */
/* === АДАПТАЦИЯ ДЛЯ ПК (БОЛЬШОЙ ШАР) === */
/* ========================================= */
@media (min-width: 768px) {
    .magic-ball-container {
        width: 480px; height: 480px;
    }
    #user-question {
        max-width: 400px; font-size: 1.3rem; padding: 15px 25px;
    }
    #ask-btn {
        font-size: 1.2rem; padding: 15px 40px;
    }
    .triangle-wrapper {
        transform: scale(0.8) rotate(10deg);
    }
    .triangle {
        border-left-width: 90px;
        border-right-width: 90px;
        border-top-width: 150px;
        margin-top: 50px;
        /* Усиливаем свечение для большого шара */
        filter: drop-shadow(0 0 12px rgba(0, 150, 255, 0.9));
    }
    #answer-text {
        font-size: 1.1rem; width: 130px; top: -130px;
    }
    .ball.idle #answer-text {
        font-size: 12rem; transform: translate(-50%, -190px);
    }
    .shadow {
        width: 70%; margin-top: -40px;
    }
}