/* ==================== CSS 变量 ==================== */
:root {
    --bg-primary: #0f0c29;
    --bg-secondary: #302b63;
    --bg-tertiary: #24243e;
    --accent-primary: #00d4ff;
    --accent-secondary: #7b2cbf;
    --accent-glow: rgba(0, 212, 255, 0.5);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --grid-bg: rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* ==================== 基础重置 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    position: relative;
}

/* ==================== 动态背景 ==================== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

/* ==================== 主容器 ==================== */
.container {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-height: 100vh;
}

/* ==================== 头部区域 ==================== */
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-section {
    flex: 1;
}

.game-title {
    position: relative;
    display: inline-block;
}

.title-number {
    font-family: 'Orbitron', sans-serif;
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-primary), #fff, var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px var(--accent-glow);
    letter-spacing: -2px;
}

.title-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: var(--accent-primary);
    filter: blur(40px);
    opacity: 0.3;
    transform: translate(-50%, -50%);
    z-index: -1;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.4; }
}

.game-tagline {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 5px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ==================== 统计面板 ==================== */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    min-width: 90px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.score-bonus {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
    pointer-events: none;
    opacity: 0;
}

.score-bonus.show {
    animation: scorePopup 1s ease-out forwards;
}

@keyframes scorePopup {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -150%) scale(1.5); }
}

/* ==================== 控制栏 ==================== */
.control-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group {
    display: flex;
    gap: 10px;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 212, 255, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
}

.btn-icon .btn-icon {
    width: 20px;
    height: 20px;
}

.btn-icon.hidden {
    display: none;
}

.btn-large {
    padding: 16px 40px;
    font-size: 18px;
}

.btn-glow {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.4); }
    50% { box-shadow: 0 0 30px rgba(0, 212, 255, 0.6), 0 0 50px rgba(123, 44, 191, 0.3); }
}

/* ==================== 游戏区域 ==================== */
.game-board-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.game-board {
    position: relative;
    width: 100%;
    max-width: min(450px, 92vw);
    aspect-ratio: 1;
    background: var(--grid-bg);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ==================== 背景网格 ==================== */
.grid-background {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    width: 100%;
    height: 100%;
}

.grid-cell {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==================== 数字方块容器 ==================== */
.tile-container {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    pointer-events: none;
}

/* ==================== 数字方块 ==================== */
/* wrapper 负责位置和移动动画（使用 transform 实现 GPU 加速） */
.tile-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* inner 负责视觉样式和缩放动画 */
.tile {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transform: scale(1);
}

/* 方块颜色 - 科技感渐变 */
.tile-2 {
    background: linear-gradient(135deg, #1a2980, #26d0ce);
    box-shadow: 0 4px 15px rgba(38, 208, 206, 0.3);
}

.tile-4 {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.3);
}

.tile-8 {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.tile-16 {
    background: linear-gradient(135deg, #fa709a, #fee140);
    box-shadow: 0 4px 15px rgba(250, 112, 154, 0.3);
}

.tile-32 {
    background: linear-gradient(135deg, #30cfd0, #330867);
    box-shadow: 0 4px 15px rgba(48, 207, 208, 0.3);
}

.tile-64 {
    background: linear-gradient(135deg, #a8edea, #fed6e3);
    color: #333;
    box-shadow: 0 4px 15px rgba(168, 237, 234, 0.3);
}

.tile-128 {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
    color: #333;
    font-size: 28px;
    box-shadow: 0 4px 20px rgba(255, 154, 158, 0.4);
}

.tile-256 {
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    color: #333;
    font-size: 28px;
    box-shadow: 0 4px 20px rgba(252, 182, 159, 0.4);
}

.tile-512 {
    background: linear-gradient(135deg, #a18cd1, #fbc2eb);
    font-size: 28px;
    box-shadow: 0 4px 20px rgba(161, 140, 209, 0.4);
}

.tile-1024 {
    background: linear-gradient(135deg, #fad0c4, #ffd1ff);
    color: #333;
    font-size: 24px;
    box-shadow: 0 4px 25px rgba(250, 208, 196, 0.5);
}

.tile-2048 {
    background: linear-gradient(135deg, #ffecd2, #fcb69f, #ff8a80);
    font-size: 24px;
    box-shadow: 
        0 4px 25px rgba(255, 138, 128, 0.5),
        0 0 40px rgba(255, 138, 128, 0.3);
    animation: tileGlow 2s ease-in-out infinite;
}

@keyframes tileGlow {
    0%, 100% { box-shadow: 0 4px 25px rgba(255, 138, 128, 0.5), 0 0 40px rgba(255, 138, 128, 0.3); }
    50% { box-shadow: 0 4px 35px rgba(255, 138, 128, 0.7), 0 0 60px rgba(255, 138, 128, 0.5); }
}

.tile-super {
    background: linear-gradient(135deg, #000000, #434343);
    font-size: 20px;
    box-shadow: 0 4px 25px rgba(255, 255, 255, 0.3);
}

/* 4096-8192 */
.tile-super-1 {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    font-size: 22px;
    box-shadow:
        0 4px 25px rgba(255, 107, 107, 0.6),
        0 0 50px rgba(255, 107, 107, 0.3);
    animation: superGlow1 2s ease-in-out infinite;
}

@keyframes superGlow1 {
    0%, 100% { box-shadow: 0 4px 25px rgba(255, 107, 107, 0.6), 0 0 50px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 4px 35px rgba(255, 107, 107, 0.8), 0 0 70px rgba(255, 107, 107, 0.5); }
}

/* 16384-32768 */
.tile-super-2 {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    font-size: 18px;
    box-shadow:
        0 4px 25px rgba(155, 89, 182, 0.6),
        0 0 50px rgba(155, 89, 182, 0.3);
    animation: superGlow2 2s ease-in-out infinite;
}

@keyframes superGlow2 {
    0%, 100% { box-shadow: 0 4px 25px rgba(155, 89, 182, 0.6), 0 0 50px rgba(155, 89, 182, 0.3); }
    50% { box-shadow: 0 4px 35px rgba(155, 89, 182, 0.8), 0 0 70px rgba(155, 89, 182, 0.5); }
}

/* 65536+ */
.tile-super-3 {
    background: linear-gradient(135deg, #3498db, #2980b9);
    font-size: 16px;
    box-shadow:
        0 4px 25px rgba(52, 152, 219, 0.6),
        0 0 50px rgba(52, 152, 219, 0.3);
    animation: superGlow3 2s ease-in-out infinite;
}

@keyframes superGlow3 {
    0%, 100% { box-shadow: 0 4px 25px rgba(52, 152, 219, 0.6), 0 0 50px rgba(52, 152, 219, 0.3); }
    50% { box-shadow: 0 4px 35px rgba(52, 152, 219, 0.8), 0 0 70px rgba(52, 152, 219, 0.5); }
}

/* ==================== 方块动画 ==================== */
/* 新方块出现动画 - 从小变大，带弹性效果 */
.tile-spawned {
    animation: tileSpawn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes tileSpawn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 合并方块弹出动画 - 碰撞后从小变大，带弹性回弹 */
.tile-merged {
    animation: mergePop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mergePop {
    0% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.25);
    }
    60% {
        transform: scale(0.92);
    }
    80% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

/* ==================== 粒子效果 ==================== */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: particleFly 0.5s ease-out forwards;
    box-shadow: 0 0 6px currentColor;
}

@keyframes particleFly {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0);
        opacity: 0;
    }
}

/* 2048庆祝提示 */
.celebration-toast {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(255, 200, 100, 0.95), rgba(255, 150, 50, 0.95));
    border-radius: 50px;
    padding: 20px 40px;
    box-shadow: 0 10px 40px rgba(255, 150, 0, 0.5);
    z-index: 1000;
    animation: celebrationPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes celebrationPop {
    0% {
        transform: translateX(-50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

.celebration-toast.fade-out {
    animation: celebrationFade 0.5s ease-out forwards;
}

@keyframes celebrationFade {
    to {
        transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }
}

.celebration-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.celebration-icon {
    font-size: 36px;
    animation: iconBounce 0.6s ease infinite;
}

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

.celebration-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ==================== 遮罩层 ==================== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 12, 41, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    z-index: 100;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    animation: overlayIn 0.5s ease-out;
}

@keyframes overlayIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.result-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

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

.overlay-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-primary), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-message {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.overlay-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}

.overlay-stat {
    text-align: center;
}

.overlay-stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.overlay-stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-primary);
}

/* ==================== 操作提示 ==================== */
.instructions {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    padding: 10px 0;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.instruction-icon {
    font-size: 18px;
}

/* ==================== 页脚 ==================== */
.footer {
    margin-top: auto;
    padding: 20px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        gap: 15px;
        max-width: 100%;
    }

    .game-header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .title-number {
        font-size: 48px;
    }

    .game-tagline {
        font-size: 14px;
        text-align: center;
    }

    .stats-panel {
        width: 100%;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 8px 5px;
        min-width: auto;
        border-radius: 10px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    .control-bar {
        padding: 0 5px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    .btn-icon {
        width: 40px;
        height: 40px;
    }

    .game-board-wrapper {
        padding: 5px;
    }

    .game-board {
        padding: 10px;
        border-radius: 16px;
        max-width: 95vw;
    }

    .grid-background {
        gap: 8px;
    }

    .grid-cell {
        border-radius: 8px;
    }

    .tile-container {
        top: 10px;
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .tile {
        font-size: 22px;
        border-radius: 8px;
    }

    .tile-128, .tile-256, .tile-512 {
        font-size: 18px;
    }

    .tile-1024, .tile-2048 {
        font-size: 14px;
    }

    .tile-super {
        font-size: 12px;
    }

    .instructions {
        gap: 12px;
        padding: 5px 0;
    }

    .instruction-item {
        font-size: 12px;
    }

    .instruction-icon {
        font-size: 16px;
    }

    .overlay-content {
        padding: 30px 20px;
    }

    .result-icon {
        font-size: 48px;
    }

    .overlay-title {
        font-size: 24px;
    }

    .overlay-message {
        font-size: 14px;
    }

    .overlay-stats {
        gap: 20px;
    }

    .overlay-stat-value {
        font-size: 22px;
    }

    .btn-large {
        padding: 14px 30px;
        font-size: 16px;
    }

    .footer {
        font-size: 11px;
        padding: 15px 0;
    }
}

@media (max-width: 480px) {
    .title-number {
        font-size: 42px;
    }

    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .stat-card {
        padding: 6px 4px;
    }

    .stat-value {
        font-size: 14px;
    }

    .tile {
        font-size: 18px;
    }

    .tile-128, .tile-256, .tile-512 {
        font-size: 14px;
    }

    .tile-1024, .tile-2048 {
        font-size: 12px;
    }

    .tile-super {
        font-size: 10px;
    }

    .instructions {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
}

@media (max-width: 360px) {
    .title-number {
        font-size: 36px;
    }

    .tile {
        font-size: 16px;
    }

    .tile-128, .tile-256, .tile-512 {
        font-size: 12px;
    }

    .tile-1024, .tile-2048 {
        font-size: 10px;
    }

    .tile-super-1 {
        font-size: 14px;
    }

    .tile-super-2 {
        font-size: 12px;
    }

    .tile-super-3 {
        font-size: 10px;
    }

    /* 移动端庆祝提示 */
    .celebration-toast {
        padding: 15px 25px;
        top: 15%;
    }

    .celebration-text {
        font-size: 18px;
    }

    .celebration-icon {
        font-size: 28px;
    }
}

/* 触摸设备优化 */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-icon {
        min-height: 44px;
        min-width: 44px;
    }

    .game-board {
        cursor: pointer;
    }
}

/* ==================== 模态框 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(36, 36, 62, 0.95), rgba(48, 43, 99, 0.95));
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--card-border);
}

.modal-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    text-align: center;
}

/* ==================== 排行榜 ==================== */
.leaderboard-modal .modal-body {
    padding: 0;
}

.leaderboard-loading,
.leaderboard-error,
.leaderboard-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 24px;
    color: var(--text-secondary);
    text-align: center;
}

.leaderboard-error .error-icon {
    font-size: 32px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.leaderboard-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 16px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.leaderboard-item:last-child {
    margin-bottom: 0;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.leaderboard-rank {
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.leaderboard-item.rank-1 .leaderboard-rank {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #1a1a2e;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.leaderboard-item.rank-2 .leaderboard-rank {
    background: linear-gradient(135deg, #e0e0e0, #b0b0b0);
    color: #1a1a2e;
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
}

.leaderboard-item.rank-3 .leaderboard-rank {
    background: linear-gradient(135deg, #cd7f32, #a0522d);
    color: #fff;
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.3);
}

.leaderboard-item.rank-1,
.leaderboard-item.rank-2,
.leaderboard-item.rank-3 {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-nickname {
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.leaderboard-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.leaderboard-score {
    text-align: right;
    flex-shrink: 0;
}

.leaderboard-score-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-primary);
}

.leaderboard-score-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.leaderboard-tip {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== 设置弹窗 ==================== */
.settings-group {
    margin-bottom: 20px;
}

.settings-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.settings-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    outline: none;
    transition: all 0.2s ease;
}

.settings-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.settings-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.settings-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.nickname-intro {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

#nickname-error {
    color: #ff6b6b;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#nickname-error.show {
    opacity: 1;
}

.nickname-modal .modal-footer {
    padding-top: 8px;
}

.btn-block {
    width: 100%;
}

/* ==================== 公告弹窗 ==================== */
.announcement-modal.modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(10, 15, 35, 0.98), rgba(20, 25, 55, 0.98));
    border: 2px solid var(--accent-primary);
    border-radius: 16px;
    box-shadow:
        0 0 20px rgba(0, 212, 255, 0.3),
        inset 0 0 40px rgba(0, 212, 255, 0.05);
    max-width: 420px;
    padding: 32px 28px;
    text-align: center;
    overflow: visible;
}

.announcement-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-glow);
}

.announcement-corner.tl {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
    border-radius: 12px 0 0 0;
}

.announcement-corner.tr {
    top: -2px;
    right: -2px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 12px 0 0;
}

.announcement-corner.bl {
    bottom: -2px;
    left: -2px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 12px;
}

.announcement-corner.br {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 12px 0;
}

.announcement-icon {
    position: absolute;
    top: 16px;
    left: 20px;
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.6));
}

.announcement-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.announcement-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    font-weight: 900;
    color: var(--accent-primary);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.6), 0 0 40px rgba(0, 212, 255, 0.3);
    letter-spacing: 8px;
    margin: 0;
}

.announcement-text {
    font-size: 18px;
    line-height: 2;
    color: var(--text-primary);
    margin: 0;
}

.announcement-highlight {
    color: var(--accent-primary);
    font-weight: 700;
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.5);
}

.announcement-footer {
    margin-top: 28px;
}

.announcement-btn {
    position: relative;
    width: 100%;
    max-width: 240px;
    padding: 14px 32px;
    font-family: 'Orbitron', 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.15), rgba(123, 44, 191, 0.15));
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(0, 212, 255, 0.3);
    transition: all 0.2s ease;
}

.announcement-btn:hover {
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.3), rgba(123, 44, 191, 0.3));
    box-shadow: 0 0 24px rgba(0, 212, 255, 0.5);
    transform: translateY(-2px);
}

.announcement-btn:active {
    transform: translateY(0);
}

.btn-sm {
    width: 36px;
    height: 36px;
    min-height: 36px;
    min-width: 36px;
}

.btn-sm .btn-icon {
    width: 18px;
    height: 18px;
}

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