/* =============================================
   MAGIC8BALL.CSS — Magic 8 Ball game styles
   Sofia's Game Arcade
   ============================================= */

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Back nav handled by base.css */

/* ---- Game container ---- */
.game-container {
    text-align: center;
    padding: var(--space-xl);
    max-width: 480px;
    width: 100%;
}

/* ---- Title ---- */
.title {
    font-size: 2.4rem;
    font-weight: 800;
    margin-bottom: var(--space-xs);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.credit {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
}

/* ---- The 8 Ball ---- */
.eight-ball {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #444, #111 60%, #000 100%);
    margin: 0 auto var(--space-xl);
    position: relative;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5),
                inset 0 -4px 12px rgba(255, 255, 255, 0.05);
    transition: transform var(--transition-fast);
}

/* White circle with the "8" on top */
.ball-number {
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Triangle answer window */
.triangle-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    /* Triangle made with borders */
    border-left: 55px solid transparent;
    border-right: 55px solid transparent;
    border-bottom: 95px solid #1a1a6e;
    filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.3));
}

.answer-text {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.3;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.answer-text.visible {
    opacity: 1;
}

/* ---- Shake animation ---- */
.eight-ball.shaking {
    animation: shakeBall 1.2s ease;
}

@keyframes shakeBall {
    0%   { transform: translateX(0)   rotate(0deg); }
    10%  { transform: translateX(-12px) rotate(-5deg); }
    20%  { transform: translateX(12px)  rotate(5deg); }
    30%  { transform: translateX(-10px) rotate(-4deg); }
    40%  { transform: translateX(10px)  rotate(4deg); }
    50%  { transform: translateX(-8px)  rotate(-3deg); }
    60%  { transform: translateX(8px)   rotate(3deg); }
    70%  { transform: translateX(-5px)  rotate(-2deg); }
    80%  { transform: translateX(5px)   rotate(2deg); }
    90%  { transform: translateX(-2px)  rotate(-1deg); }
    100% { transform: translateX(0)     rotate(0deg); }
}

/* ---- Input area ---- */
.input-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.question-input {
    width: 100%;
    max-width: 360px;
    padding: 0.8rem 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.05rem;
    text-align: center;
    outline: none;
    transition: border-color var(--transition-med);
}

.question-input::placeholder {
    color: var(--text-muted);
}

.question-input:focus {
    border-color: var(--accent-purple);
}

/* ---- Button states ---- */
.btn {
    display: inline-block;
    padding: 0.9rem 2.4rem;
    border-radius: var(--radius-full);
    border: none;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-fast),
                box-shadow var(--transition-fast);
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
}

.btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: scale(0.97);
}

.btn-start {
    background: var(--accent-green);
    color: #0b0e1a;
    padding: 1rem 3rem;
    font-size: 1.3rem;
    animation: pulseGlow 2.5s ease-in-out infinite;
}

.btn-start:hover {
    background: #22c55e;
    animation: none;
    box-shadow: 0 0 24px rgba(74, 222, 128, 0.4);
}

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
    transform: none;
    box-shadow: none;
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(74, 222, 128, 0.2); }
    50%      { box-shadow: 0 0 24px rgba(74, 222, 128, 0.45); }
}

/* ---- Responsive ---- */
@media (max-width: 420px) {
    .game-container {
        padding: 1.2rem;
    }

    .title {
        font-size: 1.8rem;
    }

    .eight-ball {
        width: 190px;
        height: 190px;
    }

    .ball-number {
        top: 22px;
        width: 42px;
        height: 42px;
        font-size: 1.5rem;
    }

    .triangle-window {
        border-left: 44px solid transparent;
        border-right: 44px solid transparent;
        border-bottom: 76px solid #1a1a6e;
    }

    .answer-text {
        top: 22px;
        width: 72px;
        font-size: 0.6rem;
    }

    .question-input {
        font-size: 0.95rem;
    }
}
