/* ============================================
   MAGIC 8-BALL - Airlinetechs
   ============================================ */

/* Modal Overlay */
.magic8-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(6px);
    animation: magic8-fadeIn 0.3s ease;
}
.magic8-overlay.active {
    display: flex;
}

@keyframes magic8-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Container */
.magic8-modal {
    background: linear-gradient(145deg, #1a1a2e, #0d0d1a);
    border: 1px solid rgba(198, 12, 48, 0.4);
    border-radius: 16px;
    padding: 30px 40px 35px;
    text-align: center;
    position: relative;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 0 60px rgba(198, 12, 48, 0.15), 0 20px 60px rgba(0,0,0,0.5);
}

/* Close Button */
.magic8-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    z-index: 2;
}
.magic8-close:hover {
    color: #C60C30;
    transform: scale(1.2);
}

/* Title */
.magic8-title {
    font-family: var(--font-display);
    color: #fff;
    font-size: 24px;
    margin: 0 0 6px 0;
    text-shadow: 0 0 15px rgba(198, 12, 48, 0.5);
}
.magic8-subtitle {
    color: #777;
    font-size: 13px;
    margin: 0 0 25px 0;
    font-style: italic;
}

/* 8-Ball Container */
.magic8-ball-wrap {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 25px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* The Ball */
.magic8-ball {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #4a4a4a, #1a1a1a 50%, #000 80%);
    position: relative;
    box-shadow:
        inset 0 -8px 20px rgba(0,0,0,0.8),
        inset 0 8px 20px rgba(255,255,255,0.05),
        0 8px 40px rgba(0,0,0,0.6),
        0 0 20px rgba(0,0,0,0.4);
    transition: transform 0.1s ease;
}

/* Glossy highlight on ball */
.magic8-ball::before {
    content: '';
    position: absolute;
    top: 12px; left: 28px;
    width: 70px;
    height: 40px;
    background: radial-gradient(ellipse, rgba(255,255,255,0.18), transparent);
    border-radius: 50%;
    transform: rotate(-25deg);
}

/* The "8" circle on top */
.magic8-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #2a2a5e, #0f0f2e);
    border: 3px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

/* The 8 or answer text */
.magic8-display {
    color: #fff;
    font-family: var(--font-display);
    font-size: 42px;
    line-height: 1;
    text-shadow: 0 0 10px rgba(100, 140, 255, 0.4);
    transition: opacity 0.3s ease;
    user-select: none;
}

/* Answer text (smaller, wrapped) */
.magic8-display.has-answer {
    font-family: 'Patua One', serif;
    font-size: 13px;
    line-height: 1.3;
    padding: 6px;
    text-align: center;
    color: #8cb4ff;
    text-shadow: 0 0 8px rgba(100, 160, 255, 0.6);
}

/* Shake animation */
@keyframes magic8-shake {
    0%   { transform: translate(0, 0) rotate(0deg); }
    10%  { transform: translate(-8px, -4px) rotate(-4deg); }
    20%  { transform: translate(8px, 2px) rotate(3deg); }
    30%  { transform: translate(-6px, 4px) rotate(-2deg); }
    40%  { transform: translate(6px, -2px) rotate(4deg); }
    50%  { transform: translate(-4px, 3px) rotate(-3deg); }
    60%  { transform: translate(5px, -3px) rotate(2deg); }
    70%  { transform: translate(-3px, 2px) rotate(-1deg); }
    80%  { transform: translate(3px, -1px) rotate(1deg); }
    90%  { transform: translate(-1px, 1px) rotate(0deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

.magic8-ball-wrap.shaking .magic8-ball {
    animation: magic8-shake 0.6s ease-in-out;
}

/* Fade answer in */
@keyframes magic8-answerReveal {
    0%   { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}
.magic8-display.revealing {
    animation: magic8-answerReveal 0.5s ease forwards;
}

/* Instruction text */
.magic8-instruction {
    color: #aaa;
    font-size: 14px;
    margin: 0;
    font-family: 'Patua One', serif;
    letter-spacing: 0.5px;
}
.magic8-instruction i {
    color: #C60C30;
    margin-right: 4px;
}

/* Subtle pulse hint on idle */
@keyframes magic8-pulse {
    0%, 100% { box-shadow: inset 0 -8px 20px rgba(0,0,0,0.8), inset 0 8px 20px rgba(255,255,255,0.05), 0 8px 40px rgba(0,0,0,0.6), 0 0 20px rgba(0,0,0,0.4); }
    50% { box-shadow: inset 0 -8px 20px rgba(0,0,0,0.8), inset 0 8px 20px rgba(255,255,255,0.05), 0 8px 40px rgba(0,0,0,0.6), 0 0 30px rgba(198,12,48,0.2); }
}
.magic8-ball.idle {
    animation: magic8-pulse 3s ease-in-out infinite;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .magic8-modal {
        padding: 25px 20px 30px;
    }
    .magic8-ball-wrap,
    .magic8-ball {
        width: 200px;
        height: 200px;
    }
    .magic8-number {
        width: 85px;
        height: 85px;
    }
    .magic8-display {
        font-size: 36px;
    }
    .magic8-display.has-answer {
        font-size: 11px;
    }
    .magic8-title {
        font-size: 20px;
    }
}
