/* ==================== 全局样式和变量 ==================== */
:root {
    /* 颜色系统 */
    --primary-color: #00f2ff;
    --secondary-color: #ff00ff;
    --accent-color: #ffff00;
    --success-color: #00ff88;
    --danger-color: #ff3366;
    
    /* 渐变色 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-success: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-game: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    
    /* 背景色 */
    --bg-dark: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-overlay: rgba(0, 0, 0, 0.9);
    
    /* 文字颜色 */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    /* 间距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 242, 255, 0.5);
    
    /* 动画时长 */
    --transition-fast: 0.15s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s;
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: none;
    position: relative;
}

html, body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.home{
    position: fixed;
    right: 18px;
    top: 10px;
    color: #b3b3b3;
    text-decoration: none;
    font-size: 1rem;
}
.home:hover{
    color: white;
}

/* ==================== 背景动画 ==================== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: var(--gradient-game);
    overflow: hidden;
}

.background-animation::before,
.background-animation::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.background-animation::before {
    background: var(--primary-color);
    top: -250px;
    left: -250px;
    animation-delay: 0s;
}

.background-animation::after {
    background: var(--secondary-color);
    bottom: -250px;
    right: -250px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(100px, -100px) scale(1.1);
    }
    66% {
        transform: translate(-100px, 100px) scale(0.9);
    }
}

/* ==================== 容器 ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    
}

/* ==================== 游戏标题 ==================== */
.game-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    display: flex;
    justify-content: center;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    margin-bottom: 10px;
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px var(--primary-color));
    animation: titlePulse 3s ease-in-out infinite;
}

.title-icon {
    display: inline-block;
    animation: wiggle 2s infinite ease-in-out;
    font-size: 3rem;
}

.title-glow {
    display: block;
    font-size: 1.2rem;
    margin-top: 0.5rem;
    letter-spacing: 0.3em;
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(-5deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

/* ==================== 游戏包装器 ==================== */
.game-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* ==================== 信息面板 ==================== */
.info-panel {
    display: flex;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    justify-content: space-around;
    align-items: center;
}

.score-card {
    /*background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);*/
    text-align: center;
    /*transition: all var(--transition-normal);*/
    position: relative;
    overflow: hidden;
}


.high-score-card::before {
    background: var(--gradient-secondary);
}

.score-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.score-value {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== 画布容器 ==================== */
.canvas-container {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-canvas {
    display: block;
    margin: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* ==================== 游戏覆盖层 ==================== */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.game-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
    padding: var(--spacing-xl);
}

.overlay-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-text {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

/* ==================== 按钮样式 ==================== */
.btn-primary {
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 700;
    padding: 10px 20px;
    background: var(--gradient-success);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(-1px) scale(1.02);
}

/* ==================== 控制面板 ==================== */
.control-panel {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.difficulty-selector {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

.control-label {
    display: block;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--spacing-sm);
}

.btn-difficulty {
    font-family: 'Noto Sans SC', sans-serif;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 600;
}

.btn-difficulty:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.btn-difficulty.active {
    background: var(--gradient-success);
    color: var(--text-primary);
    border-color: transparent;
    box-shadow: var(--shadow-glow);
}

.game-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-sm);
}

.btn-control {
    font-family: 'Noto Sans SC', sans-serif;
    padding: var(--spacing-md);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    font-size: 1.2rem;
}

/* ==================== 移动端控制 ==================== */
.mobile-controls {
    display: none;
}

.dpad {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.dpad-btn {
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dpad-btn:active {
    background: var(--gradient-success);
    /*transform: scale(0.95);*/
    box-shadow: var(--shadow-glow);
}

.dpad-up {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-left {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-right {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* ==================== 游戏说明 ==================== */
.instructions {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
}

.instructions-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
}

.instructions-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.instructions-list li {
    color: var(--text-secondary);
    padding-left: var(--spacing-md);
    position: relative;
}

.instructions-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

kbd {
    display: inline-block;
    padding: 0.2em 0.5em;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-family: 'Orbitron', monospace;
    font-size: 0.9em;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .title-icon {
        font-size: 2rem;
    }
    
    .title-glow {
        font-size: 1rem;
    }
    
    .container {
        padding: var(--spacing-sm);
    }
    
    .mobile-controls {
        display: block;
    }
    .canvas-container{
        padding:0;
    }
    .instructions {
        font-size: 0.9rem;
    }
    .score-value{
        font-size: 1.5rem;
    }
    .btn-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }
    
    .score-value {
        font-size: 2rem;
    }
    
    .overlay-title {
        font-size: 2rem;
    }
}
