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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    /* 防止移动端双击缩放 */
    touch-action: manipulation;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 600px;
    width: 100%;
    /* 防止水平滚动 */
    overflow-x: hidden;
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
    font-size: 28px;
}

.game-info {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item .label {
    font-weight: bold;
    color: #666;
    font-size: 14px;
}

.info-item .value {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
    min-width: 40px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.hole {
    width: 100%;
    aspect-ratio: 1;
    min-width: 70px;
    min-height: 70px;
    background: #8b4513;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
    overflow: hidden;
    /* 防止移动端触摸延迟 */
    -webkit-tap-highlight-color: transparent;
}

.hole::before {
    content: '';
    position: absolute;
    width: 75%;
    height: 75%;
    background: #5c3317;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.hole:active {
    transform: scale(0.95);
}

.mole {
    position: absolute;
    width: 95%;
    height: 95%;
    font-size: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    bottom: -70%;
    left: 50%;
    transform: translateX(-50%);
    transition: bottom 0.1s ease-out;
    user-select: none;
    -webkit-user-select: none;
    z-index: 10;
    padding-top: 10%;
}

.mole.active {
    bottom: 15%;
}

.mole.hit {
    animation: hit 0.3s ease-out;
}

.mole.special {
    font-size: 45px;
    filter: drop-shadow(0 0 10px gold);
}

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

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.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-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    color: white;
}

.message {
    text-align: center;
    padding: 15px;
    background: #e9ecef;
    border-radius: 10px;
    margin-bottom: 25px;
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

.level-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.level-info h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 18px;
}

.level-info p {
    margin: 8px 0;
    color: #666;
    font-size: 14px;
    padding-left: 10px;
    border-left: 2px solid #ddd;
}

/* 得分动画 */
.score-popup {
    position: absolute;
    font-size: 20px;
    font-weight: bold;
    color: #4CAF50;
    animation: popup 0.5s ease-out;
    pointer-events: none;
    z-index: 100;
}

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

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

    .container {
        padding: 15px;
        border-radius: 15px;
    }

    h1 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .game-info {
        padding: 10px;
        margin-bottom: 15px;
        gap: 8px;
    }

    .info-item .label {
        font-size: 12px;
    }

    .info-item .value {
        font-size: 16px;
        min-width: 30px;
    }

    .game-board {
        gap: 8px;
        padding: 8px;
        margin-bottom: 15px;
    }

    .hole {
        min-width: 70px;
        min-height: 70px;
    }

    .controls {
        gap: 10px;
        margin-bottom: 15px;
    }

    .btn {
        padding: 10px 15px;
        font-size: 14px;
        flex: 1;
        min-width: 80px;
    }

    .message {
        padding: 10px;
        margin-bottom: 15px;
        font-size: 14px;
    }

    .level-info {
        padding: 15px;
        font-size: 12px;
        max-height: 200px;
        overflow-y: auto;
    }

    .level-info h3 {
        font-size: 16px;
    }

    .level-info p {
        font-size: 12px;
        padding-left: 8px;
    }

    .score-popup {
        font-size: 16px;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 18px;
    }

    .hole {
        min-width: 60px;
        min-height: 60px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .level-info {
        display: none;
    }
}

/* 大屏幕/平板优化 */
@media (min-width: 601px) {
    .hole {
        min-width: 80px;
        min-height: 80px;
    }
}

/* 大屏幕优化 */
@media (min-width: 768px) {
    .hole {
        min-width: 90px;
        min-height: 90px;
    }
}

/* 游戏结束动画 */
.game-over {
    animation: gameOver 0.5s ease-in;
}

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