/* Configurable Variables */
:root {
    --crystal-ball-size: 220px;
    --crystal-ball-glow-color: #8A2BE2;
    --crystal-ball-glow-intensity: 0.5;
    --crystal-ball-highlight-size: 40%;
    --crystal-ball-highlight-opacity: 0.6;
}

/* Base Styles */
body {
    font-family: 'Philosopher', serif;
    text-align: center;
    margin: 0;
    padding: 0;
    background-color: #0a0a1a;
    color: #e0e0ff;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Stars Background */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" preserveAspectRatio="none"><circle cx="500" cy="500" r="1" fill="white" opacity="0.8"/></svg>') repeat;
    background-size: 100px 100px;
    animation: twinkle 5s infinite;
    z-index: -1;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    50% { opacity: 0.8; }
    100% { opacity: 0.3; }
}

/* Main Container */
.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    background: radial-gradient(circle at center, rgba(75, 0, 130, 0.4) 0%, rgba(10, 10, 26, 0.8) 70%);
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

/* Typography */
h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.8);
    letter-spacing: 2px;
}

p {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    max-width: 600px;
    line-height: 1.6;
    font-style: italic;
    opacity: 0.9;
}

/* Audio Controls */
.audio-control {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background: rgba(30, 30, 60, 0.6);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 30px;
    padding: 5px 15px;
    backdrop-filter: blur(5px);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.3);
    z-index: 10;
}

.audio-btn {
    background: transparent;
    border: none;
    color: #e0e0ff;
    cursor: pointer;
    padding: 8px;
    margin: 0;
    font-size: 1.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.3s ease;
}

.audio-btn:hover {
    background: rgba(138, 43, 226, 0.3);
}

#volume-slider {
    appearance: none;
    width: 80px;
    height: 5px;
    border-radius: 5px;
    background: rgba(138, 43, 226, 0.3);
    outline: none;
    margin-left: 10px;
}

#volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #9370DB;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(138, 43, 226, 0.8);
}

#volume-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #9370DB;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(138, 43, 226, 0.8);
}

/* Crystal Ball Styles */
#crystal-ball {
    width: var(--crystal-ball-size);
    height: var(--crystal-ball-size);
    position: relative;
    margin: 1rem auto;
    transition: all 0.5s ease;
    /* Add a subtle ambient glow to make the animation transition smoother */
    filter: drop-shadow(0 0 5px rgba(138, 43, 226, 0.2));
}

#crystal-ball-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 10px rgba(138, 43, 226, var(--crystal-ball-glow-intensity)));
    transition: all 0.5s ease;
}

#crystal-ball-highlight {
    position: absolute;
    top: 15%;
    left: 35%;
    width: calc(var(--crystal-ball-highlight-size) * 0.4);
    height: calc(var(--crystal-ball-highlight-size) * 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, var(--crystal-ball-highlight-opacity));
    transform: rotate(-25deg);
    z-index: 2;
    pointer-events: none;
    animation: highlight-shift 5s infinite ease-in-out;
}

@keyframes highlight-shift {
    0% { transform: rotate(-25deg) translateX(0); }
    50% { transform: rotate(-20deg) translateX(40px); }
    100% { transform: rotate(-25deg) translateX(0); }
}

/* Glowing Animation */
#crystal-ball.glowing #crystal-ball-image {
    filter: drop-shadow(0 0 30px rgba(138, 43, 226, 1));
    animation: pulse 9s infinite;
    transform-origin: center;
    animation: pulse 9s infinite, subtle-shake 0.9s infinite;
}

#crystal-ball.glowing #crystal-ball-highlight {
    animation: highlight-pulse 9s infinite, highlight-move 3s infinite;
}

@keyframes pulse {
    0% { filter: drop-shadow(0 0 10px rgba(138, 43, 226, var(--crystal-ball-glow-intensity))); transform: scale(1); }
    50% { filter: drop-shadow(0 0 35px rgba(138, 43, 226, 1)); transform: scale(1.05); }
    100% { filter: drop-shadow(0 0 10px rgba(138, 43, 226, var(--crystal-ball-glow-intensity))); transform: scale(1); }
}

@keyframes highlight-pulse {
    0% { opacity: var(--crystal-ball-highlight-opacity); }
    50% { opacity: 0.9; }
    100% { opacity: var(--crystal-ball-highlight-opacity); }
}

@keyframes subtle-shake {
    0% { transform: translateX(0) scale(1); }
    25% { transform: translateX(-2px) scale(1.02); }
    50% { transform: translateX(0) scale(1.05); }
    75% { transform: translateX(2px) scale(1.02); }
    100% { transform: translateX(0) scale(1); }
}

@keyframes highlight-move {
    0% { transform: rotate(-25deg) translateX(0); }
    25% { transform: rotate(-20deg) translateX(20px); }
    50% { transform: rotate(-15deg) translateX(10px); }
    75% { transform: rotate(-20deg) translateX(-10px); }
    100% { transform: rotate(-25deg) translateX(0); }
}

/* Fortune Display */
#fortune-container {
    display: none;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(30, 30, 60, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(138, 43, 226, 0.3);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
    max-width: 80%;
    backdrop-filter: blur(5px);
    position: relative;
    z-index: 5;
}

#divination-text {
    color: #ffc400;
    font-size: 1.4rem;
    font-style: italic;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.7);
    font-weight: bold;
}

#fortune {
    font-size: 1.75rem;
    font-weight: bold;
    line-height: 1.5;
    color: #ffc400;
    position: relative;
    text-shadow: 0 0 5px rgba(138, 43, 226, 0.5);
}

/* Home Link */
.home-link {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.home-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: white;
    background: linear-gradient(135deg, #483D8B, #191970);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
    transition: all 0.3s ease;
}

.home-button i {
    margin-right: 6px;
}

.home-button:hover {
    background: linear-gradient(135deg, #5D4EA8, #2D2D7D);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.8);
}


/* urgent Link */
.urgent-link {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.urgent-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: white;
    background: linear-gradient(135deg, #8b3d3d, #701919);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
    transition: all 0.3s ease;
}

.urgent-button i {
    margin-right: 6px;
}

.urgent-button:hover {
    background: linear-gradient(135deg, #64a84e, #347d2d);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.8);
}

/* Button Styles */
button {
    display: inline-block;
    padding: 12px 24px;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #9370DB, #483D8B);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
    letter-spacing: 1px;
}

button:hover {
    background: linear-gradient(135deg, #8A2BE2, #4B0082);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.8);
}

button:active {
    transform: translateY(1px);
}

#retry {
    display: none;
    background: linear-gradient(135deg, #8b823d, #706119);
    font-size: 0.9rem;
    padding: 10px 20px;
}

/* Responsive Styles */
@media (max-width: 600px) {
    :root {
        --crystal-ball-size: 180px;
    }
    
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    h1 {
        font-size: 2rem;
        margin-top: 60px; /* Add space for audio controls */
    }
    
    p {
        font-size: 1rem;
    }
    
    #fortune {
        font-size: 1.3rem;
    }
    
    .audio-control {
        top: 10px;
        right: 10px;
        padding: 3px 10px;
        /* Center control horizontally on mobile */
        right: 50%;
        transform: translateX(50%);
    }
    
    #volume-slider {
        width: 60px;
    }
    
    .container {
        padding: 10px;
    }
    
    .home-link {
        top: 10px;
        left: 10px;
    }
    
    .home-button {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    #divination-text {
        font-size: 1.6rem;
        color: palegreen;
    }
}