/* ==========================================
   基础样式和全局设置
   ========================================== */

/* CSS Custom Properties */
:root {
    /* Colors */
    --color-gold: #FFD700;
    --color-primary: #4CAF50;
    --color-danger: #ff4757;
    --color-bg-dark: #000033;
    --color-bg-card: rgba(30, 60, 114, 0.9);
    --color-text-light: #e3f2fd;
    --color-text-white: #fff;

    /* Z-index layers */
    --z-game-ui: 100;
    --z-modal: 1000;
    --z-mobile-nav: 10000;
    --z-overlay: 10000;
    --z-spotlight: 100001;
    --z-error-notification: 10000;
    --z-learning-overlay: 20000;
    --z-virtual-keyboard: 10002;
    --z-leaderboard: 10002;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* 全局动画关键帧 */
@keyframes movingStars {
    from {
        transform: translateZ(-2000px);
        opacity: 0;
    }
    to {
        transform: translateZ(1000px);
        opacity: 1;
    }
}

/* 基础元素样式 */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #000033;
    min-height: 100vh;
    color: white;
    overflow: hidden;
    transition: box-shadow 0.3s ease-in-out;
}

/* 通用容器样式 */
.stats-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    max-height: 50vh;
    overflow-y: auto;
}

.stats-container h2 {
    color: #FFD700;
    margin-bottom: 15px;
}

/* 通用 tooltip 样式 */
.tooltip {
    visibility: hidden;
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: pre-line;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2100;
    pointer-events: none;
}

/* tooltip 箭头 */
.tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 5px 5px 5px;
    border-style: solid;
    border-color: transparent transparent rgba(0, 0, 0, 0.8) transparent;
}

/* 显示 tooltip */
.difficulty-btn:hover .tooltip,
.toggle-btn:hover .tooltip,
.crazy-switch:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* 为不同类型的按钮调整 tooltip 位置 */
.difficulty-btn .tooltip {
    bottom: -45px;
    width: max-content;
    font-size: 14px;
    white-space: nowrap;
    z-index: 2500;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 10px 15px;
}

.toggle-btn .tooltip {
    bottom: -60px;
    width: max-content;
    z-index: 2400;
}

.crazy-switch .tooltip {
    bottom: -30px;
    width: max-content;
    z-index: 2300;
}