* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    text-align: center;
    width: 90%;
    max-width: 600px;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: #f0f0f0;
    padding: 15px;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.info-left, .info-right {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.level, .score, .moves, .time {
    font-size: 1.2em;
    font-weight: bold;
    color: #555;
    background: white;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 设备选择界面样式 */
#device-select-screen {
    background: #f9f9f9;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    margin: 0 auto;
    max-width: 600px;
}

#device-select-screen h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

#device-select-screen p {
    color: #666;
    margin: 20px 0 30px;
    font-size: 1.5em;
}

.device-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

#mobile-btn, #desktop-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.8em;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 200px;
}

#mobile-btn:hover, #desktop-btn:hover {
    background: #45a049;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 开始界面样式 */
#start-screen {
    background: #f9f9f9;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    margin: 0 auto;
}

#start-screen h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

#start-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.5em;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 20px;
}

#start-btn:hover {
    background: #45a049;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 美化暂停按钮 */
#pause-btn {
    background: #FF9800;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
}

#pause-btn:hover {
    background: #F57C00;
    transform: scale(1.05);
}

#reset-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
}

#reset-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

#resume-btn, #restart-btn {
    margin: 0 10px;
}

/* 电脑网页适配 */
@media (min-width: 769px) {
    .game-info {
        gap: 20px;
    }
    
    .info-left, .info-right {
        gap: 20px;
    }
    
    .level, .score, .moves, .time {
        font-size: 1.5em;
        padding: 8px 15px;
    }
    
    #pause-btn, #reset-btn {
        font-size: 1.2em;
        padding: 10px 20px;
    }
}

.game-rules {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: left;
}

.game-rules h3 {
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.game-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.game-rules li {
    padding: 8px 0;
    color: #666;
    position: relative;
    padding-left: 25px;
    line-height: 1.5;
}

.game-rules li::before {
    content: "•";
    color: #4CAF50;
    font-weight: bold;
    position: absolute;
    left: 5px;
    font-size: 1.5em;
    vertical-align: middle;
    line-height: 1;
}

.level-info {
    background: #f0f0f0;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

.level-target {
    font-size: 1.2em;
    font-weight: bold;
    color: #555;
    margin-bottom: 10px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #ddd;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

#level-complete, #pause-screen, #level-start {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    text-align: center;
    min-width: 300px;
}

/* 每关开始界面样式 */
#level-start h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
}

#level-start p {
    color: #666;
    margin: 10px 0;
    font-size: 1.2em;
}

#start-level-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.5em;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 20px;
}

#start-level-btn:hover {
    background: #45a049;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* 超过5秒无操作提示样式 */
.fruit.hint {
    animation: pulse 1s infinite;
    background: #FFEB3B;
    box-shadow: 0 0 20px rgba(255, 235, 59, 0.7);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#pause-screen h2 {
    color: #333;
    margin-bottom: 30px;
}

#pause-screen button, #level-complete button {
    margin: 0 10px;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background 0.3s;
}

#pause-screen button:hover, #level-complete button:hover {
    background: #45a049;
}

/* 电脑网页适配 */
@media (min-width: 769px) {
    .game-container {
        max-width: 800px;
        padding: 30px;
    }
    
    h1 {
        font-size: 3em;
    }
    
    .game-info {
        gap: 15px;
    }
    
    .level, .score, .moves, .time {
        font-size: 1.5em;
        padding: 8px 15px;
    }
    
    #game-board {
        gap: 8px;
        padding: 20px;
    }
    
    .fruit {
        font-size: 2.5em;
    }
    
    .game-rules {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .game-rules h3 {
        font-size: 1.8em;
    }
    
    .game-rules li {
        font-size: 1.2em;
        padding: 8px 0;
    }
    
    .level-info {
        padding: 20px;
        margin-top: 30px;
    }
    
    .level-target {
        font-size: 1.5em;
    }
    
    .progress-bar {
        height: 25px;
    }
}

#reset-btn, #play-again {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background 0.3s;
}

#reset-btn:hover, #play-again:hover {
    background: #45a049;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 5px;
    background: #e0e0e0;
    padding: 15px;
    border-radius: 10px;
    aspect-ratio: 1;
    margin: 0 auto 20px;
    max-width: 600px;
}

.fruit {
    background: white;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 移动端适配 */
@media (max-width: 768px) {
    #game-board {
        gap: 3px;
        padding: 10px;
    }
    
    .fruit {
        font-size: 1.5em;
    }
}

/* 电脑网页适配 */
@media (min-width: 769px) {
    #game-board {
        gap: 8px;
        padding: 20px;
        max-width: 800px;
    }
    
    .fruit {
        font-size: 2.5em;
    }
    
    .game-container {
        max-width: 900px;
    }
    
    h1 {
        font-size: 3em;
    }
    
    .game-info {
        gap: 20px;
    }
    
    .info-left, .info-right {
        gap: 20px;
    }
    
    .level, .score, .moves, .time {
        font-size: 1.5em;
        padding: 8px 15px;
    }
    
    #pause-btn, #reset-btn {
        font-size: 1.2em;
        padding: 10px 20px;
    }
    
    .game-rules {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    .game-rules h3 {
        font-size: 1.8em;
    }
    
    .game-rules li {
        font-size: 1.2em;
        padding: 8px 0;
    }
    
    .level-info {
        padding: 20px;
        margin-top: 30px;
    }
    
    .level-target {
        font-size: 1.5em;
    }
    
    .progress-bar {
        height: 25px;
    }
}

.fruit:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.fruit.selected {
    background: #FFEB3B;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.7);
}

#game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

#game-over h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

#game-over p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.5em;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .game-container {
        width: 95%;
        padding: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    #game-board {
        gap: 3px;
        padding: 10px;
    }
    
    .fruit {
        font-size: 1.5em;
    }
}