/* 8 Ball game container */
.ball-game {
    text-align: center;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

/* Question input */
.question-input {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
}

.question-input input {
    width: 100%;
    padding: 12px 20px;
    font-size: 1.1em;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--background-color);
    color: var(--text-color);
    font-family: 'Patrick Hand', cursive;
}

.question-input input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.question-input::after {
    content: '';
    position: absolute;
    left: -4px;
    right: -4px;
    top: -4px;
    bottom: -4px;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    transform: rotate(-1deg);
    z-index: -1;
    opacity: 0.5;
}

/* Ball container */
.ball-container {
    width: 250px;
    height: 250px;
    margin: 40px auto;
    position: relative;
    perspective: 1000px;
    background: rgba(var(--surface-rgb), 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
}

/* Ball style */
.magic-ball {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s ease-out;
    cursor: pointer;
}

.magic-ball.shaking {
    animation: shake 0.5s ease-in-out;
}

.ball-body {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #000000, #1a1a1a);
    box-shadow: 
        inset 0 0 50px rgba(255, 255, 255, 0.1),
        0 0 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-window {
    width: 120px;
    height: 120px;
    background: #2b2b2b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Patrick Hand', cursive;
    font-size: 1.2em;
    color: white;
    text-align: center;
    padding: 10px;
    transform: translateZ(1px);
    position: relative;
}

.answer-window::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: rotate(-3deg);
}

/* Ball animation */
@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Result display */
.ball-result {
    font-family: 'Patrick Hand', cursive;
    font-size: 28px;
    min-height: 40px;
    color: var(--primary-color);
    margin: 20px 0;
    padding: 10px;
    position: relative;
}

.ball-result::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 100px;
    height: 2px;
    background: var(--text-color);
    transform: translateX(-50%) rotate(-1deg);
    opacity: 0.3;
}

/* 统计信息 */
.ball-stats {
    margin-top: 30px;
    padding: 20px;
    background-color: var(--surface-color);
    border-radius: 12px;
}

.stats-title {
    font-family: 'Patrick Hand', cursive;
    color: var(--text-color);
    font-size: 24px;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.stats-title::after {
    content: '';
    position: absolute;
    left: -10px;
    right: -10px;
    bottom: -5px;
    height: 2px;
    background: var(--primary-color);
    transform: rotate(-1deg);
    opacity: 0.5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 10px;
}

.stat-item {
    background-color: var(--background-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transform: rotate(-1deg);
    z-index: 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    z-index: 1;
}

.stat-count {
    font-family: 'Patrick Hand', cursive;
    font-size: 24px;
    color: var(--primary-color);
    z-index: 1;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title {
        font-size: 2em;
    }

    .ball-container {
        width: 200px;
        height: 200px;
    }

    .answer-window {
        width: 100px;
        height: 100px;
        font-size: 1em;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-item {
        padding: 10px;
    }
}

/* 无障碍支持 */
@media (prefers-reduced-motion: reduce) {
    .magic-ball {
        transition: none;
    }

    .magic-ball.shaking {
        animation: none;
    }
}

.answer-display {
    background: rgba(var(--surface-rgb), 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
}

/* Navigation bar */
.top-nav {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333;
    font-size: 1.5em;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.nav-brand:hover {
    transform: scale(1.05);
}

.nav-text {
    position: relative;
    z-index: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2em;
    }

    .ball-container {
        width: 200px;
        height: 200px;
        padding: 20px;
    }

    .answer-window {
        width: 100px;
        height: 100px;
        font-size: 1em;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-item {
        padding: 10px;
    }

    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
}

/* Accessibility support */
@media (prefers-reduced-motion: reduce) {
    .magic-ball {
        transition: none;
    }

    .magic-ball.shaking {
        animation: none;
    }

    .shake-button {
        animation: none;
    }
}