/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    color: #333;
    overflow: hidden; /* 防止滚动 */
}

/* 游戏容器 */
.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 500px;
    width: 100%;
    backdrop-filter: blur(10px);
    max-height: 90vh; /* 限制最大高度 */
    overflow: hidden; /* 禁止滚动 */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 头部样式 */
.game-header {
    position: relative; /* 为绝对定位的按钮提供参考 */
    text-align: center;
    margin-bottom: 15px;
}

.game-header {
    position: relative; /* 为绝对定位的按钮提供参考 */
}

.game-header h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    background: linear-gradient(45deg, #ff6b6b, #ffd93d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 头部操作区 */
.header-actions {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* 分数板 */
.score-board {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 8px 15px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.score-item .label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 3px;
}

.score-item .value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #ff6b6b;
}

/* 游戏区域 */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* 防止被压缩 */
}

/* 画布样式 */
#gameCanvas {
    border: 3px solid #667eea;
    border-radius: 15px;
    background: linear-gradient(180deg, #f0f4f8 0%, #d9e2ec 100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    touch-action: none;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* 控制按钮 */
.game-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

/* 游戏说明 */
/* 已移除，规则改为按钮弹窗 */

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease;
    max-width: 90%;
    width: 350px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #ff6b6b;
}

.modal-content p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #333;
}

/* 响应式设计 */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .game-container {
        padding: 10px;
        max-height: 90vh;
    }

    .game-header h1 {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }

    .score-board {
        gap: 12px;
    }

    .score-item {
        padding: 5px 10px;
    }

    .score-item .label {
        font-size: 0.7rem;
    }

    .score-item .value {
        font-size: 1.1rem;
    }

    .game-area {
        gap: 8px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .modal-content {
        padding: 15px;
        width: 260px;
    }

    .modal-content h2 {
        font-size: 1.1rem;
    }

    .modal-content p {
        font-size: 0.9rem;
    }

    .modal-content ul {
        font-size: 0.8rem;
    }
}
