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

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

.loading-container {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

.loading-text {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.loading-progress {
    color: #3498db;
    font-size: 1.2rem;
    font-weight: bold;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.game-top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    position: relative;
    padding: 8px 10px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.game-bottom-bar {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
    gap: 10px;
}

h1 {
    color: #2c3e50;
    font-size: 2.2rem;
    margin-bottom: 5px;
}

.score-container {
    font-size: 2rem;
    font-weight: bold;
    color: #e74c3c;
    background: #ffffff;
    border-radius: 8px;
    padding: 5px 15px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
    width: 100px;
    text-align: center;
    min-width: 100px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

#game-board {
    width: 100%;
    height: 600px;
    background-color: #ecf0f1;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

/* 下一个物体容器 - 变为水平布局 */
.next-item-container {
    background-color: #ffffff;
    padding: 1px 2px;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

.next-item-label {
    font-weight: bold;
    margin-right: 8px;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* 当前物体 - 在顶部栏中央 */
#current-item-holder {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

#current-item {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border-radius: 50%;
    padding: 5px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(52, 152, 219, 0.3);
}

/* 下一个物体 */
#next-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border-radius: 8px;
    padding: 4px;
}

#next-item img,
#current-item img {
    max-width: 90%;
    max-height: 90%;
    transition: transform 0.3s;
}

.game-item {
    border-radius: 50%;
    position: absolute;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* 调整SVG图像在物理引擎中的呈现 */
canvas {
    position: relative;
}

canvas svg {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.hidden {
    display: none;
}

.game-over-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

.game-over-content h2 {
    color: #e74c3c;
    margin-bottom: 20px;
}

.game-over-content p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

#play-again-btn {
    background-color: #e74c3c;
}

#play-again-btn:hover {
    background-color: #c0392b;
}

.instructions {
    width: 100%;
    max-width: 500px;
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.instructions h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.instructions p {
    color: #34495e;
    margin-bottom: 10px;
    line-height: 1.5;
}

/* 下落位置指示线 */
#drop-indicator {
    position: absolute;
    top: 0;
    width: 3px;
    height: 30px; /* 进一步缩短长度 */
    background: linear-gradient(to bottom, rgba(231, 76, 60, 0.9), rgba(231, 76, 60, 0)); /* 一端透明的渐变 */
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.1s, transform 0.2s;
    transform-origin: top center;
}

/* 警告指示器样式 */
.warning-indicator {
    position: absolute;
    height: 5px;
    background-color: rgba(255, 0, 0, 0.7);
    border-radius: 3px;
    z-index: 15;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

/* 点击提示动画 */
.click-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(52, 152, 219, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    animation: pulse 1.5s infinite;
    z-index: 100;
    pointer-events: none;
}

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

/* 合并动画特效 */
.merge-flash {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
    animation: merge-flash 0.3s ease-out;
}

@keyframes merge-flash {
    0% {
        width: 10px;
        height: 10px;
        background-color: rgba(255, 255, 255, 0.9);
        box-shadow: 0 0 10px rgba(255, 255, 255, 1);
        opacity: 0;
    }
    50% {
        width: 80px;
        height: 80px;
        background-color: rgba(255, 255, 255, 0.7);
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
        opacity: 0.8;
    }
    100% {
        width: 120px;
        height: 120px;
        background-color: rgba(255, 255, 255, 0);
        box-shadow: 0 0 40px rgba(255, 255, 255, 0);
        opacity: 0;
    }
}

/* 最高级合成特效 */
.ultimate-merge-effect {
    position: absolute;
    pointer-events: none;
    z-index: 15;
}

.particle {
    position: absolute;
    background-color: rgba(255, 215, 0, 0.8);
    border-radius: 50%;
    width: 8px;
    height: 8px;
    opacity: 0;
}

.ultimate-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, rgba(255, 215, 0, 0) 70%);
    opacity: 0;
    animation: ultimate-flash 1s ease-out;
    pointer-events: none;
    z-index: 12;
}

@keyframes ultimate-flash {
    0% {
        opacity: 0;
    }
    30% {
        opacity: 0.7;
    }
    100% {
        opacity: 0;
    }
}

@keyframes particle-move {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 冷却动画样式已移除 */

/* 游戏标题装饰元素样式 */
.game-title-decor {
    font-size: 1.5rem;
    color: #f39c12;
    animation: sparkle 1.5s infinite;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

@media (max-width: 600px) {
    #game-board {
        height: 450px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .instructions {
        padding: 15px;
    }
}
