:root {
    /* 默认主题颜色 - Cute Game UI 风格 */
    --theme-primary: #667eea;
    --theme-secondary: #764ba2;

    /* 马卡龙色系 */
    --bg-primary: #FAF9FB;
    --color-primary: #E0B4E8;
    --color-secondary: #C8E4F9;
    --color-accent: #FFF4D6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    margin: 0;
    padding: 0;
}

.background-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(224, 180, 232, 0.03) 0%,
        rgba(200, 228, 249, 0.03) 50%,
        rgba(255, 244, 214, 0.03) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* 浮动装饰圆圈 */
.background-decoration::before,
.background-decoration::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.background-decoration::before {
    top: 20%;
    left: 10%;
    width: 200px;
    height: 200px;
    background: var(--color-primary);
    animation-delay: 0s;
}

.background-decoration::after {
    bottom: 20%;
    right: 10%;
    width: 250px;
    height: 250px;
    background: var(--color-secondary);
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.1);
    }
}

.game-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: auto;  /* 自动宽度 */
}

.header {
    display: flex;
    gap: 12px;
    align-items: stretch;
    background: #FFFFFF;  /* 纯白背景 */
    padding: 12px;
    border-radius: 24px;  /* 大圆角 */
    min-height: 60px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);  /* 轻量阴影 */
    border: 1px solid #F0EEF2;  /* 细边框 */
    position: relative;
    overflow: hidden;
}

/* 为header添加光泽效果 */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(224, 180, 232, 0.1), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

.header-item {
    background-color: #F2E0F5;  /* 淡粉紫色背景 */
    color: #5A4963;  /* 深紫灰文字 */
    padding: 10px 18px;
    border-radius: 20px;  /* 大圆角 */
    font-size: 24px;
    font-weight: bold;
    min-width: 60px;
    min-height: 60px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 1px solid #E0B4E8;  /* 粉紫色边框 */
    position: relative;
    z-index: 1;
}

.header-item.target {
    font-size: 28px;
}

.header-item.score {
    min-width: 100px;
    background: linear-gradient(135deg, #B8E6D5 0%, #A3F4E1 100%);  /* 薄荷绿渐变 */
    color: #2c4a45;
    border-color: #9FD9C8;
    transition: all 0.3s ease;
}

.header-item.pause-btn {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    background: #E8F4FC;  /* 淡天蓝色 */
    border: 2px solid #C8E4F9;
}

.header-item.pause-btn:hover {
    background: #C8E4F9;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(200, 228, 249, 0.4);
    border-color: #A3D4F2;
}

.header-item.pause-btn:active {
    transform: translateY(-1px);
}

.header-item.help-btn {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    background: #FFF4D6;  /* 奶黄色 */
    border: 2px solid #FFE9B3;
    font-size: 24px;
}

.header-item.help-btn:hover {
    background: #FFE9B3;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(255, 244, 214, 0.4);
    border-color: #FFD68F;
}

.header-item.help-btn:active {
    transform: translateY(-1px);
}

.header-item.difficulty-btn {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    background: #F2E0F5;  /* 淡粉紫色 */
    font-size: 20px;
    min-width: 100px;
    border: 2px solid #E0B4E8;
}

.header-item.difficulty-btn:hover {
    background: #E0B4E8;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(224, 180, 232, 0.4);
    border-color: #C896D4;
}

.header-item.difficulty-btn:active {
    transform: translateY(-1px);
}

.header-item.mistakes-counter {
    font-size: 18px;
    min-width: 140px;
    background: linear-gradient(135deg, #FFB8B8 0%, #FFA3A3 100%);  /* 淡粉红色 */
    color: #8B3A3A;  /* 深红色文字 */
    border-color: #FF9999;
    transition: all 0.3s ease;
}

/* 为分数添加悬停效果 */
.header-item.score:hover {
    box-shadow: 0 4px 12px rgba(184, 230, 213, 0.5);
    transform: translateY(-2px);
}

/* 为倒计时添加悬停效果 */
.header-item.timer-display {
    background: #E8F4FC;  /* 淡天蓝色 */
    border-color: #C8E4F9;
}

.header-item.timer-display:hover {
    background: #D8EEFA;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 228, 249, 0.3);
}

/* 为错误计数添加悬停效果 */
.header-item.mistakes-counter:hover {
    box-shadow: 0 4px 12px rgba(255, 163, 163, 0.5);
    transform: translateY(-2px);
}

.emoji {
    font-size: 32px;
}

.flag-icon, .timer-icon {
    width: 30px;
    height: 30px;
}

.game-board {
    width: 100%;  /* 与功能栏同宽 */
    height: 500px;
    background-color: #ffffff;
    border: 3px solid #333333;
    border-radius: 10px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 1px;
    padding: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 10;
}

/* 步数计数器样式 */
.step-counter {
    position: absolute;
    bottom: 10px;  /* 底部对齐 */
    right: -130px;  /* 向右偏移，移到游戏区域右侧 */
    background-color: rgba(44, 74, 69, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;  /* 长方形圆角 */
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10;
    transition: all 0.3s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 100px;  /* 长方形最小宽度 */
    text-align: center;
}

.step-counter.warning {
    background-color: rgba(255, 165, 0, 0.9);
    border-color: rgba(255, 165, 0, 0.5);
    animation: pulse 0.5s ease-in-out;
}

.step-counter.danger {
    background-color: rgba(239, 83, 80, 0.9);
    border-color: rgba(239, 83, 80, 0.5);
    animation: shake 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cell {
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.cell:hover {
    background-color: rgba(190, 219, 253, 0.3);
    transform: scale(1.05);
}

.cell.selected {
    background-color: rgb(190, 219, 253);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(190, 219, 253, 0.8);
}

.cell.number {
    background-color: #ffffff;
}

.cell.number-1 { background-color: #ffffff; color: #000000; }
.cell.number-2 { background-color: #ffffff; color: #000000; }
.cell.number-3 { background-color: #ffffff; color: #000000; }
.cell.number-4 { background-color: #ffffff; color: #000000; }
.cell.number-5 { background-color: #ffffff; color: #000000; }
.cell.number-6 { background-color: #ffffff; color: #000000; }
.cell.number-7 { background-color: #ffffff; color: #000000; }
.cell.number-8 { background-color: #ffffff; color: #000000; }
.cell.number-9 { background-color: #ffffff; color: #000000; }

/* 选中状态的颜色优先级要高于数字颜色 */
.cell.number-1.selected,
.cell.number-2.selected,
.cell.number-3.selected,
.cell.number-4.selected,
.cell.number-5.selected,
.cell.number-6.selected,
.cell.number-7.selected,
.cell.number-8.selected,
.cell.number-9.selected {
    background-color: rgb(190, 219, 253) !important;
}

.cell.number-10 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #d84315;
    font-size: 24px;
    animation: glow 0.5s ease-in-out;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 1); }
}

/* +10S 时间奖励文字样式 */
.time-bonus {
    position: fixed;
    font-size: 32px;
    font-weight: bold;
    color: #4caf50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 9999;
    animation: floatUp 2s ease-out forwards;
}

@keyframes floatUp {
    0% {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -150px);
        opacity: 0;
    }
}

.cell.merging {
    animation: merge 0.3s ease-in-out;
}

@keyframes merge {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.cell.falling {
    animation: fall 0.3s ease-in;
}

@keyframes fall {
    0% { transform: translateY(-50px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* 倒计时样式 */
.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 26px;
    min-width: 110px;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);  /* 文字阴影增强可读性 */
}

/* 分数文字阴影（白色字体用较深阴影增强可读性） */
.header-item.score {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 错误计数文字阴影 */
.header-item.mistakes-counter {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 游戏结束弹窗样式 */
.game-over-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.game-over-modal.show {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: 30px;  /* 40px × 0.75 = 30px */
    padding: 60px 75px;  /* 80px × 0.75 = 60px, 100px × 0.75 = 75px */
    box-shadow: 0 22px 75px rgba(0, 0, 0, 0.5);  /* 30px × 0.75 = 22.5px, 100px × 0.75 = 75px */
    text-align: center;
    max-width: 600px;  /* 800px × 0.75 = 600px */
    animation: modalSlideIn 0.3s ease-out;
    position: relative;  /* 关键：让关闭按钮相对于此元素定位 */
}

@keyframes modalSlideIn {
    0% {
        transform: scale(0.7);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 48px;  /* 64px × 0.75 = 48px */
    color: #2c4a45;
    margin-bottom: 30px;  /* 40px × 0.75 = 30px */
    font-weight: bold;
}

.modal-message {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

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

.btn {
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
}

.btn-confirm {
    background-color: #66bb6a;
    color: white;
    box-shadow: 0 4px 10px rgba(102, 187, 106, 0.4);
}

.btn-confirm:hover {
    background-color: #57a05a;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 187, 106, 0.6);
}

.btn-confirm:active {
    transform: translateY(0);
}

.btn-cancel {
    background-color: #666;
    color: white;
    box-shadow: 0 4px 10px rgba(102, 102, 102, 0.4);
}

.btn-cancel:hover {
    background-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 102, 102, 0.6);
}

.btn-cancel:active {
    transform: translateY(0);
}

/* 难度选择弹窗样式 */
.difficulty-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.difficulty-modal.show {
    display: flex;
}

/* 弹窗关闭按钮 */
.modal-close-btn {
    position: absolute;
    top: 22px;  /* 30px × 0.75 = 22.5px */
    right: 22px;  /* 30px × 0.75 = 22.5px */
    width: 52px;  /* 70px × 0.75 = 52.5px */
    height: 52px;  /* 70px × 0.75 = 52.5px */
    background-color: transparent;
    border: 3px solid #666;  /* 4px × 0.75 = 3px */
    border-radius: 50%;
    color: #666;
    font-size: 42px;  /* 56px × 0.75 = 42px */
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.modal-close-btn:hover {
    background-color: #ef5350;
    border-color: #ef5350;
    color: white;
    transform: rotate(90deg);
}

.modal-close-btn:active {
    transform: rotate(90deg) scale(0.9);
}

.difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 22px;  /* 30px × 0.75 = 22.5px */
}

.difficulty-option {
    padding: 22px 60px;  /* 30px × 0.75 = 22.5px, 80px × 0.75 = 60px */
    font-size: 30px;  /* 40px × 0.75 = 30px */
    font-weight: bold;
    border: none;
    border-radius: 15px;  /* 20px × 0.75 = 15px */
    cursor: pointer;
    transition: all 0.3s;
    background-color: #66bb6a;
    color: white;
    box-shadow: 0 6px 15px rgba(102, 187, 106, 0.4);  /* 8px × 0.75 = 6px, 20px × 0.75 = 15px */
}

.difficulty-option:hover {
    background-color: #57a05a;
    transform: translateX(7px);  /* 10px × 0.75 = 7.5px */
    box-shadow: 0 9px 22px rgba(102, 187, 106, 0.6);  /* 12px × 0.75 = 9px, 30px × 0.75 = 22.5px */
}

.difficulty-option:active {
    transform: translateX(3px);  /* 4px × 0.75 = 3px */
}

.difficulty-option[data-difficulty="easy"] {
    background-color: #66bb6a;
}

.difficulty-option[data-difficulty="medium"] {
    background-color: #ffa726;
}

.difficulty-option[data-difficulty="hard"] {
    background-color: #ef5350;
}

/* ===== 连击系统样式 ===== */

/* 连击文字动画 */
.combo-text {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    font-weight: bold;
    text-shadow: 0 0 20px currentColor, 0 4px 8px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    letter-spacing: 2px;
}

.combo-text.show {
    animation: comboTextAppear 1s ease-out;
}

@keyframes comboTextAppear {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -60%) scale(1.1);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -80%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -150%) scale(0.9);
        opacity: 0;
    }
}

/* ===== 特殊方块样式 ===== */

.special-block {
    font-size: 20px !important;
    font-weight: bold;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    gap: 2px;
}

/* 炸弹块 💣 */
.special-bomb {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.6);
    animation: bombPulse 1s ease-in-out infinite;
}

@keyframes bombPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 107, 107, 0.6);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 107, 107, 0.9);
    }
}

/* 彩虹块 🌈 */
.special-rainbow {
    background: linear-gradient(
        135deg,
        #ff0000 0%,
        #ff7f00 14%,
        #ffff00 28%,
        #00ff00 42%,
        #0000ff 57%,
        #4b0082 71%,
        #9400d3 85%,
        #ff0000 100%
    );
    background-size: 200% 200%;
    color: #fff;
    animation: rainbowShift 3s linear infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
}

@keyframes rainbowShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 时间块 ⏰ */
.special-time {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.6);
    animation: timeGlow 1.5s ease-in-out infinite;
}

@keyframes timeGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(79, 172, 254, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 242, 254, 0.9);
        transform: scale(1.05);
    }
}

/* 冻结块 ❄️ */
.special-frozen {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #0066cc;
    box-shadow: 0 0 15px rgba(168, 237, 234, 0.6);
    border: 2px solid #00ccff;
    animation: frozenShimmer 2s ease-in-out infinite;
}

@keyframes frozenShimmer {
    0%, 100% {
        box-shadow: 0 0 15px rgba(168, 237, 234, 0.6);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 204, 255, 0.9);
    }
}

/* 加分块 ⭐ */
.special-star {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #d84315;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: starTwinkle 1s ease-in-out infinite;
}

@keyframes starTwinkle {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-5deg) scale(1.05);
    }
    75% {
        transform: rotate(5deg) scale(1.05);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 237, 78, 1);
    }
}

/* 特殊方块选中状态 */
.special-block.selected {
    transform: scale(1.15) !important;
    box-shadow: 0 0 30px rgba(255, 255, 255, 1) !important;
    z-index: 10;
}

/* 特殊方块悬停效果 */
.special-block:hover {
    transform: scale(1.1);
    cursor: pointer;
}

/* ===== 炸弹爆炸特效 ===== */

/* 爆炸波纹 */
.bomb-ripple {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 107, 0.8) 0%, rgba(238, 90, 111, 0.4) 50%, transparent 100%);
    pointer-events: none;
    z-index: 9999;
    animation: rippleExpand 0.6s ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 1;
    }
    100% {
        width: 200px;
        height: 200px;
        margin-left: -100px;
        margin-top: -100px;
        opacity: 0;
    }
}

/* 爆炸文字 */
.explosion-text {
    position: fixed;
    font-size: 48px;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow:
        0 0 10px rgba(255, 107, 107, 1),
        0 0 20px rgba(238, 90, 111, 0.8),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    animation: explosionTextAnim 1s ease-out forwards;
}

@keyframes explosionTextAnim {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-20deg);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.5) rotate(10deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2) rotate(-5deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -100px) scale(0.8) rotate(0deg);
        opacity: 0;
    }
}

/* 方块爆炸动画 */
.cell.exploding {
    animation: cellExplode 0.2s ease-out forwards;
}

@keyframes cellExplode {
    0% {
        transform: scale(1);
        opacity: 1;
        background-color: #ff6b6b;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
        background-color: #ffeb3b;
        box-shadow: 0 0 20px rgba(255, 107, 107, 1);
    }
    100% {
        transform: scale(0.5);
        opacity: 0;
        background-color: #fff;
    }
}

/* ===== 彩虹方块特效 ===== */

/* 彩虹波纹 */
.rainbow-ripple {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #ff0000 0deg,
        #ff7f00 51deg,
        #ffff00 102deg,
        #00ff00 153deg,
        #0000ff 204deg,
        #4b0082 255deg,
        #9400d3 306deg,
        #ff0000 360deg
    );
    pointer-events: none;
    z-index: 9999;
    animation: rainbowRippleExpand 0.8s ease-out forwards;
}

@keyframes rainbowRippleExpand {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 0.9;
    }
    100% {
        width: 180px;
        height: 180px;
        margin-left: -90px;
        margin-top: -90px;
        opacity: 0;
    }
}

/* 彩虹粒子 */
.rainbow-particle {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    pointer-events: none;
    z-index: 9999;
    animation: rainbowParticleMove 1s ease-out forwards;
}

@keyframes rainbowParticleMove {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(var(--angle-x), var(--angle-y)) scale(0.3);
        opacity: 0;
    }
}

/* 彩虹文字 */
.rainbow-text {
    position: fixed;
    font-size: 42px;
    font-weight: bold;
    background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    animation: rainbowTextAnim 1.2s ease-out forwards;
}

@keyframes rainbowTextAnim {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-15deg);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1) rotate(-2deg);
        opacity: 1;
        background-position: 0% 50%;
    }
    100% {
        transform: translate(-50%, -80px) scale(0.8) rotate(0deg);
        opacity: 0;
        background-position: 200% 50%;
    }
}

/* ===== 时间方块特效 ===== */

/* 时间波纹 */
.time-ripple {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.8) 0%, rgba(0, 242, 254, 0.4) 50%, transparent 100%);
    pointer-events: none;
    z-index: 9999;
    animation: timeRippleExpand 0.8s ease-out forwards;
}

@keyframes timeRippleExpand {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 1;
    }
    100% {
        width: 160px;
        height: 160px;
        margin-left: -80px;
        margin-top: -80px;
        opacity: 0;
    }
}

/* 时间粒子 */
.time-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.8);
    pointer-events: none;
    z-index: 9999;
    animation: timeParticleMove 1s ease-out forwards;
}

@keyframes timeParticleMove {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(var(--angle-x), var(--angle-y)) scale(0.5);
        opacity: 0;
    }
}

/* 时间特效文字 */
.time-effect-text {
    position: fixed;
    font-size: 38px;
    font-weight: bold;
    color: #4facfe;
    text-shadow:
        0 0 10px rgba(79, 172, 254, 1),
        0 0 20px rgba(0, 242, 254, 0.8),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    animation: timeEffectTextAnim 1.5s ease-out forwards;
}

@keyframes timeEffectTextAnim {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -120px) scale(0.7);
        opacity: 0;
    }
}

/* ===== 冻结方块特效 ===== */

/* 冰晶波纹 */
.frozen-ripple {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 237, 234, 0.9) 0%, rgba(0, 204, 255, 0.5) 50%, transparent 100%);
    border: 2px solid rgba(0, 204, 255, 0.6);
    pointer-events: none;
    z-index: 9999;
    animation: frozenRippleExpand 1s ease-out forwards;
}

@keyframes frozenRippleExpand {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 1;
        transform: rotate(0deg);
    }
    100% {
        width: 170px;
        height: 170px;
        margin-left: -85px;
        margin-top: -85px;
        opacity: 0;
        transform: rotate(90deg);
    }
}

/* 冰晶粒子 */
.frozen-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #a8edea 0%, #00ccff 100%);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: 0 0 10px rgba(0, 204, 255, 0.9);
    pointer-events: none;
    z-index: 9999;
    animation: frozenParticleMove 1.2s ease-out forwards;
}

@keyframes frozenParticleMove {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(var(--angle-x), var(--angle-y)) scale(0.3) rotate(360deg);
        opacity: 0;
    }
}

/* 冰冻文字 */
.frozen-text {
    position: fixed;
    font-size: 40px;
    font-weight: bold;
    color: #00ccff;
    text-shadow:
        0 0 10px rgba(168, 237, 234, 1),
        0 0 20px rgba(0, 204, 255, 0.8),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    animation: frozenTextAnim 1.3s ease-out forwards;
}

@keyframes frozenTextAnim {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -100px) scale(0.8);
        opacity: 0;
    }
}

/* ===== 星星方块特效 ===== */

/* 星星波纹 */
.star-ripple {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.9) 0%, rgba(255, 237, 78, 0.5) 50%, transparent 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    pointer-events: none;
    z-index: 9999;
    animation: starRippleExpand 0.8s ease-out forwards;
}

@keyframes starRippleExpand {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 1;
        transform: rotate(0deg);
    }
    100% {
        width: 150px;
        height: 150px;
        margin-left: -75px;
        margin-top: -75px;
        opacity: 0;
        transform: rotate(180deg);
    }
}

/* 星星粒子 */
.star-particle {
    position: fixed;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #ffd700;
    pointer-events: none;
    z-index: 9999;
    animation: starParticleMove 1s ease-out forwards;
}

.star-particle::before {
    content: '';
    position: absolute;
    top: 3px;
    left: -6px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 10px solid #ffd700;
}

@keyframes starParticleMove {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(var(--angle-x), var(--angle-y)) scale(0.5) rotate(360deg);
        opacity: 0;
    }
}

/* 星星特效文字 */
.star-effect-text {
    position: fixed;
    font-size: 44px;
    font-weight: bold;
    color: #ffd700;
    text-shadow:
        0 0 15px rgba(255, 215, 0, 1),
        0 0 25px rgba(255, 237, 78, 0.8),
        2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    animation: starEffectTextAnim 1.5s ease-out forwards;
}

@keyframes starEffectTextAnim {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-20deg);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -50%) scale(1.5) rotate(10deg);
        opacity: 1;
    }
    40% {
        transform: translate(-50%, -50%) scale(1.2) rotate(-5deg);
        opacity: 1;
    }
    60% {
        transform: translate(-50%, -50%) scale(1.3) rotate(3deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -100px) scale(0.7) rotate(0deg);
        opacity: 0;
    }
}

/* ===== 游戏说明弹窗 ===== */

.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}

.help-modal.show {
    display: flex;
}

.help-modal-content {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    background-color: #fff;
    border-radius: 20px;
    padding: 40px;
    position: relative;
}

.help-content {
    margin-top: 20px;
}

.help-section {
    margin-bottom: 30px;
}

.help-section h3 {
    font-size: 24px;
    color: #2c4a45;
    margin-bottom: 15px;
    border-bottom: 2px solid #4AD6C5;
    padding-bottom: 10px;
}

.help-section p {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin: 10px 0;
}

.help-section ul {
    list-style: none;
    padding-left: 0;
}

.help-section ul li {
    font-size: 15px;
    line-height: 1.8;
    color: #555;
    padding-left: 25px;
    position: relative;
    margin: 8px 0;
}

.help-section ul li::before {
    content: '▸';
    position: absolute;
    left: 5px;
    color: #4AD6C5;
    font-weight: bold;
}

/* 连击信息 */
.combo-info {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
}

.combo-tier {
    font-size: 16px;
    font-weight: bold;
    margin: 8px 0;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
}

.tip {
    font-size: 14px;
    color: #FF9066;
    font-style: italic;
    margin-top: 10px;
}

/* 特殊方块信息 */
.special-block-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.block-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    border-radius: 12px;
    border-left: 4px solid #4AD6C5;
    transition: transform 0.2s;
}

.block-item:hover {
    transform: translateX(5px);
}

.block-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.rainbow-bg {
    background: linear-gradient(
        135deg,
        #ff0000 0%,
        #ff7f00 14%,
        #ffff00 28%,
        #00ff00 42%,
        #0000ff 57%,
        #4b0082 71%,
        #9400d3 85%,
        #ff0000 100%
    );
    background-size: 200% 200%;
    animation: rainbowShift 3s linear infinite;
}

.block-desc {
    flex: 1;
}

.block-desc strong {
    font-size: 18px;
    color: #2c4a45;
    display: block;
    margin-bottom: 5px;
}

.block-desc p {
    font-size: 14px;
    color: #555;
    margin: 5px 0;
}

.block-desc small {
    font-size: 12px;
    color: #888;
}

/* 隐藏滚动条 */
.help-modal-content::-webkit-scrollbar {
    display: none;
}

.help-modal-content {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* ===== 等级系统样式 ===== */

/* 等级信息栏 */
.level-info-bar {
    width: 100%;
    max-width: 650px;
    background: linear-gradient(135deg, #2c4a45 0%, #4a7872 100%);
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
}

/* 等级徽章 */
.level-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.level-number {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.level-title-text {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 经验条容器 */
.exp-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 经验条包装器 */
.exp-bar-wrapper {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 经验条填充 */
.exp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4AD6C5 0%, #66BB6A 50%, #ffd700 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
    box-shadow: 0 0 10px rgba(74, 214, 197, 0.5);
}

/* 经验条动画效果 */
.exp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: expShine 2s infinite;
}

@keyframes expShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 经验文字显示 */
.exp-text-display {
    font-size: 12px;
    color: #fff;
    text-align: right;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== 升级弹窗样式 ===== */

.level-up-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.level-up-modal.show {
    opacity: 1;
}

.level-up-modal.fade-out {
    opacity: 0;
}

.level-up-content {
    background: linear-gradient(135deg, #2c4a45 0%, #4a7872 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    transform: scale(0.8);
    animation: levelUpAppear 0.5s ease-out forwards;
}

@keyframes levelUpAppear {
    0% {
        transform: scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.level-up-animation {
    position: relative;
}

.level-up-star {
    font-size: 80px;
    animation: starRotate 2s infinite linear;
}

@keyframes starRotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.level-up-content h2 {
    font-size: 36px;
    color: #ffd700;
    margin: 20px 0;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

.level-up-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.old-level, .new-level {
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.new-level {
    color: #ffd700;
    border-color: rgba(255, 215, 0, 0.5);
    animation: newLevelPulse 1s ease-in-out infinite;
}

@keyframes newLevelPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    }
}

.level-arrow {
    font-size: 36px;
    color: #4AD6C5;
}

.level-title {
    font-size: 28px;
    color: #4AD6C5;
    margin: 20px 0;
    font-weight: bold;
}

.level-rewards {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.level-rewards h3 {
    font-size: 20px;
    color: #fff;
    margin-bottom: 15px;
}

.level-rewards ul {
    list-style: none;
    padding: 0;
}

.level-rewards li {
    font-size: 16px;
    color: #fff;
    padding: 8px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #ffd700;
}

.level-up-close-btn {
    background: linear-gradient(135deg, #4AD6C5 0%, #66BB6A 100%);
    color: white;
    border: none;
    padding: 12px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(74, 214, 197, 0.4);
    transition: all 0.3s ease;
}

.level-up-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 214, 197, 0.6);
}

/* ===== 经验获得通知 ===== */

.exp-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%) translateY(-50px);
    background: linear-gradient(135deg, #4AD6C5 0%, #66BB6A 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(74, 214, 197, 0.5);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.exp-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== 消除特效样式 ===== */

/* 消除光环扩散 */
.merge-ripple {
    position: fixed;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--ripple-color, #42a5f5) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9998;
    animation: mergeRippleExpand 0.6s ease-out forwards;
}

@keyframes mergeRippleExpand {
    0% {
        width: 0;
        height: 0;
        margin-left: 0;
        margin-top: 0;
        opacity: 0.8;
    }
    100% {
        width: 150px;
        height: 150px;
        margin-left: -75px;
        margin-top: -75px;
        opacity: 0;
    }
}

/* 消除粒子爆炸 */
.merge-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    box-shadow: 0 0 8px currentColor;
    animation: mergeParticleMove 0.8s ease-out forwards;
}

@keyframes mergeParticleMove {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(var(--angle-x), var(--angle-y)) scale(0.3);
        opacity: 0;
    }
}

/* 方块消失动画 */
.cell.merge-disappear {
    animation: mergeDisappear 0.4s ease-out forwards;
}

@keyframes mergeDisappear {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0) rotate(20deg);
        opacity: 0;
    }
}

/* 分数飘字效果 */
.score-float {
    position: fixed;
    font-weight: bold;
    pointer-events: none;
    z-index: 9999;
    text-shadow:
        0 0 10px currentColor,
        0 2px 4px rgba(0, 0, 0, 0.5);
    animation: scoreFloatUp 1.5s ease-out forwards;
}

@keyframes scoreFloatUp {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -60%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -150px) scale(1);
        opacity: 0;
    }
}

/* 连击分数飘字（金色） */
.score-float-combo {
    animation: scoreFloatUpCombo 1.5s ease-out forwards;
}

@keyframes scoreFloatUpCombo {
    0% {
        transform: translate(-50%, -50%) scale(0.5) rotate(-10deg);
        opacity: 0;
    }
    20% {
        transform: translate(-50%, -60%) scale(1.3) rotate(5deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -180px) scale(1) rotate(0deg);
        opacity: 0;
    }
}

/* 特殊分数飘字（红色） */
.score-float-special {
    animation: scoreFloatUpSpecial 1.8s ease-out forwards;
}

@keyframes scoreFloatUpSpecial {
    0% {
        transform: translate(-50%, -50%) scale(0.3) rotate(-20deg);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, -60%) scale(1.5) rotate(10deg);
        opacity: 1;
    }
    30% {
        transform: translate(-50%, -80%) scale(1.3) rotate(-5deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -200px) scale(1) rotate(0deg);
        opacity: 0;
    }
}

/* ===== 连击光束效果 ===== */

.combo-beams {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
}

.combo-beam {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.8), transparent);
    animation: comboBeamPulse 1s ease-in-out infinite;
}

.combo-beam[style*="--beam-position: top"] {
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.combo-beam[style*="--beam-position: bottom"] {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
}

.combo-beam[style*="--beam-position: left"] {
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, transparent, rgba(255, 215, 0, 0.8), transparent);
}

.combo-beam[style*="--beam-position: right"] {
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, transparent, rgba(255, 215, 0, 0.8), transparent);
}

@keyframes comboBeamPulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* ===== 优化方块动画 ===== */

/* 方块下落动画（缓入缓出） */
.cell.falling {
    animation: fallEaseInOut 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fallEaseInOut {
    0% {
        transform: translateY(-60px) scale(0.9);
        opacity: 0;
    }
    60% {
        transform: translateY(5px) scale(1.05);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* 方块生成动画（从小到大弹出） */
.cell.spawning {
    animation: spawnBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes spawnBounce {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(5deg);
        opacity: 1;
    }
    75% {
        transform: scale(0.9) rotate(-3deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* 方块选中动画（脉冲 + 浮动） */
.cell.selected {
    animation: selectedPulseFloat 1s ease-in-out infinite;
}

@keyframes selectedPulseFloat {
    0%, 100% {
        transform: scale(1.1) translateY(0);
        box-shadow: 0 0 10px rgba(190, 219, 253, 0.8);
    }
    25% {
        transform: scale(1.15) translateY(-3px);
        box-shadow: 0 0 20px rgba(190, 219, 253, 1);
    }
    50% {
        transform: scale(1.1) translateY(-5px);
        box-shadow: 0 0 15px rgba(190, 219, 253, 0.9);
    }
    75% {
        transform: scale(1.15) translateY(-3px);
        box-shadow: 0 0 20px rgba(190, 219, 253, 1);
    }
}

/* 方块合并动画（向中心收缩） */
.cell.merging {
    animation: mergeShrink 0.4s ease-in-out;
}

@keyframes mergeShrink {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
        filter: brightness(1.5);
    }
    100% {
        transform: scale(0.5);
        opacity: 0;
    }
}

/* ===== 响应式设计 ===== */

/* 平板设备 */
@media (max-width: 1024px) {
    .game-container {
        gap: 15px;
    }

    .header {
        gap: 8px;
        padding: 8px;
        min-height: 50px;
    }

    .header-item {
        font-size: 20px;
        min-width: 50px;
        min-height: 50px;
        padding: 6px 12px;
    }

    .game-board {
        height: 450px;
    }

    .step-counter {
        right: -120px;
        min-width: 90px;
        font-size: 16px;
        padding: 12px 16px;
    }
}

/* 移动端 */
@media (max-width: 768px) {
    body {
        overflow: hidden;
        margin: 0;
        padding: 0;
    }

    /* 隐藏移动端滚动条但保持可滚动 */
    body::-webkit-scrollbar {
        display: none;
    }

    body {
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }

    .game-container {
        width: 100%;
        padding: 0 10px;
        gap: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .header {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px;
        min-height: auto;
        justify-content: space-between;  /* 两端对齐 */
        margin-top: 70px;  /* 在难度UI下方留出空间 */
    }

    .header-item {
        font-size: 16px;
        min-width: 45px;
        min-height: 45px;
        padding: 5px 10px;
    }

    /* 第一行：难度、分数、错误次数 */
    .header-item.difficulty-btn {
        font-size: 14px;
        min-width: 80px;
        order: 1;
        flex: 0 0 calc(33.33% - 4px);  /* 占1/3宽度 */
    }

    .header-item.score {
        font-size: 18px;
        min-width: 70px;
        order: 2;
        flex: 0 0 calc(33.33% - 4px);  /* 占1/3宽度 */
    }

    .header-item.mistakes-counter {
        font-size: 16px;
        min-width: 100px;
        order: 3;
        flex: 0 0 calc(33.33% - 4px);  /* 占1/3宽度 */
    }

    /* 第二行：暂停、倒计时、说明按钮 */
    .header-item.pause-btn {
        order: 4;
        flex: 0 0 calc(33.33% - 4px);  /* 占1/3宽度 */
    }

    .header-item.timer-display {
        font-size: 18px;
        min-width: 90px;
        order: 5;
        flex: 0 0 calc(33.33% - 4px);  /* 占1/3宽度 */
    }

    .header-item.help-btn {
        order: 6;
        flex: 0 0 calc(33.33% - 4px);  /* 占1/3宽度 */
    }

    .game-board {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        max-height: 400px;
        padding: 5px;
        gap: 1px;
    }

    .cell {
        font-size: 16px;
    }

    /* 步数计数器移到游戏区域下方 */
    .step-counter {
        position: static;
        margin: 10px auto 0;
        right: auto;
        bottom: auto;
        min-width: 120px;
        font-size: 16px;
        padding: 12px 18px;
    }

    /* 道具栏移到步数计数器下方，水平排列 */
    .item-toolbar {
        position: static !important;
        margin: 15px auto 20px !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;
        flex-direction: row !important;
        justify-content: flex-start;  /* 改为左对齐，支持滚动 */
        gap: 8px;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(10px);
        padding: 8px;
        border-radius: 12px;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;  /* 添加横向滚动 */
        overflow-y: hidden;
        /* 隐藏滚动条但保持可滚动 */
        scrollbar-width: none;  /* Firefox */
        -ms-overflow-style: none;  /* IE and Edge */
    }

    /* 隐藏 webkit 浏览器的滚动条 */
    .item-toolbar::-webkit-scrollbar {
        display: none;
    }

    .item-button {
        width: 50px;
        height: 50px;
        flex-shrink: 0;  /* 防止在滚动时收缩 */
    }

    .item-icon {
        font-size: 24px;
    }

    .item-icon img {
        width: 50px;
        height: 50px;
    }

    /* 特殊尺寸道具在移动端也保持比例 */
    #item-bomb .item-icon,
    #item-refresh .item-icon {
        width: 64px;
        height: 64px;
    }

    #item-bomb .item-icon img,
    #item-refresh .item-icon img {
        width: 64px;
        height: 64px;
    }

    #item-bomb,
    #item-refresh {
        width: 64px;
        height: 64px;
    }

    .item-count {
        font-size: 10px;
        padding: 1px 4px;
    }

    /* 连击文字 */
    .combo-text {
        font-size: 48px;
        top: 30%;
    }

    /* 特殊方块 */
    .special-block {
        font-size: 16px !important;
    }
}

/* 小屏手机 */
@media (max-width: 480px) {
    /* 隐藏滚动条但保持可滚动 */
    body::-webkit-scrollbar {
        display: none;
    }

    body {
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }

    .game-container {
        padding: 0 5px;
        gap: 8px;
    }

    .header {
        gap: 4px;
        padding: 5px;
        justify-content: space-between;  /* 两端对齐 */
        margin-top: 65px;  /* 小屏幕也在难度UI下方留出空间 */
    }

    .header-item {
        font-size: 14px;
        min-width: 40px;
        min-height: 40px;
        padding: 4px 8px;
    }

    /* 第一行：难度、分数、错误次数 */
    .header-item.difficulty-btn {
        font-size: 12px;
        min-width: 70px;
        order: 1;
        flex: 0 0 calc(33.33% - 3px);  /* 占1/3宽度 */
    }

    .header-item.score {
        font-size: 16px;
        min-width: 60px;
        order: 2;
        flex: 0 0 calc(33.33% - 3px);  /* 占1/3宽度 */
    }

    .header-item.mistakes-counter {
        font-size: 14px;
        min-width: 90px;
        order: 3;
        flex: 0 0 calc(33.33% - 3px);  /* 占1/3宽度 */
    }

    /* 第二行：暂停、倒计时、说明按钮 */
    .header-item.pause-btn {
        order: 4;
        flex: 0 0 calc(33.33% - 3px);  /* 占1/3宽度 */
    }

    .header-item.timer-display {
        font-size: 16px;
        min-width: 80px;
        order: 5;
        flex: 0 0 calc(33.33% - 3px);  /* 占1/3宽度 */
    }

    .header-item.help-btn {
        order: 6;
        flex: 0 0 calc(33.33% - 3px);  /* 占1/3宽度 */
    }

    .game-board {
        max-height: 320px;
        padding: 4px;
    }

    .cell {
        font-size: 14px;
    }

    .step-counter {
        min-width: 100px;
        font-size: 14px;
        padding: 10px 15px;
    }

    .item-toolbar {
        gap: 6px;
        padding: 6px;
        overflow-x: auto;  /* 小屏也支持横向滚动 */
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .item-toolbar::-webkit-scrollbar {
        display: none;
    }

    .item-button {
        width: 45px;
        height: 45px;
        flex-shrink: 0;  /* 防止收缩 */
    }

    .item-icon {
        font-size: 20px;
    }

    .item-icon img {
        width: 45px;
        height: 45px;
    }

    /* 小屏特殊尺寸道具 */
    #item-bomb .item-icon,
    #item-refresh .item-icon {
        width: 56px;
        height: 56px;
    }

    #item-bomb .item-icon img,
    #item-refresh .item-icon img {
        width: 56px;
        height: 56px;
    }

    #item-bomb,
    #item-refresh {
        width: 56px;
        height: 56px;
    }

    .combo-text {
        font-size: 36px;
        top: 25%;
    }

    .special-block {
        font-size: 14px !important;
    }

    /* 弹窗调整 */
    .modal-content {
        padding: 40px 30px;
        max-width: 90%;
    }

    .modal-title {
        font-size: 32px;
    }

    .help-modal-content {
        padding: 20px;
        width: 95%;
    }
}
