* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-callout: none;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Arial', sans-serif;
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8b0 50%, #ffd3b6 100%);
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    color: #5d4e37;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* 主菜单样式 */
#main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    max-width: 1200px;
}

.title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: #5d4e37;
    text-shadow: 2px 2px 8px rgba(255, 255, 255, 0.6);
    margin-bottom: 20px;
    text-align: -webkit-center;
    width: 100%;
}

.subtitle {
    font-size: 1rem;
    color: #7a6b5a;
    margin-bottom: 30px;
    text-align: -webkit-center;
    width: 100%;
}

/* 菜单按钮 */
.menu-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.menu-button {
    background: linear-gradient(145deg, #ffffff 0%, #f5f5f5 100%);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 28px;
    font-size: 1.05rem;
    color: #5d4e37;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-button:hover,
.menu-button:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #88d8b0;
}

.menu-button:active {
    transform: translateY(0);
}

/* 游戏网格 */
.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 900px;
}

.game-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid #e8e8e8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
}

.game-card:hover,
.game-card:active {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    background: linear-gradient(145deg, #ffffff 0%, #fff9f0 100%);
    border-color: #88d8b0;
}

.game-card:active {
    transform: translateY(-2px);
}

.game-icon {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.game-name {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #333;
    font-weight: 600;
    letter-spacing: 0.02em;
}


/* ========================================
   猫咪友好视觉增强样式
   使用猫咪可见的蓝色和黄色系
   ======================================== */

/* CSS 变量 - 猫咪友好配色 */
:root {
    /* 蓝色系 - 猫咪最敏感 */
    --cat-blue-primary: #00D4FF;
    --cat-blue-light: #7DF9FF;
    --cat-blue-dark: #0099CC;

    /* 黄色系 - 猫咪次敏感 */
    --cat-yellow-primary: #FFD700;
    --cat-yellow-light: #FFEB3B;
    --cat-yellow-dark: #FFA500;

    /* 中性色 */
    --cat-neutral-light: #F5F5F5;
    --cat-neutral-dark: #333333;

    /* 动画时间 */
    --transition-fast: 200ms;
    --transition-normal: 400ms;
    --transition-slow: 600ms;
}

/* 主菜单背景动画 */
#main-menu {
    background: linear-gradient(135deg,
            rgba(0, 212, 255, 0.1) 0%,
            rgba(125, 249, 255, 0.05) 50%,
            rgba(255, 215, 0, 0.1) 100%);
    position: relative;
    overflow: hidden;
}

#main-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 215, 0, 0.15) 0%, transparent 40%);
    animation: backgroundPulse 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes backgroundPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* 标题闪烁动画 */
.title {
    background: linear-gradient(90deg,
            var(--cat-blue-primary),
            var(--cat-yellow-primary),
            var(--cat-blue-primary));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 3s linear infinite;
}

@keyframes titleShimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* 游戏卡片增强 */
.game-card {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal) ease;
}

.game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle,
            rgba(0, 212, 255, 0.2) 0%,
            transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
    pointer-events: none;
}

.game-card:hover::before,
.game-card:active::before {
    opacity: 1;
}

.game-card:hover,
.game-card:active {
    border-color: var(--cat-blue-primary);
    box-shadow:
        0 8px 25px rgba(0, 212, 255, 0.2),
        0 0 20px rgba(0, 212, 255, 0.1);
}

/* 游戏图标空闲动画 */
.game-icon {
    animation: iconIdle 3s ease-in-out infinite;
    transform-origin: center;
}

@keyframes iconIdle {

    0%,
    100% {
        transform: scale(1) rotate(0deg) translateY(0);
    }

    25% {
        transform: scale(1.05) rotate(2deg) translateY(-2px);
    }

    50% {
        transform: scale(1) rotate(0deg) translateY(0);
    }

    75% {
        transform: scale(1.05) rotate(-2deg) translateY(-2px);
    }
}

/* 菜单按钮增强 */
.menu-button {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal) ease;
}

.menu-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle,
            rgba(0, 212, 255, 0.3) 0%,
            transparent 70%);
    transform: translate(-50%, -50%);
    transition: width var(--transition-normal) ease,
        height var(--transition-normal) ease;
    pointer-events: none;
}

.menu-button:hover::after,
.menu-button:active::after {
    width: 200%;
    height: 200%;
}

.menu-button:hover,
.menu-button:active {
    border-color: var(--cat-blue-primary);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.25);
}


/* 游戏界面样式 */
#game-screen {
    background: #1a1a2e;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* 分数显示增强 */
.score-display {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 30px;
    border-radius: 25px;
    color: var(--cat-yellow-primary);
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 100;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.1);
    transition: transform var(--transition-fast) ease;
}

.score-display #score {
    display: inline-block;
    transition: transform var(--transition-fast) ease;
}

/* 退出按钮增强 */
#exit-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal) ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#exit-button:hover,
#exit-button:active {
    background: rgba(255, 100, 100, 0.6);
    border-color: rgba(255, 100, 100, 0.5);
    transform: scale(1.1);
}

/* 退出指示器 */
#exit-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle,
            rgba(0, 212, 255, 0.8) 0%,
            rgba(0, 153, 204, 0.6) 100%);
    opacity: 0;
    pointer-events: none;
    z-index: 99;
    transition: all var(--transition-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#exit-indicator.active {
    opacity: 0.8;
}

#exit-indicator .countdown {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

/* 退出提示 */
#exit-hint {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    opacity: 0;
    transition: all var(--transition-normal) ease;
    z-index: 100;
}

#exit-hint.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 退出确认弹窗 */
#exit-confirmation {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal) ease;
}

#exit-confirmation.active {
    opacity: 1;
    visibility: visible;
}

.exit-dialog {
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 320px;
    transform: scale(0.8);
    transition: transform var(--transition-normal) ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#exit-confirmation.active .exit-dialog {
    transform: scale(1);
}

.exit-dialog h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.exit-dialog p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1rem;
}

.exit-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.exit-buttons button {
    padding: 12px 30px;
    border-radius: 25px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast) ease;
}

#cancel-exit {
    background: linear-gradient(145deg, #f0f0f0 0%, #e0e0e0 100%);
    color: #666;
}

#cancel-exit:hover {
    background: linear-gradient(145deg, #e8e8e8 0%, #d8d8d8 100%);
}

#confirm-exit {
    background: linear-gradient(145deg, var(--cat-blue-primary) 0%, var(--cat-blue-dark) 100%);
    color: white;
}

#confirm-exit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}


/* 设置面板增强 */
#settings-panel,
#stats-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    max-width: 90vw;
    height: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 300;
    transition: right var(--transition-normal) ease;
    overflow-y: auto;
    padding: 30px;
}

#settings-panel.active,
#stats-panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.panel-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.close-panel {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: #666;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast) ease;
}

.close-panel:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    color: #555;
    font-weight: 600;
    margin-bottom: 10px;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right,
            var(--cat-blue-primary) 0%,
            var(--cat-blue-primary) var(--value, 50%),
            #e0e0e0 var(--value, 50%),
            #e0e0e0 100%);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cat-blue-primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.4);
    transition: transform var(--transition-fast) ease;
}

.setting-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.setting-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    color: #333;
    background: white;
    cursor: pointer;
    transition: border-color var(--transition-fast) ease;
}

.setting-group select:focus {
    outline: none;
    border-color: var(--cat-blue-primary);
}

/* 开关样式 */
.toggle-switch {
    position: relative;
    width: 60px;
    height: 32px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 32px;
    transition: background var(--transition-fast) ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 26px;
    height: 26px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-fast) ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--cat-blue-primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(28px);
}

/* 奖励弹窗增强 */
.reward-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(145deg, #ffffff 0%, #fff9e6 100%);
    border-radius: 25px;
    padding: 40px 50px;
    text-align: center;
    z-index: 400;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 215, 0, 0.3);
    border: 3px solid var(--cat-yellow-primary);
    opacity: 0;
    transition: all var(--transition-normal) ease;
}

.reward-popup.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.reward-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 15px;
    animation: rewardBounce 0.6s ease infinite;
}

@keyframes rewardBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-10px) scale(1.1);
    }
}

.reward-text {
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
}

/* 计时器弹窗 */
.timer-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(145deg, #ffffff 0%, #f0f8ff 100%);
    border-radius: 25px;
    padding: 40px;
    text-align: center;
    z-index: 400;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--cat-blue-primary);
    opacity: 0;
    transition: all var(--transition-normal) ease;
    max-width: 350px;
}

.timer-popup.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.timer-popup h3 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.timer-popup p {
    color: #666;
    margin-bottom: 25px;
}

.timer-popup button {
    padding: 12px 30px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(145deg, var(--cat-blue-primary) 0%, var(--cat-blue-dark) 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast) ease;
}

.timer-popup button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

/* 统计面板样式 */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #666;
    font-size: 1rem;
}

.stat-value {
    color: var(--cat-blue-primary);
    font-size: 1.2rem;
    font-weight: bold;
}


/* ========================================
   高级视觉增强 - Phase 1/2/3
   ======================================== */

/* ===== 浮动猫爪背景粒子 ===== */
#main-menu::after {
    content: '🐾';
    position: absolute;
    font-size: 30px;
    opacity: 0.1;
    animation: floatPaw1 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.floating-paw {
    position: absolute;
    font-size: 24px;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
    animation: floatPaw 20s ease-in-out infinite;
}

.floating-paw:nth-child(1) {
    left: 10%;
    top: 20%;
    animation-delay: 0s;
    animation-duration: 18s;
}

.floating-paw:nth-child(2) {
    left: 80%;
    top: 15%;
    animation-delay: -3s;
    animation-duration: 22s;
}

.floating-paw:nth-child(3) {
    left: 30%;
    top: 70%;
    animation-delay: -6s;
    animation-duration: 16s;
}

.floating-paw:nth-child(4) {
    left: 70%;
    top: 60%;
    animation-delay: -9s;
    animation-duration: 20s;
}

.floating-paw:nth-child(5) {
    left: 50%;
    top: 40%;
    animation-delay: -12s;
    animation-duration: 24s;
}

@keyframes floatPaw {

    0%,
    100% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0.08;
    }

    25% {
        transform: translateY(-30px) rotate(15deg) scale(1.1);
        opacity: 0.12;
    }

    50% {
        transform: translateY(-10px) rotate(-10deg) scale(0.95);
        opacity: 0.1;
    }

    75% {
        transform: translateY(-40px) rotate(5deg) scale(1.05);
        opacity: 0.15;
    }
}

@keyframes floatPaw1 {

    0%,
    100% {
        top: 20%;
        left: 85%;
        transform: rotate(0deg) scale(1);
    }

    33% {
        top: 60%;
        left: 10%;
        transform: rotate(120deg) scale(1.2);
    }

    66% {
        top: 30%;
        left: 50%;
        transform: rotate(240deg) scale(0.9);
    }
}

/* ===== 增强标题动画 ===== */
.title {
    background: linear-gradient(90deg,
            var(--cat-blue-primary),
            var(--cat-yellow-primary),
            var(--cat-blue-light),
            var(--cat-yellow-light),
            var(--cat-blue-primary));
    background-size: 300% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 4s ease-in-out infinite, titleFloat 3s ease-in-out infinite;
    text-shadow: none;
    filter: drop-shadow(0 2px 10px rgba(0, 212, 255, 0.3)) drop-shadow(0 4px 20px rgba(255, 215, 0, 0.2));
    position: relative;
    z-index: 1;
}

@keyframes titleFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* ===== 3D游戏卡片增强 ===== */
.game-card {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal) cubic-bezier(0.34, 1.56, 0.64, 1);
    background: linear-gradient(145deg, #ffffff 0%, #f8f8f8 100%);
    border: 2px solid #e8e8e8;
    z-index: 1;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 14px;
    background: linear-gradient(135deg,
            rgba(0, 212, 255, 0.15) 0%,
            rgba(255, 215, 0, 0.1) 50%,
            rgba(0, 212, 255, 0.15) 100%);
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
}

@keyframes borderGlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.game-card:hover::before,
.game-card:active::before {
    opacity: 0.8;
}

.game-card:hover,
.game-card:active {
    transform: translateY(-6px);
    border-color: var(--cat-blue-primary);
    z-index: 2;
    box-shadow:
        0 12px 28px rgba(0, 212, 255, 0.2),
        0 6px 12px rgba(0, 0, 0, 0.08);
}

/* ===== 游戏图标增强发光 ===== */
.game-icon {
    animation: iconIdle 3s ease-in-out infinite, iconGlow 2s ease-in-out infinite;
    transform-origin: center;
    filter: drop-shadow(0 2px 8px rgba(0, 212, 255, 0.3));
    transition: all var(--transition-normal) ease;
}

.game-card:hover .game-icon,
.game-card:active .game-icon {
    animation: iconExcited 0.5s ease-in-out infinite;
    filter: drop-shadow(0 0 15px var(--cat-blue-primary)) drop-shadow(0 0 30px var(--cat-yellow-primary));
    transform: scale(1.15);
}

@keyframes iconGlow {

    0%,
    100% {
        filter: drop-shadow(0 2px 8px rgba(0, 212, 255, 0.3));
    }

    50% {
        filter: drop-shadow(0 2px 15px rgba(255, 215, 0, 0.5));
    }
}

@keyframes iconExcited {

    0%,
    100% {
        transform: scale(1.15) rotate(0deg);
    }

    25% {
        transform: scale(1.2) rotate(5deg);
    }

    75% {
        transform: scale(1.2) rotate(-5deg);
    }
}

/* ===== 分数显示增强 ===== */
.score-display {
    background: linear-gradient(135deg,
            rgba(0, 0, 0, 0.7) 0%,
            rgba(20, 20, 40, 0.8) 100%);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 215, 0, 0.4);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 215, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.score-display.pulse {
    animation: scorePulse 0.3s ease-out;
}

@keyframes scorePulse {
    0% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
        border-color: var(--cat-yellow-primary);
    }

    100% {
        transform: translateX(-50%) scale(1);
    }
}

.score-display #score {
    display: inline-block;
    min-width: 2ch;
    text-align: center;
}

.score-display #score.pop {
    animation: scorePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scorePop {
    0% {
        transform: scale(1);
        color: var(--cat-yellow-primary);
    }

    50% {
        transform: scale(1.5);
        color: #ffffff;
        text-shadow: 0 0 20px var(--cat-yellow-primary);
    }

    100% {
        transform: scale(1);
        color: var(--cat-yellow-primary);
    }
}

/* ===== 退出按钮脉冲边框 ===== */
#exit-button {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.6) 0%, rgba(30, 30, 50, 0.7) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: visible;
}

#exit-button::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cat-blue-primary), var(--cat-yellow-primary));
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-normal) ease;
    animation: exitPulse 2s ease-in-out infinite;
}

@keyframes exitPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.6;
    }
}

#exit-button:hover::before,
#exit-button:active::before {
    opacity: 1;
}

#exit-button .exit-icon {
    transition: transform var(--transition-fast) ease;
}

#exit-button:hover .exit-icon {
    transform: rotate(90deg);
}

/* ===== 面板毛玻璃效果增强 ===== */
#settings-panel,
#stats-panel {
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.95) 0%,
            rgba(248, 248, 252, 0.98) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid rgba(0, 212, 255, 0.2);
    box-shadow:
        -10px 0 40px rgba(0, 0, 0, 0.15),
        -2px 0 10px rgba(0, 212, 255, 0.1);
}

/* 面板关闭按钮悬停效果 */
.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: linear-gradient(135deg, var(--cat-blue-primary) 0%, var(--cat-blue-dark) 100%);
    color: white;
    border-color: var(--cat-blue-primary);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

/* ===== 开关控件发光 ===== */
.toggle-switch input:checked+.slider {
    background: linear-gradient(135deg, var(--cat-blue-primary) 0%, var(--cat-blue-dark) 100%);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
}

/* ===== 奖励弹窗3D翻转 ===== */
.reward-popup {
    transform-style: preserve-3d;
    animation: none;
}

.reward-popup.active {
    animation: rewardFlipIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes rewardFlipIn {
    0% {
        transform: translate(-50%, -50%) perspective(1000px) rotateY(-90deg) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) perspective(1000px) rotateY(0deg) scale(1);
        opacity: 1;
    }
}

.reward-popup .reward-icon {
    animation: rewardBounce 0.6s ease infinite, rewardGlow 1s ease-in-out infinite alternate;
}

@keyframes rewardGlow {
    0% {
        filter: drop-shadow(0 0 10px var(--cat-yellow-primary));
    }

    100% {
        filter: drop-shadow(0 0 30px var(--cat-yellow-primary)) drop-shadow(0 0 50px var(--cat-blue-primary));
    }
}

/* ===== 确认弹窗增强 ===== */
.confirmation-content {
    background: linear-gradient(145deg, #ffffff 0%, #f8f8fc 100%);
    border-radius: 24px;
    padding: 35px;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(0, 212, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.confirmation-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cat-blue-primary), var(--cat-yellow-primary), var(--cat-blue-primary));
    background-size: 200% 100%;
    animation: borderGlow 3s ease-in-out infinite;
}

/* ===== 统计卡片动画 ===== */
.stat-card {
    background: linear-gradient(145deg, #ffffff 0%, #f5f5f8 100%);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(0, 212, 255, 0.1);
    transition: all var(--transition-normal) ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.3);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--cat-blue-primary), var(--cat-yellow-primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== 屏幕过渡动画 ===== */
.screen {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.screen:not(.active) {
    transform: scale(0.95);
}

.screen.transitioning-out {
    animation: screenFadeOut 0.4s ease-out forwards;
}

.screen.transitioning-in {
    animation: screenFadeIn 0.4s ease-out forwards;
}

@keyframes screenFadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes screenFadeIn {
    0% {
        opacity: 0;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== 彩带雨容器 ===== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
}

/* ===== 加载动画 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8b0 50%, #ffd3b6 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top-color: var(--cat-blue-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #5d4e37;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* ===== 星光爆炸效果类 ===== */
.star-burst {
    position: absolute;
    pointer-events: none;
    animation: starBurst 0.6s ease-out forwards;
}

@keyframes starBurst {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: scale(2) rotate(180deg);
        opacity: 0;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .game-card {
        min-height: 140px;
        padding: 20px 15px;
    }

    .menu-buttons {
        flex-direction: column;
        align-items: center;
    }

    .menu-button {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }

    #settings-panel,
    #stats-panel {
        width: 100%;
        max-width: 100vw;
    }
}

@media (max-width: 480px) {
    .game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .game-card {
        min-height: 120px;
        padding: 15px 10px;
    }

    .title {
        font-size: 1.8rem;
    }

    .score-display {
        padding: 10px 20px;
        font-size: 1.2rem;
    }
}