/**
 * 拔萝卜游戏 - 像素风格样式
 */

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

body {
    font-family: '"Courier New", Courier, monospace';
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* 游戏容器 */
.game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* 游戏标题 */
.game-title {
    font-size: 48px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 
        3px 3px 0 #8B4513,
        -1px -1px 0 #8B4513,
        1px -1px 0 #8B4513,
        -1px 1px 0 #8B4513,
        1px 1px 0 #8B4513;
    letter-spacing: 4px;
    animation: titleBounce 2s ease-in-out infinite;
}

@keyframes titleBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Canvas 样式 */
#gameCanvas {
    border: 6px solid #8B4513;
    border-radius: 8px;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.1);
    background: #87CEEB;
    cursor: pointer;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    transition: transform 0.3s ease;
}

#gameCanvas:hover {
    transform: scale(1.02);
}

#gameCanvas:active {
    transform: scale(0.98);
}

/* 像素风格边框 */
.pixel-border {
    position: relative;
    padding: 10px;
    background: #8B4513;
}

.pixel-border::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: 
        linear-gradient(90deg, #000 25%, transparent 25%) 0 0 / 8px 8px,
        linear-gradient(90deg, #000 25%, transparent 25%) 0 0 / 8px 8px;
    z-index: -1;
}

/* 游戏信息面板 */
.game-info {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 800px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    border: 3px solid #FFD700;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.info-label {
    font-size: 14px;
    color: #AAAAAA;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.info-value {
    font-size: 28px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 0 #000;
}

/* 按钮样式 */
.pixel-button {
    padding: 15px 40px;
    font-size: 24px;
    font-family: '"Courier New", monospace';
    font-weight: bold;
    color: #FFFFFF;
    background: #228B22;
    border: none;
    cursor: pointer;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
}

.pixel-button::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    right: 4px;
    height: 40%;
    background: rgba(255, 255, 255, 0.2);
}

.pixel-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 4px solid #000;
}

.pixel-button:hover {
    background: #2E9B2E;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.pixel-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* 连击动画 */
@keyframes comboFlash {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.combo-text {
    animation: comboFlash 0.5s ease-in-out infinite;
    color: #FF6347;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
}

/* 得分动画 */
@keyframes scorePopup {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

.score-popup {
    position: absolute;
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 0 #000;
    pointer-events: none;
    animation: scorePopup 1s ease-out forwards;
}

/* 像素化文本 */
.pixel-text {
    font-family: '"Courier New", monospace';
    letter-spacing: 2px;
    text-rendering: optimizeSpeed;
}

/* 响应式设计 */
@media (max-width: 850px) {
    .game-title {
        font-size: 36px;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 600px;
        height: auto;
    }
    
    .game-info {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .info-item {
        flex: 1 1 120px;
    }
    
    .pixel-button {
        padding: 12px 30px;
        font-size: 20px;
    }
}

@media (max-width: 500px) {
    .game-title {
        font-size: 28px;
    }
    
    .game-info {
        padding: 10px;
    }
    
    .info-label {
        font-size: 12px;
    }
    
    .info-value {
        font-size: 22px;
    }
    
    .pixel-button {
        padding: 10px 25px;
        font-size: 18px;
    }
}

/* 加载动画 */
@keyframes loading {
    0% {
        content: '加载中.';
    }
    33% {
        content: '加载中..';
    }
    66% {
        content: '加载中...';
    }
}

.loading::after {
    content: '加载中...';
    animation: loading 1.5s infinite;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 禁用选择 */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    #gameCanvas {
        cursor: default;
    }
    
    .pixel-button {
        min-height: 48px;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .game-container {
        display: none;
    }
}
